@discuss-ds/ui 0.29.1 → 0.30.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 +6 -0
- package/dist/index.cjs +8 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -674,6 +674,10 @@ interface QuestionEditorCardProps extends Omit<React.HTMLAttributes<HTMLDivEleme
|
|
|
674
674
|
titlePlaceholderTone?: 'muted' | 'regular';
|
|
675
675
|
/** Shortest title (in characters) that may be saved. Turns on the title guardrail: see `QuestionHeader`'s `titleMinLength`. */
|
|
676
676
|
titleMinLength?: number;
|
|
677
|
+
/** A title longer than this many characters switches to the regular 16px body style and shows `titleRecommendedNote` under it. See `QuestionHeader`. */
|
|
678
|
+
titleRecommendedMax?: number;
|
|
679
|
+
/** The recommendation shown under a title that is longer than `titleRecommendedMax`. */
|
|
680
|
+
titleRecommendedNote?: React.ReactNode;
|
|
677
681
|
/** The question is being edited: accent border, counter and footer are shown. */
|
|
678
682
|
active?: boolean;
|
|
679
683
|
/**
|
|
@@ -731,6 +735,13 @@ interface QuestionHeaderProps extends Omit<React.HTMLAttributes<HTMLDivElement>,
|
|
|
731
735
|
* saved (the field stays open and says why), and the always-on counter is replaced by that line.
|
|
732
736
|
*/
|
|
733
737
|
titleMinLength?: number;
|
|
738
|
+
/**
|
|
739
|
+
* Editor mode: a title longer than this many characters (counted live while it is typed) switches to the regular 16px body style
|
|
740
|
+
* instead of the heading style and shows `titleRecommendedNote` under it. Both need to be set.
|
|
741
|
+
*/
|
|
742
|
+
titleRecommendedMax?: number;
|
|
743
|
+
/** Editor mode: the recommendation shown under a title that is longer than `titleRecommendedMax`. */
|
|
744
|
+
titleRecommendedNote?: React.ReactNode;
|
|
734
745
|
/** Editor mode: action buttons (copy, delete, preview, AI) revealed on hover or focus. */
|
|
735
746
|
actions?: React.ReactNode;
|
|
736
747
|
/** Editor mode: content shown right beside the "Question N" tag, e.g. the time allowed for the question. */
|
package/dist/index.d.ts
CHANGED
|
@@ -674,6 +674,10 @@ interface QuestionEditorCardProps extends Omit<React.HTMLAttributes<HTMLDivEleme
|
|
|
674
674
|
titlePlaceholderTone?: 'muted' | 'regular';
|
|
675
675
|
/** Shortest title (in characters) that may be saved. Turns on the title guardrail: see `QuestionHeader`'s `titleMinLength`. */
|
|
676
676
|
titleMinLength?: number;
|
|
677
|
+
/** A title longer than this many characters switches to the regular 16px body style and shows `titleRecommendedNote` under it. See `QuestionHeader`. */
|
|
678
|
+
titleRecommendedMax?: number;
|
|
679
|
+
/** The recommendation shown under a title that is longer than `titleRecommendedMax`. */
|
|
680
|
+
titleRecommendedNote?: React.ReactNode;
|
|
677
681
|
/** The question is being edited: accent border, counter and footer are shown. */
|
|
678
682
|
active?: boolean;
|
|
679
683
|
/**
|
|
@@ -731,6 +735,13 @@ interface QuestionHeaderProps extends Omit<React.HTMLAttributes<HTMLDivElement>,
|
|
|
731
735
|
* saved (the field stays open and says why), and the always-on counter is replaced by that line.
|
|
732
736
|
*/
|
|
733
737
|
titleMinLength?: number;
|
|
738
|
+
/**
|
|
739
|
+
* Editor mode: a title longer than this many characters (counted live while it is typed) switches to the regular 16px body style
|
|
740
|
+
* instead of the heading style and shows `titleRecommendedNote` under it. Both need to be set.
|
|
741
|
+
*/
|
|
742
|
+
titleRecommendedMax?: number;
|
|
743
|
+
/** Editor mode: the recommendation shown under a title that is longer than `titleRecommendedMax`. */
|
|
744
|
+
titleRecommendedNote?: React.ReactNode;
|
|
734
745
|
/** Editor mode: action buttons (copy, delete, preview, AI) revealed on hover or focus. */
|
|
735
746
|
actions?: React.ReactNode;
|
|
736
747
|
/** Editor mode: content shown right beside the "Question N" tag, e.g. the time allowed for the question. */
|
package/dist/index.js
CHANGED
|
@@ -2663,13 +2663,14 @@ import { DotsSixVertical } from "@phosphor-icons/react";
|
|
|
2663
2663
|
import { jsx as jsx41, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
2664
2664
|
var eyebrow = "text-ui-caption uppercase text-secondary-muted-foreground";
|
|
2665
2665
|
var QuestionHeader = React40.forwardRef(
|
|
2666
|
-
({ 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) => {
|
|
2666
|
+
({ 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) => {
|
|
2667
2667
|
const [draft, setDraft] = React40.useState(null);
|
|
2668
2668
|
const label = String(number).padStart(2, "0");
|
|
2669
2669
|
const showError = error !== void 0 && error !== false;
|
|
2670
2670
|
if (editor) {
|
|
2671
2671
|
const text = typeof title === "string" ? title : "";
|
|
2672
2672
|
const count = (draft ?? text).length;
|
|
2673
|
+
const long = titleRecommendedMax !== void 0 && titleRecommendedNote != null && count > titleRecommendedMax;
|
|
2673
2674
|
return /* @__PURE__ */ jsxs29("div", { ref, className: cn("group/header flex w-full flex-col gap-2", className), ...props, children: [
|
|
2674
2675
|
/* @__PURE__ */ jsxs29("div", { className: "flex items-center justify-between", children: [
|
|
2675
2676
|
/* @__PURE__ */ jsxs29("div", { className: "flex items-center gap-2", children: [
|
|
@@ -2728,9 +2729,10 @@ var QuestionHeader = React40.forwardRef(
|
|
|
2728
2729
|
onEditingChange: (editing) => {
|
|
2729
2730
|
if (!editing) setDraft(null);
|
|
2730
2731
|
},
|
|
2731
|
-
textClassName: "text-heading-h4"
|
|
2732
|
+
textClassName: long ? "text-body-base" : "text-heading-h4"
|
|
2732
2733
|
}
|
|
2733
2734
|
),
|
|
2735
|
+
long && /* @__PURE__ */ jsx41("p", { className: "text-ui-caption text-secondary-muted-foreground", children: titleRecommendedNote }),
|
|
2734
2736
|
showCounter && titleMinLength === void 0 && /* @__PURE__ */ jsxs29("p", { className: "text-ui-caption text-secondary-muted-foreground", children: [
|
|
2735
2737
|
count,
|
|
2736
2738
|
"/",
|
|
@@ -2766,6 +2768,8 @@ var QuestionEditorCard = React41.forwardRef(
|
|
|
2766
2768
|
titlePlaceholder,
|
|
2767
2769
|
titlePlaceholderTone,
|
|
2768
2770
|
titleMinLength,
|
|
2771
|
+
titleRecommendedMax,
|
|
2772
|
+
titleRecommendedNote,
|
|
2769
2773
|
active,
|
|
2770
2774
|
hovered,
|
|
2771
2775
|
maxLength,
|
|
@@ -2814,6 +2818,8 @@ var QuestionEditorCard = React41.forwardRef(
|
|
|
2814
2818
|
titlePlaceholder,
|
|
2815
2819
|
titlePlaceholderTone,
|
|
2816
2820
|
titleMinLength,
|
|
2821
|
+
titleRecommendedMax,
|
|
2822
|
+
titleRecommendedNote,
|
|
2817
2823
|
active,
|
|
2818
2824
|
showCounter: !!active,
|
|
2819
2825
|
dragHandleProps,
|