/*---------------------------------------------------------------------------------------------
 * 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 { DivWithOutsideClick, Icon } from "@itwin/core-react";
import { PopupManager } from "../popup/PopupManager.js";
import { PositionPopup, PositionPopupContent } from "../popup/PositionPopup.js";
import { Calculator } from "./Calculator.js";
/** Popup component for Calculator
 * @public
 * @deprecated in 4.16.0. Use {@link Calculator} component with {@link https://itwinui.bentley.com/docs/popover iTwinUI Popover} or {@link AccuDrawPopupManager.showCalculator} method instead.
 */
export class CalculatorPopup extends React.PureComponent {
    constructor() {
        super(...arguments);
        this.state = {
            size: { width: -1, height: -1 },
        };
        this._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(PositionPopup, { key: this.props.id, point: point, className: "uifw-calculator-host", onSizeKnown: this._onSizeKnown },
            React.createElement(DivWithOutsideClick, { onOutsideClick: this.props.onCancel },
                React.createElement(PositionPopupContent, null,
                    React.createElement(Calculator, { initialValue: this.props.initialValue, resultIcon: 
                        // eslint-disable-next-line @typescript-eslint/no-deprecated
                        React.createElement(Icon, { iconSpec: this.props.resultIcon }), onOk: this.props.onOk, onCancel: this.props.onCancel })))));
    }
}
//# sourceMappingURL=CalculatorPopup.js.map