import { useState } from 'react'; import { Screen, View, Button, Text, Dialog } from '../index'; import { BlurView } from '@idealyst/blur'; import type { BackdropComponentProps } from '../Dialog/types'; /** * Custom blur backdrop component for dialogs. * Uses @idealyst/blur to create a frosted glass effect over the content. */ const BlurBackdrop = ({ isVisible }: BackdropComponentProps) => ( ); export const DialogExamples = () => { const [basicOpen, setBasicOpen] = useState(false); const [alertOpen, setAlertOpen] = useState(false); const [confirmationOpen, setConfirmationOpen] = useState(false); const [sizesOpen, setSizesOpen] = useState(null); const [blurBackdropOpen, setBlurBackdropOpen] = useState(false); return ( Dialog Examples {/* Basic Dialog */} Basic Dialog setBasicOpen(false)} title="Basic Dialog" > This is a basic dialog with a title and some content. {/* Dialog Variants */} Dialog Variants {/* Alert Dialog */} setAlertOpen(false)} title="Important Alert" type="alert" > This is an alert dialog. It has a top border to indicate importance. {/* Confirmation Dialog */} setConfirmationOpen(false)} title="Confirm Action" type="confirmation" closeOnBackdropClick={false} > Are you sure you want to delete this item? This action cannot be undone. {/* Dialog Sizes */} Dialog Sizes {['sm', 'md', 'lg'].map((size) => ( ))} {sizesOpen && ( setSizesOpen(null)} title={`${sizesOpen === 'sm' ? 'Small' : sizesOpen === 'md' ? 'Medium' : 'Large'} Dialog`} size={sizesOpen as 'sm' | 'md' | 'lg'} > This is a {sizesOpen} dialog. The width and maximum width are adjusted based on the size prop. )} {/* Custom Blur Backdrop */} Custom Blur Backdrop Use the BackdropComponent prop to create a custom blur backdrop using @idealyst/blur. setBlurBackdropOpen(false)} title="Blur Backdrop Dialog" BackdropComponent={BlurBackdrop} > This dialog uses a custom backdrop component with @idealyst/blur to create a frosted glass effect over the background content. The blur intensity animates based on the isVisible prop passed to the BackdropComponent. {/* Dialog Options */} Dialog Options • Close on backdrop click: Enabled by default, disabled for confirmation dialog above • Close on escape key: Enabled by default (web only) • Hardware back button: Handled automatically (native only) • Focus management: Automatic focus trapping and restoration (web only) • Custom backdrop: Use BackdropComponent prop for custom effects like blur ); };