import React, { Fragment, PureComponent } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { SOFT_TITLE_SIZES as TITLE_SIZES } from '../Title/SoftTitle';
import { SoftFlexGroup, SoftFlexItem } from '../Flex';
import { SoftSpacer } from '../spacer';
import { SoftIcon, COLORS, TYPES } from '../Icon/SoftIcon';
import { SoftText, SoftTextColor } from '../Text';
import { SoftTitle } from '../Title';
export class SoftEmptyPrompt extends PureComponent {
    render() {
        let { iconType, iconColor, title, titleSize, body, actions, className, ...rest } = this.props;
        const classes = classNames('softEmptyPrompt', className);
        let icon;
        if (iconType) {
            icon = (React.createElement(Fragment, null,
                React.createElement(SoftIcon, { type: iconType, size: "xxl", color: iconColor }),
                React.createElement(SoftSpacer, { size: "s" })));
        }
        let content;
        if (body || title) {
            let titleEl;
            if (title) {
                titleEl = (React.createElement(Fragment, null,
                    React.createElement(SoftTitle, { size: titleSize }, title),
                    React.createElement(SoftSpacer, { size: "m" })));
            }
            let bodyEl;
            if (body) {
                bodyEl = (React.createElement(Fragment, null,
                    React.createElement(SoftText, null, body)));
            }
            content = (React.createElement(SoftTextColor, { color: "subdued" },
                titleEl,
                bodyEl));
        }
        let actionsEl;
        if (actions) {
            let actionsRow;
            if (Array.isArray(actions)) {
                actionsRow = (React.createElement(SoftFlexGroup, { gutterSize: "m", alignItems: "center", justifyContent: "center", direction: "column" }, actions.map((action, index) => (React.createElement(SoftFlexItem, { key: index, grow: false }, action)))));
            }
            else {
                actionsRow = actions;
            }
            actionsEl = (React.createElement(Fragment, null,
                React.createElement(SoftSpacer, { size: "s" }),
                actionsRow));
        }
        return (React.createElement("div", Object.assign({ className: classes }, rest),
            icon,
            content,
            body && actions &&
                React.createElement(SoftSpacer, { size: "l" }),
            actionsEl));
    }
}
SoftEmptyPrompt.defaultProps = {
    iconColor: 'subdued',
};
SoftEmptyPrompt.propTypes = {
    iconType: PropTypes.oneOf(TYPES),
    /**
     * Pass `null` to use original icon color
     */
    iconColor: PropTypes.oneOf(COLORS),
    title: PropTypes.node,
    titleSize: PropTypes.oneOf(TITLE_SIZES),
    body: PropTypes.node,
    actions: PropTypes.node,
    className: PropTypes.string,
};
//# sourceMappingURL=SoftEmptyPrompt.js.map