@discuss-ds/ui 0.29.1 → 0.30.1

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.30.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#109](https://github.com/TamyresLucas/Discuss-UI-Storybook/pull/109) [`09b0261`](https://github.com/TamyresLucas/Discuss-UI-Storybook/commit/09b026152cd200df34744f7bd964352c17aa5d54) Thanks [@TamyresLucas](https://github.com/TamyresLucas)! - `QuestionEditorCard` / `QuestionHeader`: `titleRecommendedMax` now switches a long title to the 16px body style on its own; `titleRecommendedNote` is optional and only adds the text under it.
8
+
9
+ ## 0.30.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#107](https://github.com/TamyresLucas/Discuss-UI-Storybook/pull/107) [`43f364a`](https://github.com/TamyresLucas/Discuss-UI-Storybook/commit/43f364a042167fd14b8cd4748e15829f81a90be8) Thanks [@TamyresLucas](https://github.com/TamyresLucas)! - `QuestionEditorCard` and `QuestionHeader` take `titleRecommendedMax` and `titleRecommendedNote`: a title longer than that many characters (counted live while typing) switches from the heading style to the regular 16px body style and shows the note under it. Opt-in; without the props nothing changes.
14
+
3
15
  ## 0.29.1
4
16
 
5
17
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -2809,13 +2809,14 @@ var import_react19 = require("@phosphor-icons/react");
2809
2809
  var import_jsx_runtime41 = require("react/jsx-runtime");
2810
2810
  var eyebrow = "text-ui-caption uppercase text-secondary-muted-foreground";
2811
2811
  var QuestionHeader = React40.forwardRef(
2812
- ({ className, number, title, required, error, onDismissError, editor, onTitleChange, titlePlaceholder = "Click to write the question text", titlePlaceholderTone, titleMinLength, actions, meta, maxLength = 2e3, active, showCounter = true, dragHandleProps, showDragHandle = true, ...props }, ref) => {
2812
+ ({ className, number, title, required, error, onDismissError, editor, onTitleChange, titlePlaceholder = "Click to write the question text", titlePlaceholderTone, titleMinLength, titleRecommendedMax, titleRecommendedNote, actions, meta, maxLength = 2e3, active, showCounter = true, dragHandleProps, showDragHandle = true, ...props }, ref) => {
2813
2813
  const [draft, setDraft] = React40.useState(null);
2814
2814
  const label = String(number).padStart(2, "0");
2815
2815
  const showError = error !== void 0 && error !== false;
2816
2816
  if (editor) {
2817
2817
  const text = typeof title === "string" ? title : "";
2818
2818
  const count = (draft ?? text).length;
2819
+ const long = titleRecommendedMax !== void 0 && count > titleRecommendedMax;
2819
2820
  return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { ref, className: cn("group/header flex w-full flex-col gap-2", className), ...props, children: [
2820
2821
  /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex items-center justify-between", children: [
2821
2822
  /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex items-center gap-2", children: [
@@ -2874,9 +2875,10 @@ var QuestionHeader = React40.forwardRef(
2874
2875
  onEditingChange: (editing) => {
2875
2876
  if (!editing) setDraft(null);
2876
2877
  },
2877
- textClassName: "text-heading-h4"
2878
+ textClassName: long ? "text-body-base" : "text-heading-h4"
2878
2879
  }
2879
2880
  ),
2881
+ long && titleRecommendedNote != null && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { className: "text-ui-caption text-secondary-muted-foreground", children: titleRecommendedNote }),
2880
2882
  showCounter && titleMinLength === void 0 && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("p", { className: "text-ui-caption text-secondary-muted-foreground", children: [
2881
2883
  count,
2882
2884
  "/",
@@ -2912,6 +2914,8 @@ var QuestionEditorCard = React41.forwardRef(
2912
2914
  titlePlaceholder,
2913
2915
  titlePlaceholderTone,
2914
2916
  titleMinLength,
2917
+ titleRecommendedMax,
2918
+ titleRecommendedNote,
2915
2919
  active,
2916
2920
  hovered,
2917
2921
  maxLength,
@@ -2960,6 +2964,8 @@ var QuestionEditorCard = React41.forwardRef(
2960
2964
  titlePlaceholder,
2961
2965
  titlePlaceholderTone,
2962
2966
  titleMinLength,
2967
+ titleRecommendedMax,
2968
+ titleRecommendedNote,
2963
2969
  active,
2964
2970
  showCounter: !!active,
2965
2971
  dragHandleProps,