@discuss-ds/ui 0.27.0 → 0.28.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
@@ -666,6 +666,8 @@ interface QuestionEditorCardProps extends Omit<React.HTMLAttributes<HTMLDivEleme
666
666
  number: number;
667
667
  title: string;
668
668
  onTitleChange?: (title: string) => void;
669
+ /** Shown while the title is empty. Defaults to "Click to write the question text". */
670
+ titlePlaceholder?: string;
669
671
  /** The question is being edited: accent border, counter and footer are shown. */
670
672
  active?: boolean;
671
673
  /**
@@ -713,6 +715,8 @@ interface QuestionHeaderProps extends Omit<React.HTMLAttributes<HTMLDivElement>,
713
715
  editor?: boolean;
714
716
  /** Editor mode: called as the title is typed. `title` must then be a string. */
715
717
  onTitleChange?: (title: string) => void;
718
+ /** Editor mode: shown while the title is empty. Defaults to "Click to write the question text". */
719
+ titlePlaceholder?: string;
716
720
  /** Editor mode: action buttons (copy, delete, preview, AI) revealed on hover or focus. */
717
721
  actions?: React.ReactNode;
718
722
  /** Editor mode: content shown right beside the "Question N" tag, e.g. the time allowed for the question. */
@@ -797,6 +801,8 @@ interface QuestionOptionEditorProps {
797
801
  onRemove?: () => void;
798
802
  /** Called by the add (+) button. */
799
803
  onAdd?: () => void;
804
+ /** Shown while the option is empty, for example "Option 1". */
805
+ placeholder?: string;
800
806
  /** Disables the trash button, for example when the question is already at its minimum number of options. */
801
807
  removeDisabled?: boolean;
802
808
  /** Disables the add (+) button, for example when the question is already at its maximum number of options. */
@@ -832,7 +838,7 @@ interface QuestionOptionEditorProps {
832
838
  */
833
839
  locked?: boolean;
834
840
  }
835
- declare function QuestionOptionEditor({ label, onLabelChange, onRemove, onAdd, removeDisabled, addDisabled, className, kind, rank, dragHandleProps, lifted, locked }: QuestionOptionEditorProps): React.JSX.Element;
841
+ declare function QuestionOptionEditor({ label, onLabelChange, placeholder, onRemove, onAdd, removeDisabled, addDisabled, className, kind, rank, dragHandleProps, lifted, locked }: QuestionOptionEditorProps): React.JSX.Element;
836
842
 
837
843
  interface RankItemData {
838
844
  id: string;
package/dist/index.d.ts CHANGED
@@ -666,6 +666,8 @@ interface QuestionEditorCardProps extends Omit<React.HTMLAttributes<HTMLDivEleme
666
666
  number: number;
667
667
  title: string;
668
668
  onTitleChange?: (title: string) => void;
669
+ /** Shown while the title is empty. Defaults to "Click to write the question text". */
670
+ titlePlaceholder?: string;
669
671
  /** The question is being edited: accent border, counter and footer are shown. */
670
672
  active?: boolean;
671
673
  /**
@@ -713,6 +715,8 @@ interface QuestionHeaderProps extends Omit<React.HTMLAttributes<HTMLDivElement>,
713
715
  editor?: boolean;
714
716
  /** Editor mode: called as the title is typed. `title` must then be a string. */
715
717
  onTitleChange?: (title: string) => void;
718
+ /** Editor mode: shown while the title is empty. Defaults to "Click to write the question text". */
719
+ titlePlaceholder?: string;
716
720
  /** Editor mode: action buttons (copy, delete, preview, AI) revealed on hover or focus. */
717
721
  actions?: React.ReactNode;
718
722
  /** Editor mode: content shown right beside the "Question N" tag, e.g. the time allowed for the question. */
@@ -797,6 +801,8 @@ interface QuestionOptionEditorProps {
797
801
  onRemove?: () => void;
798
802
  /** Called by the add (+) button. */
799
803
  onAdd?: () => void;
804
+ /** Shown while the option is empty, for example "Option 1". */
805
+ placeholder?: string;
800
806
  /** Disables the trash button, for example when the question is already at its minimum number of options. */
801
807
  removeDisabled?: boolean;
802
808
  /** Disables the add (+) button, for example when the question is already at its maximum number of options. */
@@ -832,7 +838,7 @@ interface QuestionOptionEditorProps {
832
838
  */
833
839
  locked?: boolean;
834
840
  }
835
- declare function QuestionOptionEditor({ label, onLabelChange, onRemove, onAdd, removeDisabled, addDisabled, className, kind, rank, dragHandleProps, lifted, locked }: QuestionOptionEditorProps): React.JSX.Element;
841
+ declare function QuestionOptionEditor({ label, onLabelChange, placeholder, onRemove, onAdd, removeDisabled, addDisabled, className, kind, rank, dragHandleProps, lifted, locked }: QuestionOptionEditorProps): React.JSX.Element;
836
842
 
837
843
  interface RankItemData {
838
844
  id: string;
package/dist/index.js CHANGED
@@ -2663,7 +2663,7 @@ 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, 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", 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;
@@ -2717,7 +2717,7 @@ var QuestionHeader = React40.forwardRef(
2717
2717
  selected: active,
2718
2718
  className: "-mx-3 w-auto",
2719
2719
  "aria-label": "Question title",
2720
- placeholder: "Click to write the question text",
2720
+ placeholder: titlePlaceholder,
2721
2721
  value: text,
2722
2722
  maxLength,
2723
2723
  onValueChange: onTitleChange,
@@ -2760,6 +2760,7 @@ var QuestionEditorCard = React41.forwardRef(
2760
2760
  number,
2761
2761
  title,
2762
2762
  onTitleChange,
2763
+ titlePlaceholder,
2763
2764
  active,
2764
2765
  hovered,
2765
2766
  maxLength,
@@ -2805,6 +2806,7 @@ var QuestionEditorCard = React41.forwardRef(
2805
2806
  number,
2806
2807
  title,
2807
2808
  onTitleChange,
2809
+ titlePlaceholder,
2808
2810
  active,
2809
2811
  showCounter: !!active,
2810
2812
  dragHandleProps,
@@ -3022,7 +3024,7 @@ var QuestionOtherOption = React44.forwardRef(
3022
3024
  }
3023
3025
  );
3024
3026
  QuestionOtherOption.displayName = "QuestionOtherOption";
3025
- function QuestionOptionEditor({ label, onLabelChange, onRemove, onAdd, removeDisabled, addDisabled, className, kind, rank, dragHandleProps, lifted, locked }) {
3027
+ function QuestionOptionEditor({ label, onLabelChange, placeholder, onRemove, onAdd, removeDisabled, addDisabled, className, kind, rank, dragHandleProps, lifted, locked }) {
3026
3028
  const reveal = kind !== void 0;
3027
3029
  const gripProps = dragHandleProps ? {
3028
3030
  "aria-label": rank ? `Reorder option ${rank}` : "Reorder option",
@@ -3080,6 +3082,7 @@ function QuestionOptionEditor({ label, onLabelChange, onRemove, onAdd, removeDis
3080
3082
  "input",
3081
3083
  {
3082
3084
  "aria-label": "Option label",
3085
+ placeholder,
3083
3086
  value: label,
3084
3087
  onChange: (event) => onLabelChange?.(event.target.value),
3085
3088
  className: "min-w-0 flex-1 bg-transparent text-body-base text-surface-foreground outline-none"