"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.AccuDrawDialog = void 0;
require("./AccuDrawDialog.scss");
const classnames_1 = require("classnames");
const React = require("react");
const core_react_1 = require("@itwin/core-react");
const UiFramework_1 = require("../UiFramework");
const ModelessDialog_1 = require("../dialog/ModelessDialog");
const AccuDrawFieldContainer_1 = require("./AccuDrawFieldContainer");
/** Dialog displays [[AccuDrawFieldContainer]] for AccuDraw Ui
 * @beta */
function AccuDrawDialog(props) {
    const title = React.useRef(UiFramework_1.UiFramework.translate("accuDraw.dialogTitle"));
    const [opened, setOpened] = React.useState(props.opened);
    const closeDialog = React.useCallback(() => {
        setOpened(false);
        props.onClose && props.onClose();
    }, [props]);
    const handleClose = React.useCallback(() => {
        closeDialog();
    }, [closeDialog]);
    const handleEscape = React.useCallback(() => {
        UiFramework_1.UiFramework.keyboardShortcuts.setFocusToHome();
    }, []);
    const classNames = (0, classnames_1.default)("uifw-accudraw-dialog", props.className);
    const orientation = (props.orientation !== undefined) ? props.orientation : core_react_1.Orientation.Vertical;
    const dialogWidth = (orientation === core_react_1.Orientation.Horizontal) ? 500 : 250;
    return (React.createElement(ModelessDialog_1.ModelessDialog, { className: classNames, style: props.style, title: title.current, opened: opened, dialogId: props.dialogId, width: dialogWidth, minHeight: 75, inset: false, movable: true, onClose: handleClose, onEscape: handleEscape },
        React.createElement(AccuDrawFieldContainer_1.AccuDrawFieldContainer, { orientation: orientation })));
}
exports.AccuDrawDialog = AccuDrawDialog;
//# sourceMappingURL=AccuDrawDialog.js.map