@discuss-ds/ui 0.7.1 → 0.8.1
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 +155 -86
- 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 +150 -82
- 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.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#43](https://github.com/TamyresLucas/Discuss-UI-Storybook/pull/43) [`1f674dd`](https://github.com/TamyresLucas/Discuss-UI-Storybook/commit/1f674ddc5f1d5d9cbcadb7bca561cb480cea74bf) Thanks [@TamyresLucas](https://github.com/TamyresLucas)! - `StimulusCard`: the editable caption now fills the width of the card, so its hover and focus underline spans the full line instead of only the text.
|
|
8
|
+
|
|
9
|
+
## 0.8.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#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.
|
|
14
|
+
|
|
3
15
|
## 0.7.1
|
|
4
16
|
|
|
5
17
|
### Patch 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,
|
|
@@ -3194,28 +3195,95 @@ var RatingScale = React46.forwardRef(
|
|
|
3194
3195
|
);
|
|
3195
3196
|
RatingScale.displayName = "RatingScale";
|
|
3196
3197
|
|
|
3197
|
-
// src/components/
|
|
3198
|
+
// src/components/Question Types/StimulusCard.tsx
|
|
3198
3199
|
var React47 = __toESM(require("react"), 1);
|
|
3199
|
-
var
|
|
3200
|
+
var import_react25 = require("@phosphor-icons/react");
|
|
3200
3201
|
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
3201
|
-
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 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(
|
|
3202
3270
|
({ className, value = 0, label, valueLabel, detailsStart, detailsEnd, ...props }, ref) => {
|
|
3203
3271
|
const hasHeader = label != null || valueLabel != null;
|
|
3204
3272
|
const hasDetails = detailsStart != null || detailsEnd != null;
|
|
3205
3273
|
const clamped = Math.min(100, Math.max(0, value ?? 0));
|
|
3206
|
-
return /* @__PURE__ */ (0,
|
|
3207
|
-
hasHeader && /* @__PURE__ */ (0,
|
|
3208
|
-
/* @__PURE__ */ (0,
|
|
3209
|
-
/* @__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 })
|
|
3210
3278
|
] }),
|
|
3211
|
-
/* @__PURE__ */ (0,
|
|
3279
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
3212
3280
|
import_radix_ui23.Progress.Root,
|
|
3213
3281
|
{
|
|
3214
3282
|
ref,
|
|
3215
3283
|
value: clamped,
|
|
3216
3284
|
className: "relative h-2 w-full overflow-hidden rounded-full bg-secondary",
|
|
3217
3285
|
...props,
|
|
3218
|
-
children: /* @__PURE__ */ (0,
|
|
3286
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
3219
3287
|
import_radix_ui23.Progress.Indicator,
|
|
3220
3288
|
{
|
|
3221
3289
|
className: "h-full rounded-full bg-accent transition-[width]",
|
|
@@ -3224,9 +3292,9 @@ var Progress = React47.forwardRef(
|
|
|
3224
3292
|
)
|
|
3225
3293
|
}
|
|
3226
3294
|
),
|
|
3227
|
-
hasDetails && /* @__PURE__ */ (0,
|
|
3228
|
-
/* @__PURE__ */ (0,
|
|
3229
|
-
/* @__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 })
|
|
3230
3298
|
] })
|
|
3231
3299
|
] });
|
|
3232
3300
|
}
|
|
@@ -3234,11 +3302,11 @@ var Progress = React47.forwardRef(
|
|
|
3234
3302
|
Progress.displayName = "Progress";
|
|
3235
3303
|
|
|
3236
3304
|
// src/components/Data Display/Table.tsx
|
|
3237
|
-
var
|
|
3238
|
-
var
|
|
3239
|
-
var
|
|
3240
|
-
var Table =
|
|
3241
|
-
({ 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)(
|
|
3242
3310
|
"table",
|
|
3243
3311
|
{
|
|
3244
3312
|
ref,
|
|
@@ -3249,16 +3317,16 @@ var Table = React48.forwardRef(
|
|
|
3249
3317
|
) })
|
|
3250
3318
|
);
|
|
3251
3319
|
Table.displayName = "Table";
|
|
3252
|
-
var TableHeader =
|
|
3253
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
3320
|
+
var TableHeader = React49.forwardRef(
|
|
3321
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("thead", { ref, className, ...props })
|
|
3254
3322
|
);
|
|
3255
3323
|
TableHeader.displayName = "TableHeader";
|
|
3256
|
-
var TableBody =
|
|
3257
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
3324
|
+
var TableBody = React49.forwardRef(
|
|
3325
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("tbody", { ref, className, ...props })
|
|
3258
3326
|
);
|
|
3259
3327
|
TableBody.displayName = "TableBody";
|
|
3260
|
-
var TableRow =
|
|
3261
|
-
({ className, selected, ...props }, ref) => /* @__PURE__ */ (0,
|
|
3328
|
+
var TableRow = React49.forwardRef(
|
|
3329
|
+
({ className, selected, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
3262
3330
|
"tr",
|
|
3263
3331
|
{
|
|
3264
3332
|
ref,
|
|
@@ -3275,10 +3343,10 @@ var TableRow = React48.forwardRef(
|
|
|
3275
3343
|
);
|
|
3276
3344
|
TableRow.displayName = "TableRow";
|
|
3277
3345
|
var ariaSort = { none: "none", asc: "ascending", desc: "descending" };
|
|
3278
|
-
var TableHead =
|
|
3346
|
+
var TableHead = React49.forwardRef(
|
|
3279
3347
|
({ className, align = "left", sortable, sort = "none", onSort, checkbox, children, ...props }, ref) => {
|
|
3280
|
-
const caret = sort === "asc" ? /* @__PURE__ */ (0,
|
|
3281
|
-
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)(
|
|
3282
3350
|
"th",
|
|
3283
3351
|
{
|
|
3284
3352
|
ref,
|
|
@@ -3291,7 +3359,7 @@ var TableHead = React48.forwardRef(
|
|
|
3291
3359
|
className
|
|
3292
3360
|
),
|
|
3293
3361
|
...props,
|
|
3294
|
-
children: sortable ? /* @__PURE__ */ (0,
|
|
3362
|
+
children: sortable ? /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
|
|
3295
3363
|
"button",
|
|
3296
3364
|
{
|
|
3297
3365
|
type: "button",
|
|
@@ -3302,14 +3370,14 @@ var TableHead = React48.forwardRef(
|
|
|
3302
3370
|
caret
|
|
3303
3371
|
]
|
|
3304
3372
|
}
|
|
3305
|
-
) : checkbox ? /* @__PURE__ */ (0,
|
|
3373
|
+
) : checkbox ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "flex items-center justify-center", children }) : children
|
|
3306
3374
|
}
|
|
3307
3375
|
);
|
|
3308
3376
|
}
|
|
3309
3377
|
);
|
|
3310
3378
|
TableHead.displayName = "TableHead";
|
|
3311
|
-
var TableCell =
|
|
3312
|
-
({ 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)(
|
|
3313
3381
|
"td",
|
|
3314
3382
|
{
|
|
3315
3383
|
ref,
|
|
@@ -3322,25 +3390,25 @@ var TableCell = React48.forwardRef(
|
|
|
3322
3390
|
className
|
|
3323
3391
|
),
|
|
3324
3392
|
...props,
|
|
3325
|
-
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
|
|
3326
3394
|
}
|
|
3327
3395
|
)
|
|
3328
3396
|
);
|
|
3329
3397
|
TableCell.displayName = "TableCell";
|
|
3330
3398
|
function TableCellTwoLines({ primary, secondary, avatar, className, ...props }) {
|
|
3331
|
-
return /* @__PURE__ */ (0,
|
|
3399
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: cn("flex items-center gap-2", className), ...props, children: [
|
|
3332
3400
|
avatar,
|
|
3333
|
-
/* @__PURE__ */ (0,
|
|
3334
|
-
/* @__PURE__ */ (0,
|
|
3335
|
-
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 })
|
|
3336
3404
|
] })
|
|
3337
3405
|
] });
|
|
3338
3406
|
}
|
|
3339
3407
|
|
|
3340
3408
|
// src/components/Data Display/StatCard.tsx
|
|
3341
|
-
var
|
|
3409
|
+
var React50 = __toESM(require("react"), 1);
|
|
3342
3410
|
var import_class_variance_authority6 = require("class-variance-authority");
|
|
3343
|
-
var
|
|
3411
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
3344
3412
|
var statCardVariants = (0, import_class_variance_authority6.cva)("flex min-w-0 flex-col gap-2 rounded-md border p-3", {
|
|
3345
3413
|
variants: {
|
|
3346
3414
|
variant: {
|
|
@@ -3350,11 +3418,11 @@ var statCardVariants = (0, import_class_variance_authority6.cva)("flex min-w-0 f
|
|
|
3350
3418
|
},
|
|
3351
3419
|
defaultVariants: { variant: "default" }
|
|
3352
3420
|
});
|
|
3353
|
-
var StatCard =
|
|
3354
|
-
({ className, variant, label, value, icon, ...props }, ref) => /* @__PURE__ */ (0,
|
|
3355
|
-
/* @__PURE__ */ (0,
|
|
3356
|
-
/* @__PURE__ */ (0,
|
|
3357
|
-
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 }),
|
|
3358
3426
|
value
|
|
3359
3427
|
] })
|
|
3360
3428
|
] })
|
|
@@ -3362,13 +3430,13 @@ var StatCard = React49.forwardRef(
|
|
|
3362
3430
|
StatCard.displayName = "StatCard";
|
|
3363
3431
|
|
|
3364
3432
|
// src/components/Research-Specific/ActivityStructure.tsx
|
|
3365
|
-
var
|
|
3433
|
+
var React52 = __toESM(require("react"), 1);
|
|
3366
3434
|
|
|
3367
3435
|
// src/components/Tags & Badges/EditableTag.tsx
|
|
3368
|
-
var
|
|
3369
|
-
var
|
|
3436
|
+
var React51 = __toESM(require("react"), 1);
|
|
3437
|
+
var import_react27 = require("@phosphor-icons/react");
|
|
3370
3438
|
var import_class_variance_authority7 = require("class-variance-authority");
|
|
3371
|
-
var
|
|
3439
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
3372
3440
|
var editableTagVariants = (0, import_class_variance_authority7.cva)(
|
|
3373
3441
|
"inline-flex h-6.5 items-center whitespace-nowrap rounded-sm py-1 text-ui-caption transition-colors",
|
|
3374
3442
|
{
|
|
@@ -3383,27 +3451,27 @@ var editableTagVariants = (0, import_class_variance_authority7.cva)(
|
|
|
3383
3451
|
defaultVariants: { type: "default" }
|
|
3384
3452
|
}
|
|
3385
3453
|
);
|
|
3386
|
-
var EditableTag =
|
|
3454
|
+
var EditableTag = React51.forwardRef(
|
|
3387
3455
|
({ className, type = "default", icon, onRemove, onClick, children, ...props }, ref) => {
|
|
3388
3456
|
const classes = cn(editableTagVariants({ type }), className);
|
|
3389
|
-
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;
|
|
3390
3458
|
if (type === "add" || type === "multiple" && onClick) {
|
|
3391
|
-
return /* @__PURE__ */ (0,
|
|
3459
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("button", { ref, type: "button", className: classes, onClick, ...props, children: [
|
|
3392
3460
|
leading,
|
|
3393
3461
|
children
|
|
3394
3462
|
] });
|
|
3395
3463
|
}
|
|
3396
|
-
return /* @__PURE__ */ (0,
|
|
3464
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("span", { ref, className: classes, ...props, children: [
|
|
3397
3465
|
leading,
|
|
3398
3466
|
children,
|
|
3399
|
-
onRemove && /* @__PURE__ */ (0,
|
|
3467
|
+
onRemove && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
3400
3468
|
"button",
|
|
3401
3469
|
{
|
|
3402
3470
|
type: "button",
|
|
3403
3471
|
"aria-label": typeof children === "string" ? `Remove ${children}` : "Remove",
|
|
3404
3472
|
onClick: onRemove,
|
|
3405
3473
|
className: "inline-flex size-3 items-center justify-center rounded-xs",
|
|
3406
|
-
children: /* @__PURE__ */ (0,
|
|
3474
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_react27.X, { size: 12, "aria-hidden": true })
|
|
3407
3475
|
}
|
|
3408
3476
|
)
|
|
3409
3477
|
] });
|
|
@@ -3412,23 +3480,23 @@ var EditableTag = React50.forwardRef(
|
|
|
3412
3480
|
EditableTag.displayName = "EditableTag";
|
|
3413
3481
|
|
|
3414
3482
|
// src/components/Research-Specific/ActivityStructure.tsx
|
|
3415
|
-
var
|
|
3416
|
-
var ActivityStructure =
|
|
3417
|
-
({ 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)(
|
|
3418
3486
|
"section",
|
|
3419
3487
|
{
|
|
3420
3488
|
ref,
|
|
3421
3489
|
className: cn("flex w-full max-w-96.5 flex-col gap-4 rounded-xl bg-surface p-4", className),
|
|
3422
3490
|
...props,
|
|
3423
3491
|
children: [
|
|
3424
|
-
/* @__PURE__ */ (0,
|
|
3425
|
-
stats.length > 0 && /* @__PURE__ */ (0,
|
|
3426
|
-
sections?.map(({ id, heading, body, tags }) => /* @__PURE__ */ (0,
|
|
3427
|
-
/* @__PURE__ */ (0,
|
|
3428
|
-
/* @__PURE__ */ (0,
|
|
3429
|
-
(tags?.length || onAddTag) && /* @__PURE__ */ (0,
|
|
3430
|
-
tags?.map((tag) => /* @__PURE__ */ (0,
|
|
3431
|
-
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 })
|
|
3432
3500
|
] })
|
|
3433
3501
|
] }, id)),
|
|
3434
3502
|
children
|
|
@@ -3439,10 +3507,10 @@ var ActivityStructure = React51.forwardRef(
|
|
|
3439
3507
|
ActivityStructure.displayName = "ActivityStructure";
|
|
3440
3508
|
|
|
3441
3509
|
// src/components/Tags & Badges/Badge.tsx
|
|
3442
|
-
var
|
|
3443
|
-
var
|
|
3510
|
+
var React53 = __toESM(require("react"), 1);
|
|
3511
|
+
var import_react28 = require("@phosphor-icons/react");
|
|
3444
3512
|
var import_class_variance_authority8 = require("class-variance-authority");
|
|
3445
|
-
var
|
|
3513
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
3446
3514
|
var roleTagVariants = (0, import_class_variance_authority8.cva)(
|
|
3447
3515
|
"group inline-flex h-6 items-center whitespace-nowrap rounded-sm py-1 text-ui-caption transition-colors",
|
|
3448
3516
|
{
|
|
@@ -3468,11 +3536,11 @@ var roleTagVariants = (0, import_class_variance_authority8.cva)(
|
|
|
3468
3536
|
defaultVariants: { type: "primary", selected: false }
|
|
3469
3537
|
}
|
|
3470
3538
|
);
|
|
3471
|
-
var Badge =
|
|
3539
|
+
var Badge = React53.forwardRef(
|
|
3472
3540
|
({ className, type = "primary", selected = false, onClick, children, ...props }, ref) => {
|
|
3473
3541
|
const classes = cn(roleTagVariants({ type, selected: type === "interactable" ? selected : false }), className);
|
|
3474
3542
|
if (type === "interactable") {
|
|
3475
|
-
return /* @__PURE__ */ (0,
|
|
3543
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
3476
3544
|
"button",
|
|
3477
3545
|
{
|
|
3478
3546
|
ref,
|
|
@@ -3482,15 +3550,15 @@ var Badge = React52.forwardRef(
|
|
|
3482
3550
|
onClick,
|
|
3483
3551
|
...props,
|
|
3484
3552
|
children: [
|
|
3485
|
-
/* @__PURE__ */ (0,
|
|
3553
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_react28.DotsSixVertical, { size: 16, "aria-hidden": true, className: "hidden shrink-0 group-hover:block" }),
|
|
3486
3554
|
children
|
|
3487
3555
|
]
|
|
3488
3556
|
}
|
|
3489
3557
|
);
|
|
3490
3558
|
}
|
|
3491
|
-
return /* @__PURE__ */ (0,
|
|
3492
|
-
type === "question" && /* @__PURE__ */ (0,
|
|
3493
|
-
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" }),
|
|
3494
3562
|
children
|
|
3495
3563
|
] });
|
|
3496
3564
|
}
|
|
@@ -3498,9 +3566,9 @@ var Badge = React52.forwardRef(
|
|
|
3498
3566
|
Badge.displayName = "Badge";
|
|
3499
3567
|
|
|
3500
3568
|
// src/components/Utility/Pagination.tsx
|
|
3501
|
-
var
|
|
3502
|
-
var
|
|
3503
|
-
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");
|
|
3504
3572
|
function getPaginationItems(page, pageCount, siblings = 1) {
|
|
3505
3573
|
const keep = /* @__PURE__ */ new Set([1, pageCount]);
|
|
3506
3574
|
for (let p = page - siblings; p <= page + siblings; p++) if (p >= 1 && p <= pageCount) keep.add(p);
|
|
@@ -3514,10 +3582,10 @@ function getPaginationItems(page, pageCount, siblings = 1) {
|
|
|
3514
3582
|
});
|
|
3515
3583
|
return items;
|
|
3516
3584
|
}
|
|
3517
|
-
var Pagination =
|
|
3585
|
+
var Pagination = React54.forwardRef(
|
|
3518
3586
|
({ className, page, pageCount, onPageChange, variant = "full", siblings = 1, ...props }, ref) => {
|
|
3519
3587
|
const go = (next2) => onPageChange(Math.min(pageCount, Math.max(1, next2)));
|
|
3520
|
-
const previous = /* @__PURE__ */ (0,
|
|
3588
|
+
const previous = /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
3521
3589
|
Button,
|
|
3522
3590
|
{
|
|
3523
3591
|
type: "button",
|
|
@@ -3526,10 +3594,10 @@ var Pagination = React53.forwardRef(
|
|
|
3526
3594
|
"aria-label": "Previous page",
|
|
3527
3595
|
disabled: page <= 1,
|
|
3528
3596
|
onClick: () => go(page - 1),
|
|
3529
|
-
children: /* @__PURE__ */ (0,
|
|
3597
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react29.ArrowLeft, { size: 16, "aria-hidden": true })
|
|
3530
3598
|
}
|
|
3531
3599
|
);
|
|
3532
|
-
const next = /* @__PURE__ */ (0,
|
|
3600
|
+
const next = /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
3533
3601
|
Button,
|
|
3534
3602
|
{
|
|
3535
3603
|
type: "button",
|
|
@@ -3538,10 +3606,10 @@ var Pagination = React53.forwardRef(
|
|
|
3538
3606
|
"aria-label": "Next page",
|
|
3539
3607
|
disabled: page >= pageCount,
|
|
3540
3608
|
onClick: () => go(page + 1),
|
|
3541
|
-
children: /* @__PURE__ */ (0,
|
|
3609
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react29.ArrowRight, { size: 16, "aria-hidden": true })
|
|
3542
3610
|
}
|
|
3543
3611
|
);
|
|
3544
|
-
return /* @__PURE__ */ (0,
|
|
3612
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
|
|
3545
3613
|
"nav",
|
|
3546
3614
|
{
|
|
3547
3615
|
ref,
|
|
@@ -3550,14 +3618,14 @@ var Pagination = React53.forwardRef(
|
|
|
3550
3618
|
...props,
|
|
3551
3619
|
children: [
|
|
3552
3620
|
previous,
|
|
3553
|
-
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: [
|
|
3554
3622
|
page,
|
|
3555
3623
|
"/",
|
|
3556
3624
|
pageCount
|
|
3557
|
-
] }) : /* @__PURE__ */ (0,
|
|
3558
|
-
/* @__PURE__ */ (0,
|
|
3559
|
-
/* @__PURE__ */ (0,
|
|
3560
|
-
] }) : /* @__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)(
|
|
3561
3629
|
Button,
|
|
3562
3630
|
{
|
|
3563
3631
|
type: "button",
|
|
@@ -3662,6 +3730,7 @@ Pagination.displayName = "Pagination";
|
|
|
3662
3730
|
Slider,
|
|
3663
3731
|
StatCard,
|
|
3664
3732
|
StatusTag,
|
|
3733
|
+
StimulusCard,
|
|
3665
3734
|
Switch,
|
|
3666
3735
|
TabItem,
|
|
3667
3736
|
TabNavigation,
|