@@ -16,22 +16,19 @@ import {
16
16
composeRenderProps ,
17
17
Dialog ,
18
18
DialogProps ,
19
- ModalRenderProps ,
20
19
OverlayArrow ,
21
20
OverlayTriggerStateContext ,
22
21
useLocale
23
22
} from 'react-aria-components' ;
24
23
import { colorScheme , getAllowedOverrides , StyleProps , UnsafeStyles } from './style-utils' with { type : 'macro' } ;
25
24
import { ColorSchemeContext } from './Provider' ;
26
- import { DismissButton } from 'react-aria' ;
27
25
import { DOMRef } from '@react-types/shared' ;
28
26
import { forwardRef , MutableRefObject , useCallback , useContext } from 'react' ;
29
27
import { keyframes } from '../style/style-macro' with { type : 'macro' } ;
30
28
import { mergeStyles } from '../style/runtime' ;
31
- import { Modal } from './Modal' ;
32
29
import { style } from '../style' with { type : 'macro' } ;
33
30
import { StyleString } from '../style/types' with { type : 'macro' } ;
34
- import { useDOMRef , useIsMobileDevice } from '@react-spectrum/utils' ;
31
+ import { useDOMRef } from '@react-spectrum/utils' ;
35
32
36
33
export interface PopoverProps extends UnsafeStyles , Omit < AriaPopoverProps , 'arrowSize' | 'isNonModal' | 'arrowBoundaryOffset' | 'isKeyboardDismissDisabled' | 'shouldCloseOnInteractOutside' | 'shouldUpdatePosition' > {
37
34
styles ?: StyleString ,
@@ -44,9 +41,9 @@ export interface PopoverProps extends UnsafeStyles, Omit<AriaPopoverProps, 'arro
44
41
/**
45
42
* The size of the Popover. If not specified, the popover fits its contents.
46
43
*/
47
- size ?: 'S' | 'M' | 'L' ,
44
+ size ?: 'S' | 'M' | 'L'
48
45
/** The type of overlay that should be rendered when on a mobile device. */
49
- mobileType ?: 'modal' | 'fullscreen' | 'fullscreenTakeover' // TODO: add tray back in
46
+ // mobileType?: 'modal' | 'fullscreen' | 'fullscreenTakeover' // TODO: add tray back in
50
47
}
51
48
52
49
const fadeKeyframes = keyframes ( `
@@ -126,6 +123,9 @@ let popover = style({
126
123
L : 576
127
124
}
128
125
} ,
126
+ // Don't be larger than full screen minus 2 * containerPadding
127
+ maxWidth : '[calc(100vw - 24px)]' ,
128
+ boxSizing : 'border-box' ,
129
129
translateY : {
130
130
placement : {
131
131
bottom : {
@@ -221,9 +221,7 @@ function PopoverBase(props: PopoverProps, ref: DOMRef<HTMLDivElement>) {
221
221
UNSAFE_className = '' ,
222
222
UNSAFE_style,
223
223
styles,
224
- size,
225
- children,
226
- trigger = null
224
+ size
227
225
} = props ;
228
226
let domRef = useDOMRef ( ref ) ;
229
227
let colorScheme = useContext ( ColorSchemeContext ) ;
@@ -239,24 +237,25 @@ function PopoverBase(props: PopoverProps, ref: DOMRef<HTMLDivElement>) {
239
237
} , [ locale , direction , domRef ] ) ;
240
238
241
239
// On small devices, show a modal (or eventually a tray) instead of a popover.
242
- let isMobile = useIsMobileDevice ( ) ;
243
- if ( isMobile && process . env . NODE_ENV !== 'test' ) {
244
- let mappedChildren = typeof children === 'function'
245
- ? ( renderProps : ModalRenderProps ) => children ( { ...renderProps , defaultChildren : null , trigger, placement : 'bottom' } )
246
- : children ;
240
+ // TODO: reverted this until we have trays.
241
+ // let isMobile = useIsMobileDevice();
242
+ // if (isMobile && process.env.NODE_ENV !== 'test') {
243
+ // let mappedChildren = typeof children === 'function'
244
+ // ? (renderProps: ModalRenderProps) => children({...renderProps, defaultChildren: null, trigger, placement: 'bottom'})
245
+ // : children;
247
246
248
- return (
249
- < Modal size = { size } isDismissable >
250
- { composeRenderProps ( mappedChildren , ( children , { state} ) => (
251
- < >
252
- { children }
253
- { /* Add additional dismiss button at the end to match popovers. */ }
254
- < DismissButton onDismiss = { state . close } />
255
- </ >
256
- ) ) }
257
- </ Modal >
258
- ) ;
259
- }
247
+ // return (
248
+ // <Modal size={size} isDismissable>
249
+ // {composeRenderProps(mappedChildren, (children, {state}) => (
250
+ // <>
251
+ // {children}
252
+ // {/* Add additional dismiss button at the end to match popovers. */}
253
+ // <DismissButton onDismiss={state.close} />
254
+ // </>
255
+ // ))}
256
+ // </Modal>
257
+ // );
258
+ // }
260
259
261
260
// TODO: this still isn't the final popover 'tip', copying various ones out of the designs files yields different results
262
261
// containerPadding not working as expected
@@ -289,7 +288,7 @@ function PopoverBase(props: PopoverProps, ref: DOMRef<HTMLDivElement>) {
289
288
let _PopoverBase = forwardRef ( PopoverBase ) ;
290
289
export { _PopoverBase as PopoverBase } ;
291
290
292
- export interface PopoverDialogProps extends Pick < PopoverProps , 'size' | 'hideArrow' | 'mobileType' | 'placement' | 'shouldFlip' | 'containerPadding' | 'offset' | 'crossOffset' > , Omit < DialogProps , 'className' | 'style' > , StyleProps { }
291
+ export interface PopoverDialogProps extends Pick < PopoverProps , 'size' | 'hideArrow' | 'placement' | 'shouldFlip' | 'containerPadding' | 'offset' | 'crossOffset' > , Omit < DialogProps , 'className' | 'style' > , StyleProps { }
293
292
294
293
const dialogStyle = style ( {
295
294
padding : 8 ,
0 commit comments