"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));

var _react = _interopRequireDefault(require("react"));

var _classnames = _interopRequireDefault(require("classnames"));

var _constants = require("../../constants");

// Copyright 1999-2020. Plesk International GmbH. All rights reserved.

/**
 * `Input` component is used for entering short text (like user name or email address).
 * @since 0.0.57
 */
const Input = ({
  baseClassName = `${_constants.CLS_PREFIX}input`,
  className,
  size = 'md',
  type = 'text',
  textAlign,
  prefix,
  suffix,
  innerRef,
  rootProps,
  ...props
}) => {
  const useSizeModifier = typeof size === 'string' && ['sm', 'md', 'lg', 'xl', 'fill'].indexOf(size) !== -1;
  return /*#__PURE__*/_react.default.createElement("span", (0, _extends2.default)({
    className: (0, _classnames.default)(baseClassName, {
      [`${baseClassName}--size-${size}`]: useSizeModifier,
      [`${baseClassName}--text-${textAlign}`]: textAlign,
      [`${baseClassName}--affix`]: prefix || suffix
    }, className)
  }, rootProps), prefix && /*#__PURE__*/_react.default.createElement("span", {
    className: `${baseClassName}__prefix`
  }, prefix), /*#__PURE__*/_react.default.createElement("input", (0, _extends2.default)({
    ref: innerRef,
    type: type,
    size: typeof size === 'number' ? size : undefined,
    className: `${baseClassName}__input`
  }, props)), suffix && /*#__PURE__*/_react.default.createElement("span", {
    className: `${baseClassName}__suffix`
  }, suffix));
};

var _default = Input;
exports.default = _default;