/*---------------------------------------------------------------------------------------------
 * 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 { Size } from "@itwin/core-react";
import { PopupManager } from "../popup/PopupManager";
import { MenuButton } from "./MenuButton";
/** Popup component for Menu Buttons
 * @public
 */
export class MenuButtonPopup extends React.PureComponent {
    constructor() {
        super(...arguments);
        this.state = {
            size: new Size(-1, -1),
        };
        this._onSizeKnown = (newSize) => {
            if (!this.state.size.equals(newSize))
                this.setState({ size: Size.create(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