@discuss-ds/ui 0.6.2 → 0.7.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/dist/index.d.cts CHANGED
@@ -749,9 +749,14 @@ interface QuestionOptionEditorProps {
749
749
  * On hover or keyboard focus it becomes the editor: the shadow lifts, the drag handle replaces the indicator and the
750
750
  * buttons appear. The border colour does not change. Omit it for an always-on editor row.
751
751
  */
752
- kind?: 'radio' | 'checkbox';
752
+ kind?: 'radio' | 'checkbox' | 'rank';
753
+ /**
754
+ * `kind="rank"` only: the position shown in the round number tag, as in `RankList`. For a ranking question the row keeps
755
+ * its drag handle and number at rest and, like the other kinds, becomes the editor on hover or keyboard focus.
756
+ */
757
+ rank?: number;
753
758
  }
754
- declare function QuestionOptionEditor({ label, onLabelChange, onRemove, onAdd, className, kind }: QuestionOptionEditorProps): React.JSX.Element;
759
+ declare function QuestionOptionEditor({ label, onLabelChange, onRemove, onAdd, className, kind, rank }: QuestionOptionEditorProps): React.JSX.Element;
755
760
 
756
761
  interface RankItemData {
757
762
  id: string;
package/dist/index.d.ts CHANGED
@@ -749,9 +749,14 @@ interface QuestionOptionEditorProps {
749
749
  * On hover or keyboard focus it becomes the editor: the shadow lifts, the drag handle replaces the indicator and the
750
750
  * buttons appear. The border colour does not change. Omit it for an always-on editor row.
751
751
  */
752
- kind?: 'radio' | 'checkbox';
752
+ kind?: 'radio' | 'checkbox' | 'rank';
753
+ /**
754
+ * `kind="rank"` only: the position shown in the round number tag, as in `RankList`. For a ranking question the row keeps
755
+ * its drag handle and number at rest and, like the other kinds, becomes the editor on hover or keyboard focus.
756
+ */
757
+ rank?: number;
753
758
  }
754
- declare function QuestionOptionEditor({ label, onLabelChange, onRemove, onAdd, className, kind }: QuestionOptionEditorProps): React.JSX.Element;
759
+ declare function QuestionOptionEditor({ label, onLabelChange, onRemove, onAdd, className, kind, rank }: QuestionOptionEditorProps): React.JSX.Element;
755
760
 
756
761
  interface RankItemData {
757
762
  id: string;
package/dist/index.js CHANGED
@@ -2519,6 +2519,8 @@ var QuestionHeader = React40.forwardRef(
2519
2519
  ...dragHandleProps,
2520
2520
  className: cn(
2521
2521
  "group/handle inline-flex h-6 items-center gap-1 rounded-sm px-2.5 text-ui-caption hover:pl-1",
2522
+ // Inside a QuestionEditorCard the tag takes its hover look whenever the card is hovered.
2523
+ "group-hover/editor:pl-1",
2522
2524
  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",
2523
2525
  dragHandleProps && "cursor-grab touch-none select-none focus-visible:pl-1",
2524
2526
  dragHandleProps?.className
@@ -2529,7 +2531,7 @@ var QuestionHeader = React40.forwardRef(
2529
2531
  {
2530
2532
  size: 16,
2531
2533
  "aria-hidden": true,
2532
- className: "hidden shrink-0 group-hover/handle:block group-focus-visible/handle:block"
2534
+ className: "hidden shrink-0 group-hover/editor:block group-hover/handle:block group-focus-visible/handle:block"
2533
2535
  }
2534
2536
  ),
2535
2537
  "Question ",
@@ -2788,7 +2790,7 @@ QuestionNavItem.displayName = "QuestionNavItem";
2788
2790
  // src/components/Question Types/QuestionOption.tsx
2789
2791
  import * as React44 from "react";
2790
2792
  import { Check as Check4, DotsSixVertical as DotsSixVertical3, Plus as Plus4, Trash as Trash4 } from "@phosphor-icons/react";
2791
- import { jsx as jsx45, jsxs as jsxs31 } from "react/jsx-runtime";
2793
+ import { Fragment as Fragment8, jsx as jsx45, jsxs as jsxs31 } from "react/jsx-runtime";
2792
2794
  var optionClasses = "flex w-full max-w-150 cursor-pointer items-center gap-2 rounded-md border border-border bg-surface px-4 py-2 text-body-base text-surface-foreground transition-colors hover:bg-accent-soft hover:shadow-md has-[[data-state=checked]]:border-accent-foreground has-[:disabled]:cursor-not-allowed has-[:disabled]:opacity-50";
2793
2795
  function QuestionOption(props) {
2794
2796
  const id = React44.useId();
@@ -2842,7 +2844,7 @@ var QuestionOtherOption = React44.forwardRef(
2842
2844
  }
2843
2845
  );
2844
2846
  QuestionOtherOption.displayName = "QuestionOtherOption";
2845
- function QuestionOptionEditor({ label, onLabelChange, onRemove, onAdd, className, kind }) {
2847
+ function QuestionOptionEditor({ label, onLabelChange, onRemove, onAdd, className, kind, rank }) {
2846
2848
  const reveal = kind !== void 0;
2847
2849
  return /* @__PURE__ */ jsxs31("div", { className: cn("group/option flex w-full items-center gap-2", className), children: [
2848
2850
  /* @__PURE__ */ jsxs31(
@@ -2856,7 +2858,17 @@ function QuestionOptionEditor({ label, onLabelChange, onRemove, onAdd, className
2856
2858
  ) : "border-border hover:border-input hover:shadow-md"
2857
2859
  ),
2858
2860
  children: [
2859
- reveal ? /* @__PURE__ */ jsxs31("span", { "aria-hidden": "true", className: "relative flex size-5 shrink-0 items-center justify-center", children: [
2861
+ kind === "rank" ? /* @__PURE__ */ jsxs31(Fragment8, { children: [
2862
+ /* @__PURE__ */ jsx45(DotsSixVertical3, { size: 20, "aria-hidden": true, className: "shrink-0 text-surface-foreground" }),
2863
+ /* @__PURE__ */ jsx45(
2864
+ "span",
2865
+ {
2866
+ "aria-hidden": "true",
2867
+ className: "flex size-6 shrink-0 items-center justify-center rounded-full border border-border bg-background bg-linear-to-r from-overlay-dark-5 to-overlay-dark-5 text-ui-caption text-surface-foreground",
2868
+ children: rank
2869
+ }
2870
+ )
2871
+ ] }) : reveal ? /* @__PURE__ */ jsxs31("span", { "aria-hidden": "true", className: "relative flex size-5 shrink-0 items-center justify-center", children: [
2860
2872
  /* @__PURE__ */ jsx45(
2861
2873
  "span",
2862
2874
  {
@@ -2905,7 +2917,7 @@ function QuestionOptionEditor({ label, onLabelChange, onRemove, onAdd, className
2905
2917
  // src/components/Question Types/RankList.tsx
2906
2918
  import * as React45 from "react";
2907
2919
  import { DotsSixVertical as DotsSixVertical4 } from "@phosphor-icons/react";
2908
- import { Fragment as Fragment8, jsx as jsx46, jsxs as jsxs32 } from "react/jsx-runtime";
2920
+ import { Fragment as Fragment9, jsx as jsx46, jsxs as jsxs32 } from "react/jsx-runtime";
2909
2921
  function move(list, from, to) {
2910
2922
  if (from === to || to < 0 || to >= list.length) return list;
2911
2923
  const next = list.slice();
@@ -2932,7 +2944,7 @@ var RankList = React45.forwardRef(
2932
2944
  setAnnouncement(`Moved to position ${to + 1} of ${items.length}`);
2933
2945
  onItemsChange(next);
2934
2946
  };
2935
- return /* @__PURE__ */ jsxs32(Fragment8, { children: [
2947
+ return /* @__PURE__ */ jsxs32(Fragment9, { children: [
2936
2948
  /* @__PURE__ */ jsx46("ol", { ref, className: cn("flex w-full max-w-150 flex-col gap-4", className), ...props, children: items.map((item, index) => /* @__PURE__ */ jsxs32(
2937
2949
  "li",
2938
2950
  {