import { objectWithoutProperties as _objectWithoutProperties, extends as _extends } from '../../../../_virtual/_rollupPluginBabelHelpers.js';
import React__default, { forwardRef } from 'react';
import cls from 'classnames';
import { StyledInput } from './Input.styles.js';

var _excluded = ["value", "readOnly", "disabled", "placeholder", "contentLeft", "contentRight", "textBefore", "textAfter", "required", "requiredPlacement", "hasRequiredIndicator", "label", "labelPlacement", "keepPlaceholder", "errorClass", "successClass", "appearance", "hasClearDivider", "onChangeValue", "onSearch", "onFocus", "onBlur", "onKeyDown"];
var Input = /*#__PURE__*/forwardRef(function (_ref, ref) {
  var value = _ref.value,
    readOnly = _ref.readOnly,
    disabled = _ref.disabled,
    placeholder = _ref.placeholder,
    contentLeft = _ref.contentLeft,
    contentRight = _ref.contentRight,
    textBefore = _ref.textBefore,
    textAfter = _ref.textAfter,
    required = _ref.required,
    requiredPlacement = _ref.requiredPlacement,
    hasRequiredIndicator = _ref.hasRequiredIndicator,
    label = _ref.label,
    labelPlacement = _ref.labelPlacement,
    keepPlaceholder = _ref.keepPlaceholder,
    errorClass = _ref.errorClass,
    successClass = _ref.successClass,
    appearance = _ref.appearance,
    hasClearDivider = _ref.hasClearDivider,
    onChangeValue = _ref.onChangeValue,
    onSearch = _ref.onSearch,
    onFocus = _ref.onFocus,
    onBlur = _ref.onBlur,
    onKeyDown = _ref.onKeyDown,
    rest = _objectWithoutProperties(_ref, _excluded);
  var handleSearch = function handleSearch(searchValue, event) {
    if (onSearch) {
      onSearch(event, searchValue);
    }
  };
  return /*#__PURE__*/React__default.createElement(StyledInput, _extends({
    ref: ref,
    className: cls(errorClass, successClass),
    value: value,
    readOnly: readOnly,
    disabled: disabled,
    appearance: appearance,
    hasDivider: hasClearDivider,
    placeholder: placeholder,
    contentLeft: contentLeft,
    contentRight: contentRight,
    textBefore: textBefore,
    textAfter: textAfter,
    onChange: onChangeValue,
    onSearch: handleSearch,
    onFocus: onFocus,
    onBlur: onBlur,
    onKeyDown: onKeyDown,
    required: required,
    requiredPlacement: requiredPlacement,
    hasRequiredIndicator: hasRequiredIndicator,
    label: label,
    labelPlacement: labelPlacement,
    keepPlaceholder: keepPlaceholder
  }, rest));
});

export { Input };
