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

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

import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';

import { mapToCssModules, omit, pick, TransitionPropTypeKeys, TransitionTimeouts, tagPropType } from './Shared/helper.js';
//
import CCard from './CCard';
import CProgress from './CProgress';
import CCardBody from './CCardBody';
//import CCardHeader from './CCardHeader';
//import CCardFooter from './CCardFooter';

//component - CoreUI / CWidget4

var CWidgetProgressIcon = function CWidgetProgressIcon(props) {
  var children = props.children,
      className = props.className,
      cssModule = props.cssModule,
      header = props.header,
      value = props.value,
      icon = props.icon,
      color = props.color,
      invert = props.invert,
      attributes = _objectWithoutProperties(props, ['children', 'className', 'cssModule', 'header', 'value', 'icon', 'color', 'invert']);

  var progress = { style: '', color: color, value: value };
  var card = { style: '', bgColor: '', icon: 'icon ' + icon };

  if (invert) {
    progress.style = 'progress-white';
    progress.color = '';
    card.style = 'text-white';
    card.bgColor = 'bg-' + color;
  }

  var classes = mapToCssModules(classNames(className, card.style, card.bgColor), cssModule);
  progress.style = classNames('progress-xs mt-3 mb-0', progress.style);

  return React.createElement(
    CCard,
    _extends({}, attributes, { className: classes }),
    React.createElement(
      'div',
      { className: 'h1 text-muted text-right mb-4' },
      React.createElement('i', { className: card.icon })
    ),
    React.createElement(
      'div',
      { className: 'text-value-lg' },
      header
    ),
    React.createElement(
      'small',
      { className: 'text-muted text-uppercase font-weight-bold' },
      children
    ),
    React.createElement(CProgress, { className: progress.style, color: progress.color, value: progress.value })
  );
};

CWidgetProgressIcon.propTypes = process.env.NODE_ENV !== "production" ? {
  children: PropTypes.node,
  className: PropTypes.string,
  cssModule: PropTypes.object,
  //
  innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func, PropTypes.string]),
  header: PropTypes.string,
  icon: PropTypes.string,
  color: PropTypes.string,
  value: PropTypes.string,
  invert: PropTypes.bool
} : {};

CWidgetProgressIcon.defaultProps = {
  header: '87.500',
  icon: 'cil-people',
  color: 'info',
  value: '25',
  children: 'Visitors',
  invert: false
};

export default CWidgetProgressIcon;