"use strict";
/*---------------------------------------------------------------------------------------------
* 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
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.StickyMessage = void 0;
require("./StickyMessage.scss");
const React = require("react");
const classnames_1 = require("classnames");
const appui_layout_react_1 = require("@itwin/appui-layout-react");
const MessageLabel_1 = require("./MessageLabel");
const HollowIcon_1 = require("./HollowIcon");
const core_react_1 = require("@itwin/core-react");
/** Sticky Message React component
 * @public
 * @deprecated in 3.3. Replaced by Toaster from @itwin/itwinui-react.
 */
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 = (0, classnames_1.default)("uifw-statusbar-sticky-message", closing && "uifw-closing");
    return (React.createElement("div", { className: classNames },
        React.createElement(appui_layout_react_1.Message // eslint-disable-line deprecation/deprecation
        , { status: appui_layout_react_1.StatusHelpers.severityToStatus(severity), icon: React.createElement(HollowIcon_1.HollowIcon, { iconSpec: core_react_1.MessageContainer.getIconClassName(severity, true) }) },
            React.createElement(appui_layout_react_1.MessageLayout, { buttons: React.createElement(appui_layout_react_1.MessageButton, { onClick: handleClose, className: "uifw-statusbar-sticky-close" },
                    React.createElement(core_react_1.Icon, { iconSpec: "icon-close" })) },
                React.createElement(MessageLabel_1.MessageLabel, { message: messageDetails.briefMessage, className: "uifw-statusbar-message-brief" }),
                messageDetails.detailedMessage && (React.createElement(MessageLabel_1.MessageLabel, { message: messageDetails.detailedMessage, className: "uifw-statusbar-message-detailed" }))))));
}
exports.StickyMessage = StickyMessage;
//# sourceMappingURL=StickyMessage.js.map