/*---------------------------------------------------------------------------------------------
 * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
 * See LICENSE.md in the project root for license terms and full copyright notice.
 *--------------------------------------------------------------------------------------------*/
/** @packageDocumentation
 * @module StatusBar
 */
import * as React from "react";
import { Popover } from "@itwin/itwinui-react";
import { ButtonExpandIndicator } from "./ExpandIndicator";
import { PopupContext } from "@itwin/core-react";
/** Popover component used in `StatusBar` component.
 * This component should wrap the element that triggers the popover.
 * @note Add the `StatusBarPopover.ExpandIndicator` to popover trigger buttons.
 * @public
 */
export function StatusBarPopover({ content, ...props }) {
    const [portalTarget, setPortalTarget] = React.useState(undefined);
    return (React.createElement(Popover, { ...props, content: React.createElement(PopupContext.Provider, { value: portalTarget }, content), placement: "top", applyBackground: true, middleware: {
            offset: 4,
        }, ref: (el) => {
            setPortalTarget(el ?? undefined);
        } }));
}
/** Components used in `StatusBarPopover`.
 * @public
 */
(function (StatusBarPopover) {
    /** Indicator to be used in popover trigger buttons to show expandable content.
     * @public
     */
    StatusBarPopover.ExpandIndicator = ButtonExpandIndicator;
})(StatusBarPopover || (StatusBarPopover = {}));
//# sourceMappingURL=StatusBarPopover.js.map