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 / CWidgetProgress

var CWidgetProgress = function CWidgetProgress(props) {
  var children = props.children,
      className = props.className,
      cssModule = props.cssModule,
      header = props.header,
      mainText = props.mainText,
      smallText = props.smallText,
      color = props.color,
      value = props.value,
      variant = props.variant,
      attributes = _objectWithoutProperties(props, ['children', 'className', 'cssModule', 'header', 'mainText', 'smallText', 'color', 'value', 'variant']);

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

  if (variant === 'inverse') {
    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 my-3', progress.style);

  return React.createElement(
    CCard,
    _extends({}, attributes, { className: classes }),
    React.createElement(
      'div',
      { className: 'h4 m-0' },
      header
    ),
    React.createElement(
      'div',
      null,
      mainText
    ),
    React.createElement(CProgress, { className: progress.style, color: progress.color, value: progress.value }),
    React.createElement(
      'small',
      { className: 'text-muted' },
      smallText
    ),
    React.createElement(
      'div',
      null,
      children
    )
  );
};

CWidgetProgress.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,
  mainText: PropTypes.string,
  smallText: PropTypes.string,
  color: PropTypes.string,
  value: PropTypes.string,
  variant: PropTypes.string
} : {};

CWidgetProgress.defaultProps = {
  header: '89.9%',
  mainText: 'Widget title',
  smallText: 'Widget helper text',
  // color: '',
  value: '25',
  variant: ''
};

export default CWidgetProgress;