@discuss-ds/ui 0.14.1 → 0.15.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,11 @@
1
1
  # @discuss-ds/ui
2
2
 
3
+ ## 0.15.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#68](https://github.com/TamyresLucas/Discuss-UI-Storybook/pull/68) [`0c09dcf`](https://github.com/TamyresLucas/Discuss-UI-Storybook/commit/0c09dcf4cf733c71cefabd61a37e704fb59599b8) Thanks [@TamyresLucas](https://github.com/TamyresLucas)! - QuestionOptionEditor: new optional `dragHandleProps` makes the row's grip a drag handle for reordering options (grab cursor, focusable, labelled "Reorder option N"), and a new optional `lifted` prop gives the copy that follows the pointer its lifted look (shadow, grip showing). Nothing changes for existing callers: without the props the grip stays decorative.
8
+
3
9
  ## 0.14.1
4
10
 
5
11
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -3030,8 +3030,14 @@ var QuestionOtherOption = React44.forwardRef(
3030
3030
  }
3031
3031
  );
3032
3032
  QuestionOtherOption.displayName = "QuestionOtherOption";
3033
- function QuestionOptionEditor({ label, onLabelChange, onRemove, onAdd, className, kind, rank }) {
3033
+ function QuestionOptionEditor({ label, onLabelChange, onRemove, onAdd, className, kind, rank, dragHandleProps, lifted }) {
3034
3034
  const reveal = kind !== void 0;
3035
+ const gripProps = dragHandleProps ? {
3036
+ "aria-label": rank ? `Reorder option ${rank}` : "Reorder option",
3037
+ ...dragHandleProps,
3038
+ className: cn("cursor-grab touch-none select-none", dragHandleProps.className)
3039
+ } : { "aria-hidden": true };
3040
+ const grip = dragHandleProps ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { ...gripProps, className: cn("shrink-0", gripProps.className), children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react23.DotsSixVertical, { size: 20, "aria-hidden": true, className: "text-surface-foreground" }) }) : /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react23.DotsSixVertical, { size: 20, "aria-hidden": true, className: "shrink-0 text-surface-foreground" });
3035
3041
  return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: cn("group/option flex w-full items-center gap-2", className), children: [
3036
3042
  /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
3037
3043
  "div",
@@ -3040,12 +3046,12 @@ function QuestionOptionEditor({ label, onLabelChange, onRemove, onAdd, className
3040
3046
  "flex h-11.5 min-w-0 flex-1 items-center gap-2 rounded-md border bg-surface px-4 py-2 focus-within:border-input-accent",
3041
3047
  reveal ? (
3042
3048
  // The border is always visible and does not change on hover; only the shadow lifts the row. The field being edited keeps the accent.
3043
- "border-border group-hover/option:shadow-md group-focus-within/option:shadow-md"
3049
+ cn("border-border group-hover/option:shadow-md group-focus-within/option:shadow-md", lifted && "shadow-md")
3044
3050
  ) : "border-border hover:border-input hover:shadow-md"
3045
3051
  ),
3046
3052
  children: [
3047
3053
  kind === "rank" ? /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
3048
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react23.DotsSixVertical, { size: 20, "aria-hidden": true, className: "shrink-0 text-surface-foreground" }),
3054
+ grip,
3049
3055
  /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
3050
3056
  "span",
3051
3057
  {
@@ -3054,12 +3060,14 @@ function QuestionOptionEditor({ label, onLabelChange, onRemove, onAdd, className
3054
3060
  children: rank
3055
3061
  }
3056
3062
  )
3057
- ] }) : reveal ? /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("span", { "aria-hidden": "true", className: "relative flex size-5 shrink-0 items-center justify-center", children: [
3063
+ ] }) : reveal ? /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("span", { ...gripProps, className: cn("relative flex size-5 shrink-0 items-center justify-center", gripProps.className), children: [
3058
3064
  /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
3059
3065
  "span",
3060
3066
  {
3067
+ "aria-hidden": "true",
3061
3068
  className: cn(
3062
3069
  "inline-flex size-4 border-2 border-input bg-surface group-hover/option:hidden group-focus-within/option:hidden",
3070
+ lifted && "hidden",
3063
3071
  kind === "radio" ? "rounded-full" : "rounded-xxs"
3064
3072
  )
3065
3073
  }
@@ -3068,10 +3076,14 @@ function QuestionOptionEditor({ label, onLabelChange, onRemove, onAdd, className
3068
3076
  import_react23.DotsSixVertical,
3069
3077
  {
3070
3078
  size: 20,
3071
- className: "hidden shrink-0 text-surface-foreground group-hover/option:block group-focus-within/option:block"
3079
+ "aria-hidden": true,
3080
+ className: cn(
3081
+ "hidden shrink-0 text-surface-foreground group-hover/option:block group-focus-within/option:block",
3082
+ lifted && "block"
3083
+ )
3072
3084
  }
3073
3085
  )
3074
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react23.DotsSixVertical, { size: 20, "aria-hidden": true, className: "shrink-0 text-surface-foreground" }),
3086
+ ] }) : grip,
3075
3087
  /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
3076
3088
  "input",
3077
3089
  {