var __rest = (this && this.__rest) || function (s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                t[p[i]] = s[p[i]];
        }
    return t;
};
import React from 'react';
import { LinearProgress as MuiLinearProgress } from '@material-ui/core';
import { makeStyles } from '@material-ui/core/styles';
import clsx from 'clsx';
const useStyles = makeStyles((theme) => ({
    root: {
        backgroundColor: theme.palette.grey[300]
    },
    barColorPrimary: {
        backgroundColor: theme.palette.primary.main
    },
    barColorSecondary: {
        backgroundColor: theme.palette.secondary.main
    },
    barColorSuccess: {
        backgroundColor: theme.palette.success.main
    },
    barColorError: {
        backgroundColor: theme.palette.error.main
    },
    barColorWarning: {
        backgroundColor: theme.palette.warning.main
    },
    barColorInfo: {
        backgroundColor: theme.palette.info.main
    },
    // Custom bar color class
    customColorBar: (props) => ({
        backgroundColor: props.color
    })
}));
export const LinearProgress = (props) => {
    const { variant = 'indeterminate', value, color = 'primary' } = props, otherProps = __rest(props, ["variant", "value", "color"]);
    const isPredefinedColor = [
        'primary',
        'secondary',
        'success',
        'error',
        'warning',
        'info'
    ].includes(color);
    const classes = useStyles({ color });
    return (React.createElement(MuiLinearProgress, Object.assign({}, otherProps, { variant: variant, value: value, classes: {
            root: classes.root,
            bar: clsx({
                [classes.barColorPrimary]: color === 'primary',
                [classes.barColorSecondary]: color === 'secondary',
                [classes.barColorSuccess]: color === 'success',
                [classes.barColorError]: color === 'error',
                [classes.barColorWarning]: color === 'warning',
                [classes.barColorInfo]: color === 'info',
                [classes.customColorBar]: !isPredefinedColor
            })
        } })));
};
//# sourceMappingURL=LinearProgress.js.map