'use client'; import { createAlertDialog } from '@gluestack-ui/core/alert-dialog/creator'; import type { VariantProps } from '@gluestack-ui/utils/nativewind-utils'; import { tva, useStyleContext, withStyleContext, } from '@gluestack-ui/utils/nativewind-utils'; import React from 'react'; import { Pressable, ScrollView, View } from 'react-native'; import Animated, { Easing, FadeIn, FadeOut, ZoomIn } from 'react-native-reanimated'; const SCOPE = 'ALERT_DIALOG'; const RootComponent = withStyleContext(View, SCOPE); const AnimatedPressable = Animated.createAnimatedComponent(Pressable); const AnimatedView = Animated.createAnimatedComponent(View); const UIAccessibleAlertDialog = createAlertDialog({ Root: RootComponent, Body: ScrollView, Content: AnimatedView, CloseButton: Pressable, Header: View, Footer: View, Backdrop: AnimatedPressable, }); const alertDialogStyle = tva({ base: 'group/modal w-full h-full justify-center items-center web:pointer-events-none', parentVariants: { size: { xs: '', sm: '', md: '', lg: '', full: '', }, }, }); const alertDialogContentStyle = tva({ base: 'bg-background rounded-lg overflow-hidden border border-border p-6', parentVariants: { size: { xs: 'w-[60%] max-w-[360px]', sm: 'w-[70%] max-w-[420px]', md: 'w-[80%] max-w-[510px]', lg: 'w-[90%] max-w-[640px]', full: 'w-full', }, }, }); const alertDialogCloseButtonStyle = tva({ base: 'group/alert-dialog-close-button z-10 rounded-sm p-2 data-[focus-visible=true]:bg-background/10 web:cursor-pointer outline-0', }); const alertDialogHeaderStyle = tva({ base: 'justify-between items-center flex-row', }); const alertDialogFooterStyle = tva({ base: 'flex-row justify-end items-center gap-3', }); const alertDialogBodyStyle = tva({ base: '' }); const alertDialogBackdropStyle = tva({ base: 'absolute left-0 top-0 right-0 bottom-0 bg-black/50 web:cursor-default', }); type IAlertDialogProps = React.ComponentPropsWithoutRef< typeof UIAccessibleAlertDialog > & VariantProps; type IAlertDialogContentProps = React.ComponentPropsWithoutRef< typeof UIAccessibleAlertDialog.Content > & VariantProps & { className?: string }; type IAlertDialogCloseButtonProps = React.ComponentPropsWithoutRef< typeof UIAccessibleAlertDialog.CloseButton > & VariantProps; type IAlertDialogHeaderProps = React.ComponentPropsWithoutRef< typeof UIAccessibleAlertDialog.Header > & VariantProps; type IAlertDialogFooterProps = React.ComponentPropsWithoutRef< typeof UIAccessibleAlertDialog.Footer > & VariantProps; type IAlertDialogBodyProps = React.ComponentPropsWithoutRef< typeof UIAccessibleAlertDialog.Body > & VariantProps; type IAlertDialogBackdropProps = React.ComponentPropsWithoutRef< typeof UIAccessibleAlertDialog.Backdrop > & VariantProps & { className?: string }; const AlertDialog = React.forwardRef< React.ComponentRef, IAlertDialogProps >(function AlertDialog({ className, size = 'md', style, ...props }, ref) { return ( ); }); const AlertDialogContent = React.forwardRef< React.ComponentRef, IAlertDialogContentProps >(function AlertDialogContent({ className, size, ...props }, ref) { const { size: parentSize } = useStyleContext(SCOPE); const { style, ...restProps } = props; return ( ); }); const AlertDialogCloseButton = React.forwardRef< React.ComponentRef, IAlertDialogCloseButtonProps >(function AlertDialogCloseButton({ className, ...props }, ref) { return ( ); }); const AlertDialogHeader = React.forwardRef< React.ComponentRef, IAlertDialogHeaderProps >(function AlertDialogHeader({ className, ...props }, ref) { return ( ); }); const AlertDialogFooter = React.forwardRef< React.ComponentRef, IAlertDialogFooterProps >(function AlertDialogFooter({ className, ...props }, ref) { return ( ); }); const AlertDialogBody = React.forwardRef< React.ComponentRef, IAlertDialogBodyProps >(function AlertDialogBody({ className, ...props }, ref) { return ( ); }); const AlertDialogBackdrop = React.forwardRef< React.ComponentRef, IAlertDialogBackdropProps >(function AlertDialogBackdrop({ className, ...props }, ref) { return ( ); }); AlertDialog.displayName = 'AlertDialog'; AlertDialogContent.displayName = 'AlertDialogContent'; AlertDialogCloseButton.displayName = 'AlertDialogCloseButton'; AlertDialogHeader.displayName = 'AlertDialogHeader'; AlertDialogFooter.displayName = 'AlertDialogFooter'; AlertDialogBody.displayName = 'AlertDialogBody'; AlertDialogBackdrop.displayName = 'AlertDialogBackdrop'; export { AlertDialog, AlertDialogBackdrop, AlertDialogBody, AlertDialogCloseButton, AlertDialogContent, AlertDialogFooter, AlertDialogHeader };