"use strict";
/* @flow */
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
    result["default"] = mod;
    return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const React = __importStar(require("react"));
{
    LinearProgressBarProps;
}
from;
'./types';
const prop_types_1 = __importDefault(require("prop-types"));
const classnames_1 = __importDefault(require("classnames"));
const lodash_1 = __importDefault(require("lodash"));
const withStyles_1 = __importDefault(require("components/hoc/withStyles"));
const ErrorBoundary_1 = __importDefault(require("components/hoc/ErrorBoundary"));
const styles_1 = __importDefault(require("./styles"));
class LinearProgressBar extends React.Component {
    _renderProgressBar() {
        const { classes, showParts } = this.props;
        return (React.createElement("div", { className: classes.progressBar },
            React.createElement("div", { className: classes.filledBar }),
            showParts && (React.createElement("div", { className: classes.parts }, lodash_1.default.range(0, 10).map(index => (React.createElement("div", { key: index, className: classnames_1.default(classes.part, { hide: index === 0 }), style: { left: `${index * 10}%` } })))))));
    }
    render() {
        const { classes, label, showPercentage, value } = this.props;
        return (React.createElement(ErrorBoundary_1.default, null,
            React.createElement("div", { className: classes.component },
                Boolean(label) && React.createElement("div", { className: classes.label }, label),
                this._renderProgressBar(),
                showPercentage && React.createElement("div", { className: classes.percentage },
                    value,
                    "%"))));
    }
}
LinearProgressBar.propTypes = {
    label: prop_types_1.default.string,
    showPercentage: prop_types_1.default.bool,
    showParts: prop_types_1.default.bool,
    filledColor: prop_types_1.default.string,
    unfilledColor: prop_types_1.default.string,
    value: prop_types_1.default.number,
    rounded: prop_types_1.default.bool,
    width: prop_types_1.default.number,
    classes: prop_types_1.default.object,
};
LinearProgressBar.defaultProps = {
    unfilledColor: '#f5f5f5',
    filledColor: '#2bc88f',
    showParts: true,
    showPercentage: true,
    rounded: true,
    width: 200,
};
exports.default = withStyles_1.default(styles_1.default)(LinearProgressBar);
//# sourceMappingURL=index.js.map