/*---------------------------------------------------------------------------------------------
 * 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 "./AccuDrawDialog.scss";
import classnames from "classnames";
import * as React from "react";
import { Orientation } from "@itwin/components-react";
import { AccuDrawFieldContainer } from "./AccuDrawFieldContainer";
import { useTranslation } from "../hooks/useTranslation";
import { Dialog } from "@itwin/itwinui-react";
/** Dialog displays [[AccuDrawFieldContainer]] for AccuDraw Ui
 * @public
 */
export function AccuDrawDialog(props) {
    const { translate } = 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 = classnames("uifw-accudraw-dialog", props.className);
    const orientation = props.orientation !== undefined ? props.orientation : Orientation.Vertical;
    const dialogWidth = orientation === Orientation.Horizontal ? 500 : 250;
    return (React.createElement(Dialog, { isOpen: opened, onClose: handleClose, className: classNames, style: props.style, closeOnEsc: true, isDraggable: true, preventDocumentScroll: true },
        React.createElement(Dialog.Main, { style: { minHeight: 75, width: dialogWidth }, "data-testid": "accudraw-dialog-container" },
            React.createElement(Dialog.TitleBar, { titleText: translate("accuDraw.dialogTitle") }),
            React.createElement(Dialog.Content, { style: { padding: 0 } },
                React.createElement(AccuDrawFieldContainer, { orientation: orientation })))));
}
//# sourceMappingURL=AccuDrawDialog.js.map