function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

import React, { memo, forwardRef } from 'react';
import InputBase from './InputBase';
import InputAdvanced from './InputAdvanced';
import { useFormControl } from '../../composites/FormControl';
import { useHasResponsiveProps } from '../../../hooks/useHasResponsiveProps';

const Input = (props, ref) => {
  const inputProps = useFormControl({
    isDisabled: props.isDisabled,
    isInvalid: props.isInvalid,
    isReadOnly: props.isReadOnly,
    isRequired: props.isRequired,
    nativeID: props.nativeID
  }); //TODO: refactor for responsive prop

  if (useHasResponsiveProps(props)) {
    return null;
  }

  if (props.InputLeftElement || props.InputRightElement || props.leftElement || props.rightElement) return /*#__PURE__*/React.createElement(InputAdvanced, _extends({}, props, {
    ref: ref,
    inputProps: inputProps
  }));else return /*#__PURE__*/React.createElement(InputBase, _extends({}, props, {
    ref: ref,
    inputProps: inputProps
  }));
};

export default /*#__PURE__*/memo( /*#__PURE__*/forwardRef(Input));
//# sourceMappingURL=Input.js.map