@discuss-ds/ui 0.4.2 → 0.6.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,19 @@
1
1
  # @discuss-ds/ui
2
2
 
3
+ ## 0.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#29](https://github.com/TamyresLucas/Discuss-UI-Storybook/pull/29) [`1dd39c5`](https://github.com/TamyresLucas/Discuss-UI-Storybook/commit/1dd39c577a5fa4b96effedd38f1eb5003529c544) Thanks [@TamyresLucas](https://github.com/TamyresLucas)! - `ActivityStructure` can now be a single-purpose widget: it renders `children` under its title, stats and sections, and no longer renders an empty stats grid when `stats` is empty. `<ActivityStructure title="Research Goal" stats={[]}>…</ActivityStructure>` has the same card, title style and colour as the full Activity Summary. Existing usage is unchanged.
8
+
9
+ ## 0.5.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#27](https://github.com/TamyresLucas/Discuss-UI-Storybook/pull/27) [`1a4ff8c`](https://github.com/TamyresLucas/Discuss-UI-Storybook/commit/1a4ff8c0c8b485a7edaf27bd0d327a9005f902e7) Thanks [@TamyresLucas](https://github.com/TamyresLucas)! - `QuestionHeader` and `QuestionEditorCard` get an optional `dragHandleProps` that turns the "Question N" tag into a drag handle. It is spread onto the tag, so it accepts what a drag-and-drop library provides (`ref`, `role`, `tabIndex`, pointer and keyboard listeners, aria attributes). With it the tag shows a grab cursor, is keyboard focusable, shows the grip icon on focus and is labelled "Reorder question N". Without it nothing changes.
14
+
15
+ `ActivityStructure`: the card corner radius is now 16px (was 24px) to match the question cards, and the title uses the primary foreground colour.
16
+
3
17
  ## 0.4.2
4
18
 
5
19
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -2649,7 +2649,7 @@ var import_react19 = require("@phosphor-icons/react");
2649
2649
  var import_jsx_runtime41 = require("react/jsx-runtime");
2650
2650
  var eyebrow = "text-ui-caption uppercase text-secondary-muted-foreground";
2651
2651
  var QuestionHeader = React40.forwardRef(
2652
- ({ className, number, title, required, error, onDismissError, editor, onTitleChange, actions, maxLength = 2e3, active, showCounter = true, ...props }, ref) => {
2652
+ ({ className, number, title, required, error, onDismissError, editor, onTitleChange, actions, maxLength = 2e3, active, showCounter = true, dragHandleProps, ...props }, ref) => {
2653
2653
  const [draft, setDraft] = React40.useState(null);
2654
2654
  const label = String(number).padStart(2, "0");
2655
2655
  const showError = error !== void 0 && error !== false;
@@ -2661,12 +2661,23 @@ var QuestionHeader = React40.forwardRef(
2661
2661
  /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
2662
2662
  "span",
2663
2663
  {
2664
+ "aria-label": dragHandleProps ? `Reorder question ${number}` : void 0,
2665
+ ...dragHandleProps,
2664
2666
  className: cn(
2665
2667
  "group/handle inline-flex h-6 items-center gap-1 rounded-sm px-2.5 text-ui-caption hover:pl-1",
2666
- 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"
2668
+ 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",
2669
+ dragHandleProps && "cursor-grab touch-none select-none focus-visible:pl-1",
2670
+ dragHandleProps?.className
2667
2671
  ),
2668
2672
  children: [
2669
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react19.DotsSixVertical, { size: 16, "aria-hidden": true, className: "hidden shrink-0 group-hover/handle:block" }),
2673
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
2674
+ import_react19.DotsSixVertical,
2675
+ {
2676
+ size: 16,
2677
+ "aria-hidden": true,
2678
+ className: "hidden shrink-0 group-hover/handle:block group-focus-visible/handle:block"
2679
+ }
2680
+ ),
2670
2681
  "Question ",
2671
2682
  number
2672
2683
  ]
@@ -2736,6 +2747,7 @@ var QuestionEditorCard = React41.forwardRef(
2736
2747
  onAdd,
2737
2748
  onPaste,
2738
2749
  note,
2750
+ dragHandleProps,
2739
2751
  children,
2740
2752
  ...props
2741
2753
  }, ref) => {
@@ -2766,6 +2778,7 @@ var QuestionEditorCard = React41.forwardRef(
2766
2778
  onTitleChange,
2767
2779
  active,
2768
2780
  showCounter: !!active,
2781
+ dragHandleProps,
2769
2782
  maxLength,
2770
2783
  actions: actions ?? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
2771
2784
  /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
@@ -3394,15 +3407,15 @@ EditableTag.displayName = "EditableTag";
3394
3407
  // src/components/Research-Specific/ActivityStructure.tsx
3395
3408
  var import_jsx_runtime52 = require("react/jsx-runtime");
3396
3409
  var ActivityStructure = React51.forwardRef(
3397
- ({ className, title = "Activity Structure", stats, sections, onRemoveTag, onAddTag, addTagLabel = "Add tag", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
3410
+ ({ className, title = "Activity Structure", stats, sections, onRemoveTag, onAddTag, addTagLabel = "Add tag", children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
3398
3411
  "section",
3399
3412
  {
3400
3413
  ref,
3401
- className: cn("flex w-full max-w-96.5 flex-col gap-4 rounded-2xl bg-surface p-4", className),
3414
+ className: cn("flex w-full max-w-96.5 flex-col gap-4 rounded-xl bg-surface p-4", className),
3402
3415
  ...props,
3403
3416
  children: [
3404
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("h3", { className: "text-heading-h3 text-surface-foreground", children: title }),
3405
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "grid grid-cols-2 gap-3", children: stats.map(({ id, ...stat }) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(StatCard, { ...stat }, id)) }),
3417
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("h3", { className: "text-heading-h3 text-primary", children: title }),
3418
+ stats.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "grid grid-cols-2 gap-3", children: stats.map(({ id, ...stat }) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(StatCard, { ...stat }, id)) }),
3406
3419
  sections?.map(({ id, heading, body, tags }) => /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "flex flex-col gap-2", children: [
3407
3420
  /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("h4", { className: "text-heading-h4 text-surface-foreground", children: heading }),
3408
3421
  /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "text-body-base text-surface-foreground", children: body }),
@@ -3410,7 +3423,8 @@ var ActivityStructure = React51.forwardRef(
3410
3423
  tags?.map((tag) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(EditableTag, { type: "editable", onRemove: onRemoveTag && (() => onRemoveTag(id, tag)), children: tag }, tag)),
3411
3424
  onAddTag && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(EditableTag, { type: "add", onClick: () => onAddTag(id), children: addTagLabel })
3412
3425
  ] })
3413
- ] }, id))
3426
+ ] }, id)),
3427
+ children
3414
3428
  ]
3415
3429
  }
3416
3430
  )