import { forwardRef } from 'react'; import { twMerge } from 'tailwind-merge'; import * as Dialog from './Dialog'; import { Button } from './Button'; import { InfoCircle } from '../icons/InfoCircle'; import type { ElementRef, ComponentPropsWithoutRef, ComponentPropsWithRef } from 'react'; export const Root = Dialog.Root; export const Trigger = Dialog.Trigger; export const Description = Dialog.Description; export const Close = Dialog.Close; export const variants = ['confirm', 'alert'] as const; export type VariantType = (typeof variants)[number]; type ConfirmDialogFooterProps = ComponentPropsWithoutRef<'div'> & { confirmButtonText: string; cancelButtonText: string; variant: VariantType; confirmButtonProps?: ComponentPropsWithoutRef; cancelButtonProps?: ComponentPropsWithoutRef; }; export const ConfirmDialogFooter = forwardRef(function ConfirmDialogFooter( { className, cancelButtonText, confirmButtonText, variant, confirmButtonProps = {}, cancelButtonProps = {}, ...other }, forwardedRef, ) { return (
); }); type TitleProps = ComponentPropsWithRef & { variant: VariantType; }; export const Title = forwardRef, TitleProps>(function Title( { children, className, variant, ...other }, forwardedRef, ) { return ( {variant === 'alert' && } {children} ); }); type ContentProps = ComponentPropsWithRef & { title: string; confirmButtonText?: string; cancelButtonText?: string; variant?: VariantType; confirmButtonProps?: ComponentPropsWithoutRef; cancelButtonProps?: ComponentPropsWithoutRef; }; export const Content = forwardRef, ContentProps>(function Content( { className, title, children, cancelButtonText = 'Cancel', confirmButtonText = 'Confirm', variant = 'confirm', ...other }, forwardedRef, ) { return ( {title}
{children}
); });