'use strict';

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

var _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; };

var _getClassName2 = require('babel-plugin-react-css-modules/dist/browser/getClassName');

var _getClassName3 = _interopRequireDefault(_getClassName2);

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _propTypes = require('prop-types');

var _propTypes2 = _interopRequireDefault(_propTypes);

var _classnames = require('classnames');

var _classnames2 = _interopRequireDefault(_classnames);

var _Background = require('../Background');

var _Background2 = _interopRequireDefault(_Background);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var _styleModuleImportMap = {
  './icon.scss': {
    'icon-xs': 'flive_icon_icon-xs',
    'icon-sm': 'flive_icon_icon-sm',
    'icon-md': 'flive_icon_icon-md',
    'icon-lg': 'flive_icon_icon-lg',
    'icon-auto': 'flive_icon_icon-auto',
    'circle': 'flive_icon_circle',
    'circle-xs': 'flive_icon_circle-xs',
    'circle-sm': 'flive_icon_circle-sm',
    'circle-md': 'flive_icon_circle-md',
    'circle-lg': 'flive_icon_circle-lg',
    'circle-auto': 'flive_icon_circle-auto',
    'circle-wrapper': 'flive_icon_circle-wrapper',
    'icon': 'flive_icon_icon',
    'icon-doc': 'flive_icon_icon-doc',
    'icon-app-launcher': 'flive_icon_icon-app-launcher',
    'icon-sigfox': 'flive_icon_icon-sigfox',
    'icon-trash': 'flive_icon_icon-trash',
    'icon-certification': 'flive_icon_icon-certification',
    'icon-eye': 'flive_icon_icon-eye',
    'icon-eye-off': 'flive_icon_icon-eye-off',
    'icon-ok-circle': 'flive_icon_icon-ok-circle',
    'icon-world': 'flive_icon_icon-world',
    'icon-ok-ellipsis': 'flive_icon_icon-ok-ellipsis',
    'icon-attach': 'flive_icon_icon-attach',
    'icon-link': 'flive_icon_icon-link',
    'icon-briefcase': 'flive_icon_icon-briefcase',
    'icon-sdr-dongle': 'flive_icon_icon-sdr-dongle',
    'icon-technical-quickstart': 'flive_icon_icon-technical-quickstart',
    'icon-mail': 'flive_icon_icon-mail',
    'icon-location': 'flive_icon_icon-location',
    'icon-resize-cover': 'flive_icon_icon-resize-cover',
    'icon-resize-contain': 'flive_icon_icon-resize-contain',
    'icon-search': 'flive_icon_icon-search',
    'icon-phone': 'flive_icon_icon-phone',
    'icon-signal': 'flive_icon_icon-signal',
    'icon-certificate-outline': 'flive_icon_icon-certificate-outline',
    'icon-integrator': 'flive_icon_icon-integrator',
    'icon-soc': 'flive_icon_icon-soc',
    'icon-software-partner': 'flive_icon_icon-software-partner',
    'icon-kit-maker': 'flive_icon_icon-kit-maker',
    'icon-solution': 'flive_icon_icon-solution',
    'icon-solution-provider': 'flive_icon_icon-solution-provider',
    'icon-kit': 'flive_icon_icon-kit',
    'icon-chip-maker': 'flive_icon_icon-chip-maker',
    'icon-manufacturer': 'flive_icon_icon-manufacturer',
    'icon-tech-hub': 'flive_icon_icon-tech-hub',
    'icon-transceiver': 'flive_icon_icon-transceiver',
    'icon-consulting-company': 'flive_icon_icon-consulting-company',
    'icon-consulting': 'flive_icon_icon-consulting',
    'icon-module-maker': 'flive_icon_icon-module-maker',
    'icon-utilities': 'flive_icon_icon-utilities',
    'icon-module': 'flive_icon_icon-module',
    'icon-na': 'flive_icon_icon-na',
    'icon-contact': 'flive_icon_icon-contact',
    'icon-design-house': 'flive_icon_icon-design-house',
    'icon-platform-provider': 'flive_icon_icon-platform-provider',
    'icon-platform': 'flive_icon_icon-platform',
    'icon-device-maker': 'flive_icon_icon-device-maker',
    'icon-design': 'flive_icon_icon-design',
    'icon-device': 'flive_icon_icon-device',
    'icon-distributor': 'flive_icon_icon-distributor',
    'icon-service': 'flive_icon_icon-service',
    'icon-edit': 'flive_icon_icon-edit',
    'icon-development': 'flive_icon_icon-development',
    'icon-industrialization': 'flive_icon_icon-industrialization',
    'icon-library': 'flive_icon_icon-library',
    'icon-start': 'flive_icon_icon-start',
    'icon-study': 'flive_icon_icon-study',
    'icon-down': 'flive_icon_icon-down',
    'icon-left': 'flive_icon_icon-left',
    'icon-right': 'flive_icon_icon-right',
    'icon-up': 'flive_icon_icon-up',
    'icon-resize-full': 'flive_icon_icon-resize-full',
    'icon-resize-small': 'flive_icon_icon-resize-small',
    'icon-account': 'flive_icon_icon-account',
    'icon-basket': 'flive_icon_icon-basket',
    'icon-card': 'flive_icon_icon-card',
    'icon-antenna-designer': 'flive_icon_icon-antenna-designer',
    'icon-refdesign': 'flive_icon_icon-refdesign',
    'icon-wrench': 'flive_icon_icon-wrench',
    'icon-sigfox-operator': 'flive_icon_icon-sigfox-operator',
    'icon-test-house': 'flive_icon_icon-test-house',
    'icon-security-expert': 'flive_icon_icon-security-expert',
    'icon-secure-element': 'flive_icon_icon-secure-element',
    'icon-company': 'flive_icon_icon-company',
    'icon-cloud-platform-provider': 'flive_icon_icon-cloud-platform-provider',
    'icon-cloud-platform': 'flive_icon_icon-cloud-platform',
    'icon-user': 'flive_icon_icon-user',
    'icon-doc-text': 'flive_icon_icon-doc-text',
    'icon-battery': 'flive_icon_icon-battery',
    'icon-sigfox-id': 'flive_icon_icon-sigfox-id',
    'icon-close': 'flive_icon_icon-close'
  }
};

function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }

// eslint-disable-line no-unused-vars

var propTypes = {
  /** @ignore */
  className: _propTypes2.default.string,
  name: _propTypes2.default.string.isRequired,
  variant: _propTypes2.default.oneOf(['primary', 'circle']),
  size: _propTypes2.default.oneOf(['xs', 'sm', 'md', 'lg', 'auto'])
};

var defaultProps = {
  className: undefined,
  variant: 'primary',
  size: 'sm'
};

var Icon = function Icon(_ref) {
  var name = _ref.name,
      size = _ref.size,
      className = _ref.className,
      variant = _ref.variant,
      props = _objectWithoutProperties(_ref, ['name', 'size', 'className', 'variant']);

  switch (variant) {
    case 'circle':
      return _react2.default.createElement(
        'div',
        { className: (className ? className + ' ' : '') + 'flive_icon_circle-wrapper' },
        _react2.default.createElement(
          _Background2.default,
          _extends({}, props, {
            className: (0, _getClassName3.default)((0, _classnames2.default)('circle', 'circle-' + size), _styleModuleImportMap)
          }),
          _react2.default.createElement('i', {
            className: (0, _getClassName3.default)((0, _classnames2.default)('icon', 'icon-' + name, 'icon-auto'), _styleModuleImportMap)
          })
        )
      );
    case 'primary':
    default:
      return _react2.default.createElement(_Background2.default, _extends({
        component: 'i'
      }, props, {
        className: (className ? className + ' ' : '') + (0, _getClassName3.default)((0, _classnames2.default)('icon', 'icon-' + name, 'icon-' + size), _styleModuleImportMap)
      }));
  }
};

Icon.propTypes = propTypes;
Icon.defaultProps = defaultProps;

exports.default = Icon;
module.exports = exports['default'];