@discuss-ds/ui 0.11.0 → 0.13.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 +38 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +41 -30
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -655,6 +655,10 @@ interface QuestionEditorCardProps extends Omit<React.HTMLAttributes<HTMLDivEleme
|
|
|
655
655
|
onAdd?: () => void;
|
|
656
656
|
/** Footer: opens paste-many-choices. */
|
|
657
657
|
onPaste?: () => void;
|
|
658
|
+
/** Inline error shown at the bottom of the card, e.g. "Not available in Self-Paced". Keep it as short as possible. */
|
|
659
|
+
error?: React.ReactNode;
|
|
660
|
+
/** Content right beside the "Question N" tag, e.g. the time allowed for the question. */
|
|
661
|
+
meta?: React.ReactNode;
|
|
658
662
|
/** Optional strip under the card body, e.g. an "Inferred" assumption note. */
|
|
659
663
|
note?: React.ReactNode;
|
|
660
664
|
/** Makes the "Question N" tag a drag handle for reordering. See `QuestionHeader`'s `dragHandleProps`. */
|
|
@@ -677,6 +681,8 @@ interface QuestionHeaderProps extends Omit<React.HTMLAttributes<HTMLDivElement>,
|
|
|
677
681
|
onTitleChange?: (title: string) => void;
|
|
678
682
|
/** Editor mode: action buttons (copy, delete, preview, AI) revealed on hover or focus. */
|
|
679
683
|
actions?: React.ReactNode;
|
|
684
|
+
/** Editor mode: content shown right beside the "Question N" tag, e.g. the time allowed for the question. */
|
|
685
|
+
meta?: React.ReactNode;
|
|
680
686
|
/** Editor mode: title length limit. */
|
|
681
687
|
maxLength?: number;
|
|
682
688
|
/** Editor mode: the question is being edited — the number tag turns accent. */
|
package/dist/index.d.ts
CHANGED
|
@@ -655,6 +655,10 @@ interface QuestionEditorCardProps extends Omit<React.HTMLAttributes<HTMLDivEleme
|
|
|
655
655
|
onAdd?: () => void;
|
|
656
656
|
/** Footer: opens paste-many-choices. */
|
|
657
657
|
onPaste?: () => void;
|
|
658
|
+
/** Inline error shown at the bottom of the card, e.g. "Not available in Self-Paced". Keep it as short as possible. */
|
|
659
|
+
error?: React.ReactNode;
|
|
660
|
+
/** Content right beside the "Question N" tag, e.g. the time allowed for the question. */
|
|
661
|
+
meta?: React.ReactNode;
|
|
658
662
|
/** Optional strip under the card body, e.g. an "Inferred" assumption note. */
|
|
659
663
|
note?: React.ReactNode;
|
|
660
664
|
/** Makes the "Question N" tag a drag handle for reordering. See `QuestionHeader`'s `dragHandleProps`. */
|
|
@@ -677,6 +681,8 @@ interface QuestionHeaderProps extends Omit<React.HTMLAttributes<HTMLDivElement>,
|
|
|
677
681
|
onTitleChange?: (title: string) => void;
|
|
678
682
|
/** Editor mode: action buttons (copy, delete, preview, AI) revealed on hover or focus. */
|
|
679
683
|
actions?: React.ReactNode;
|
|
684
|
+
/** Editor mode: content shown right beside the "Question N" tag, e.g. the time allowed for the question. */
|
|
685
|
+
meta?: React.ReactNode;
|
|
680
686
|
/** Editor mode: title length limit. */
|
|
681
687
|
maxLength?: number;
|
|
682
688
|
/** Editor mode: the question is being edited — the number tag turns accent. */
|
package/dist/index.js
CHANGED
|
@@ -2502,7 +2502,8 @@ import {
|
|
|
2502
2502
|
Eye,
|
|
2503
2503
|
Plus as Plus3,
|
|
2504
2504
|
Sparkle as Sparkle2,
|
|
2505
|
-
Trash as Trash3
|
|
2505
|
+
Trash as Trash3,
|
|
2506
|
+
Warning as Warning2
|
|
2506
2507
|
} from "@phosphor-icons/react";
|
|
2507
2508
|
|
|
2508
2509
|
// src/components/Question Types/QuestionHeader.tsx
|
|
@@ -2511,7 +2512,7 @@ import { DotsSixVertical } from "@phosphor-icons/react";
|
|
|
2511
2512
|
import { jsx as jsx41, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
2512
2513
|
var eyebrow = "text-ui-caption uppercase text-secondary-muted-foreground";
|
|
2513
2514
|
var QuestionHeader = React40.forwardRef(
|
|
2514
|
-
({ className, number, title, required, error, onDismissError, editor, onTitleChange, actions, maxLength = 2e3, active, showCounter = true, dragHandleProps, ...props }, ref) => {
|
|
2515
|
+
({ className, number, title, required, error, onDismissError, editor, onTitleChange, actions, meta, maxLength = 2e3, active, showCounter = true, dragHandleProps, ...props }, ref) => {
|
|
2515
2516
|
const [draft, setDraft] = React40.useState(null);
|
|
2516
2517
|
const label = String(number).padStart(2, "0");
|
|
2517
2518
|
const showError = error !== void 0 && error !== false;
|
|
@@ -2520,33 +2521,36 @@ var QuestionHeader = React40.forwardRef(
|
|
|
2520
2521
|
const count = (draft ?? text).length;
|
|
2521
2522
|
return /* @__PURE__ */ jsxs28("div", { ref, className: cn("group/header flex w-full flex-col gap-2", className), ...props, children: [
|
|
2522
2523
|
/* @__PURE__ */ jsxs28("div", { className: "flex items-center justify-between", children: [
|
|
2523
|
-
/* @__PURE__ */ jsxs28(
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
children: [
|
|
2537
|
-
/* @__PURE__ */ jsx41(
|
|
2538
|
-
DotsSixVertical,
|
|
2539
|
-
{
|
|
2540
|
-
size: 16,
|
|
2541
|
-
"aria-hidden": true,
|
|
2542
|
-
className: "hidden shrink-0 group-hover/editor:block group-hover/handle:block group-focus-visible/handle:block"
|
|
2543
|
-
}
|
|
2524
|
+
/* @__PURE__ */ jsxs28("div", { className: "flex items-center gap-2", children: [
|
|
2525
|
+
/* @__PURE__ */ jsxs28(
|
|
2526
|
+
"span",
|
|
2527
|
+
{
|
|
2528
|
+
"aria-label": dragHandleProps ? `Reorder question ${number}` : void 0,
|
|
2529
|
+
...dragHandleProps,
|
|
2530
|
+
className: cn(
|
|
2531
|
+
"group/handle inline-flex h-6 items-center gap-1 rounded-sm px-2.5 text-ui-caption hover:pl-1",
|
|
2532
|
+
// Inside a QuestionEditorCard the tag takes its hover look whenever the card is hovered.
|
|
2533
|
+
"group-hover/editor:pl-1",
|
|
2534
|
+
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",
|
|
2535
|
+
dragHandleProps && "cursor-grab touch-none select-none focus-visible:pl-1",
|
|
2536
|
+
dragHandleProps?.className
|
|
2544
2537
|
),
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2538
|
+
children: [
|
|
2539
|
+
/* @__PURE__ */ jsx41(
|
|
2540
|
+
DotsSixVertical,
|
|
2541
|
+
{
|
|
2542
|
+
size: 16,
|
|
2543
|
+
"aria-hidden": true,
|
|
2544
|
+
className: "hidden shrink-0 group-hover/editor:block group-hover/handle:block group-focus-visible/handle:block"
|
|
2545
|
+
}
|
|
2546
|
+
),
|
|
2547
|
+
"Question ",
|
|
2548
|
+
number
|
|
2549
|
+
]
|
|
2550
|
+
}
|
|
2551
|
+
),
|
|
2552
|
+
meta
|
|
2553
|
+
] }),
|
|
2550
2554
|
actions && /* @__PURE__ */ jsx41("div", { className: cn(
|
|
2551
2555
|
"flex items-center gap-2 opacity-0 transition-opacity group-focus-within/header:opacity-100 group-hover/header:opacity-100",
|
|
2552
2556
|
// Inside a QuestionEditorCard, hovering or focusing anywhere on the card reveals them too.
|
|
@@ -2615,6 +2619,8 @@ var QuestionEditorCard = React41.forwardRef(
|
|
|
2615
2619
|
onAdd,
|
|
2616
2620
|
onPaste,
|
|
2617
2621
|
note,
|
|
2622
|
+
error,
|
|
2623
|
+
meta,
|
|
2618
2624
|
dragHandleProps,
|
|
2619
2625
|
children,
|
|
2620
2626
|
...props
|
|
@@ -2647,6 +2653,7 @@ var QuestionEditorCard = React41.forwardRef(
|
|
|
2647
2653
|
active,
|
|
2648
2654
|
showCounter: !!active,
|
|
2649
2655
|
dragHandleProps,
|
|
2656
|
+
meta,
|
|
2650
2657
|
maxLength,
|
|
2651
2658
|
actions: actions ?? /* @__PURE__ */ jsxs29(Fragment7, { children: [
|
|
2652
2659
|
/* @__PURE__ */ jsx42(
|
|
@@ -2687,6 +2694,10 @@ var QuestionEditorCard = React41.forwardRef(
|
|
|
2687
2694
|
),
|
|
2688
2695
|
children
|
|
2689
2696
|
] }),
|
|
2697
|
+
error && /* @__PURE__ */ jsxs29("p", { className: "flex items-center gap-1 text-ui-caption text-destructive-foreground", children: [
|
|
2698
|
+
/* @__PURE__ */ jsx42(Warning2, { size: 16, "aria-hidden": true, className: "shrink-0" }),
|
|
2699
|
+
error
|
|
2700
|
+
] }),
|
|
2690
2701
|
footer && /* @__PURE__ */ jsxs29("div", { className: "flex items-center justify-between", children: [
|
|
2691
2702
|
/* @__PURE__ */ jsx42("p", { className: "text-ui-caption text-secondary-muted-foreground", children: countLabel }),
|
|
2692
2703
|
/* @__PURE__ */ jsxs29("div", { className: "flex items-center gap-2", children: [
|
|
@@ -2733,7 +2744,7 @@ QuestionEditorCard.displayName = "QuestionEditorCard";
|
|
|
2733
2744
|
|
|
2734
2745
|
// src/components/Question Types/QuestionNavItem.tsx
|
|
2735
2746
|
import * as React43 from "react";
|
|
2736
|
-
import { DotsSixVertical as DotsSixVertical2, Warning as
|
|
2747
|
+
import { DotsSixVertical as DotsSixVertical2, Warning as Warning3 } from "@phosphor-icons/react";
|
|
2737
2748
|
import { Slot as Slot3 } from "radix-ui";
|
|
2738
2749
|
|
|
2739
2750
|
// src/components/Question Types/QuestionTypeIcon.tsx
|
|
@@ -2778,7 +2789,7 @@ var QuestionNavItem = React43.forwardRef(
|
|
|
2778
2789
|
children: [
|
|
2779
2790
|
/* @__PURE__ */ jsxs30("span", { "aria-hidden": "true", className: "relative flex size-4 shrink-0 items-center justify-center", children: [
|
|
2780
2791
|
/* @__PURE__ */ jsx44(DotsSixVertical2, { size: 16, className: "hidden group-hover/nav:block" }),
|
|
2781
|
-
/* @__PURE__ */ jsx44("span", { className: "group-hover/nav:hidden", children: error ? /* @__PURE__ */ jsx44(
|
|
2792
|
+
/* @__PURE__ */ jsx44("span", { className: "group-hover/nav:hidden", children: error ? /* @__PURE__ */ jsx44(Warning3, { size: 16, className: "text-destructive-foreground" }) : /* @__PURE__ */ jsx44(
|
|
2782
2793
|
QuestionTypeIcon,
|
|
2783
2794
|
{
|
|
2784
2795
|
type: questionType,
|