import React, { Dispatch, ReactNode, SetStateAction } from 'react';
import Button, { ButtonProps } from '~/components/Button';
import Title from '~/components/Title';
import {
Button as AriaButton,
Dialog as AriaDialog,
DialogTrigger,
Heading as AriaHeading,
Modal,
ModalOverlay,
} from 'react-aria-components';
import { cn } from '~/utils/cn';
interface ActionProps extends ButtonProps {
variant: 'cancel' | 'confirm';
}
function Action(props: ActionProps) {
return (
);
}
function Text(props: React.HTMLProps) {
return (
);
}
interface PanelProps {
children: (close: () => void) => ReactNode;
control?: [boolean, Dispatch>];
className?: string;
}
function Panel({ children, control, className }: PanelProps) {
return (
{({ close }) => children(close)}
);
}
interface DialogProps {
children: ReactNode;
control?: [boolean, Dispatch>];
}
function Dialog({ children, control }: DialogProps) {
if (control) {
return children;
}
return {children};
}
export default Object.assign(Dialog, { Button, Title, Text, Panel, Action });