import React from 'react';
import { DialogProps as BaseDialogProps } from '@radix-ui/react-dialog';

import { DialogProvider } from './dialog.context';
import { DialogRoot } from './dialog-root';

export interface DialogProps extends BaseDialogProps {}

export function Dialog({
  open,
  modal,
  defaultOpen,
  onOpenChange,
  ...rest
}: DialogProps) {
  return (
    <DialogProvider
      open={open}
      modal={modal}
      defaultOpen={defaultOpen}
      onOpenChange={onOpenChange}
    >
      <DialogRoot {...rest} />
    </DialogProvider>
  );
}
