'use strict';

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

var _tslib = require('../../_virtual/_tslib.js');
var React = require('react');
var styles = require('./styles.js');
var index = require('../../utils/index.js');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var React__default = /*#__PURE__*/_interopDefaultLegacy(React);

function ProgressBar(_a) {
    var { percentage, label, labelDetails, assistiveText, color = 'primary', variant = 'default' } = _a, props = _tslib.__rest(_a, ["percentage", "label", "labelDetails", "assistiveText", "color", "variant"]);
    if (percentage < 0 || percentage > 100) {
        console.warn('Component with wrong percentage value ', percentage);
        return null;
    }
    const appendTestId = index.getId(props['data-testid']);
    const appendTrackId = index.getId(props['data-testid']);
    return (React__default['default'].createElement(styles.ProgressBarContainer, { "data-testid": appendTestId('progress-bar'), "data-trackid": appendTrackId('progress-bar'), "aria-label": props['aria-label'] },
        (label || labelDetails) && (React__default['default'].createElement(styles.ProgressBarHeader, null,
            React__default['default'].createElement(styles.LabelText, null, label),
            React__default['default'].createElement(styles.LabelDetailsText, null, labelDetails))),
        React__default['default'].createElement(styles.ProgressBarEmpty, null, variant === 'default' ? (React__default['default'].createElement(styles.ProgressBarFiller, { color: color, width: percentage })) : (React__default['default'].createElement(styles.IndeterminateProgressBarFiller, { color: color, width: percentage }))),
        assistiveText && React__default['default'].createElement(styles.AssistiveText, null, assistiveText)));
}

exports.ProgressBar = ProgressBar;
