"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
var _classnames = _interopRequireDefault(require("classnames"));
var _editMode = _interopRequireDefault(require("./edit-mode"));
var _textMode = _interopRequireDefault(require("./text-mode"));
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
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__*/(0, _jsxRuntime.jsx)("div", {
    className: (0, _classnames.default)('editable-text', {
      editing: isEditing
    }),
    "test-id": testId,
    children: isEditing ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_editMode.default, {
      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__*/(0, _jsxRuntime.jsx)(_textMode.default, {
      className: textClassName,
      startEditing: startEditing,
      areHyperLinksClickable: areHyperLinksClickable,
      value: value,
      buttonLabel: buttonLabel,
      isMultiline: isMultiline,
      isDisabled: isDisabled,
      isLoading: isLoading,
      placeholder: placeholder,
      buttonTooltip: buttonTooltip,
      buttonTestId: editButtonTestId,
      buttonAriaLabel: buttonAriaLabel
    })
  });
};
var _default = exports.default = EditableTextControlled;