/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
/* eslint-disable deprecation/deprecation */
/** @packageDocumentation
 * @module Frontstage
 */
import "./StagePanelHeader.scss";
import classnames from "classnames";
import * as React from "react";
import { StagePanelState } from "./StagePanelDef";
import { UiFramework } from "../UiFramework";
/** Stage panel header React component.
 * @alpha @deprecated in 3.0. UI 1.0 will be removed in AppUi 4.0.
 */
export class StagePanelHeader extends React.PureComponent {
    constructor() {
        super(...arguments);
        this._handleCollapseButtonClick = () => {
            const activeFrontstageDef = UiFramework.frontstages.activeFrontstageDef;
            // istanbul ignore if
            if (!activeFrontstageDef)
                return;
            const stagePanel = activeFrontstageDef.getStagePanelDef(this.props.location);
            // istanbul ignore if
            if (!stagePanel)
                return;
            stagePanel.panelState = StagePanelState.Minimized;
        };
    }
    render() {
        const className = classnames("uifw-stagepanelheader", this.props.className);
        return (React.createElement("div", { className: className, style: this.props.style },
            React.createElement("span", null, this.props.title),
            this.props.collapseButton ?
                // eslint-disable-next-line jsx-a11y/click-events-have-key-events
                React.createElement("i", { className: "uifw-collapse icon icon-close", title: this.props.collapseButtonTitle, onClick: this._handleCollapseButtonClick, role: "button", tabIndex: -1 }) :
                undefined));
    }
}
//# sourceMappingURL=StagePanelHeader.js.map