'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var _rollupPluginBabelHelpers = require('../../../../_virtual/_rollupPluginBabelHelpers.js');
var React = require('react');
var cls = require('classnames');
var Input_styles = require('./Input.styles.js');

function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }

var React__default = /*#__PURE__*/_interopDefault(React);
var cls__default = /*#__PURE__*/_interopDefault(cls);

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__*/React.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 = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
  var handleSearch = function handleSearch(searchValue, event) {
    if (onSearch) {
      onSearch(event, searchValue);
    }
  };
  return /*#__PURE__*/React__default.default.createElement(Input_styles.StyledInput, _rollupPluginBabelHelpers.extends({
    ref: ref,
    className: cls__default.default(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));
});

exports.Input = Input;
