import React from 'react';
import classnames from 'classnames';
import EditMode from './edit-mode';
import TextMode from './text-mode';
import { jsx as _jsx } from "react/jsx-runtime";
const EditableTextControlled = ({
  isEditing,
  value,
  inputLabel,
  isMultiline,
  isDisabled,
  isLoading,
  buttonLabel,
  placeholder,
  testId,
  options,
  inputClassName,
  onSubmit,
  onKeyDown,
  onCancel,
  onBlur,
  onChange,
  editInputRef,
  startEditing,
  textClassName,
  buttonTooltip,
  areHyperLinksClickable = false,
  shouldDisplayControls = true,
  editButtonTestId,
  buttonAriaLabel
}) => {
  return /*#__PURE__*/_jsx("div", {
    className: classnames('editable-text', {
      editing: isEditing
    }),
    "test-id": testId,
    children: isEditing ? /*#__PURE__*/_jsx(EditMode, {
      onSubmit: onSubmit,
      onCancel: onCancel,
      onBlur: onBlur,
      inputLabel: inputLabel,
      isMultiline: isMultiline,
      placeholder: placeholder,
      onChange: onChange,
      onKeyDown: onKeyDown,
      value: value,
      ref: editInputRef,
      options: options,
      inputClassName: inputClassName,
      shouldDisplayControls: shouldDisplayControls
    }) : /*#__PURE__*/_jsx(TextMode, {
      className: textClassName,
      startEditing: startEditing,
      areHyperLinksClickable: areHyperLinksClickable,
      value: value,
      buttonLabel: buttonLabel,
      isMultiline: isMultiline,
      isDisabled: isDisabled,
      isLoading: isLoading,
      placeholder: placeholder,
      buttonTooltip: buttonTooltip,
      buttonTestId: editButtonTestId,
      buttonAriaLabel: buttonAriaLabel
    })
  });
};
export default EditableTextControlled;