/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
/** @packageDocumentation
 * @module Notification
 */
import "./StickyMessage.scss";
import * as React from "react";
import classnames from "classnames";
import { Message, MessageButton, MessageLayout, StatusHelpers, } from "@itwin/appui-layout-react";
import { MessageLabel } from "./MessageLabel";
import { HollowIcon } from "./HollowIcon";
import { Icon, MessageContainer } from "@itwin/core-react";
/** Sticky Message React component
 * @public
 * @deprecated in 3.3. Replaced by Toaster from @itwin/itwinui-react.
 */
export function StickyMessage(props) {
    const { id, messageDetails, severity, closeMessage } = props;
    const [closing, setClosing] = React.useState(false);
    const handleClose = () => {
        setClosing(true);
        setTimeout(() => closeMessage(id), 500);
    };
    const classNames = classnames("uifw-statusbar-sticky-message", closing && "uifw-closing");
    return (React.createElement("div", { className: classNames },
        React.createElement(Message // eslint-disable-line deprecation/deprecation
        , { status: StatusHelpers.severityToStatus(severity), icon: React.createElement(HollowIcon, { iconSpec: MessageContainer.getIconClassName(severity, true) }) },
            React.createElement(MessageLayout, { buttons: React.createElement(MessageButton, { onClick: handleClose, className: "uifw-statusbar-sticky-close" },
                    React.createElement(Icon, { iconSpec: "icon-close" })) },
                React.createElement(MessageLabel, { message: messageDetails.briefMessage, className: "uifw-statusbar-message-brief" }),
                messageDetails.detailedMessage && (React.createElement(MessageLabel, { message: messageDetails.detailedMessage, className: "uifw-statusbar-message-detailed" }))))));
}
//# sourceMappingURL=StickyMessage.js.map