@discuss-ds/ui 0.21.0 → 0.23.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 +14 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +14 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -351,6 +351,11 @@ interface InlineEditProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'on
|
|
|
351
351
|
* different message appears.
|
|
352
352
|
*/
|
|
353
353
|
showLimits?: boolean;
|
|
354
|
+
/**
|
|
355
|
+
* Multiline only: Enter saves (like a single-line field) and Shift+Enter inserts a line break. Cmd/Ctrl+Enter keeps
|
|
356
|
+
* saving too. The `question` variant already works this way.
|
|
357
|
+
*/
|
|
358
|
+
submitOnEnter?: boolean;
|
|
354
359
|
disabled?: boolean;
|
|
355
360
|
/** Called when editing starts or ends. */
|
|
356
361
|
onEditingChange?: (editing: boolean) => void;
|
|
@@ -657,6 +662,11 @@ interface QuestionEditorCardProps extends Omit<React.HTMLAttributes<HTMLDivEleme
|
|
|
657
662
|
onTitleChange?: (title: string) => void;
|
|
658
663
|
/** The question is being edited: accent border, counter and footer are shown. */
|
|
659
664
|
active?: boolean;
|
|
665
|
+
/**
|
|
666
|
+
* Shows the hover look (lifted card, revealed actions and grip) without the pointer, for mirroring a hover that happens
|
|
667
|
+
* elsewhere, such as over the same question's row in an outline.
|
|
668
|
+
*/
|
|
669
|
+
hovered?: boolean;
|
|
660
670
|
maxLength?: number;
|
|
661
671
|
/** Footer label, e.g. "4/20 choices". Shown while `active`. */
|
|
662
672
|
countLabel?: React.ReactNode;
|
|
@@ -742,6 +752,11 @@ interface QuestionNavItemProps extends React.ButtonHTMLAttributes<HTMLButtonElem
|
|
|
742
752
|
* example while a translation is being edited), so the icon stays and the row doesn't suggest dragging.
|
|
743
753
|
*/
|
|
744
754
|
showDragHandle?: boolean;
|
|
755
|
+
/**
|
|
756
|
+
* Shows the hover look (soft fill, drag grip in place of the type icon) without the pointer, for mirroring a hover that
|
|
757
|
+
* happens elsewhere, such as over the same question's card.
|
|
758
|
+
*/
|
|
759
|
+
hovered?: boolean;
|
|
745
760
|
}
|
|
746
761
|
declare const QuestionNavItem: React.ForwardRefExoticComponent<QuestionNavItemProps & React.RefAttributes<HTMLButtonElement>>;
|
|
747
762
|
|
package/dist/index.d.ts
CHANGED
|
@@ -351,6 +351,11 @@ interface InlineEditProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'on
|
|
|
351
351
|
* different message appears.
|
|
352
352
|
*/
|
|
353
353
|
showLimits?: boolean;
|
|
354
|
+
/**
|
|
355
|
+
* Multiline only: Enter saves (like a single-line field) and Shift+Enter inserts a line break. Cmd/Ctrl+Enter keeps
|
|
356
|
+
* saving too. The `question` variant already works this way.
|
|
357
|
+
*/
|
|
358
|
+
submitOnEnter?: boolean;
|
|
354
359
|
disabled?: boolean;
|
|
355
360
|
/** Called when editing starts or ends. */
|
|
356
361
|
onEditingChange?: (editing: boolean) => void;
|
|
@@ -657,6 +662,11 @@ interface QuestionEditorCardProps extends Omit<React.HTMLAttributes<HTMLDivEleme
|
|
|
657
662
|
onTitleChange?: (title: string) => void;
|
|
658
663
|
/** The question is being edited: accent border, counter and footer are shown. */
|
|
659
664
|
active?: boolean;
|
|
665
|
+
/**
|
|
666
|
+
* Shows the hover look (lifted card, revealed actions and grip) without the pointer, for mirroring a hover that happens
|
|
667
|
+
* elsewhere, such as over the same question's row in an outline.
|
|
668
|
+
*/
|
|
669
|
+
hovered?: boolean;
|
|
660
670
|
maxLength?: number;
|
|
661
671
|
/** Footer label, e.g. "4/20 choices". Shown while `active`. */
|
|
662
672
|
countLabel?: React.ReactNode;
|
|
@@ -742,6 +752,11 @@ interface QuestionNavItemProps extends React.ButtonHTMLAttributes<HTMLButtonElem
|
|
|
742
752
|
* example while a translation is being edited), so the icon stays and the row doesn't suggest dragging.
|
|
743
753
|
*/
|
|
744
754
|
showDragHandle?: boolean;
|
|
755
|
+
/**
|
|
756
|
+
* Shows the hover look (soft fill, drag grip in place of the type icon) without the pointer, for mirroring a hover that
|
|
757
|
+
* happens elsewhere, such as over the same question's card.
|
|
758
|
+
*/
|
|
759
|
+
hovered?: boolean;
|
|
745
760
|
}
|
|
746
761
|
declare const QuestionNavItem: React.ForwardRefExoticComponent<QuestionNavItemProps & React.RefAttributes<HTMLButtonElement>>;
|
|
747
762
|
|
package/dist/index.js
CHANGED
|
@@ -1407,6 +1407,7 @@ var InlineEdit = React24.forwardRef(
|
|
|
1407
1407
|
minLength,
|
|
1408
1408
|
validate,
|
|
1409
1409
|
showLimits,
|
|
1410
|
+
submitOnEnter,
|
|
1410
1411
|
disabled,
|
|
1411
1412
|
onEditingChange,
|
|
1412
1413
|
onDraftChange,
|
|
@@ -1500,7 +1501,7 @@ var InlineEdit = React24.forwardRef(
|
|
|
1500
1501
|
cancelled.current = true;
|
|
1501
1502
|
setError(null);
|
|
1502
1503
|
finish(false, true);
|
|
1503
|
-
} else if (event.key === "Enter" && (!multiline || event.metaKey || event.ctrlKey || question && !event.shiftKey)) {
|
|
1504
|
+
} else if (event.key === "Enter" && (!multiline || event.metaKey || event.ctrlKey || (question || submitOnEnter) && !event.shiftKey)) {
|
|
1504
1505
|
event.preventDefault();
|
|
1505
1506
|
finish(true, true);
|
|
1506
1507
|
}
|
|
@@ -2611,7 +2612,7 @@ var QuestionHeader = React40.forwardRef(
|
|
|
2611
2612
|
className: cn(
|
|
2612
2613
|
"group/handle inline-flex h-6 items-center gap-1 rounded-sm px-2.5 text-ui-caption",
|
|
2613
2614
|
// The tag makes room for the grip on hover, and inside a QuestionEditorCard whenever the card is hovered.
|
|
2614
|
-
showDragHandle && "hover:pl-1 group-hover/editor:pl-1",
|
|
2615
|
+
showDragHandle && "hover:pl-1 group-hover/editor:pl-1 group-data-[hovered]/editor:pl-1",
|
|
2615
2616
|
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",
|
|
2616
2617
|
dragHandleProps && "cursor-grab touch-none select-none",
|
|
2617
2618
|
dragHandleProps && showDragHandle && "focus-visible:pl-1",
|
|
@@ -2623,7 +2624,7 @@ var QuestionHeader = React40.forwardRef(
|
|
|
2623
2624
|
{
|
|
2624
2625
|
size: 16,
|
|
2625
2626
|
"aria-hidden": true,
|
|
2626
|
-
className: "hidden shrink-0 group-hover/editor:block group-hover/handle:block group-focus-visible/handle:block"
|
|
2627
|
+
className: "hidden shrink-0 group-hover/editor:block group-data-[hovered]/editor:block group-hover/handle:block group-focus-visible/handle:block"
|
|
2627
2628
|
}
|
|
2628
2629
|
),
|
|
2629
2630
|
"Question ",
|
|
@@ -2636,7 +2637,7 @@ var QuestionHeader = React40.forwardRef(
|
|
|
2636
2637
|
actions && /* @__PURE__ */ jsx41("div", { className: cn(
|
|
2637
2638
|
"flex items-center gap-2 opacity-0 transition-opacity group-focus-within/header:opacity-100 group-hover/header:opacity-100",
|
|
2638
2639
|
// Inside a QuestionEditorCard, hovering or focusing anywhere on the card reveals them too.
|
|
2639
|
-
"group-focus-within/editor:opacity-100 group-hover/editor:opacity-100"
|
|
2640
|
+
"group-focus-within/editor:opacity-100 group-hover/editor:opacity-100 group-data-[hovered]/editor:opacity-100"
|
|
2640
2641
|
), children: actions })
|
|
2641
2642
|
] }),
|
|
2642
2643
|
/* @__PURE__ */ jsx41(
|
|
@@ -2691,6 +2692,7 @@ var QuestionEditorCard = React41.forwardRef(
|
|
|
2691
2692
|
title,
|
|
2692
2693
|
onTitleChange,
|
|
2693
2694
|
active,
|
|
2695
|
+
hovered,
|
|
2694
2696
|
maxLength,
|
|
2695
2697
|
countLabel,
|
|
2696
2698
|
actions,
|
|
@@ -2714,13 +2716,14 @@ var QuestionEditorCard = React41.forwardRef(
|
|
|
2714
2716
|
{
|
|
2715
2717
|
ref,
|
|
2716
2718
|
className: cn("group/editor flex w-full items-start gap-2", className),
|
|
2719
|
+
"data-hovered": hovered ? "" : void 0,
|
|
2717
2720
|
...props,
|
|
2718
2721
|
children: [
|
|
2719
2722
|
/* @__PURE__ */ jsxs29(
|
|
2720
2723
|
"div",
|
|
2721
2724
|
{
|
|
2722
2725
|
className: cn(
|
|
2723
|
-
"flex w-full max-w-200 flex-col overflow-hidden rounded-xl border bg-surface transition-shadow group-hover/editor:shadow-lg group-focus-within/editor:shadow-lg",
|
|
2726
|
+
"flex w-full max-w-200 flex-col overflow-hidden rounded-xl border bg-surface transition-shadow group-hover/editor:shadow-lg group-focus-within/editor:shadow-lg group-data-[hovered]/editor:shadow-lg",
|
|
2724
2727
|
active ? "border-accent" : "border-border"
|
|
2725
2728
|
),
|
|
2726
2729
|
children: [
|
|
@@ -2815,7 +2818,7 @@ var QuestionEditorCard = React41.forwardRef(
|
|
|
2815
2818
|
size: "icon-sm",
|
|
2816
2819
|
"aria-label": "Ask AI",
|
|
2817
2820
|
onClick: onAskAi,
|
|
2818
|
-
className: "shrink-0 opacity-0 transition-opacity group-hover/editor:opacity-100 group-focus-within/editor:opacity-100 focus-visible:opacity-100",
|
|
2821
|
+
className: "shrink-0 opacity-0 transition-opacity group-hover/editor:opacity-100 group-focus-within/editor:opacity-100 group-data-[hovered]/editor:opacity-100 focus-visible:opacity-100",
|
|
2819
2822
|
children: /* @__PURE__ */ jsx42(Sparkle2, { size: 16, "aria-hidden": true })
|
|
2820
2823
|
}
|
|
2821
2824
|
)
|
|
@@ -2852,7 +2855,7 @@ function QuestionTypeIcon({ type, size = 22.5, className, ...props }) {
|
|
|
2852
2855
|
// src/components/Question Types/QuestionNavItem.tsx
|
|
2853
2856
|
import { jsx as jsx44, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
2854
2857
|
var QuestionNavItem = React43.forwardRef(
|
|
2855
|
-
({ className, questionType = "select-one", selected, error, asChild, showDragHandle = true, children, ...props }, ref) => {
|
|
2858
|
+
({ className, questionType = "select-one", selected, error, asChild, showDragHandle = true, hovered, children, ...props }, ref) => {
|
|
2856
2859
|
const Comp = asChild ? Slot3.Root : "button";
|
|
2857
2860
|
return /* @__PURE__ */ jsxs30(
|
|
2858
2861
|
Comp,
|
|
@@ -2860,6 +2863,7 @@ var QuestionNavItem = React43.forwardRef(
|
|
|
2860
2863
|
ref,
|
|
2861
2864
|
type: asChild ? void 0 : "button",
|
|
2862
2865
|
"aria-current": selected ? "true" : void 0,
|
|
2866
|
+
"data-hovered": hovered ? "" : void 0,
|
|
2863
2867
|
className: cn(
|
|
2864
2868
|
"group/nav flex h-9.5 w-full max-w-106.5 items-center gap-2 rounded-sm border bg-surface p-2 text-left text-body-small text-surface-foreground transition-colors focus-visible:outline-none",
|
|
2865
2869
|
error ? ["hover:bg-destructive-soft focus-visible:border-destructive", selected ? "border-destructive" : "border-border"] : [
|
|
@@ -2867,13 +2871,14 @@ var QuestionNavItem = React43.forwardRef(
|
|
|
2867
2871
|
"hover:bg-accent-soft focus-visible:border-input-accent",
|
|
2868
2872
|
selected ? "border-input-accent" : "border-border"
|
|
2869
2873
|
],
|
|
2874
|
+
hovered && (error ? "bg-destructive-soft" : "bg-accent-soft"),
|
|
2870
2875
|
className
|
|
2871
2876
|
),
|
|
2872
2877
|
...props,
|
|
2873
2878
|
children: [
|
|
2874
2879
|
/* @__PURE__ */ jsxs30("span", { "aria-hidden": "true", className: "relative flex size-4 shrink-0 items-center justify-center", children: [
|
|
2875
|
-
showDragHandle && /* @__PURE__ */ jsx44(DotsSixVertical2, { size: 16, className: "hidden group-hover/nav:block" }),
|
|
2876
|
-
/* @__PURE__ */ jsx44("span", { className: showDragHandle ? "group-hover/nav:hidden" : void 0, children: error ? /* @__PURE__ */ jsx44(Warning3, { size: 16, className: "text-destructive-foreground" }) : /* @__PURE__ */ jsx44(
|
|
2880
|
+
showDragHandle && /* @__PURE__ */ jsx44(DotsSixVertical2, { size: 16, className: "hidden group-hover/nav:block group-data-[hovered]/nav:block" }),
|
|
2881
|
+
/* @__PURE__ */ jsx44("span", { className: showDragHandle ? "group-hover/nav:hidden group-data-[hovered]/nav:hidden" : void 0, children: error ? /* @__PURE__ */ jsx44(Warning3, { size: 16, className: "text-destructive-foreground" }) : /* @__PURE__ */ jsx44(
|
|
2877
2882
|
QuestionTypeIcon,
|
|
2878
2883
|
{
|
|
2879
2884
|
type: questionType,
|