@discuss-ds/ui 0.26.0 → 0.27.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
@@ -797,6 +797,10 @@ interface QuestionOptionEditorProps {
797
797
  onRemove?: () => void;
798
798
  /** Called by the add (+) button. */
799
799
  onAdd?: () => void;
800
+ /** Disables the trash button, for example when the question is already at its minimum number of options. */
801
+ removeDisabled?: boolean;
802
+ /** Disables the add (+) button, for example when the question is already at its maximum number of options. */
803
+ addDisabled?: boolean;
800
804
  className?: string;
801
805
  /**
802
806
  * Answer type. When set the row is quiet at rest: its normal border, the radio or checkbox indicator in front of the
@@ -828,7 +832,7 @@ interface QuestionOptionEditorProps {
828
832
  */
829
833
  locked?: boolean;
830
834
  }
831
- declare function QuestionOptionEditor({ label, onLabelChange, onRemove, onAdd, className, kind, rank, dragHandleProps, lifted, locked }: QuestionOptionEditorProps): React.JSX.Element;
835
+ declare function QuestionOptionEditor({ label, onLabelChange, onRemove, onAdd, removeDisabled, addDisabled, className, kind, rank, dragHandleProps, lifted, locked }: QuestionOptionEditorProps): React.JSX.Element;
832
836
 
833
837
  interface RankItemData {
834
838
  id: string;
package/dist/index.d.ts CHANGED
@@ -797,6 +797,10 @@ interface QuestionOptionEditorProps {
797
797
  onRemove?: () => void;
798
798
  /** Called by the add (+) button. */
799
799
  onAdd?: () => void;
800
+ /** Disables the trash button, for example when the question is already at its minimum number of options. */
801
+ removeDisabled?: boolean;
802
+ /** Disables the add (+) button, for example when the question is already at its maximum number of options. */
803
+ addDisabled?: boolean;
800
804
  className?: string;
801
805
  /**
802
806
  * Answer type. When set the row is quiet at rest: its normal border, the radio or checkbox indicator in front of the
@@ -828,7 +832,7 @@ interface QuestionOptionEditorProps {
828
832
  */
829
833
  locked?: boolean;
830
834
  }
831
- declare function QuestionOptionEditor({ label, onLabelChange, onRemove, onAdd, className, kind, rank, dragHandleProps, lifted, locked }: QuestionOptionEditorProps): React.JSX.Element;
835
+ declare function QuestionOptionEditor({ label, onLabelChange, onRemove, onAdd, removeDisabled, addDisabled, className, kind, rank, dragHandleProps, lifted, locked }: QuestionOptionEditorProps): React.JSX.Element;
832
836
 
833
837
  interface RankItemData {
834
838
  id: string;
package/dist/index.js CHANGED
@@ -3022,7 +3022,7 @@ var QuestionOtherOption = React44.forwardRef(
3022
3022
  }
3023
3023
  );
3024
3024
  QuestionOtherOption.displayName = "QuestionOtherOption";
3025
- function QuestionOptionEditor({ label, onLabelChange, onRemove, onAdd, className, kind, rank, dragHandleProps, lifted, locked }) {
3025
+ function QuestionOptionEditor({ label, onLabelChange, onRemove, onAdd, removeDisabled, addDisabled, className, kind, rank, dragHandleProps, lifted, locked }) {
3026
3026
  const reveal = kind !== void 0;
3027
3027
  const gripProps = dragHandleProps ? {
3028
3028
  "aria-label": rank ? `Reorder option ${rank}` : "Reorder option",
@@ -3096,8 +3096,8 @@ function QuestionOptionEditor({ label, onLabelChange, onRemove, onAdd, className
3096
3096
  reveal && "opacity-0 transition-opacity group-hover/option:opacity-100 group-focus-within/option:opacity-100"
3097
3097
  ),
3098
3098
  children: [
3099
- /* @__PURE__ */ jsx45(Button, { type: "button", variant: "destructive", size: "icon-sm", "aria-label": "Remove option", onClick: onRemove, children: /* @__PURE__ */ jsx45(Trash4, { size: 16, "aria-hidden": true }) }),
3100
- /* @__PURE__ */ jsx45(Button, { type: "button", variant: "ghost", size: "icon-sm", "aria-label": "Add option", onClick: onAdd, children: /* @__PURE__ */ jsx45(Plus4, { size: 16, "aria-hidden": true }) })
3099
+ /* @__PURE__ */ jsx45(Button, { type: "button", variant: "destructive", size: "icon-sm", "aria-label": "Remove option", disabled: removeDisabled, onClick: onRemove, children: /* @__PURE__ */ jsx45(Trash4, { size: 16, "aria-hidden": true }) }),
3100
+ /* @__PURE__ */ jsx45(Button, { type: "button", variant: "ghost", size: "icon-sm", "aria-label": "Add option", disabled: addDisabled, onClick: onAdd, children: /* @__PURE__ */ jsx45(Plus4, { size: 16, "aria-hidden": true }) })
3101
3101
  ]
3102
3102
  }
3103
3103
  )