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 from 'react';
import { Wrapper, Label, Description, InputWrapper } from './inputComponents.styles';
import { ColorSelector1, ColorSelector2 } from './ColorSelectors';
import { RadioButtons1, RadioButtonsList1, RadioButtonsList2 } from './RadioButtons';
import NumberInput from './NumberInput';
import TextInput from './TextInput';
import RadioButtonsExpandable from './RadioButtonsExpandable';
import RadioButtonsImages from './RadioButtonsImages';
import Dropdown from './Dropdown';
import Slider from './Slider';
import PriceQuantityInput from './PriceQuantityInput';
import Switch from '@material-ui/core/Switch';
export { ColorSelector1, ColorSelector2, RadioButtons1, RadioButtonsImages, RadioButtonsList1, RadioButtonsList2, NumberInput, RadioButtonsExpandable, Dropdown, Slider, PriceQuantityInput, Switch };

const DefaultInputContainer = ({
  label,
  description,
  children,
  index,
  languageData
}) => {
  return /*#__PURE__*/React.createElement(Wrapper, {
    className: `input-component ${label.split(' ').join('-').toLowerCase()}`
  }, label && index === 0 && /*#__PURE__*/React.createElement(Label, {
    className: "input-label"
  }, languageData && Object.entries(languageData).length !== 0 && languageData[label] ? languageData[label] : label), description && /*#__PURE__*/React.createElement(Description, {
    className: "input-description"
  }, description), /*#__PURE__*/React.createElement(InputWrapper, {
    className: "input-wrapper"
  }, children));
};

export default (({
  label,
  description,
  type,
  data,
  value,
  index,
  onChange,
  cssClass,
  languageData
}) => {
  switch (type) {
    case 'toggle':
      return /*#__PURE__*/React.createElement(DefaultInputContainer, {
        languageData: languageData,
        index: index,
        label: label,
        description: description
      }, /*#__PURE__*/React.createElement(Switch, {
        value: "checkedA",
        inputProps: {
          'aria-label': 'Switch B'
        }
      }));

    case 'color':
    case 'color-1':
      return /*#__PURE__*/React.createElement(DefaultInputContainer, {
        languageData: languageData,
        index: index,
        label: label,
        description: description
      }, /*#__PURE__*/React.createElement(ColorSelector1, _extends({
        languageData: languageData,
        cssClass: cssClass
      }, data, {
        value: value,
        onChange: onChange
      })));

    case 'color-2':
      return /*#__PURE__*/React.createElement(DefaultInputContainer, {
        languageData: languageData,
        index: index,
        label: label,
        description: description
      }, /*#__PURE__*/React.createElement(ColorSelector2, _extends({
        languageData: languageData,
        cssClass: cssClass
      }, data, {
        value: value,
        onChange: onChange
      })));

    case 'dropdown':
    case 'dropdown-1':
      return /*#__PURE__*/React.createElement(DefaultInputContainer, {
        languageData: languageData,
        index: index,
        label: label,
        description: description
      }, /*#__PURE__*/React.createElement(Dropdown, _extends({
        languageData: languageData,
        cssClass: cssClass
      }, data, {
        value: value,
        onChange: onChange
      })));

    case 'radioButtonsList':
    case 'radioButtonsList-1':
      return /*#__PURE__*/React.createElement(DefaultInputContainer, {
        languageData: languageData,
        index: index,
        label: label,
        description: description
      }, /*#__PURE__*/React.createElement(RadioButtonsList1, _extends({
        languageData: languageData,
        cssClass: cssClass
      }, data, {
        value: value,
        onChange: onChange
      })));

    case 'radioButtonsList-2':
      return /*#__PURE__*/React.createElement(DefaultInputContainer, {
        languageData: languageData,
        index: index,
        label: label,
        description: description
      }, /*#__PURE__*/React.createElement(RadioButtonsList2, _extends({
        languageData: languageData,
        cssClass: cssClass
      }, data, {
        value: value,
        onChange: onChange
      })));

    case 'radioButtons':
    case 'radioButtons-1':
      return /*#__PURE__*/React.createElement(DefaultInputContainer, {
        languageData: languageData,
        index: index,
        label: label,
        description: description
      }, /*#__PURE__*/React.createElement(RadioButtons1, _extends({
        languageData: languageData,
        cssClass: cssClass
      }, data, {
        value: value,
        onChange: onChange
      })));

    case 'RadioButtonsExpandable':
    case 'RadioButtonsExpandable-1':
      return /*#__PURE__*/React.createElement(DefaultInputContainer, {
        languageData: languageData,
        index: index,
        label: label,
        description: description
      }, /*#__PURE__*/React.createElement(RadioButtonsExpandable, _extends({
        languageData: languageData,
        cssClass: cssClass
      }, data, {
        value: value,
        onChange: onChange
      })));

    case 'RadioButtonsImages':
    case 'RadioButtonsImages-1':
      return /*#__PURE__*/React.createElement(DefaultInputContainer, {
        languageData: languageData,
        index: index,
        label: label,
        description: description
      }, /*#__PURE__*/React.createElement(RadioButtonsImages, _extends({
        languageData: languageData,
        cssClass: cssClass
      }, data, {
        value: value,
        onChange: onChange
      })));

    case 'slider':
      return /*#__PURE__*/React.createElement(DefaultInputContainer, {
        languageData: languageData,
        index: index,
        label: label,
        description: description
      }, /*#__PURE__*/React.createElement(Slider, _extends({
        languageData: languageData,
        cssClass: cssClass
      }, data, {
        value: value,
        onChange: onChange
      })));

    case 'numberInput':
    case 'numberInput-1':
      return /*#__PURE__*/React.createElement(DefaultInputContainer, {
        languageData: languageData,
        index: index,
        label: label,
        description: description
      }, /*#__PURE__*/React.createElement(NumberInput, _extends({
        languageData: languageData,
        cssClass: cssClass
      }, data, {
        value: value,
        onChange: onChange
      })));

    case 'textInput':
    case 'textInput-1':
      return /*#__PURE__*/React.createElement(DefaultInputContainer, {
        languageData: languageData,
        index: index,
        label: label,
        description: description
      }, /*#__PURE__*/React.createElement(TextInput, _extends({
        languageData: languageData,
        cssClass: cssClass
      }, data, {
        value: value,
        onChange: onChange
      })));

    case 'priceQuantity-1':
    case 'priceQuantity':
      return /*#__PURE__*/React.createElement(PriceQuantityInput, _extends({
        index: index
      }, data, {
        value: value,
        onChange: onChange
      }));

    default:
      return null;
  }
});