import * as tslib_1 from "tslib";
/* tslint:disable:no-unused-variable */
import * as React from 'react';
/* tslint:enable:no-unused-variable */
import { BaseComponent, css } from '../../Utilities';
import * as stylesImport from './ProgressIndicator.scss';
var styles = stylesImport;
// if the percentComplete is near 0, don't animate it.
// This prevents animations on reset to 0 scenarios
var ZERO_THRESHOLD = 0.01;
var ProgressIndicator = /** @class */ (function (_super) {
    tslib_1.__extends(ProgressIndicator, _super);
    function ProgressIndicator(props) {
        var _this = _super.call(this, props) || this;
        _this._warnDeprecations({
            title: 'label'
        });
        return _this;
    }
    ProgressIndicator.prototype.render = function () {
        var _a = this.props, title = _a.title, description = _a.description, className = _a.className, ariaValueText = _a.ariaValueText;
        var _b = this.props, label = _b.label, percentComplete = _b.percentComplete;
        // Handle deprecated value.
        if (title) {
            label = title;
        }
        if (this.props.percentComplete !== undefined) {
            percentComplete = Math.min(100, Math.max(0, percentComplete * 100));
        }
        return (React.createElement("div", { className: css('ms-ProgressIndicator', styles.root, className) },
            React.createElement("div", { className: css('ms-ProgressIndicator-itemName', styles.itemName) }, label),
            React.createElement("div", { className: css('ms-ProgressIndicator-itemProgress', styles.itemProgress) },
                React.createElement("div", { className: css('ms-ProgressIndicator-progressTrack', styles.progressTrack) }),
                React.createElement("div", { className: css('ms-ProgressIndicator-progressBar', styles.progressBar, percentComplete && percentComplete > ZERO_THRESHOLD && 'smoothTransition', percentComplete === undefined && styles.indeterminate), style: percentComplete !== undefined ? { width: percentComplete + '%' } : undefined, role: 'progressbar', "aria-valuemin": '0', "aria-valuemax": '100', "aria-valuenow": percentComplete && percentComplete.toFixed().toString(), "aria-valuetext": ariaValueText })),
            React.createElement("div", { className: css('ms-ProgressIndicator-itemDescription', styles.itemDescription) }, description)));
    };
    ProgressIndicator.defaultProps = {
        label: '',
        description: '',
        width: 180
    };
    return ProgressIndicator;
}(BaseComponent));
export { ProgressIndicator };
//# sourceMappingURL=ProgressIndicator.js.map