@discuss-ds/ui 0.31.0 → 0.32.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 +14 -0
- package/dist/index.cjs +17 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +29 -19
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -580,6 +580,8 @@ declare const ToastAction: React.ForwardRefExoticComponent<Toast$1.ToastActionPr
|
|
|
580
580
|
interface ToastInlineProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof inlineVariants> {
|
|
581
581
|
/** Buttons shown after the message, for example a ghost "Dismiss" and an outline "Fix" (both `size="sm"`). */
|
|
582
582
|
actions?: React.ReactNode;
|
|
583
|
+
/** Where the actions sit: `end` (default) after the message on the same line, or `bottom` under the message, for messages long enough to wrap. */
|
|
584
|
+
actionsPlacement?: 'end' | 'bottom';
|
|
583
585
|
/** Show a close button and call this when it is pressed. */
|
|
584
586
|
onClose?: () => void;
|
|
585
587
|
closeLabel?: string;
|
|
@@ -683,7 +685,12 @@ declare const OpenEndAnswer: React.ForwardRefExoticComponent<OpenEndAnswerProps
|
|
|
683
685
|
|
|
684
686
|
declare const QuestionCard: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
685
687
|
|
|
686
|
-
|
|
688
|
+
/**
|
|
689
|
+
* `upload` is the generic file upload; `upload-video`, `upload-photo` and `upload-document` say which kind of file the respondent sends (a video icon, an image icon, a file-with-text
|
|
690
|
+
* icon for PDF/PPTX/DOCX). A video upload shares the video camera with screen recording: no method offers both,
|
|
691
|
+
* so they never meet in one activity.
|
|
692
|
+
*/
|
|
693
|
+
type QuestionType = 'select-one' | 'select-multiple' | 'ranking' | 'upload' | 'upload-video' | 'upload-photo' | 'upload-document' | 'rating' | 'open-end' | 'screen-recording';
|
|
687
694
|
interface QuestionTypeIconProps extends Omit<IconProps, 'weight'> {
|
|
688
695
|
type: QuestionType;
|
|
689
696
|
}
|
|
@@ -1045,6 +1052,8 @@ interface StatCardProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'chil
|
|
|
1045
1052
|
value: React.ReactNode;
|
|
1046
1053
|
/** Leading icon beside the value (24px). */
|
|
1047
1054
|
icon?: React.ReactNode;
|
|
1055
|
+
/** Small muted text under the value that says what it refers to or breaks it down ("11 open-ended · 5 closed-ended"). */
|
|
1056
|
+
caption?: React.ReactNode;
|
|
1048
1057
|
}
|
|
1049
1058
|
declare const StatCard: React.ForwardRefExoticComponent<StatCardProps & React.RefAttributes<HTMLDivElement>>;
|
|
1050
1059
|
|
package/dist/index.d.ts
CHANGED
|
@@ -580,6 +580,8 @@ declare const ToastAction: React.ForwardRefExoticComponent<Toast$1.ToastActionPr
|
|
|
580
580
|
interface ToastInlineProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof inlineVariants> {
|
|
581
581
|
/** Buttons shown after the message, for example a ghost "Dismiss" and an outline "Fix" (both `size="sm"`). */
|
|
582
582
|
actions?: React.ReactNode;
|
|
583
|
+
/** Where the actions sit: `end` (default) after the message on the same line, or `bottom` under the message, for messages long enough to wrap. */
|
|
584
|
+
actionsPlacement?: 'end' | 'bottom';
|
|
583
585
|
/** Show a close button and call this when it is pressed. */
|
|
584
586
|
onClose?: () => void;
|
|
585
587
|
closeLabel?: string;
|
|
@@ -683,7 +685,12 @@ declare const OpenEndAnswer: React.ForwardRefExoticComponent<OpenEndAnswerProps
|
|
|
683
685
|
|
|
684
686
|
declare const QuestionCard: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
685
687
|
|
|
686
|
-
|
|
688
|
+
/**
|
|
689
|
+
* `upload` is the generic file upload; `upload-video`, `upload-photo` and `upload-document` say which kind of file the respondent sends (a video icon, an image icon, a file-with-text
|
|
690
|
+
* icon for PDF/PPTX/DOCX). A video upload shares the video camera with screen recording: no method offers both,
|
|
691
|
+
* so they never meet in one activity.
|
|
692
|
+
*/
|
|
693
|
+
type QuestionType = 'select-one' | 'select-multiple' | 'ranking' | 'upload' | 'upload-video' | 'upload-photo' | 'upload-document' | 'rating' | 'open-end' | 'screen-recording';
|
|
687
694
|
interface QuestionTypeIconProps extends Omit<IconProps, 'weight'> {
|
|
688
695
|
type: QuestionType;
|
|
689
696
|
}
|
|
@@ -1045,6 +1052,8 @@ interface StatCardProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'chil
|
|
|
1045
1052
|
value: React.ReactNode;
|
|
1046
1053
|
/** Leading icon beside the value (24px). */
|
|
1047
1054
|
icon?: React.ReactNode;
|
|
1055
|
+
/** Small muted text under the value that says what it refers to or breaks it down ("11 open-ended · 5 closed-ended"). */
|
|
1056
|
+
caption?: React.ReactNode;
|
|
1048
1057
|
}
|
|
1049
1058
|
declare const StatCard: React.ForwardRefExoticComponent<StatCardProps & React.RefAttributes<HTMLDivElement>>;
|
|
1050
1059
|
|
package/dist/index.js
CHANGED
|
@@ -2220,7 +2220,7 @@ import * as React34 from "react";
|
|
|
2220
2220
|
import { CheckCircle as CheckCircle2, Info, Warning, WarningCircle as WarningCircle3, X as X4 } from "@phosphor-icons/react";
|
|
2221
2221
|
import { cva as cva4 } from "class-variance-authority";
|
|
2222
2222
|
import { Toast as ToastPrimitive } from "radix-ui";
|
|
2223
|
-
import { jsx as jsx35, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
2223
|
+
import { Fragment as Fragment6, jsx as jsx35, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
2224
2224
|
var toastVariants = cva4("border", {
|
|
2225
2225
|
variants: {
|
|
2226
2226
|
variant: {
|
|
@@ -2308,19 +2308,25 @@ var Toast = React34.forwardRef(
|
|
|
2308
2308
|
Toast.displayName = "Toast";
|
|
2309
2309
|
var ToastAction = ToastPrimitive.Action;
|
|
2310
2310
|
var ToastInline = React34.forwardRef(
|
|
2311
|
-
({ className, variant = "info", actions, onClose, closeLabel = "Close", children, ...props }, ref) => {
|
|
2311
|
+
({ className, variant = "info", actions, actionsPlacement = "end", onClose, closeLabel = "Close", children, ...props }, ref) => {
|
|
2312
2312
|
const v = variant ?? "info";
|
|
2313
|
+
const below = actionsPlacement === "bottom" && !!actions;
|
|
2313
2314
|
return /* @__PURE__ */ jsxs25(
|
|
2314
2315
|
"div",
|
|
2315
2316
|
{
|
|
2316
2317
|
ref,
|
|
2317
2318
|
role: v === "destructive" ? "alert" : "status",
|
|
2318
|
-
className: cn("flex
|
|
2319
|
+
className: cn("flex gap-2 rounded-sm px-2 py-1.5", below ? "items-start" : "items-center", inlineVariants({ variant: v }), className),
|
|
2319
2320
|
...props,
|
|
2320
2321
|
children: [
|
|
2321
|
-
/* @__PURE__ */ jsx35(VariantIcon, { variant: v === "neutral" ? "info" : v, size: 16 }),
|
|
2322
|
-
/* @__PURE__ */
|
|
2323
|
-
|
|
2322
|
+
/* @__PURE__ */ jsx35("span", { className: cn("inline-flex shrink-0", below && "mt-0.5"), children: /* @__PURE__ */ jsx35(VariantIcon, { variant: v === "neutral" ? "info" : v, size: 16 }) }),
|
|
2323
|
+
below ? /* @__PURE__ */ jsxs25("div", { className: "flex min-w-0 flex-1 flex-col gap-2", children: [
|
|
2324
|
+
/* @__PURE__ */ jsx35("p", { className: "text-body-small text-secondary-muted-foreground", children }),
|
|
2325
|
+
/* @__PURE__ */ jsx35("div", { className: "flex items-center gap-2", children: actions })
|
|
2326
|
+
] }) : /* @__PURE__ */ jsxs25(Fragment6, { children: [
|
|
2327
|
+
/* @__PURE__ */ jsx35("p", { className: "min-w-0 flex-1 text-body-small text-secondary-muted-foreground", children }),
|
|
2328
|
+
actions && /* @__PURE__ */ jsx35("div", { className: "flex shrink-0 items-center gap-2", children: actions })
|
|
2329
|
+
] }),
|
|
2324
2330
|
onClose && /* @__PURE__ */ jsx35(Button, { type: "button", variant: "ghost", size: "icon-sm", "aria-label": closeLabel, onClick: onClose, children: /* @__PURE__ */ jsx35(X4, { size: 16, "aria-hidden": true }) })
|
|
2325
2331
|
]
|
|
2326
2332
|
}
|
|
@@ -2332,7 +2338,7 @@ ToastInline.displayName = "ToastInline";
|
|
|
2332
2338
|
// src/components/Overlays & Feedback/Tooltip.tsx
|
|
2333
2339
|
import * as React35 from "react";
|
|
2334
2340
|
import { Tooltip as TooltipPrimitive } from "radix-ui";
|
|
2335
|
-
import { Fragment as
|
|
2341
|
+
import { Fragment as Fragment7, jsx as jsx36, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
2336
2342
|
var TooltipProvider = TooltipPrimitive.Provider;
|
|
2337
2343
|
var Tooltip = TooltipPrimitive.Root;
|
|
2338
2344
|
var TooltipTrigger = TooltipPrimitive.Trigger;
|
|
@@ -2353,7 +2359,7 @@ var TooltipContent = React35.forwardRef(
|
|
|
2353
2359
|
),
|
|
2354
2360
|
...props,
|
|
2355
2361
|
children: [
|
|
2356
|
-
detailed ? /* @__PURE__ */ jsxs26(
|
|
2362
|
+
detailed ? /* @__PURE__ */ jsxs26(Fragment7, { children: [
|
|
2357
2363
|
title != null && /* @__PURE__ */ jsx36("p", { className: "text-xs leading-4 font-semibold text-label", children: title }),
|
|
2358
2364
|
description != null && /* @__PURE__ */ jsx36("p", { className: "text-xs leading-4.5 text-plum-200", children: description }),
|
|
2359
2365
|
action != null && /* @__PURE__ */ jsx36("div", { className: "mt-1 text-ui-caption text-plum-300 underline *:underline", children: action })
|
|
@@ -2412,7 +2418,7 @@ var StatusTag = React36.forwardRef(
|
|
|
2412
2418
|
StatusTag.displayName = "StatusTag";
|
|
2413
2419
|
|
|
2414
2420
|
// src/components/Question Types/FileUpload.tsx
|
|
2415
|
-
import { Fragment as
|
|
2421
|
+
import { Fragment as Fragment8, jsx as jsx38, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
2416
2422
|
var FileUploadZone = React37.forwardRef(
|
|
2417
2423
|
({ className, title = "Upload document", hint, icon, onFiles, ...props }, ref) => {
|
|
2418
2424
|
const [over, setOver] = React37.useState(false);
|
|
@@ -2479,7 +2485,7 @@ var FileUploadItem = React37.forwardRef(
|
|
|
2479
2485
|
size,
|
|
2480
2486
|
status === "complete" && /* @__PURE__ */ jsx38(Tag, { variant: "success", children: "Complete" }),
|
|
2481
2487
|
status === "error" && /* @__PURE__ */ jsx38(Tag, { variant: "destructive", children: "Error" }),
|
|
2482
|
-
uploading && timeLeft && /* @__PURE__ */ jsxs28(
|
|
2488
|
+
uploading && timeLeft && /* @__PURE__ */ jsxs28(Fragment8, { children: [
|
|
2483
2489
|
/* @__PURE__ */ jsx38("span", { "aria-hidden": "true", className: "size-0.5 rounded-full bg-secondary-muted-foreground" }),
|
|
2484
2490
|
timeLeft
|
|
2485
2491
|
] })
|
|
@@ -2797,13 +2803,16 @@ import { DotsSixVertical } from "@phosphor-icons/react";
|
|
|
2797
2803
|
|
|
2798
2804
|
// src/components/Question Types/QuestionTypeIcon.tsx
|
|
2799
2805
|
import "react";
|
|
2800
|
-
import { ChatsCircle, CheckSquare, FileArrowUp, ListNumbers, RadioButton, StarHalf, VideoCamera } from "@phosphor-icons/react";
|
|
2806
|
+
import { ChatsCircle, CheckSquare, FileArrowUp, FileText as FileText2, Image, ListNumbers, RadioButton, StarHalf, VideoCamera } from "@phosphor-icons/react";
|
|
2801
2807
|
import { jsx as jsx42 } from "react/jsx-runtime";
|
|
2802
2808
|
var icons = {
|
|
2803
2809
|
"select-one": RadioButton,
|
|
2804
2810
|
"select-multiple": CheckSquare,
|
|
2805
2811
|
ranking: ListNumbers,
|
|
2806
2812
|
upload: FileArrowUp,
|
|
2813
|
+
"upload-video": VideoCamera,
|
|
2814
|
+
"upload-photo": Image,
|
|
2815
|
+
"upload-document": FileText2,
|
|
2807
2816
|
rating: StarHalf,
|
|
2808
2817
|
"open-end": ChatsCircle,
|
|
2809
2818
|
"screen-recording": VideoCamera
|
|
@@ -2924,7 +2933,7 @@ var QuestionHeader = React42.forwardRef(
|
|
|
2924
2933
|
QuestionHeader.displayName = "QuestionHeader";
|
|
2925
2934
|
|
|
2926
2935
|
// src/components/Question Types/QuestionEditorCard.tsx
|
|
2927
|
-
import { Fragment as
|
|
2936
|
+
import { Fragment as Fragment10, jsx as jsx44, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
2928
2937
|
var QuestionEditorCard = React43.forwardRef(
|
|
2929
2938
|
({
|
|
2930
2939
|
className,
|
|
@@ -3004,7 +3013,7 @@ var QuestionEditorCard = React43.forwardRef(
|
|
|
3004
3013
|
onTitleMarkDismiss,
|
|
3005
3014
|
meta,
|
|
3006
3015
|
maxLength,
|
|
3007
|
-
actions: actions ?? /* @__PURE__ */ jsxs31(
|
|
3016
|
+
actions: actions ?? /* @__PURE__ */ jsxs31(Fragment10, { children: [
|
|
3008
3017
|
/* @__PURE__ */ jsx44(
|
|
3009
3018
|
Button,
|
|
3010
3019
|
{
|
|
@@ -3141,7 +3150,7 @@ QuestionNavItem.displayName = "QuestionNavItem";
|
|
|
3141
3150
|
// src/components/Question Types/QuestionOption.tsx
|
|
3142
3151
|
import * as React45 from "react";
|
|
3143
3152
|
import { Check as Check4, DotsSixVertical as DotsSixVertical3, Plus as Plus4, Trash as Trash5, WarningCircle as WarningCircle4 } from "@phosphor-icons/react";
|
|
3144
|
-
import { Fragment as
|
|
3153
|
+
import { Fragment as Fragment11, jsx as jsx46, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
3145
3154
|
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";
|
|
3146
3155
|
function QuestionOption(props) {
|
|
3147
3156
|
const id = React45.useId();
|
|
@@ -3243,7 +3252,7 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3243
3252
|
) : "border-border hover:border-input-muted hover:shadow-md"
|
|
3244
3253
|
),
|
|
3245
3254
|
children: /* @__PURE__ */ jsxs33("div", { className: "flex min-w-0 items-start gap-2", children: [
|
|
3246
|
-
(kind !== void 0 || !locked) && /* @__PURE__ */ jsx46("div", { className: "flex h-7 shrink-0 items-center gap-2", children: kind === "rank" ? /* @__PURE__ */ jsxs33(
|
|
3255
|
+
(kind !== void 0 || !locked) && /* @__PURE__ */ jsx46("div", { className: "flex h-7 shrink-0 items-center gap-2", children: kind === "rank" ? /* @__PURE__ */ jsxs33(Fragment11, { children: [
|
|
3247
3256
|
!locked && grip,
|
|
3248
3257
|
/* @__PURE__ */ jsx46(
|
|
3249
3258
|
"span",
|
|
@@ -3376,7 +3385,7 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3376
3385
|
// src/components/Question Types/RankList.tsx
|
|
3377
3386
|
import * as React46 from "react";
|
|
3378
3387
|
import { DotsSixVertical as DotsSixVertical4 } from "@phosphor-icons/react";
|
|
3379
|
-
import { Fragment as
|
|
3388
|
+
import { Fragment as Fragment12, jsx as jsx47, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
3380
3389
|
function move(list, from, to) {
|
|
3381
3390
|
if (from === to || to < 0 || to >= list.length) return list;
|
|
3382
3391
|
const next = list.slice();
|
|
@@ -3403,7 +3412,7 @@ var RankList = React46.forwardRef(
|
|
|
3403
3412
|
setAnnouncement(`Moved to position ${to + 1} of ${items.length}`);
|
|
3404
3413
|
onItemsChange(next);
|
|
3405
3414
|
};
|
|
3406
|
-
return /* @__PURE__ */ jsxs34(
|
|
3415
|
+
return /* @__PURE__ */ jsxs34(Fragment12, { children: [
|
|
3407
3416
|
/* @__PURE__ */ jsx47("ol", { ref, className: cn("flex w-full max-w-150 flex-col gap-4", className), ...props, children: items.map((item, index) => /* @__PURE__ */ jsxs34(
|
|
3408
3417
|
"li",
|
|
3409
3418
|
{
|
|
@@ -3769,12 +3778,13 @@ var statCardVariants = cva6("flex min-w-0 flex-col gap-2 rounded-md border p-3",
|
|
|
3769
3778
|
defaultVariants: { variant: "default" }
|
|
3770
3779
|
});
|
|
3771
3780
|
var StatCard = React51.forwardRef(
|
|
3772
|
-
({ className, variant, label, value, icon, ...props }, ref) => /* @__PURE__ */ jsxs39("div", { ref, className: cn(statCardVariants({ variant }), className), ...props, children: [
|
|
3781
|
+
({ className, variant, label, value, icon, caption, ...props }, ref) => /* @__PURE__ */ jsxs39("div", { ref, className: cn(statCardVariants({ variant }), className), ...props, children: [
|
|
3773
3782
|
/* @__PURE__ */ jsx52("p", { className: "truncate text-ui-caption text-secondary-muted-foreground", children: label }),
|
|
3774
3783
|
/* @__PURE__ */ jsxs39("p", { className: "flex items-center gap-2 text-body-base text-surface-foreground", children: [
|
|
3775
3784
|
icon && /* @__PURE__ */ jsx52("span", { "aria-hidden": "true", className: "inline-flex size-6 shrink-0 items-center justify-center", children: icon }),
|
|
3776
3785
|
value
|
|
3777
|
-
] })
|
|
3786
|
+
] }),
|
|
3787
|
+
caption && /* @__PURE__ */ jsx52("p", { className: "text-ui-caption text-secondary-muted-foreground", children: caption })
|
|
3778
3788
|
] })
|
|
3779
3789
|
);
|
|
3780
3790
|
StatCard.displayName = "StatCard";
|