import React from 'react';
import { st, classes } from './StatusIndicator.st.css.js';
import Tooltip from '../Tooltip';
import { FormFieldSuccessFilled, FormFieldWarningFilled, FormFieldErrorFilled, } from '@wix/wix-ui-icons-common/system';
import Loader from '../Loader';
import { dataHooks, STATUS, TOOLTIP_PLACEMENT, } from './StatusIndicator.constants';
const statusToIconMap = {
    success: React.createElement(FormFieldSuccessFilled, null),
    warning: React.createElement(FormFieldWarningFilled, null),
    loading: React.createElement(Loader, { size: "tiny" }),
    error: React.createElement(FormFieldErrorFilled, null),
};
const StatusIndicator = ({ dataHook, status = STATUS.ERROR, message, tooltipPlacement = TOOLTIP_PLACEMENT.TOP, className, tooltipProps, }) => {
    const icon = statusToIconMap[status];
    const renderIcon = () => {
        if (message) {
            return (React.createElement("span", { tabIndex: 0, className: classes.iconWrapper }, icon));
        }
        return icon;
    };
    return (React.createElement("div", { className: st(classes.root, { status }, className), "data-hook": dataHook, "data-status": status }, message ? (React.createElement(Tooltip, { dataHook: dataHooks.tooltip, appendTo: "window", placement: tooltipPlacement, exitDelay: 100, content: message, maxWidth: 250, ...tooltipProps }, renderIcon())) : (icon)));
};
StatusIndicator.displayName = 'StatusIndicator';
export default StatusIndicator;
//# sourceMappingURL=StatusIndicator.js.map