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 * as React from 'react';
import classNames from 'classnames';
import { createUseStyles } from '@fluent-ui/styles';
import { styles } from './Progress.styled';
import { ProgressPropTypes } from './Progress.type';
export const name = 'Progress';
const useStyles = createUseStyles(styles, {
  name
});
const Progress = React.forwardRef((props, ref) => {
  const {
    as: Component = 'div',
    className: classNameProp,
    value,
    ...rest
  } = props;
  const isIndeterminate = !(typeof value === 'number');
  const transform = !isIndeterminate && value ? value - 100 : false;
  const classes = useStyles(props);
  const className = classNames(classes.root, classNameProp);
  const progressClassName = classNames(classes.progress, {
    [classes.isIndeterminate]: isIndeterminate
  });
  return React.createElement(Component, _extends({
    className: className,
    ref: ref
  }, rest), React.createElement("div", {
    className: progressClassName,
    style: transform ? {
      transform: `translateX(${transform}%)`
    } : {}
  }));
});
Progress.displayName = `F${name}`;
Progress.propTypes = ProgressPropTypes;
export default Progress;