@discuss-ds/ui 0.7.0 → 0.8.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 +158 -91
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +28 -1
- package/dist/index.d.ts +28 -1
- package/dist/index.js +153 -87
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @discuss-ds/ui
|
|
2
2
|
|
|
3
|
+
## 0.8.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#41](https://github.com/TamyresLucas/Discuss-UI-Storybook/pull/41) [`b4d5774`](https://github.com/TamyresLucas/Discuss-UI-Storybook/commit/b4d5774ec8d2a3acae16dd10ee977d204f11e3e7) Thanks [@TamyresLucas](https://github.com/TamyresLucas)! - New `StimulusCard` (Question Types): the image or video attached to a question, as it appears in the question card. An 80px thumbnail (image, custom icon, or a neutral placeholder), the "AI Moderator" label over a caption (what the moderator says about the stimulus), and a trash button. `onCaptionChange` makes the caption editable in place; `status="error"`, or a thumbnail that fails to load, shows the broken-image state. Additive; nothing existing changes.
|
|
8
|
+
|
|
9
|
+
## 0.7.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#39](https://github.com/TamyresLucas/Discuss-UI-Storybook/pull/39) [`2bc5789`](https://github.com/TamyresLucas/Discuss-UI-Storybook/commit/2bc5789c1a0b9d55686664ac93cc9a313fc5f6fb) Thanks [@TamyresLucas](https://github.com/TamyresLucas)! - `FileUploadItem`: the "Complete" / "Error" status tag now sits to the right of the file size on the second line instead of beside the file name, so a long name can use the full first line. No API change.
|
|
14
|
+
|
|
3
15
|
## 0.7.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/dist/index.cjs
CHANGED
|
@@ -114,6 +114,7 @@ __export(index_exports, {
|
|
|
114
114
|
Slider: () => Slider,
|
|
115
115
|
StatCard: () => StatCard,
|
|
116
116
|
StatusTag: () => StatusTag,
|
|
117
|
+
StimulusCard: () => StimulusCard,
|
|
117
118
|
Switch: () => Switch,
|
|
118
119
|
TabItem: () => TabItem,
|
|
119
120
|
TabNavigation: () => TabNavigation,
|
|
@@ -2347,16 +2348,14 @@ var FileUploadItem = React36.forwardRef(
|
|
|
2347
2348
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "flex size-10 shrink-0 items-center justify-center rounded-full bg-background bg-linear-to-r from-overlay-dark-5 to-overlay-dark-5 text-surface-foreground", children: icon ?? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react17.FileText, { size: 24, "aria-hidden": true }) }),
|
|
2348
2349
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
2349
2350
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
|
|
2350
|
-
/* @__PURE__ */ (0, import_jsx_runtime37.
|
|
2351
|
-
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "truncate text-ui-label text-surface-foreground", children: name }),
|
|
2352
|
-
status === "complete" && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Tag, { variant: "success", children: "Complete" }),
|
|
2353
|
-
status === "error" && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Tag, { variant: "destructive", children: "Error" })
|
|
2354
|
-
] }),
|
|
2351
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "min-w-0 truncate text-ui-label text-surface-foreground", children: name }),
|
|
2355
2352
|
onRemove && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Button, { type: "button", variant: "ghost", size: "icon-sm", "aria-label": removeLabel ?? `Remove ${name}`, onClick: onRemove, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react17.X, { size: 16, "aria-hidden": true }) })
|
|
2356
2353
|
] }),
|
|
2357
2354
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex items-center justify-between text-ui-caption text-secondary-muted-foreground", children: [
|
|
2358
2355
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("span", { className: "flex items-center gap-2", children: [
|
|
2359
2356
|
size,
|
|
2357
|
+
status === "complete" && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Tag, { variant: "success", children: "Complete" }),
|
|
2358
|
+
status === "error" && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Tag, { variant: "destructive", children: "Error" }),
|
|
2360
2359
|
uploading && timeLeft && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
|
|
2361
2360
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { "aria-hidden": "true", className: "size-0.5 rounded-full bg-secondary-muted-foreground" }),
|
|
2362
2361
|
timeLeft
|
|
@@ -3196,28 +3195,95 @@ var RatingScale = React46.forwardRef(
|
|
|
3196
3195
|
);
|
|
3197
3196
|
RatingScale.displayName = "RatingScale";
|
|
3198
3197
|
|
|
3199
|
-
// src/components/
|
|
3198
|
+
// src/components/Question Types/StimulusCard.tsx
|
|
3200
3199
|
var React47 = __toESM(require("react"), 1);
|
|
3201
|
-
var
|
|
3200
|
+
var import_react25 = require("@phosphor-icons/react");
|
|
3202
3201
|
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
3203
|
-
var
|
|
3202
|
+
var StimulusCard = React47.forwardRef(
|
|
3203
|
+
({
|
|
3204
|
+
className,
|
|
3205
|
+
thumbnail,
|
|
3206
|
+
thumbnailAlt = "",
|
|
3207
|
+
icon,
|
|
3208
|
+
status = "default",
|
|
3209
|
+
label = "AI Moderator",
|
|
3210
|
+
caption,
|
|
3211
|
+
onCaptionChange,
|
|
3212
|
+
captionPlaceholder = "Click to write what the AI moderator says",
|
|
3213
|
+
onRemove,
|
|
3214
|
+
removeLabel = "Remove stimulus",
|
|
3215
|
+
...props
|
|
3216
|
+
}, ref) => {
|
|
3217
|
+
const [failedSrc, setFailedSrc] = React47.useState();
|
|
3218
|
+
const error = status === "error" || thumbnail !== void 0 && failedSrc === thumbnail;
|
|
3219
|
+
const showImage = thumbnail !== void 0 && !error;
|
|
3220
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
3221
|
+
"div",
|
|
3222
|
+
{
|
|
3223
|
+
ref,
|
|
3224
|
+
"data-status": error ? "error" : "default",
|
|
3225
|
+
className: cn("flex w-full items-center gap-4 rounded-md border border-border p-0.5 pr-4", className),
|
|
3226
|
+
...props,
|
|
3227
|
+
children: [
|
|
3228
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex min-w-0 flex-1 items-center gap-4", children: [
|
|
3229
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
3230
|
+
"span",
|
|
3231
|
+
{
|
|
3232
|
+
className: cn(
|
|
3233
|
+
"flex size-20 shrink-0 items-center justify-center overflow-hidden rounded-sm border",
|
|
3234
|
+
error ? "border-destructive-soft-border bg-destructive-soft bg-linear-to-r from-overlay-dark-5 to-overlay-dark-5 text-destructive" : "border-border bg-background bg-linear-to-r from-overlay-dark-5 to-overlay-dark-5 text-surface-foreground",
|
|
3235
|
+
showImage && "bg-none"
|
|
3236
|
+
),
|
|
3237
|
+
children: showImage ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("img", { src: thumbnail, alt: thumbnailAlt, className: "size-full object-cover", onError: () => setFailedSrc(thumbnail) }) : error ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react25.ImageBroken, { size: 24, "aria-hidden": true }) : icon ?? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react25.Image, { size: 24, "aria-hidden": true })
|
|
3238
|
+
}
|
|
3239
|
+
),
|
|
3240
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col items-start gap-2 text-surface-foreground", children: [
|
|
3241
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { className: "w-full text-ui-label", children: label }),
|
|
3242
|
+
onCaptionChange ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
3243
|
+
InlineEdit,
|
|
3244
|
+
{
|
|
3245
|
+
variant: "question",
|
|
3246
|
+
multiline: true,
|
|
3247
|
+
className: "-mx-3 w-auto",
|
|
3248
|
+
"aria-label": "Stimulus caption",
|
|
3249
|
+
value: caption ?? "",
|
|
3250
|
+
placeholder: captionPlaceholder,
|
|
3251
|
+
onValueChange: onCaptionChange,
|
|
3252
|
+
textClassName: "text-body-base"
|
|
3253
|
+
}
|
|
3254
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { className: "w-full text-body-base [word-break:break-word]", children: caption })
|
|
3255
|
+
] })
|
|
3256
|
+
] }),
|
|
3257
|
+
onRemove && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Button, { type: "button", variant: "destructive", size: "icon-sm", "aria-label": removeLabel, onClick: onRemove, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react25.Trash, { size: 16, "aria-hidden": true }) })
|
|
3258
|
+
]
|
|
3259
|
+
}
|
|
3260
|
+
);
|
|
3261
|
+
}
|
|
3262
|
+
);
|
|
3263
|
+
StimulusCard.displayName = "StimulusCard";
|
|
3264
|
+
|
|
3265
|
+
// src/components/Data Display/Progress.tsx
|
|
3266
|
+
var React48 = __toESM(require("react"), 1);
|
|
3267
|
+
var import_radix_ui23 = require("radix-ui");
|
|
3268
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
3269
|
+
var Progress = React48.forwardRef(
|
|
3204
3270
|
({ className, value = 0, label, valueLabel, detailsStart, detailsEnd, ...props }, ref) => {
|
|
3205
3271
|
const hasHeader = label != null || valueLabel != null;
|
|
3206
3272
|
const hasDetails = detailsStart != null || detailsEnd != null;
|
|
3207
3273
|
const clamped = Math.min(100, Math.max(0, value ?? 0));
|
|
3208
|
-
return /* @__PURE__ */ (0,
|
|
3209
|
-
hasHeader && /* @__PURE__ */ (0,
|
|
3210
|
-
/* @__PURE__ */ (0,
|
|
3211
|
-
/* @__PURE__ */ (0,
|
|
3274
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: cn("flex w-full flex-col gap-2", className), children: [
|
|
3275
|
+
hasHeader && /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex items-center justify-between text-ui-label text-surface-foreground", children: [
|
|
3276
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { children: label }),
|
|
3277
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { children: valueLabel === true ? `${Math.round(clamped)}%` : valueLabel })
|
|
3212
3278
|
] }),
|
|
3213
|
-
/* @__PURE__ */ (0,
|
|
3279
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
3214
3280
|
import_radix_ui23.Progress.Root,
|
|
3215
3281
|
{
|
|
3216
3282
|
ref,
|
|
3217
3283
|
value: clamped,
|
|
3218
3284
|
className: "relative h-2 w-full overflow-hidden rounded-full bg-secondary",
|
|
3219
3285
|
...props,
|
|
3220
|
-
children: /* @__PURE__ */ (0,
|
|
3286
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
3221
3287
|
import_radix_ui23.Progress.Indicator,
|
|
3222
3288
|
{
|
|
3223
3289
|
className: "h-full rounded-full bg-accent transition-[width]",
|
|
@@ -3226,9 +3292,9 @@ var Progress = React47.forwardRef(
|
|
|
3226
3292
|
)
|
|
3227
3293
|
}
|
|
3228
3294
|
),
|
|
3229
|
-
hasDetails && /* @__PURE__ */ (0,
|
|
3230
|
-
/* @__PURE__ */ (0,
|
|
3231
|
-
/* @__PURE__ */ (0,
|
|
3295
|
+
hasDetails && /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex items-start justify-between text-ui-label leading-5 text-secondary-muted-foreground", children: [
|
|
3296
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { children: detailsStart }),
|
|
3297
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { children: detailsEnd })
|
|
3232
3298
|
] })
|
|
3233
3299
|
] });
|
|
3234
3300
|
}
|
|
@@ -3236,11 +3302,11 @@ var Progress = React47.forwardRef(
|
|
|
3236
3302
|
Progress.displayName = "Progress";
|
|
3237
3303
|
|
|
3238
3304
|
// src/components/Data Display/Table.tsx
|
|
3239
|
-
var
|
|
3240
|
-
var
|
|
3241
|
-
var
|
|
3242
|
-
var Table =
|
|
3243
|
-
({ className, containerClassName, striped, ...props }, ref) => /* @__PURE__ */ (0,
|
|
3305
|
+
var React49 = __toESM(require("react"), 1);
|
|
3306
|
+
var import_react26 = require("@phosphor-icons/react");
|
|
3307
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
3308
|
+
var Table = React49.forwardRef(
|
|
3309
|
+
({ className, containerClassName, striped, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: cn("relative w-full overflow-auto rounded-lg border border-border bg-surface", containerClassName), children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
3244
3310
|
"table",
|
|
3245
3311
|
{
|
|
3246
3312
|
ref,
|
|
@@ -3251,16 +3317,16 @@ var Table = React48.forwardRef(
|
|
|
3251
3317
|
) })
|
|
3252
3318
|
);
|
|
3253
3319
|
Table.displayName = "Table";
|
|
3254
|
-
var TableHeader =
|
|
3255
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
3320
|
+
var TableHeader = React49.forwardRef(
|
|
3321
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("thead", { ref, className, ...props })
|
|
3256
3322
|
);
|
|
3257
3323
|
TableHeader.displayName = "TableHeader";
|
|
3258
|
-
var TableBody =
|
|
3259
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
3324
|
+
var TableBody = React49.forwardRef(
|
|
3325
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("tbody", { ref, className, ...props })
|
|
3260
3326
|
);
|
|
3261
3327
|
TableBody.displayName = "TableBody";
|
|
3262
|
-
var TableRow =
|
|
3263
|
-
({ className, selected, ...props }, ref) => /* @__PURE__ */ (0,
|
|
3328
|
+
var TableRow = React49.forwardRef(
|
|
3329
|
+
({ className, selected, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
3264
3330
|
"tr",
|
|
3265
3331
|
{
|
|
3266
3332
|
ref,
|
|
@@ -3277,10 +3343,10 @@ var TableRow = React48.forwardRef(
|
|
|
3277
3343
|
);
|
|
3278
3344
|
TableRow.displayName = "TableRow";
|
|
3279
3345
|
var ariaSort = { none: "none", asc: "ascending", desc: "descending" };
|
|
3280
|
-
var TableHead =
|
|
3346
|
+
var TableHead = React49.forwardRef(
|
|
3281
3347
|
({ className, align = "left", sortable, sort = "none", onSort, checkbox, children, ...props }, ref) => {
|
|
3282
|
-
const caret = sort === "asc" ? /* @__PURE__ */ (0,
|
|
3283
|
-
return /* @__PURE__ */ (0,
|
|
3348
|
+
const caret = sort === "asc" ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_react26.CaretUp, { size: 16, "aria-hidden": true, className: "shrink-0" }) : /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_react26.CaretDown, { size: 16, "aria-hidden": true, className: "shrink-0" });
|
|
3349
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
3284
3350
|
"th",
|
|
3285
3351
|
{
|
|
3286
3352
|
ref,
|
|
@@ -3293,7 +3359,7 @@ var TableHead = React48.forwardRef(
|
|
|
3293
3359
|
className
|
|
3294
3360
|
),
|
|
3295
3361
|
...props,
|
|
3296
|
-
children: sortable ? /* @__PURE__ */ (0,
|
|
3362
|
+
children: sortable ? /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
|
|
3297
3363
|
"button",
|
|
3298
3364
|
{
|
|
3299
3365
|
type: "button",
|
|
@@ -3304,14 +3370,14 @@ var TableHead = React48.forwardRef(
|
|
|
3304
3370
|
caret
|
|
3305
3371
|
]
|
|
3306
3372
|
}
|
|
3307
|
-
) : checkbox ? /* @__PURE__ */ (0,
|
|
3373
|
+
) : checkbox ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "flex items-center justify-center", children }) : children
|
|
3308
3374
|
}
|
|
3309
3375
|
);
|
|
3310
3376
|
}
|
|
3311
3377
|
);
|
|
3312
3378
|
TableHead.displayName = "TableHead";
|
|
3313
|
-
var TableCell =
|
|
3314
|
-
({ className, align = "left", muted, checkbox, actions, children, ...props }, ref) => /* @__PURE__ */ (0,
|
|
3379
|
+
var TableCell = React49.forwardRef(
|
|
3380
|
+
({ className, align = "left", muted, checkbox, actions, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
3315
3381
|
"td",
|
|
3316
3382
|
{
|
|
3317
3383
|
ref,
|
|
@@ -3324,25 +3390,25 @@ var TableCell = React48.forwardRef(
|
|
|
3324
3390
|
className
|
|
3325
3391
|
),
|
|
3326
3392
|
...props,
|
|
3327
|
-
children: checkbox ? /* @__PURE__ */ (0,
|
|
3393
|
+
children: checkbox ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "flex items-center justify-center", children }) : actions ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "flex items-start justify-end gap-1", children }) : children
|
|
3328
3394
|
}
|
|
3329
3395
|
)
|
|
3330
3396
|
);
|
|
3331
3397
|
TableCell.displayName = "TableCell";
|
|
3332
3398
|
function TableCellTwoLines({ primary, secondary, avatar, className, ...props }) {
|
|
3333
|
-
return /* @__PURE__ */ (0,
|
|
3399
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: cn("flex items-center gap-2", className), ...props, children: [
|
|
3334
3400
|
avatar,
|
|
3335
|
-
/* @__PURE__ */ (0,
|
|
3336
|
-
/* @__PURE__ */ (0,
|
|
3337
|
-
secondary && /* @__PURE__ */ (0,
|
|
3401
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex flex-col gap-0.5 whitespace-nowrap", children: [
|
|
3402
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "text-ui-label text-surface-foreground", children: primary }),
|
|
3403
|
+
secondary && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "text-ui-caption text-secondary-muted-foreground", children: secondary })
|
|
3338
3404
|
] })
|
|
3339
3405
|
] });
|
|
3340
3406
|
}
|
|
3341
3407
|
|
|
3342
3408
|
// src/components/Data Display/StatCard.tsx
|
|
3343
|
-
var
|
|
3409
|
+
var React50 = __toESM(require("react"), 1);
|
|
3344
3410
|
var import_class_variance_authority6 = require("class-variance-authority");
|
|
3345
|
-
var
|
|
3411
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
3346
3412
|
var statCardVariants = (0, import_class_variance_authority6.cva)("flex min-w-0 flex-col gap-2 rounded-md border p-3", {
|
|
3347
3413
|
variants: {
|
|
3348
3414
|
variant: {
|
|
@@ -3352,11 +3418,11 @@ var statCardVariants = (0, import_class_variance_authority6.cva)("flex min-w-0 f
|
|
|
3352
3418
|
},
|
|
3353
3419
|
defaultVariants: { variant: "default" }
|
|
3354
3420
|
});
|
|
3355
|
-
var StatCard =
|
|
3356
|
-
({ className, variant, label, value, icon, ...props }, ref) => /* @__PURE__ */ (0,
|
|
3357
|
-
/* @__PURE__ */ (0,
|
|
3358
|
-
/* @__PURE__ */ (0,
|
|
3359
|
-
icon && /* @__PURE__ */ (0,
|
|
3421
|
+
var StatCard = React50.forwardRef(
|
|
3422
|
+
({ className, variant, label, value, icon, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { ref, className: cn(statCardVariants({ variant }), className), ...props, children: [
|
|
3423
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("p", { className: "truncate text-ui-caption text-secondary-muted-foreground", children: label }),
|
|
3424
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("p", { className: "flex items-center gap-2 text-body-base text-surface-foreground", children: [
|
|
3425
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { "aria-hidden": "true", className: "inline-flex size-6 shrink-0 items-center justify-center", children: icon }),
|
|
3360
3426
|
value
|
|
3361
3427
|
] })
|
|
3362
3428
|
] })
|
|
@@ -3364,13 +3430,13 @@ var StatCard = React49.forwardRef(
|
|
|
3364
3430
|
StatCard.displayName = "StatCard";
|
|
3365
3431
|
|
|
3366
3432
|
// src/components/Research-Specific/ActivityStructure.tsx
|
|
3367
|
-
var
|
|
3433
|
+
var React52 = __toESM(require("react"), 1);
|
|
3368
3434
|
|
|
3369
3435
|
// src/components/Tags & Badges/EditableTag.tsx
|
|
3370
|
-
var
|
|
3371
|
-
var
|
|
3436
|
+
var React51 = __toESM(require("react"), 1);
|
|
3437
|
+
var import_react27 = require("@phosphor-icons/react");
|
|
3372
3438
|
var import_class_variance_authority7 = require("class-variance-authority");
|
|
3373
|
-
var
|
|
3439
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
3374
3440
|
var editableTagVariants = (0, import_class_variance_authority7.cva)(
|
|
3375
3441
|
"inline-flex h-6.5 items-center whitespace-nowrap rounded-sm py-1 text-ui-caption transition-colors",
|
|
3376
3442
|
{
|
|
@@ -3385,27 +3451,27 @@ var editableTagVariants = (0, import_class_variance_authority7.cva)(
|
|
|
3385
3451
|
defaultVariants: { type: "default" }
|
|
3386
3452
|
}
|
|
3387
3453
|
);
|
|
3388
|
-
var EditableTag =
|
|
3454
|
+
var EditableTag = React51.forwardRef(
|
|
3389
3455
|
({ className, type = "default", icon, onRemove, onClick, children, ...props }, ref) => {
|
|
3390
3456
|
const classes = cn(editableTagVariants({ type }), className);
|
|
3391
|
-
const leading = type === "add" ? /* @__PURE__ */ (0,
|
|
3457
|
+
const leading = type === "add" ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_react27.Plus, { size: 12, "aria-hidden": true }) : icon !== void 0 ? icon : type === "default" ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_react27.Crown, { size: 12, weight: "fill", "aria-hidden": true }) : null;
|
|
3392
3458
|
if (type === "add" || type === "multiple" && onClick) {
|
|
3393
|
-
return /* @__PURE__ */ (0,
|
|
3459
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("button", { ref, type: "button", className: classes, onClick, ...props, children: [
|
|
3394
3460
|
leading,
|
|
3395
3461
|
children
|
|
3396
3462
|
] });
|
|
3397
3463
|
}
|
|
3398
|
-
return /* @__PURE__ */ (0,
|
|
3464
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("span", { ref, className: classes, ...props, children: [
|
|
3399
3465
|
leading,
|
|
3400
3466
|
children,
|
|
3401
|
-
onRemove && /* @__PURE__ */ (0,
|
|
3467
|
+
onRemove && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
3402
3468
|
"button",
|
|
3403
3469
|
{
|
|
3404
3470
|
type: "button",
|
|
3405
3471
|
"aria-label": typeof children === "string" ? `Remove ${children}` : "Remove",
|
|
3406
3472
|
onClick: onRemove,
|
|
3407
3473
|
className: "inline-flex size-3 items-center justify-center rounded-xs",
|
|
3408
|
-
children: /* @__PURE__ */ (0,
|
|
3474
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_react27.X, { size: 12, "aria-hidden": true })
|
|
3409
3475
|
}
|
|
3410
3476
|
)
|
|
3411
3477
|
] });
|
|
@@ -3414,23 +3480,23 @@ var EditableTag = React50.forwardRef(
|
|
|
3414
3480
|
EditableTag.displayName = "EditableTag";
|
|
3415
3481
|
|
|
3416
3482
|
// src/components/Research-Specific/ActivityStructure.tsx
|
|
3417
|
-
var
|
|
3418
|
-
var ActivityStructure =
|
|
3419
|
-
({ className, title = "Activity Structure", stats, sections, onRemoveTag, onAddTag, addTagLabel = "Add tag", children, ...props }, ref) => /* @__PURE__ */ (0,
|
|
3483
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
3484
|
+
var ActivityStructure = React52.forwardRef(
|
|
3485
|
+
({ className, title = "Activity Structure", stats, sections, onRemoveTag, onAddTag, addTagLabel = "Add tag", children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
3420
3486
|
"section",
|
|
3421
3487
|
{
|
|
3422
3488
|
ref,
|
|
3423
3489
|
className: cn("flex w-full max-w-96.5 flex-col gap-4 rounded-xl bg-surface p-4", className),
|
|
3424
3490
|
...props,
|
|
3425
3491
|
children: [
|
|
3426
|
-
/* @__PURE__ */ (0,
|
|
3427
|
-
stats.length > 0 && /* @__PURE__ */ (0,
|
|
3428
|
-
sections?.map(({ id, heading, body, tags }) => /* @__PURE__ */ (0,
|
|
3429
|
-
/* @__PURE__ */ (0,
|
|
3430
|
-
/* @__PURE__ */ (0,
|
|
3431
|
-
(tags?.length || onAddTag) && /* @__PURE__ */ (0,
|
|
3432
|
-
tags?.map((tag) => /* @__PURE__ */ (0,
|
|
3433
|
-
onAddTag && /* @__PURE__ */ (0,
|
|
3492
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("h3", { className: "text-heading-h3 text-primary", children: title }),
|
|
3493
|
+
stats.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "grid grid-cols-2 gap-3", children: stats.map(({ id, ...stat }) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(StatCard, { ...stat }, id)) }),
|
|
3494
|
+
sections?.map(({ id, heading, body, tags }) => /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
3495
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("h4", { className: "text-heading-h4 text-surface-foreground", children: heading }),
|
|
3496
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "text-body-base text-surface-foreground", children: body }),
|
|
3497
|
+
(tags?.length || onAddTag) && /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
3498
|
+
tags?.map((tag) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(EditableTag, { type: "editable", onRemove: onRemoveTag && (() => onRemoveTag(id, tag)), children: tag }, tag)),
|
|
3499
|
+
onAddTag && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(EditableTag, { type: "add", onClick: () => onAddTag(id), children: addTagLabel })
|
|
3434
3500
|
] })
|
|
3435
3501
|
] }, id)),
|
|
3436
3502
|
children
|
|
@@ -3441,10 +3507,10 @@ var ActivityStructure = React51.forwardRef(
|
|
|
3441
3507
|
ActivityStructure.displayName = "ActivityStructure";
|
|
3442
3508
|
|
|
3443
3509
|
// src/components/Tags & Badges/Badge.tsx
|
|
3444
|
-
var
|
|
3445
|
-
var
|
|
3510
|
+
var React53 = __toESM(require("react"), 1);
|
|
3511
|
+
var import_react28 = require("@phosphor-icons/react");
|
|
3446
3512
|
var import_class_variance_authority8 = require("class-variance-authority");
|
|
3447
|
-
var
|
|
3513
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
3448
3514
|
var roleTagVariants = (0, import_class_variance_authority8.cva)(
|
|
3449
3515
|
"group inline-flex h-6 items-center whitespace-nowrap rounded-sm py-1 text-ui-caption transition-colors",
|
|
3450
3516
|
{
|
|
@@ -3470,11 +3536,11 @@ var roleTagVariants = (0, import_class_variance_authority8.cva)(
|
|
|
3470
3536
|
defaultVariants: { type: "primary", selected: false }
|
|
3471
3537
|
}
|
|
3472
3538
|
);
|
|
3473
|
-
var Badge =
|
|
3539
|
+
var Badge = React53.forwardRef(
|
|
3474
3540
|
({ className, type = "primary", selected = false, onClick, children, ...props }, ref) => {
|
|
3475
3541
|
const classes = cn(roleTagVariants({ type, selected: type === "interactable" ? selected : false }), className);
|
|
3476
3542
|
if (type === "interactable") {
|
|
3477
|
-
return /* @__PURE__ */ (0,
|
|
3543
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
3478
3544
|
"button",
|
|
3479
3545
|
{
|
|
3480
3546
|
ref,
|
|
@@ -3484,15 +3550,15 @@ var Badge = React52.forwardRef(
|
|
|
3484
3550
|
onClick,
|
|
3485
3551
|
...props,
|
|
3486
3552
|
children: [
|
|
3487
|
-
/* @__PURE__ */ (0,
|
|
3553
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_react28.DotsSixVertical, { size: 16, "aria-hidden": true, className: "hidden shrink-0 group-hover:block" }),
|
|
3488
3554
|
children
|
|
3489
3555
|
]
|
|
3490
3556
|
}
|
|
3491
3557
|
);
|
|
3492
3558
|
}
|
|
3493
|
-
return /* @__PURE__ */ (0,
|
|
3494
|
-
type === "question" && /* @__PURE__ */ (0,
|
|
3495
|
-
type === "id" && /* @__PURE__ */ (0,
|
|
3559
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { ref, className: classes, ...props, children: [
|
|
3560
|
+
type === "question" && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_react28.RadioButton, { size: 16, weight: "fill", "aria-hidden": true }),
|
|
3561
|
+
type === "id" && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "text-secondary-muted-foreground", children: "ID" }),
|
|
3496
3562
|
children
|
|
3497
3563
|
] });
|
|
3498
3564
|
}
|
|
@@ -3500,9 +3566,9 @@ var Badge = React52.forwardRef(
|
|
|
3500
3566
|
Badge.displayName = "Badge";
|
|
3501
3567
|
|
|
3502
3568
|
// src/components/Utility/Pagination.tsx
|
|
3503
|
-
var
|
|
3504
|
-
var
|
|
3505
|
-
var
|
|
3569
|
+
var React54 = __toESM(require("react"), 1);
|
|
3570
|
+
var import_react29 = require("@phosphor-icons/react");
|
|
3571
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
3506
3572
|
function getPaginationItems(page, pageCount, siblings = 1) {
|
|
3507
3573
|
const keep = /* @__PURE__ */ new Set([1, pageCount]);
|
|
3508
3574
|
for (let p = page - siblings; p <= page + siblings; p++) if (p >= 1 && p <= pageCount) keep.add(p);
|
|
@@ -3516,10 +3582,10 @@ function getPaginationItems(page, pageCount, siblings = 1) {
|
|
|
3516
3582
|
});
|
|
3517
3583
|
return items;
|
|
3518
3584
|
}
|
|
3519
|
-
var Pagination =
|
|
3585
|
+
var Pagination = React54.forwardRef(
|
|
3520
3586
|
({ className, page, pageCount, onPageChange, variant = "full", siblings = 1, ...props }, ref) => {
|
|
3521
3587
|
const go = (next2) => onPageChange(Math.min(pageCount, Math.max(1, next2)));
|
|
3522
|
-
const previous = /* @__PURE__ */ (0,
|
|
3588
|
+
const previous = /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
3523
3589
|
Button,
|
|
3524
3590
|
{
|
|
3525
3591
|
type: "button",
|
|
@@ -3528,10 +3594,10 @@ var Pagination = React53.forwardRef(
|
|
|
3528
3594
|
"aria-label": "Previous page",
|
|
3529
3595
|
disabled: page <= 1,
|
|
3530
3596
|
onClick: () => go(page - 1),
|
|
3531
|
-
children: /* @__PURE__ */ (0,
|
|
3597
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react29.ArrowLeft, { size: 16, "aria-hidden": true })
|
|
3532
3598
|
}
|
|
3533
3599
|
);
|
|
3534
|
-
const next = /* @__PURE__ */ (0,
|
|
3600
|
+
const next = /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
3535
3601
|
Button,
|
|
3536
3602
|
{
|
|
3537
3603
|
type: "button",
|
|
@@ -3540,10 +3606,10 @@ var Pagination = React53.forwardRef(
|
|
|
3540
3606
|
"aria-label": "Next page",
|
|
3541
3607
|
disabled: page >= pageCount,
|
|
3542
3608
|
onClick: () => go(page + 1),
|
|
3543
|
-
children: /* @__PURE__ */ (0,
|
|
3609
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react29.ArrowRight, { size: 16, "aria-hidden": true })
|
|
3544
3610
|
}
|
|
3545
3611
|
);
|
|
3546
|
-
return /* @__PURE__ */ (0,
|
|
3612
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
|
|
3547
3613
|
"nav",
|
|
3548
3614
|
{
|
|
3549
3615
|
ref,
|
|
@@ -3552,14 +3618,14 @@ var Pagination = React53.forwardRef(
|
|
|
3552
3618
|
...props,
|
|
3553
3619
|
children: [
|
|
3554
3620
|
previous,
|
|
3555
|
-
variant === "compact" ? /* @__PURE__ */ (0,
|
|
3621
|
+
variant === "compact" ? /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("span", { className: "text-body-small text-surface-foreground", "aria-live": "polite", children: [
|
|
3556
3622
|
page,
|
|
3557
3623
|
"/",
|
|
3558
3624
|
pageCount
|
|
3559
|
-
] }) : /* @__PURE__ */ (0,
|
|
3560
|
-
/* @__PURE__ */ (0,
|
|
3561
|
-
/* @__PURE__ */ (0,
|
|
3562
|
-
] }) : /* @__PURE__ */ (0,
|
|
3625
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("ul", { className: "flex items-center gap-2", children: getPaginationItems(page, pageCount, siblings).map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("li", { children: item === "ellipsis" ? /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("span", { className: "inline-flex size-8 items-center justify-center rounded-sm border border-border bg-surface text-surface-foreground", children: [
|
|
3626
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react29.DotsThree, { size: 16, "aria-hidden": true }),
|
|
3627
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "sr-only", children: "More pages" })
|
|
3628
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
3563
3629
|
Button,
|
|
3564
3630
|
{
|
|
3565
3631
|
type: "button",
|
|
@@ -3664,6 +3730,7 @@ Pagination.displayName = "Pagination";
|
|
|
3664
3730
|
Slider,
|
|
3665
3731
|
StatCard,
|
|
3666
3732
|
StatusTag,
|
|
3733
|
+
StimulusCard,
|
|
3667
3734
|
Switch,
|
|
3668
3735
|
TabItem,
|
|
3669
3736
|
TabNavigation,
|