office-ui-fabric-react
Version: 
Reusable React components for building experiences for Office 365.
41 lines • 2.66 kB
JavaScript
define(["require", "exports", "tslib", "react", "../../Utilities", "./ProgressIndicator.scss"], function (require, exports, tslib_1, React, Utilities_1, stylesImport) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    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 = (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, label = _a.label, description = _a.description, percentComplete = _a.percentComplete, className = _a.className, ariaValueText = _a.ariaValueText;
            // Handle deprecated value.
            if (title) {
                label = title;
            }
            percentComplete = Math.min(100, Math.max(0, percentComplete * 100));
            return (React.createElement("div", { className: Utilities_1.css('ms-ProgressIndicator', styles.root, className) },
                React.createElement("div", { className: Utilities_1.css('ms-ProgressIndicator-itemName', styles.itemName) }, label),
                React.createElement("div", { className: Utilities_1.css('ms-ProgressIndicator-itemProgress', styles.itemProgress) },
                    React.createElement("div", { className: Utilities_1.css('ms-ProgressIndicator-progressTrack', styles.progressTrack) }),
                    React.createElement("div", { className: Utilities_1.css('ms-ProgressIndicator-progressBar', styles.progressBar, percentComplete > ZERO_THRESHOLD && 'smoothTransition'), style: { width: percentComplete + '%' }, role: 'progressbar', "aria-valuemin": '0', "aria-valuemax": '100', "aria-valuenow": percentComplete.toFixed().toString(), "aria-valuetext": ariaValueText })),
                React.createElement("div", { className: Utilities_1.css('ms-ProgressIndicator-itemDescription', styles.itemDescription) }, description)));
        };
        ProgressIndicator.defaultProps = {
            label: '',
            description: '',
            percentComplete: 0,
            width: 180
        };
        return ProgressIndicator;
    }(Utilities_1.BaseComponent));
    exports.ProgressIndicator = ProgressIndicator;
});
//# sourceMappingURL=ProgressIndicator.js.map