import React from 'react';
import Title from '../../atom/title';
import Autocomplete from '../../atom/autocomplete';
import InputText from '../../atom/input-text';
import InputTextarea from '../../atom/input-textarea';
import Select from '../../atom/select';
import SelectMultiple from '../../molecule/select-multiple';
import SelectOpponents from '../select-opponents';
import IconEditor from '../icon-editor';
import propTypes from './types';
import style from './style.css';
export const inputStyle = {
  default: style.defaultWidth,
  medium: style.mediumWidth,
  large: style.largeWidth
};
const buildInput = (childType, field) => {
  switch (childType) {
    case 'autoComplete':
      return /*#__PURE__*/React.createElement(Autocomplete, field);
    case 'iconEditor':
      return /*#__PURE__*/React.createElement(IconEditor, field);
    case 'inputText':
      return /*#__PURE__*/React.createElement(InputText, field);
    case 'inputTextArea':
      return /*#__PURE__*/React.createElement(InputTextarea, field);
    case 'select':
      return /*#__PURE__*/React.createElement(Select, field);
    case 'selectMultiple':
      return /*#__PURE__*/React.createElement(SelectMultiple, field);
    case 'selectOpponents':
      return /*#__PURE__*/React.createElement(SelectOpponents, field);
  }
};
const TitleAndInput = props => {
  const {
    title: {
      titleSize,
      subtitleSize,
      type,
      ...restTitleProps
    },
    field,
    childType
  } = props;
  const titleProps = {
    ...restTitleProps,
    titleSize: titleSize ?? 'medium',
    subtitleSize: subtitleSize ?? 'small-without-margin',
    type: type ?? 'form-group'
  };
  const input = buildInput(childType, field);
  const {
    size = 'default'
  } = field;
  const styleInput = childType === 'selectOpponents' ? style.selectOpponentsContainer : inputStyle[size];
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Title, titleProps), /*#__PURE__*/React.createElement("div", {
    className: styleInput
  }, input));
};
TitleAndInput.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
export default TitleAndInput;
//# sourceMappingURL=index.js.map