import _extends from "@babel/runtime/helpers/extends";
// Copyright 1999-2020. Plesk International GmbH. All rights reserved.
import React, { useContext } from 'react';
import classNames from 'classnames';
import { CLS_PREFIX } from '../../constants';
import ProgressIndicator from './ProgressIndicator';
import OnDarkContext from '../OnDarkContext';

const ProgressBar = ({
  baseClassName = "".concat(CLS_PREFIX, "progress-bar"),
  className,
  intent,
  progress = -1,
  ...props
}) => /*#__PURE__*/React.createElement("div", _extends({
  className: classNames(baseClassName, {
    ["".concat(baseClassName, "--on-dark")]: useContext(OnDarkContext)
  }, className),
  "aria-valuemin": 0,
  "aria-valuemax": 100,
  "aria-valuenow": progress >= 0 && progress <= 100 ? progress : undefined,
  role: "progressbar"
}, props), /*#__PURE__*/React.createElement(ProgressIndicator, {
  intent: intent,
  progress: progress
}));

export default ProgressBar;