/*---------------------------------------------------------------------------------------------
 * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
 * See LICENSE.md in the project root for license terms and full copyright notice.
 *--------------------------------------------------------------------------------------------*/
/** @packageDocumentation
 * @module ContentView
 */
import * as React from "react";
import { UiEvent } from "@itwin/appui-abstract";
import { ConfigurableCreateInfo, ConfigurableUiControl, ConfigurableUiControlType, } from "../configurableui/ConfigurableUiControl.js";
/** ContentControl Activated Event class.
 * @public
 * @deprecated in 4.13.0. This class should not be used by applications to instantiate objects.
 */
// eslint-disable-next-line @typescript-eslint/no-deprecated
export class ContentControlActivatedEvent extends UiEvent {
}
/** The base class for Frontstage content controls.
 * @public
 * @deprecated in 4.16.0. Extends a deprecated class {@link ConfigurableUiControl}.
 */
export class ContentControl extends ConfigurableUiControl {
    /** Creates an instance of ContentControl.
     * @param info         An object that the subclass must pass to this base class.
     * @param options      Options provided via the applicationData in a [[ContentProps]].
     */
    constructor(info, options) {
        super(info, options);
        this._keyAdded = false;
    }
    /** Called when this ContentControl is activated */
    onActivated() { }
    /** Called when this ContentControl is deactivated */
    onDeactivated() { }
    /** Gets the type of ConfigurableUiControl, which is 'Content' in this case */
    getType() {
        return ConfigurableUiControlType.Content;
    }
    /** Returns true if this control is a Viewport control. */
    get isViewport() {
        return false;
    }
    /** Returns the ScreenViewport if isViewport is true */
    get viewport() {
        return undefined;
    }
    getKeyedReactNode() {
        if (!this._keyAdded && React.isValidElement(this._reactNode)) {
            if (!this._reactNode.key) {
                const additionalProps = { key: this.uniqueId };
                this._reactNode = React.cloneElement(this._reactNode, additionalProps);
            }
            this._keyAdded = true;
        }
        return this._reactNode;
    }
    getReactNode() {
        return this.getKeyedReactNode();
    }
    /** The React node associated with this control. */
    get reactNode() {
        return this.getReactNode();
    }
    set reactNode(r) {
        this._reactNode = r;
    }
    /** Get the NavigationAidControl associated with this ContentControl */
    get navigationAidControl() {
        return "";
    }
}
/**
 * @beta
 * @deprecated in 4.16.0. Use {@link UiItemsProvider} to provide a floating {@link Widget} instead.
 * Additionally, use {@link ContentOverlay} component to display the active content indicator.
 */
export class FloatingContentControl extends ContentControl {
    constructor(uniqueId, name, node) {
        super(new ConfigurableCreateInfo(name, uniqueId, name), undefined);
        this._reactNode = node;
    }
}
//# sourceMappingURL=ContentControl.js.map