"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _classnames = _interopRequireDefault(require("classnames"));
var _constants = require("../../constants");
var _jsxRuntime = require("react/jsx-runtime");
// Copyright 1999-2023. 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 = _ref => {
  let {
    baseClassName = `${_constants.CLS_PREFIX}input`,
    className,
    size = 'md',
    type = 'text',
    textAlign,
    prefix,
    suffix,
    innerRef,
    rootProps,
    ...props
  } = _ref;
  const useSizeModifier = typeof size === 'string' && ['sm', 'md', 'lg', 'xl', 'fill'].indexOf(size) !== -1;
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
    className: (0, _classnames.default)(baseClassName, {
      [`${baseClassName}--size-${size}`]: useSizeModifier,
      [`${baseClassName}--text-${textAlign}`]: textAlign,
      [`${baseClassName}--affix`]: prefix || suffix
    }, className),
    ...rootProps,
    children: [prefix && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
      className: `${baseClassName}__prefix`,
      children: prefix
    }), /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
      ref: innerRef,
      type: type,
      size: typeof size === 'number' ? size : undefined,
      className: `${baseClassName}__input`,
      ...props
    }), suffix && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
      className: `${baseClassName}__suffix`,
      children: suffix
    })]
  });
};
var _default = exports.default = Input;