@discuss-ds/ui 0.11.0 → 0.13.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.13.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#62](https://github.com/TamyresLucas/Discuss-UI-Storybook/pull/62) [`19d61b8`](https://github.com/TamyresLucas/Discuss-UI-Storybook/commit/19d61b844cb1e3d8fb7c8e4c9ffebad3ad6fb823) Thanks [@TamyresLucas](https://github.com/TamyresLucas)! - `QuestionEditorCard` and `QuestionHeader` (editor mode): new optional `meta` prop shows content right beside the "Question N" tag, for example the time allowed for the question. No change unless `meta` is passed.
8
+
9
+ ## 0.12.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#60](https://github.com/TamyresLucas/Discuss-UI-Storybook/pull/60) [`503586f`](https://github.com/TamyresLucas/Discuss-UI-Storybook/commit/503586f5c36ed1379939234e45a83ea4c4b5409a) Thanks [@TamyresLucas](https://github.com/TamyresLucas)! - `QuestionEditorCard`: new optional `error` prop shows a short inline message at the bottom of the card (warning icon, destructive foreground). `QuestionNavItem`'s error warning icon now uses the destructive foreground token (same colour, correct token).
14
+
3
15
  ## 0.11.0
4
16
 
5
17
  ### Minor Changes
package/dist/index.cjs CHANGED
@@ -2658,7 +2658,7 @@ var import_react19 = require("@phosphor-icons/react");
2658
2658
  var import_jsx_runtime41 = require("react/jsx-runtime");
2659
2659
  var eyebrow = "text-ui-caption uppercase text-secondary-muted-foreground";
2660
2660
  var QuestionHeader = React40.forwardRef(
2661
- ({ className, number, title, required, error, onDismissError, editor, onTitleChange, actions, maxLength = 2e3, active, showCounter = true, dragHandleProps, ...props }, ref) => {
2661
+ ({ className, number, title, required, error, onDismissError, editor, onTitleChange, actions, meta, maxLength = 2e3, active, showCounter = true, dragHandleProps, ...props }, ref) => {
2662
2662
  const [draft, setDraft] = React40.useState(null);
2663
2663
  const label = String(number).padStart(2, "0");
2664
2664
  const showError = error !== void 0 && error !== false;
@@ -2667,33 +2667,36 @@ var QuestionHeader = React40.forwardRef(
2667
2667
  const count = (draft ?? text).length;
2668
2668
  return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { ref, className: cn("group/header flex w-full flex-col gap-2", className), ...props, children: [
2669
2669
  /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex items-center justify-between", children: [
2670
- /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
2671
- "span",
2672
- {
2673
- "aria-label": dragHandleProps ? `Reorder question ${number}` : void 0,
2674
- ...dragHandleProps,
2675
- className: cn(
2676
- "group/handle inline-flex h-6 items-center gap-1 rounded-sm px-2.5 text-ui-caption hover:pl-1",
2677
- // Inside a QuestionEditorCard the tag takes its hover look whenever the card is hovered.
2678
- "group-hover/editor:pl-1",
2679
- 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",
2680
- dragHandleProps && "cursor-grab touch-none select-none focus-visible:pl-1",
2681
- dragHandleProps?.className
2682
- ),
2683
- children: [
2684
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
2685
- import_react19.DotsSixVertical,
2686
- {
2687
- size: 16,
2688
- "aria-hidden": true,
2689
- className: "hidden shrink-0 group-hover/editor:block group-hover/handle:block group-focus-visible/handle:block"
2690
- }
2670
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex items-center gap-2", children: [
2671
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
2672
+ "span",
2673
+ {
2674
+ "aria-label": dragHandleProps ? `Reorder question ${number}` : void 0,
2675
+ ...dragHandleProps,
2676
+ className: cn(
2677
+ "group/handle inline-flex h-6 items-center gap-1 rounded-sm px-2.5 text-ui-caption hover:pl-1",
2678
+ // Inside a QuestionEditorCard the tag takes its hover look whenever the card is hovered.
2679
+ "group-hover/editor:pl-1",
2680
+ 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",
2681
+ dragHandleProps && "cursor-grab touch-none select-none focus-visible:pl-1",
2682
+ dragHandleProps?.className
2691
2683
  ),
2692
- "Question ",
2693
- number
2694
- ]
2695
- }
2696
- ),
2684
+ children: [
2685
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
2686
+ import_react19.DotsSixVertical,
2687
+ {
2688
+ size: 16,
2689
+ "aria-hidden": true,
2690
+ className: "hidden shrink-0 group-hover/editor:block group-hover/handle:block group-focus-visible/handle:block"
2691
+ }
2692
+ ),
2693
+ "Question ",
2694
+ number
2695
+ ]
2696
+ }
2697
+ ),
2698
+ meta
2699
+ ] }),
2697
2700
  actions && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: cn(
2698
2701
  "flex items-center gap-2 opacity-0 transition-opacity group-focus-within/header:opacity-100 group-hover/header:opacity-100",
2699
2702
  // Inside a QuestionEditorCard, hovering or focusing anywhere on the card reveals them too.
@@ -2762,6 +2765,8 @@ var QuestionEditorCard = React41.forwardRef(
2762
2765
  onAdd,
2763
2766
  onPaste,
2764
2767
  note,
2768
+ error,
2769
+ meta,
2765
2770
  dragHandleProps,
2766
2771
  children,
2767
2772
  ...props
@@ -2794,6 +2799,7 @@ var QuestionEditorCard = React41.forwardRef(
2794
2799
  active,
2795
2800
  showCounter: !!active,
2796
2801
  dragHandleProps,
2802
+ meta,
2797
2803
  maxLength,
2798
2804
  actions: actions ?? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
2799
2805
  /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
@@ -2834,6 +2840,10 @@ var QuestionEditorCard = React41.forwardRef(
2834
2840
  ),
2835
2841
  children
2836
2842
  ] }),
2843
+ error && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("p", { className: "flex items-center gap-1 text-ui-caption text-destructive-foreground", children: [
2844
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_react20.Warning, { size: 16, "aria-hidden": true, className: "shrink-0" }),
2845
+ error
2846
+ ] }),
2837
2847
  footer && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex items-center justify-between", children: [
2838
2848
  /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { className: "text-ui-caption text-secondary-muted-foreground", children: countLabel }),
2839
2849
  /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex items-center gap-2", children: [
@@ -2925,7 +2935,7 @@ var QuestionNavItem = React43.forwardRef(
2925
2935
  children: [
2926
2936
  /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("span", { "aria-hidden": "true", className: "relative flex size-4 shrink-0 items-center justify-center", children: [
2927
2937
  /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react22.DotsSixVertical, { size: 16, className: "hidden group-hover/nav:block" }),
2928
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "group-hover/nav:hidden", children: error ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react22.Warning, { size: 16, className: "text-destructive" }) : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
2938
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "group-hover/nav:hidden", children: error ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react22.Warning, { size: 16, className: "text-destructive-foreground" }) : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
2929
2939
  QuestionTypeIcon,
2930
2940
  {
2931
2941
  type: questionType,