@discuss-ds/ui 0.12.0 → 0.14.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 +33 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +33 -28
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/styles/globals.css +22 -0
package/dist/index.d.cts
CHANGED
|
@@ -657,6 +657,8 @@ interface QuestionEditorCardProps extends Omit<React.HTMLAttributes<HTMLDivEleme
|
|
|
657
657
|
onPaste?: () => void;
|
|
658
658
|
/** Inline error shown at the bottom of the card, e.g. "Not available in Self-Paced". Keep it as short as possible. */
|
|
659
659
|
error?: React.ReactNode;
|
|
660
|
+
/** Content right beside the "Question N" tag, e.g. the time allowed for the question. */
|
|
661
|
+
meta?: React.ReactNode;
|
|
660
662
|
/** Optional strip under the card body, e.g. an "Inferred" assumption note. */
|
|
661
663
|
note?: React.ReactNode;
|
|
662
664
|
/** Makes the "Question N" tag a drag handle for reordering. See `QuestionHeader`'s `dragHandleProps`. */
|
|
@@ -679,6 +681,8 @@ interface QuestionHeaderProps extends Omit<React.HTMLAttributes<HTMLDivElement>,
|
|
|
679
681
|
onTitleChange?: (title: string) => void;
|
|
680
682
|
/** Editor mode: action buttons (copy, delete, preview, AI) revealed on hover or focus. */
|
|
681
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;
|
|
682
686
|
/** Editor mode: title length limit. */
|
|
683
687
|
maxLength?: number;
|
|
684
688
|
/** Editor mode: the question is being edited — the number tag turns accent. */
|
package/dist/index.d.ts
CHANGED
|
@@ -657,6 +657,8 @@ interface QuestionEditorCardProps extends Omit<React.HTMLAttributes<HTMLDivEleme
|
|
|
657
657
|
onPaste?: () => void;
|
|
658
658
|
/** Inline error shown at the bottom of the card, e.g. "Not available in Self-Paced". Keep it as short as possible. */
|
|
659
659
|
error?: React.ReactNode;
|
|
660
|
+
/** Content right beside the "Question N" tag, e.g. the time allowed for the question. */
|
|
661
|
+
meta?: React.ReactNode;
|
|
660
662
|
/** Optional strip under the card body, e.g. an "Inferred" assumption note. */
|
|
661
663
|
note?: React.ReactNode;
|
|
662
664
|
/** Makes the "Question N" tag a drag handle for reordering. See `QuestionHeader`'s `dragHandleProps`. */
|
|
@@ -679,6 +681,8 @@ interface QuestionHeaderProps extends Omit<React.HTMLAttributes<HTMLDivElement>,
|
|
|
679
681
|
onTitleChange?: (title: string) => void;
|
|
680
682
|
/** Editor mode: action buttons (copy, delete, preview, AI) revealed on hover or focus. */
|
|
681
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;
|
|
682
686
|
/** Editor mode: title length limit. */
|
|
683
687
|
maxLength?: number;
|
|
684
688
|
/** Editor mode: the question is being edited — the number tag turns accent. */
|
package/dist/index.js
CHANGED
|
@@ -192,7 +192,7 @@ var AIMiniAvatar = React4.forwardRef(
|
|
|
192
192
|
className: cn(
|
|
193
193
|
"h-5.75 shrink-0 fill-accent",
|
|
194
194
|
status === "working" ? "w-5" : "w-5.25",
|
|
195
|
-
busy && "motion-safe:animate-
|
|
195
|
+
busy && "motion-safe:animate-ai-draw-on"
|
|
196
196
|
),
|
|
197
197
|
children: /* @__PURE__ */ jsx4("path", { d: glyph.d })
|
|
198
198
|
}
|
|
@@ -2512,7 +2512,7 @@ import { DotsSixVertical } from "@phosphor-icons/react";
|
|
|
2512
2512
|
import { jsx as jsx41, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
2513
2513
|
var eyebrow = "text-ui-caption uppercase text-secondary-muted-foreground";
|
|
2514
2514
|
var QuestionHeader = React40.forwardRef(
|
|
2515
|
-
({ 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) => {
|
|
2516
2516
|
const [draft, setDraft] = React40.useState(null);
|
|
2517
2517
|
const label = String(number).padStart(2, "0");
|
|
2518
2518
|
const showError = error !== void 0 && error !== false;
|
|
@@ -2521,33 +2521,36 @@ var QuestionHeader = React40.forwardRef(
|
|
|
2521
2521
|
const count = (draft ?? text).length;
|
|
2522
2522
|
return /* @__PURE__ */ jsxs28("div", { ref, className: cn("group/header flex w-full flex-col gap-2", className), ...props, children: [
|
|
2523
2523
|
/* @__PURE__ */ jsxs28("div", { className: "flex items-center justify-between", children: [
|
|
2524
|
-
/* @__PURE__ */ jsxs28(
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
children: [
|
|
2538
|
-
/* @__PURE__ */ jsx41(
|
|
2539
|
-
DotsSixVertical,
|
|
2540
|
-
{
|
|
2541
|
-
size: 16,
|
|
2542
|
-
"aria-hidden": true,
|
|
2543
|
-
className: "hidden shrink-0 group-hover/editor:block group-hover/handle:block group-focus-visible/handle:block"
|
|
2544
|
-
}
|
|
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
|
|
2545
2537
|
),
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
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
|
+
] }),
|
|
2551
2554
|
actions && /* @__PURE__ */ jsx41("div", { className: cn(
|
|
2552
2555
|
"flex items-center gap-2 opacity-0 transition-opacity group-focus-within/header:opacity-100 group-hover/header:opacity-100",
|
|
2553
2556
|
// Inside a QuestionEditorCard, hovering or focusing anywhere on the card reveals them too.
|
|
@@ -2617,6 +2620,7 @@ var QuestionEditorCard = React41.forwardRef(
|
|
|
2617
2620
|
onPaste,
|
|
2618
2621
|
note,
|
|
2619
2622
|
error,
|
|
2623
|
+
meta,
|
|
2620
2624
|
dragHandleProps,
|
|
2621
2625
|
children,
|
|
2622
2626
|
...props
|
|
@@ -2649,6 +2653,7 @@ var QuestionEditorCard = React41.forwardRef(
|
|
|
2649
2653
|
active,
|
|
2650
2654
|
showCounter: !!active,
|
|
2651
2655
|
dragHandleProps,
|
|
2656
|
+
meta,
|
|
2652
2657
|
maxLength,
|
|
2653
2658
|
actions: actions ?? /* @__PURE__ */ jsxs29(Fragment7, { children: [
|
|
2654
2659
|
/* @__PURE__ */ jsx42(
|