import * as React from "react"; import styles from "./Dialog.module.scss"; import { Backdrop } from "../Backdrop/Backdrop"; import { BaseDialog, BaseDialogProps } from "./BaseDialog"; import { useLockBodyScroll } from "../hooks/useLockBodyScroll"; import { CSSTransition } from "react-transition-group"; import classNames from "classnames"; export interface DialogProps extends BaseDialogProps { /** * If the Dialog has a backdrop * * @default true */ hasBackdrop?: boolean; /** * If the Dialog is open * * @default false */ isOpen?: boolean; /** * The callback fired when the Dialog opens */ onOpen: () => void; /** * The trigger for the Dialog */ trigger: React.ReactElement; } /** * @public * * @description * * The Dialog component gives attention to a task a user can take. */ export const Dialog: React.FC = (props) => { const { ariaLabel, buttons, className, content, hasBackdrop = true, isOpen = false, onClose, onOpen, title, trigger, variant = "center", ...rest } = props; useLockBodyScroll(isOpen); return ( <> {React.cloneElement(trigger, { onClick: onOpen, role: "button", tabIndex: 0, })}
); }; Dialog.displayName = "Dialog";