import { type Dispatch, type ReactNode, type 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 ButtonProperties = Parameters[0] & { readonly control?: [boolean, Dispatch>]; } function Button(properties: ButtonProperties) { return ( { properties.control?.[1](true) } : undefined} /> ) } type ActionProperties = Parameters[0] & { readonly variant: 'cancel' | 'confirm'; } function Action(properties: ActionProperties) { return ( ) } function Title(properties: Parameters[0]) { return ( ) } function Text(properties: React.HTMLProps) { return (

) } type PanelProperties = { readonly children: (close: () => void) => ReactNode; readonly control?: [boolean, Dispatch>]; } function Panel({ children, control }: PanelProperties) { return ( ) } type DialogProperties = { readonly children: ReactNode; readonly control?: [boolean, Dispatch>]; } function Dialog({ children, control }: DialogProperties) { if (control) { return children } return ( {children} ) } export default Object.assign(Dialog, { Button, Title, Text, Panel, Action })