@@ -7,7 +7,7 @@ import * as React from 'react';
77import { createPortal } from 'react-dom' ;
88
99export default function BasicDemo ( ) {
10- const { triggerProps, backdropProps, backdropMotionProps , popupProps, closeProps, headerProps, contentProps, rootProps, state } = useDialog ( ) ;
10+ const { triggerProps, backdropProps, positionerProps , popupProps, closeProps, headerProps, contentProps, rootProps, state } = useDialog ( ) ;
1111 const portal = usePortal ( ) ;
1212
1313 const popupRef = React . useRef < HTMLDivElement > ( null ) ;
@@ -24,9 +24,10 @@ export default function BasicDemo() {
2424 leaveToClassName : 'opacity-0 scale-75'
2525 } ) ;
2626
27+ const backdropRef = React . useRef < HTMLDivElement > ( null ) ;
2728 const backdropMotion = useMotion ( {
28- ... backdropMotionProps . motionProps ,
29- visible : backdropMotionProps . visible ,
29+ elementRef : backdropRef ,
30+ visible : state . open ,
3031 enterFromClassName : 'opacity-0' ,
3132 enterActiveClassName : 'transition-opacity duration-150' ,
3233 enterToClassName : 'opacity-100' ,
@@ -48,12 +49,13 @@ export default function BasicDemo() {
4849 popupMotion . state . rendered &&
4950 createPortal (
5051 < div className = "fixed inset-0 z-1100" >
51- { backdropMotion . state . rendered && < div { ...backdropProps } className = "fixed inset-0 bg-black/50" /> }
52+ { backdropMotion . state . rendered && < div { ...backdropProps } ref = { backdropRef } className = "fixed inset-0 bg-black/50" /> }
53+ < div { ...positionerProps } className = "fixed inset-0 flex items-center justify-center p-8 pointer-events-none" >
5254 { popupMotion . state . rendered && (
5355 < div
5456 { ...popupProps }
5557 ref = { popupRef }
56- className = "fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[28rem] max-w-[90vw] max-h-[90vh] bg-surface-0 dark:bg-surface-900 rounded-xl shadow-2xl flex flex-col border border-surface-200 dark:border-surface-700 z-50 "
58+ className = "w-[28rem] max-w-[90vw] max-h-full bg-surface-0 dark:bg-surface-900 rounded-xl shadow-2xl flex flex-col border border-surface-200 dark:border-surface-700 pointer-events-auto "
5759 >
5860 < div { ...headerProps } className = "flex items-center justify-between p-5" >
5961 < span className = "text-lg font-semibold" > Edit Profile</ span >
@@ -112,6 +114,7 @@ export default function BasicDemo() {
112114 </ div >
113115 </ div >
114116 ) }
117+ </ div >
115118 </ div > ,
116119 document . body
117120 ) }
0 commit comments