@discuss-ds/ui 0.22.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 +6 -0
- package/dist/index.cjs +12 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +12 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -662,6 +662,11 @@ interface QuestionEditorCardProps extends Omit<React.HTMLAttributes<HTMLDivEleme
|
|
|
662
662
|
onTitleChange?: (title: string) => void;
|
|
663
663
|
/** The question is being edited: accent border, counter and footer are shown. */
|
|
664
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;
|
|
665
670
|
maxLength?: number;
|
|
666
671
|
/** Footer label, e.g. "4/20 choices". Shown while `active`. */
|
|
667
672
|
countLabel?: React.ReactNode;
|
|
@@ -747,6 +752,11 @@ interface QuestionNavItemProps extends React.ButtonHTMLAttributes<HTMLButtonElem
|
|
|
747
752
|
* example while a translation is being edited), so the icon stays and the row doesn't suggest dragging.
|
|
748
753
|
*/
|
|
749
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;
|
|
750
760
|
}
|
|
751
761
|
declare const QuestionNavItem: React.ForwardRefExoticComponent<QuestionNavItemProps & React.RefAttributes<HTMLButtonElement>>;
|
|
752
762
|
|
package/dist/index.d.ts
CHANGED
|
@@ -662,6 +662,11 @@ interface QuestionEditorCardProps extends Omit<React.HTMLAttributes<HTMLDivEleme
|
|
|
662
662
|
onTitleChange?: (title: string) => void;
|
|
663
663
|
/** The question is being edited: accent border, counter and footer are shown. */
|
|
664
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;
|
|
665
670
|
maxLength?: number;
|
|
666
671
|
/** Footer label, e.g. "4/20 choices". Shown while `active`. */
|
|
667
672
|
countLabel?: React.ReactNode;
|
|
@@ -747,6 +752,11 @@ interface QuestionNavItemProps extends React.ButtonHTMLAttributes<HTMLButtonElem
|
|
|
747
752
|
* example while a translation is being edited), so the icon stays and the row doesn't suggest dragging.
|
|
748
753
|
*/
|
|
749
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;
|
|
750
760
|
}
|
|
751
761
|
declare const QuestionNavItem: React.ForwardRefExoticComponent<QuestionNavItemProps & React.RefAttributes<HTMLButtonElement>>;
|
|
752
762
|
|
package/dist/index.js
CHANGED
|
@@ -2612,7 +2612,7 @@ var QuestionHeader = React40.forwardRef(
|
|
|
2612
2612
|
className: cn(
|
|
2613
2613
|
"group/handle inline-flex h-6 items-center gap-1 rounded-sm px-2.5 text-ui-caption",
|
|
2614
2614
|
// The tag makes room for the grip on hover, and inside a QuestionEditorCard whenever the card is hovered.
|
|
2615
|
-
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",
|
|
2616
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",
|
|
2617
2617
|
dragHandleProps && "cursor-grab touch-none select-none",
|
|
2618
2618
|
dragHandleProps && showDragHandle && "focus-visible:pl-1",
|
|
@@ -2624,7 +2624,7 @@ var QuestionHeader = React40.forwardRef(
|
|
|
2624
2624
|
{
|
|
2625
2625
|
size: 16,
|
|
2626
2626
|
"aria-hidden": true,
|
|
2627
|
-
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"
|
|
2628
2628
|
}
|
|
2629
2629
|
),
|
|
2630
2630
|
"Question ",
|
|
@@ -2637,7 +2637,7 @@ var QuestionHeader = React40.forwardRef(
|
|
|
2637
2637
|
actions && /* @__PURE__ */ jsx41("div", { className: cn(
|
|
2638
2638
|
"flex items-center gap-2 opacity-0 transition-opacity group-focus-within/header:opacity-100 group-hover/header:opacity-100",
|
|
2639
2639
|
// Inside a QuestionEditorCard, hovering or focusing anywhere on the card reveals them too.
|
|
2640
|
-
"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"
|
|
2641
2641
|
), children: actions })
|
|
2642
2642
|
] }),
|
|
2643
2643
|
/* @__PURE__ */ jsx41(
|
|
@@ -2692,6 +2692,7 @@ var QuestionEditorCard = React41.forwardRef(
|
|
|
2692
2692
|
title,
|
|
2693
2693
|
onTitleChange,
|
|
2694
2694
|
active,
|
|
2695
|
+
hovered,
|
|
2695
2696
|
maxLength,
|
|
2696
2697
|
countLabel,
|
|
2697
2698
|
actions,
|
|
@@ -2715,13 +2716,14 @@ var QuestionEditorCard = React41.forwardRef(
|
|
|
2715
2716
|
{
|
|
2716
2717
|
ref,
|
|
2717
2718
|
className: cn("group/editor flex w-full items-start gap-2", className),
|
|
2719
|
+
"data-hovered": hovered ? "" : void 0,
|
|
2718
2720
|
...props,
|
|
2719
2721
|
children: [
|
|
2720
2722
|
/* @__PURE__ */ jsxs29(
|
|
2721
2723
|
"div",
|
|
2722
2724
|
{
|
|
2723
2725
|
className: cn(
|
|
2724
|
-
"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",
|
|
2725
2727
|
active ? "border-accent" : "border-border"
|
|
2726
2728
|
),
|
|
2727
2729
|
children: [
|
|
@@ -2816,7 +2818,7 @@ var QuestionEditorCard = React41.forwardRef(
|
|
|
2816
2818
|
size: "icon-sm",
|
|
2817
2819
|
"aria-label": "Ask AI",
|
|
2818
2820
|
onClick: onAskAi,
|
|
2819
|
-
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",
|
|
2820
2822
|
children: /* @__PURE__ */ jsx42(Sparkle2, { size: 16, "aria-hidden": true })
|
|
2821
2823
|
}
|
|
2822
2824
|
)
|
|
@@ -2853,7 +2855,7 @@ function QuestionTypeIcon({ type, size = 22.5, className, ...props }) {
|
|
|
2853
2855
|
// src/components/Question Types/QuestionNavItem.tsx
|
|
2854
2856
|
import { jsx as jsx44, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
2855
2857
|
var QuestionNavItem = React43.forwardRef(
|
|
2856
|
-
({ 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) => {
|
|
2857
2859
|
const Comp = asChild ? Slot3.Root : "button";
|
|
2858
2860
|
return /* @__PURE__ */ jsxs30(
|
|
2859
2861
|
Comp,
|
|
@@ -2861,6 +2863,7 @@ var QuestionNavItem = React43.forwardRef(
|
|
|
2861
2863
|
ref,
|
|
2862
2864
|
type: asChild ? void 0 : "button",
|
|
2863
2865
|
"aria-current": selected ? "true" : void 0,
|
|
2866
|
+
"data-hovered": hovered ? "" : void 0,
|
|
2864
2867
|
className: cn(
|
|
2865
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",
|
|
2866
2869
|
error ? ["hover:bg-destructive-soft focus-visible:border-destructive", selected ? "border-destructive" : "border-border"] : [
|
|
@@ -2868,13 +2871,14 @@ var QuestionNavItem = React43.forwardRef(
|
|
|
2868
2871
|
"hover:bg-accent-soft focus-visible:border-input-accent",
|
|
2869
2872
|
selected ? "border-input-accent" : "border-border"
|
|
2870
2873
|
],
|
|
2874
|
+
hovered && (error ? "bg-destructive-soft" : "bg-accent-soft"),
|
|
2871
2875
|
className
|
|
2872
2876
|
),
|
|
2873
2877
|
...props,
|
|
2874
2878
|
children: [
|
|
2875
2879
|
/* @__PURE__ */ jsxs30("span", { "aria-hidden": "true", className: "relative flex size-4 shrink-0 items-center justify-center", children: [
|
|
2876
|
-
showDragHandle && /* @__PURE__ */ jsx44(DotsSixVertical2, { size: 16, className: "hidden group-hover/nav:block" }),
|
|
2877
|
-
/* @__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(
|
|
2878
2882
|
QuestionTypeIcon,
|
|
2879
2883
|
{
|
|
2880
2884
|
type: questionType,
|