@@ -43,6 +43,20 @@ import { X } from 'lucide-react'
4343import { cn } from '@/lib/utils'
4444import { Button } from '../button/button'
4545
46+ /**
47+ * Shared animation classes for modal transitions.
48+ * Mirrors the legacy `Modal` component to ensure consistent behavior.
49+ */
50+ const ANIMATION_CLASSES =
51+ 'data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:animate-out data-[state=open]:animate-in'
52+
53+ /**
54+ * Modal content animation classes.
55+ * We keep only the slide animations (no zoom) to stabilize positioning while avoiding scale effects.
56+ */
57+ const CONTENT_ANIMATION_CLASSES =
58+ 'data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[50%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[50%]'
59+
4660/**
4761 * Root modal component. Manages open state.
4862 */
@@ -64,7 +78,7 @@ const ModalPortal = DialogPrimitive.Portal
6478const ModalClose = DialogPrimitive . Close
6579
6680/**
67- * Modal overlay component with stability handling.
81+ * Modal overlay component with stability handling and fade transition .
6882 */
6983const ModalOverlay = React . forwardRef <
7084 React . ElementRef < typeof DialogPrimitive . Overlay > ,
@@ -80,7 +94,11 @@ const ModalOverlay = React.forwardRef<
8094 return (
8195 < DialogPrimitive . Overlay
8296 ref = { ref }
83- className = { cn ( 'fixed inset-0 z-50' , className ) }
97+ className = { cn (
98+ 'fixed inset-0 z-50 light:bg-[#E4E4E4]/50 backdrop-blur-[0.75px] dark:bg-[#0D0D0D]/50' ,
99+ ANIMATION_CLASSES ,
100+ className
101+ ) }
84102 style = { style }
85103 onPointerDown = { ( e ) => {
86104 if ( ! isStable ) {
@@ -128,7 +146,9 @@ const ModalContent = React.forwardRef<
128146 < DialogPrimitive . Content
129147 ref = { ref }
130148 className = { cn (
131- '-translate-x-1/2 -translate-y-1/2 fixed top-1/2 left-1/2 z-50 flex max-h-[80vh] min-w-[30vw] flex-col rounded-[8px] border bg-[#1E1E1E]' ,
149+ ANIMATION_CLASSES ,
150+ CONTENT_ANIMATION_CLASSES ,
151+ 'fixed top-[50%] left-[50%] z-50 flex max-h-[80vh] min-w-[30vw] translate-x-[-50%] translate-y-[-50%] flex-col rounded-[8px] border bg-[var(--bg)] shadow-sm duration-200' ,
132152 className
133153 ) }
134154 style = { style }
@@ -223,24 +243,6 @@ const ModalDescription = React.forwardRef<
223243
224244ModalDescription . displayName = 'ModalDescription'
225245
226- /**
227- * Modal body/content area with background and padding.
228- */
229- const ModalBody = React . forwardRef < HTMLDivElement , React . HTMLAttributes < HTMLDivElement > > (
230- ( { className, ...props } , ref ) => (
231- < div
232- ref = { ref }
233- className = { cn (
234- 'flex-1 overflow-y-auto rounded-t-[8px] border-t bg-[#232323] px-[14px] pt-[10px] pb-[20px]' ,
235- className
236- ) }
237- { ...props }
238- />
239- )
240- )
241-
242- ModalBody . displayName = 'ModalBody'
243-
244246/**
245247 * Modal tabs root component. Wraps tab list and content panels.
246248 */
@@ -291,6 +293,24 @@ const ModalTabsContent = React.forwardRef<
291293
292294ModalTabsContent . displayName = 'ModalTabsContent'
293295
296+ /**
297+ * Modal body/content area with background and padding.
298+ */
299+ const ModalBody = React . forwardRef < HTMLDivElement , React . HTMLAttributes < HTMLDivElement > > (
300+ ( { className, ...props } , ref ) => (
301+ < div
302+ ref = { ref }
303+ className = { cn (
304+ 'flex-1 overflow-y-auto rounded-t-[8px] border-t bg-[#232323] px-[14px] pt-[10px] pb-[20px]' ,
305+ className
306+ ) }
307+ { ...props }
308+ />
309+ )
310+ )
311+
312+ ModalBody . displayName = 'ModalBody'
313+
294314/**
295315 * Modal footer component for action buttons.
296316 */
@@ -311,10 +331,7 @@ ModalFooter.displayName = 'ModalFooter'
311331
312332export {
313333 Modal ,
314- ModalPortal ,
315- ModalOverlay ,
316334 ModalTrigger ,
317- ModalClose ,
318335 ModalContent ,
319336 ModalSidebar ,
320337 ModalHeader ,
@@ -326,4 +343,7 @@ export {
326343 ModalTabsTrigger ,
327344 ModalTabsContent ,
328345 ModalFooter ,
346+ ModalPortal ,
347+ ModalOverlay ,
348+ ModalClose ,
329349}
0 commit comments