"use strict";
/*---------------------------------------------------------------------------------------------
* 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
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.MenuButtonPopup = void 0;
const React = require("react");
const core_react_1 = require("@itwin/core-react");
const PopupManager_1 = require("../popup/PopupManager");
const MenuButton_1 = require("./MenuButton");
/** Popup component for Menu Buttons
 * @alpha
 */
class MenuButtonPopup extends React.PureComponent {
    constructor() {
        super(...arguments);
        /** @internal */
        this.state = {
            size: new core_react_1.Size(-1, -1),
        };
        this._onSizeKnown = (newSize) => {
            // istanbul ignore else
            if (!this.state.size.equals(newSize))
                this.setState({ size: core_react_1.Size.create(newSize) });
        };
    }
    /** @internal */
    render() {
        const point = PopupManager_1.PopupManager.getPopupPosition(this.props.el, this.props.pt, this.props.offset, this.state.size);
        return (React.createElement(MenuButton_1.MenuButton, { key: this.props.id, point: point, onSizeKnown: this._onSizeKnown }, this.props.content));
    }
}
exports.MenuButtonPopup = MenuButtonPopup;
//# sourceMappingURL=MenuButtonPopup.js.map