"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 AccuDrawFieldContainer_1 = require("./AccuDrawFieldContainer");
const useTranslation_1 = require("../hooks/useTranslation");
const itwinui_react_1 = require("@itwin/itwinui-react");
/** Dialog displays [[AccuDrawFieldContainer]] for AccuDraw Ui
 * @beta */
function AccuDrawDialog(props) {
    const { translate } = (0, useTranslation_1.useTranslation)();
    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 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(itwinui_react_1.Dialog, { isOpen: opened, onClose: handleClose, className: classNames, style: props.style, closeOnEsc: true, isDraggable: true, preventDocumentScroll: true },
        React.createElement(itwinui_react_1.Dialog.Main, { style: { minHeight: 75, width: dialogWidth }, "data-testid": "accudraw-dialog-container" },
            React.createElement(itwinui_react_1.Dialog.TitleBar, { titleText: translate("accuDraw.dialogTitle") }),
            React.createElement(itwinui_react_1.Dialog.Content, { style: { padding: 0 } },
                React.createElement(AccuDrawFieldContainer_1.AccuDrawFieldContainer, { orientation: orientation })))));
}
exports.AccuDrawDialog = AccuDrawDialog;
//# sourceMappingURL=AccuDrawDialog.js.map