@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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @discuss-ds/ui
2
2
 
3
+ ## 0.23.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#88](https://github.com/TamyresLucas/Discuss-UI-Storybook/pull/88) [`cfc8630`](https://github.com/TamyresLucas/Discuss-UI-Storybook/commit/cfc86301c4dec947b5201d340e681292a4155dac) Thanks [@TamyresLucas](https://github.com/TamyresLucas)! - `QuestionNavItem` and `QuestionEditorCard`: new optional `hovered` prop that shows the hover look without the pointer (the nav row's soft fill and drag grip; the card's lift, revealed actions and grip), for mirroring a hover that happens elsewhere, such as over the same question's row or card. Off by default; nothing changes unless it is set.
8
+
9
+ ## 0.22.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#86](https://github.com/TamyresLucas/Discuss-UI-Storybook/pull/86) [`33207c1`](https://github.com/TamyresLucas/Discuss-UI-Storybook/commit/33207c1d978d213ad8c430ecc70be4583996df24) Thanks [@TamyresLucas](https://github.com/TamyresLucas)! - `InlineEdit`: new optional `submitOnEnter` prop for `multiline` fields. Enter saves the edit (a refused edit stays open and focused with its message) and Shift+Enter inserts a line break; Cmd/Ctrl+Enter keeps saving. Off by default, so multiline fields behave as before unless it is set.
14
+
3
15
  ## 0.21.0
4
16
 
5
17
  ### Minor Changes
package/dist/index.cjs CHANGED
@@ -1561,6 +1561,7 @@ var InlineEdit = React24.forwardRef(
1561
1561
  minLength,
1562
1562
  validate,
1563
1563
  showLimits,
1564
+ submitOnEnter,
1564
1565
  disabled,
1565
1566
  onEditingChange,
1566
1567
  onDraftChange,
@@ -1654,7 +1655,7 @@ var InlineEdit = React24.forwardRef(
1654
1655
  cancelled.current = true;
1655
1656
  setError(null);
1656
1657
  finish(false, true);
1657
- } else if (event.key === "Enter" && (!multiline || event.metaKey || event.ctrlKey || question && !event.shiftKey)) {
1658
+ } else if (event.key === "Enter" && (!multiline || event.metaKey || event.ctrlKey || (question || submitOnEnter) && !event.shiftKey)) {
1658
1659
  event.preventDefault();
1659
1660
  finish(true, true);
1660
1661
  }
@@ -2757,7 +2758,7 @@ var QuestionHeader = React40.forwardRef(
2757
2758
  className: cn(
2758
2759
  "group/handle inline-flex h-6 items-center gap-1 rounded-sm px-2.5 text-ui-caption",
2759
2760
  // The tag makes room for the grip on hover, and inside a QuestionEditorCard whenever the card is hovered.
2760
- showDragHandle && "hover:pl-1 group-hover/editor:pl-1",
2761
+ showDragHandle && "hover:pl-1 group-hover/editor:pl-1 group-data-[hovered]/editor:pl-1",
2761
2762
  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",
2762
2763
  dragHandleProps && "cursor-grab touch-none select-none",
2763
2764
  dragHandleProps && showDragHandle && "focus-visible:pl-1",
@@ -2769,7 +2770,7 @@ var QuestionHeader = React40.forwardRef(
2769
2770
  {
2770
2771
  size: 16,
2771
2772
  "aria-hidden": true,
2772
- className: "hidden shrink-0 group-hover/editor:block group-hover/handle:block group-focus-visible/handle:block"
2773
+ className: "hidden shrink-0 group-hover/editor:block group-data-[hovered]/editor:block group-hover/handle:block group-focus-visible/handle:block"
2773
2774
  }
2774
2775
  ),
2775
2776
  "Question ",
@@ -2782,7 +2783,7 @@ var QuestionHeader = React40.forwardRef(
2782
2783
  actions && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: cn(
2783
2784
  "flex items-center gap-2 opacity-0 transition-opacity group-focus-within/header:opacity-100 group-hover/header:opacity-100",
2784
2785
  // Inside a QuestionEditorCard, hovering or focusing anywhere on the card reveals them too.
2785
- "group-focus-within/editor:opacity-100 group-hover/editor:opacity-100"
2786
+ "group-focus-within/editor:opacity-100 group-hover/editor:opacity-100 group-data-[hovered]/editor:opacity-100"
2786
2787
  ), children: actions })
2787
2788
  ] }),
2788
2789
  /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
@@ -2837,6 +2838,7 @@ var QuestionEditorCard = React41.forwardRef(
2837
2838
  title,
2838
2839
  onTitleChange,
2839
2840
  active,
2841
+ hovered,
2840
2842
  maxLength,
2841
2843
  countLabel,
2842
2844
  actions,
@@ -2860,13 +2862,14 @@ var QuestionEditorCard = React41.forwardRef(
2860
2862
  {
2861
2863
  ref,
2862
2864
  className: cn("group/editor flex w-full items-start gap-2", className),
2865
+ "data-hovered": hovered ? "" : void 0,
2863
2866
  ...props,
2864
2867
  children: [
2865
2868
  /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
2866
2869
  "div",
2867
2870
  {
2868
2871
  className: cn(
2869
- "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",
2872
+ "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",
2870
2873
  active ? "border-accent" : "border-border"
2871
2874
  ),
2872
2875
  children: [
@@ -2961,7 +2964,7 @@ var QuestionEditorCard = React41.forwardRef(
2961
2964
  size: "icon-sm",
2962
2965
  "aria-label": "Ask AI",
2963
2966
  onClick: onAskAi,
2964
- className: "shrink-0 opacity-0 transition-opacity group-hover/editor:opacity-100 group-focus-within/editor:opacity-100 focus-visible:opacity-100",
2967
+ 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",
2965
2968
  children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_react20.Sparkle, { size: 16, "aria-hidden": true })
2966
2969
  }
2967
2970
  )
@@ -2998,7 +3001,7 @@ function QuestionTypeIcon({ type, size = 22.5, className, ...props }) {
2998
3001
  // src/components/Question Types/QuestionNavItem.tsx
2999
3002
  var import_jsx_runtime44 = require("react/jsx-runtime");
3000
3003
  var QuestionNavItem = React43.forwardRef(
3001
- ({ className, questionType = "select-one", selected, error, asChild, showDragHandle = true, children, ...props }, ref) => {
3004
+ ({ className, questionType = "select-one", selected, error, asChild, showDragHandle = true, hovered, children, ...props }, ref) => {
3002
3005
  const Comp = asChild ? import_radix_ui21.Slot.Root : "button";
3003
3006
  return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
3004
3007
  Comp,
@@ -3006,6 +3009,7 @@ var QuestionNavItem = React43.forwardRef(
3006
3009
  ref,
3007
3010
  type: asChild ? void 0 : "button",
3008
3011
  "aria-current": selected ? "true" : void 0,
3012
+ "data-hovered": hovered ? "" : void 0,
3009
3013
  className: cn(
3010
3014
  "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",
3011
3015
  error ? ["hover:bg-destructive-soft focus-visible:border-destructive", selected ? "border-destructive" : "border-border"] : [
@@ -3013,13 +3017,14 @@ var QuestionNavItem = React43.forwardRef(
3013
3017
  "hover:bg-accent-soft focus-visible:border-input-accent",
3014
3018
  selected ? "border-input-accent" : "border-border"
3015
3019
  ],
3020
+ hovered && (error ? "bg-destructive-soft" : "bg-accent-soft"),
3016
3021
  className
3017
3022
  ),
3018
3023
  ...props,
3019
3024
  children: [
3020
3025
  /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("span", { "aria-hidden": "true", className: "relative flex size-4 shrink-0 items-center justify-center", children: [
3021
- showDragHandle && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react22.DotsSixVertical, { size: 16, className: "hidden group-hover/nav:block" }),
3022
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: showDragHandle ? "group-hover/nav:hidden" : void 0, children: error ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react22.Warning, { size: 16, className: "text-destructive-foreground" }) : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
3026
+ showDragHandle && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react22.DotsSixVertical, { size: 16, className: "hidden group-hover/nav:block group-data-[hovered]/nav:block" }),
3027
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: showDragHandle ? "group-hover/nav:hidden group-data-[hovered]/nav:hidden" : void 0, children: error ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react22.Warning, { size: 16, className: "text-destructive-foreground" }) : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
3023
3028
  QuestionTypeIcon,
3024
3029
  {
3025
3030
  type: questionType,