import React, { Component, } from 'react';
import classNames from 'classnames';
import { isNil } from '../../services/predicate';
const sizeToClassNameMap = {
    xs: 'softProgress--xs',
    s: 'softProgress--s',
    m: 'softProgress--m',
    l: 'softProgress--l',
};
export const SIZES = Object.keys(sizeToClassNameMap);
const colorToClassNameMap = {
    primary: 'softProgress--primary',
    secondary: 'softProgress--secondary',
    danger: 'softProgress--danger',
    subdued: 'softProgress--subdued',
    accent: 'softProgress--accent',
};
export const COLORS = Object.keys(colorToClassNameMap);
const positionsToClassNameMap = {
    fixed: 'softProgress--fixed',
    absolute: 'softProgress--absolute',
    static: '',
};
export const POSITIONS = Object.keys(positionsToClassNameMap);
export class SoftProgress extends Component {
    render() {
        let { className, color, size, position, max, value, ...rest } = this.props;
        const determinate = !isNil(max);
        const classes = classNames('softProgress', {
            'softProgress--indeterminate': !determinate,
            'softProgress--native': determinate,
        }, sizeToClassNameMap[size], colorToClassNameMap[color], positionsToClassNameMap[position], className);
        // Because of a Firefox animation issue, indeterminate progress needs to not use <progress />.
        // See https://css-tricks.com/html5-progress-element/
        if (determinate) {
            return (React.createElement("progress", Object.assign({ className: classes, max: max, value: value }, rest)));
        }
        else {
            return (React.createElement("div", Object.assign({ className: classes }, rest)));
        }
    }
}
SoftProgress.defaultProps = { color: 'secondary', size: 'm', position: 'static' };
//# sourceMappingURL=SoftProgress.js.map