import type { Dispatch, ReactNode, SetStateAction } from 'react'; import { Button as AriaButton, Dialog as AriaDialog, DialogTrigger, Heading as AriaHeading, Modal, ModalOverlay, } from 'react-aria-components'; import { cn } from '~/utils/cn'; type ButtonProps = Parameters[0] & { readonly control?: [boolean, Dispatch>]; }; function Button(props: ButtonProps) { return ( { props.control?.[1](true); } : undefined } /> ); } type ActionProps = Parameters[0] & { readonly variant: 'cancel' | 'confirm'; }; function Action(props: ActionProps) { return ( ); } function Title(props: Parameters[0]) { 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 ( ); } 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 });