/*---------------------------------------------------------------------------------------------
 * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
 * See LICENSE.md in the project root for license terms and full copyright notice.
 *--------------------------------------------------------------------------------------------*/
/** @packageDocumentation
 * @module AccuDraw
 */
import * as React from "react";
import { PopupManager } from "../popup/PopupManager.js";
import { MenuButton } from "./MenuButton.js";
/** Popup component for Menu Buttons
 * @public
 */
export class MenuButtonPopup extends React.PureComponent {
    state = {
        size: { width: -1, height: -1 },
    };
    _onSizeKnown = (newSize) => {
        if (newSize.height === this.state.size.height &&
            newSize.width === this.state.size.width)
            return;
        this.setState({ size: newSize });
    };
    render() {
        const point = PopupManager.getPopupPosition(this.props.el, this.props.pt, this.props.offset, this.state.size);
        return (React.createElement(MenuButton, { key: this.props.id, point: point, onSizeKnown: this._onSizeKnown }, this.props.content));
    }
}
//# sourceMappingURL=MenuButtonPopup.js.map