@discuss-ds/ui 0.27.0 → 0.29.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
@@ -328,8 +328,10 @@ interface InlineEditProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'on
328
328
  defaultValue?: string;
329
329
  /** Called when an edit is committed (Enter, blur or the commit key for multiline) with a changed value. */
330
330
  onValueChange?: (value: string) => void;
331
- /** Shown in read mode, muted, while the value is empty. */
331
+ /** Shown in read mode while the value is empty, muted unless `placeholderTone` says otherwise. */
332
332
  placeholder?: string;
333
+ /** `regular` shows the placeholder in the normal text colour instead of the muted one, for hints that read as real content. Default `muted`. */
334
+ placeholderTone?: 'muted' | 'regular';
333
335
  /** Accessible name for the read button and the field. Required: there is no visible label. */
334
336
  'aria-label': string;
335
337
  /** Use a textarea. Enter inserts a line break; Cmd/Ctrl+Enter commits. */
@@ -666,6 +668,12 @@ interface QuestionEditorCardProps extends Omit<React.HTMLAttributes<HTMLDivEleme
666
668
  number: number;
667
669
  title: string;
668
670
  onTitleChange?: (title: string) => void;
671
+ /** Shown while the title is empty. Defaults to "Click to write the question text". */
672
+ titlePlaceholder?: string;
673
+ /** `regular` shows the title placeholder in the normal text colour instead of the muted one. Default `muted`. */
674
+ titlePlaceholderTone?: 'muted' | 'regular';
675
+ /** Shortest title (in characters) that may be saved. Turns on the title guardrail: see `QuestionHeader`'s `titleMinLength`. */
676
+ titleMinLength?: number;
669
677
  /** The question is being edited: accent border, counter and footer are shown. */
670
678
  active?: boolean;
671
679
  /**
@@ -713,6 +721,16 @@ interface QuestionHeaderProps extends Omit<React.HTMLAttributes<HTMLDivElement>,
713
721
  editor?: boolean;
714
722
  /** Editor mode: called as the title is typed. `title` must then be a string. */
715
723
  onTitleChange?: (title: string) => void;
724
+ /** Editor mode: shown while the title is empty. Defaults to "Click to write the question text". */
725
+ titlePlaceholder?: string;
726
+ /** Editor mode: `regular` shows the title placeholder in the normal text colour instead of the muted one. Default `muted`. */
727
+ titlePlaceholderTone?: 'muted' | 'regular';
728
+ /**
729
+ * Editor mode: shortest title (in characters) that may be saved. When set, the title's limits guardrail turns on: while the title
730
+ * is being edited a line under it shows the allowed range and the live count (using `maxLength`), a title that is too short is not
731
+ * saved (the field stays open and says why), and the always-on counter is replaced by that line.
732
+ */
733
+ titleMinLength?: number;
716
734
  /** Editor mode: action buttons (copy, delete, preview, AI) revealed on hover or focus. */
717
735
  actions?: React.ReactNode;
718
736
  /** Editor mode: content shown right beside the "Question N" tag, e.g. the time allowed for the question. */
@@ -797,6 +815,20 @@ interface QuestionOptionEditorProps {
797
815
  onRemove?: () => void;
798
816
  /** Called by the add (+) button. */
799
817
  onAdd?: () => void;
818
+ /** Shown while the option is empty, for example "Option 1". */
819
+ placeholder?: string;
820
+ /** `regular` shows the placeholder in the normal text colour instead of the muted one. Default `muted`. */
821
+ placeholderTone?: 'muted' | 'regular';
822
+ /**
823
+ * Shortest label (in characters, ignoring surrounding spaces) that may be saved. With `minLength` or `maxLength` the label is
824
+ * guarded like an `InlineEdit`: typing only changes a draft, Enter or leaving the field saves it through `onLabelChange`, a label
825
+ * that is too short is not saved (the field stays open and says why), Escape reverts, and while it is being edited a line under
826
+ * the row shows the allowed range and the live count. An unchanged label is never refused. Without either, `onLabelChange` is
827
+ * called on every keystroke as before.
828
+ */
829
+ minLength?: number;
830
+ /** Longest label (in characters). See `minLength`. */
831
+ maxLength?: number;
800
832
  /** Disables the trash button, for example when the question is already at its minimum number of options. */
801
833
  removeDisabled?: boolean;
802
834
  /** Disables the add (+) button, for example when the question is already at its maximum number of options. */
@@ -832,7 +864,7 @@ interface QuestionOptionEditorProps {
832
864
  */
833
865
  locked?: boolean;
834
866
  }
835
- declare function QuestionOptionEditor({ label, onLabelChange, onRemove, onAdd, removeDisabled, addDisabled, className, kind, rank, dragHandleProps, lifted, locked }: QuestionOptionEditorProps): React.JSX.Element;
867
+ declare function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTone, minLength, maxLength, onRemove, onAdd, removeDisabled, addDisabled, className, kind, rank, dragHandleProps, lifted, locked }: QuestionOptionEditorProps): React.JSX.Element;
836
868
 
837
869
  interface RankItemData {
838
870
  id: string;
package/dist/index.d.ts CHANGED
@@ -328,8 +328,10 @@ interface InlineEditProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'on
328
328
  defaultValue?: string;
329
329
  /** Called when an edit is committed (Enter, blur or the commit key for multiline) with a changed value. */
330
330
  onValueChange?: (value: string) => void;
331
- /** Shown in read mode, muted, while the value is empty. */
331
+ /** Shown in read mode while the value is empty, muted unless `placeholderTone` says otherwise. */
332
332
  placeholder?: string;
333
+ /** `regular` shows the placeholder in the normal text colour instead of the muted one, for hints that read as real content. Default `muted`. */
334
+ placeholderTone?: 'muted' | 'regular';
333
335
  /** Accessible name for the read button and the field. Required: there is no visible label. */
334
336
  'aria-label': string;
335
337
  /** Use a textarea. Enter inserts a line break; Cmd/Ctrl+Enter commits. */
@@ -666,6 +668,12 @@ interface QuestionEditorCardProps extends Omit<React.HTMLAttributes<HTMLDivEleme
666
668
  number: number;
667
669
  title: string;
668
670
  onTitleChange?: (title: string) => void;
671
+ /** Shown while the title is empty. Defaults to "Click to write the question text". */
672
+ titlePlaceholder?: string;
673
+ /** `regular` shows the title placeholder in the normal text colour instead of the muted one. Default `muted`. */
674
+ titlePlaceholderTone?: 'muted' | 'regular';
675
+ /** Shortest title (in characters) that may be saved. Turns on the title guardrail: see `QuestionHeader`'s `titleMinLength`. */
676
+ titleMinLength?: number;
669
677
  /** The question is being edited: accent border, counter and footer are shown. */
670
678
  active?: boolean;
671
679
  /**
@@ -713,6 +721,16 @@ interface QuestionHeaderProps extends Omit<React.HTMLAttributes<HTMLDivElement>,
713
721
  editor?: boolean;
714
722
  /** Editor mode: called as the title is typed. `title` must then be a string. */
715
723
  onTitleChange?: (title: string) => void;
724
+ /** Editor mode: shown while the title is empty. Defaults to "Click to write the question text". */
725
+ titlePlaceholder?: string;
726
+ /** Editor mode: `regular` shows the title placeholder in the normal text colour instead of the muted one. Default `muted`. */
727
+ titlePlaceholderTone?: 'muted' | 'regular';
728
+ /**
729
+ * Editor mode: shortest title (in characters) that may be saved. When set, the title's limits guardrail turns on: while the title
730
+ * is being edited a line under it shows the allowed range and the live count (using `maxLength`), a title that is too short is not
731
+ * saved (the field stays open and says why), and the always-on counter is replaced by that line.
732
+ */
733
+ titleMinLength?: number;
716
734
  /** Editor mode: action buttons (copy, delete, preview, AI) revealed on hover or focus. */
717
735
  actions?: React.ReactNode;
718
736
  /** Editor mode: content shown right beside the "Question N" tag, e.g. the time allowed for the question. */
@@ -797,6 +815,20 @@ interface QuestionOptionEditorProps {
797
815
  onRemove?: () => void;
798
816
  /** Called by the add (+) button. */
799
817
  onAdd?: () => void;
818
+ /** Shown while the option is empty, for example "Option 1". */
819
+ placeholder?: string;
820
+ /** `regular` shows the placeholder in the normal text colour instead of the muted one. Default `muted`. */
821
+ placeholderTone?: 'muted' | 'regular';
822
+ /**
823
+ * Shortest label (in characters, ignoring surrounding spaces) that may be saved. With `minLength` or `maxLength` the label is
824
+ * guarded like an `InlineEdit`: typing only changes a draft, Enter or leaving the field saves it through `onLabelChange`, a label
825
+ * that is too short is not saved (the field stays open and says why), Escape reverts, and while it is being edited a line under
826
+ * the row shows the allowed range and the live count. An unchanged label is never refused. Without either, `onLabelChange` is
827
+ * called on every keystroke as before.
828
+ */
829
+ minLength?: number;
830
+ /** Longest label (in characters). See `minLength`. */
831
+ maxLength?: number;
800
832
  /** Disables the trash button, for example when the question is already at its minimum number of options. */
801
833
  removeDisabled?: boolean;
802
834
  /** Disables the add (+) button, for example when the question is already at its maximum number of options. */
@@ -832,7 +864,7 @@ interface QuestionOptionEditorProps {
832
864
  */
833
865
  locked?: boolean;
834
866
  }
835
- declare function QuestionOptionEditor({ label, onLabelChange, onRemove, onAdd, removeDisabled, addDisabled, className, kind, rank, dragHandleProps, lifted, locked }: QuestionOptionEditorProps): React.JSX.Element;
867
+ declare function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTone, minLength, maxLength, onRemove, onAdd, removeDisabled, addDisabled, className, kind, rank, dragHandleProps, lifted, locked }: QuestionOptionEditorProps): React.JSX.Element;
836
868
 
837
869
  interface RankItemData {
838
870
  id: string;
package/dist/index.js CHANGED
@@ -1444,8 +1444,7 @@ import * as React24 from "react";
1444
1444
  import { PencilSimple, WarningCircle as WarningCircle2 } from "@phosphor-icons/react";
1445
1445
  import { Fragment as Fragment4, jsx as jsx25, jsxs as jsxs17 } from "react/jsx-runtime";
1446
1446
  function limitsText(min, max) {
1447
- if (min !== void 0 && max !== void 0) return `${min}\u2013${max} characters`;
1448
- if (min !== void 0) return `At least ${min} characters`;
1447
+ if (min !== void 0) return `${min} ${min === 1 ? "character" : "characters"} required`;
1449
1448
  if (max !== void 0) return `Up to ${max} characters`;
1450
1449
  return "";
1451
1450
  }
@@ -1457,6 +1456,7 @@ var InlineEdit = React24.forwardRef(
1457
1456
  defaultValue = "",
1458
1457
  onValueChange,
1459
1458
  placeholder = "Click to edit",
1459
+ placeholderTone = "muted",
1460
1460
  multiline,
1461
1461
  maxLength,
1462
1462
  minLength,
@@ -1605,7 +1605,7 @@ var InlineEdit = React24.forwardRef(
1605
1605
  textClasses
1606
1606
  ),
1607
1607
  children: [
1608
- /* @__PURE__ */ jsx25("span", { className: cn("min-w-0", multiline ? "whitespace-pre-wrap" : "truncate", fill && "flex-1", !value && "text-muted-foreground"), children: value || placeholder }),
1608
+ /* @__PURE__ */ jsx25("span", { className: cn("min-w-0", multiline ? "whitespace-pre-wrap" : "truncate", fill && "flex-1", !value && placeholderTone === "muted" && "text-muted-foreground"), children: value || placeholder }),
1609
1609
  !fill && /* @__PURE__ */ jsx25(
1610
1610
  PencilSimple,
1611
1611
  {
@@ -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", titlePlaceholderTone, titleMinLength, 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,10 @@ 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
+ placeholderTone: titlePlaceholderTone,
2722
+ minLength: titleMinLength,
2723
+ showLimits: titleMinLength !== void 0,
2721
2724
  value: text,
2722
2725
  maxLength,
2723
2726
  onValueChange: onTitleChange,
@@ -2728,7 +2731,7 @@ var QuestionHeader = React40.forwardRef(
2728
2731
  textClassName: "text-heading-h4"
2729
2732
  }
2730
2733
  ),
2731
- showCounter && /* @__PURE__ */ jsxs29("p", { className: "text-ui-caption text-secondary-muted-foreground", children: [
2734
+ showCounter && titleMinLength === void 0 && /* @__PURE__ */ jsxs29("p", { className: "text-ui-caption text-secondary-muted-foreground", children: [
2732
2735
  count,
2733
2736
  "/",
2734
2737
  maxLength,
@@ -2760,6 +2763,9 @@ var QuestionEditorCard = React41.forwardRef(
2760
2763
  number,
2761
2764
  title,
2762
2765
  onTitleChange,
2766
+ titlePlaceholder,
2767
+ titlePlaceholderTone,
2768
+ titleMinLength,
2763
2769
  active,
2764
2770
  hovered,
2765
2771
  maxLength,
@@ -2805,6 +2811,9 @@ var QuestionEditorCard = React41.forwardRef(
2805
2811
  number,
2806
2812
  title,
2807
2813
  onTitleChange,
2814
+ titlePlaceholder,
2815
+ titlePlaceholderTone,
2816
+ titleMinLength,
2808
2817
  active,
2809
2818
  showCounter: !!active,
2810
2819
  dragHandleProps,
@@ -2967,7 +2976,7 @@ QuestionNavItem.displayName = "QuestionNavItem";
2967
2976
 
2968
2977
  // src/components/Question Types/QuestionOption.tsx
2969
2978
  import * as React44 from "react";
2970
- import { Check as Check4, DotsSixVertical as DotsSixVertical3, Plus as Plus4, Trash as Trash4 } from "@phosphor-icons/react";
2979
+ import { Check as Check4, DotsSixVertical as DotsSixVertical3, Plus as Plus4, Trash as Trash4, WarningCircle as WarningCircle4 } from "@phosphor-icons/react";
2971
2980
  import { Fragment as Fragment9, jsx as jsx45, jsxs as jsxs32 } from "react/jsx-runtime";
2972
2981
  var optionClasses = "flex w-full max-w-150 cursor-pointer items-center gap-2 rounded-md border border-border bg-surface px-4 py-2 text-body-base text-surface-foreground transition-colors hover:bg-accent-soft hover:shadow-md has-[[data-state=checked]]:border-accent-foreground has-[:disabled]:cursor-not-allowed has-[:disabled]:opacity-50";
2973
2982
  function QuestionOption(props) {
@@ -3022,8 +3031,34 @@ var QuestionOtherOption = React44.forwardRef(
3022
3031
  }
3023
3032
  );
3024
3033
  QuestionOtherOption.displayName = "QuestionOtherOption";
3025
- function QuestionOptionEditor({ label, onLabelChange, onRemove, onAdd, removeDisabled, addDisabled, className, kind, rank, dragHandleProps, lifted, locked }) {
3034
+ function limitsText2(min, max) {
3035
+ if (min !== void 0) return `${min} ${min === 1 ? "character" : "characters"} required`;
3036
+ if (max !== void 0) return `Up to ${max} characters`;
3037
+ return "";
3038
+ }
3039
+ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTone = "muted", minLength, maxLength, onRemove, onAdd, removeDisabled, addDisabled, className, kind, rank, dragHandleProps, lifted, locked }) {
3026
3040
  const reveal = kind !== void 0;
3041
+ const guarded = minLength !== void 0 || maxLength !== void 0;
3042
+ const [draft, setDraft] = React44.useState(null);
3043
+ const [error, setError] = React44.useState(null);
3044
+ const helperId = React44.useId();
3045
+ const fieldRef = React44.useRef(null);
3046
+ const skipBlur = React44.useRef(false);
3047
+ const problemWith = (text) => minLength !== void 0 && text.trim().length < minLength ? `Enter at least ${minLength} ${minLength === 1 ? "character" : "characters"}.` : null;
3048
+ const save = () => {
3049
+ if (draft === null) return true;
3050
+ if (draft !== label) {
3051
+ const problem = problemWith(draft);
3052
+ if (problem) {
3053
+ setError(problem);
3054
+ return false;
3055
+ }
3056
+ onLabelChange?.(draft);
3057
+ }
3058
+ setDraft(null);
3059
+ setError(null);
3060
+ return true;
3061
+ };
3027
3062
  const gripProps = dragHandleProps ? {
3028
3063
  "aria-label": rank ? `Reorder option ${rank}` : "Reorder option",
3029
3064
  ...dragHandleProps,
@@ -3035,54 +3070,113 @@ function QuestionOptionEditor({ label, onLabelChange, onRemove, onAdd, removeDis
3035
3070
  "div",
3036
3071
  {
3037
3072
  className: cn(
3038
- "flex h-11.5 min-w-0 flex-1 items-center gap-2 rounded-md border bg-surface px-4 py-2 focus-within:border-input-accent",
3073
+ "flex min-h-11.5 min-w-0 flex-1 flex-col justify-center gap-1 rounded-md border bg-surface px-4 py-2 focus-within:border-input-accent",
3039
3074
  reveal ? (
3040
3075
  // The border is always visible and does not change on hover; only the shadow lifts the row. The field being edited keeps the accent.
3041
3076
  cn("border-border group-hover/option:shadow-md group-focus-within/option:shadow-md", lifted && "shadow-md")
3042
3077
  ) : "border-border hover:border-input-muted hover:shadow-md"
3043
3078
  ),
3044
3079
  children: [
3045
- kind === "rank" ? /* @__PURE__ */ jsxs32(Fragment9, { children: [
3046
- !locked && grip,
3047
- /* @__PURE__ */ jsx45(
3048
- "span",
3049
- {
3050
- "aria-hidden": "true",
3051
- className: "flex size-6 shrink-0 items-center justify-center rounded-full border border-border bg-background bg-linear-to-r from-overlay-dark-5 to-overlay-dark-5 text-ui-caption text-surface-foreground",
3052
- children: rank
3053
- }
3054
- )
3055
- ] }) : reveal && locked ? /* @__PURE__ */ jsx45("span", { "aria-hidden": "true", className: "relative flex size-5 shrink-0 items-center justify-center", children: /* @__PURE__ */ jsx45("span", { className: cn("inline-flex size-4 border-2 border-input bg-surface", kind === "radio" ? "rounded-full" : "rounded-xxs") }) }) : reveal ? /* @__PURE__ */ jsxs32("span", { ...gripProps, className: cn("relative flex size-5 shrink-0 items-center justify-center", gripProps.className), children: [
3056
- /* @__PURE__ */ jsx45(
3057
- "span",
3058
- {
3059
- "aria-hidden": "true",
3060
- className: cn(
3061
- "inline-flex size-4 border-2 border-input bg-surface group-hover/option:hidden group-focus-within/option:hidden",
3062
- lifted && "hidden",
3063
- kind === "radio" ? "rounded-full" : "rounded-xxs"
3064
- )
3065
- }
3066
- ),
3080
+ /* @__PURE__ */ jsxs32("div", { className: "flex min-w-0 items-center gap-2", children: [
3081
+ kind === "rank" ? /* @__PURE__ */ jsxs32(Fragment9, { children: [
3082
+ !locked && grip,
3083
+ /* @__PURE__ */ jsx45(
3084
+ "span",
3085
+ {
3086
+ "aria-hidden": "true",
3087
+ className: "flex size-6 shrink-0 items-center justify-center rounded-full border border-border bg-background bg-linear-to-r from-overlay-dark-5 to-overlay-dark-5 text-ui-caption text-surface-foreground",
3088
+ children: rank
3089
+ }
3090
+ )
3091
+ ] }) : reveal && locked ? /* @__PURE__ */ jsx45("span", { "aria-hidden": "true", className: "relative flex size-5 shrink-0 items-center justify-center", children: /* @__PURE__ */ jsx45("span", { className: cn("inline-flex size-4 border-2 border-input bg-surface", kind === "radio" ? "rounded-full" : "rounded-xxs") }) }) : reveal ? /* @__PURE__ */ jsxs32("span", { ...gripProps, className: cn("relative flex size-5 shrink-0 items-center justify-center", gripProps.className), children: [
3092
+ /* @__PURE__ */ jsx45(
3093
+ "span",
3094
+ {
3095
+ "aria-hidden": "true",
3096
+ className: cn(
3097
+ "inline-flex size-4 border-2 border-input bg-surface group-hover/option:hidden group-focus-within/option:hidden",
3098
+ lifted && "hidden",
3099
+ kind === "radio" ? "rounded-full" : "rounded-xxs"
3100
+ )
3101
+ }
3102
+ ),
3103
+ /* @__PURE__ */ jsx45(
3104
+ DotsSixVertical3,
3105
+ {
3106
+ size: 20,
3107
+ "aria-hidden": true,
3108
+ className: cn(
3109
+ "hidden shrink-0 text-surface-foreground group-hover/option:block group-focus-within/option:block",
3110
+ lifted && "block"
3111
+ )
3112
+ }
3113
+ )
3114
+ ] }) : locked ? null : grip,
3067
3115
  /* @__PURE__ */ jsx45(
3068
- DotsSixVertical3,
3116
+ "input",
3069
3117
  {
3070
- size: 20,
3071
- "aria-hidden": true,
3118
+ ref: fieldRef,
3119
+ "aria-label": "Option label",
3120
+ "aria-invalid": error ? true : void 0,
3121
+ "aria-describedby": guarded && draft !== null ? helperId : void 0,
3122
+ placeholder,
3123
+ maxLength,
3124
+ value: guarded ? draft ?? label : label,
3125
+ onFocus: () => {
3126
+ if (guarded && draft === null) setDraft(label);
3127
+ },
3128
+ onChange: (event) => {
3129
+ if (!guarded) return onLabelChange?.(event.target.value);
3130
+ setDraft(event.target.value);
3131
+ if (error) setError(problemWith(event.target.value));
3132
+ },
3133
+ onKeyDown: (event) => {
3134
+ if (!guarded) return;
3135
+ if (event.key === "Escape") {
3136
+ skipBlur.current = true;
3137
+ setDraft(null);
3138
+ setError(null);
3139
+ fieldRef.current?.blur();
3140
+ } else if (event.key === "Enter") {
3141
+ event.preventDefault();
3142
+ if (save()) {
3143
+ skipBlur.current = true;
3144
+ fieldRef.current?.blur();
3145
+ }
3146
+ }
3147
+ },
3148
+ onBlur: () => {
3149
+ if (!guarded) return;
3150
+ if (skipBlur.current) {
3151
+ skipBlur.current = false;
3152
+ return;
3153
+ }
3154
+ save();
3155
+ },
3072
3156
  className: cn(
3073
- "hidden shrink-0 text-surface-foreground group-hover/option:block group-focus-within/option:block",
3074
- lifted && "block"
3157
+ "min-w-0 flex-1 bg-transparent text-body-base text-surface-foreground outline-none",
3158
+ placeholderTone === "regular" ? "placeholder:text-surface-foreground" : "placeholder:text-muted-foreground"
3075
3159
  )
3076
3160
  }
3077
3161
  )
3078
- ] }) : locked ? null : grip,
3079
- /* @__PURE__ */ jsx45(
3080
- "input",
3162
+ ] }),
3163
+ guarded && draft !== null && /* @__PURE__ */ jsxs32(
3164
+ "p",
3081
3165
  {
3082
- "aria-label": "Option label",
3083
- value: label,
3084
- onChange: (event) => onLabelChange?.(event.target.value),
3085
- className: "min-w-0 flex-1 bg-transparent text-body-base text-surface-foreground outline-none"
3166
+ id: helperId,
3167
+ role: error ? "alert" : void 0,
3168
+ className: cn("flex items-start justify-between gap-2 text-ui-caption", error ? "text-destructive" : "text-secondary-muted-foreground"),
3169
+ children: [
3170
+ /* @__PURE__ */ jsxs32("span", { className: "flex items-start gap-2", children: [
3171
+ error && /* @__PURE__ */ jsx45(WarningCircle4, { size: 16, "aria-hidden": true, className: "shrink-0" }),
3172
+ limitsText2(minLength, maxLength),
3173
+ error && /* @__PURE__ */ jsx45("span", { className: "sr-only", children: error })
3174
+ ] }),
3175
+ /* @__PURE__ */ jsxs32("span", { "aria-hidden": true, className: "shrink-0 tabular-nums", children: [
3176
+ draft.length,
3177
+ maxLength !== void 0 && `/${maxLength}`
3178
+ ] })
3179
+ ]
3086
3180
  }
3087
3181
  )
3088
3182
  ]