/*---------------------------------------------------------------------------------------------
* 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/core-react";
import { UiFramework } from "../UiFramework";
import { ModelessDialog } from "../dialog/ModelessDialog";
import { AccuDrawFieldContainer } from "./AccuDrawFieldContainer";
/** Dialog displays [[AccuDrawFieldContainer]] for AccuDraw Ui
 * @beta */
export function AccuDrawDialog(props) {
    const title = React.useRef(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.keyboardShortcuts.setFocusToHome();
    }, []);
    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(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, { orientation: orientation })));
}
//# sourceMappingURL=AccuDrawDialog.js.map