@tamagui/popover 1.68.6 → 1.69.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/Popover.tsx CHANGED
@@ -6,6 +6,7 @@ import { hideOthers } from '@tamagui/aria-hidden'
6
6
  import { useComposedRefs } from '@tamagui/compose-refs'
7
7
  import {
8
8
  MediaQueryKey,
9
+ ScopedProps,
9
10
  SizeTokens,
10
11
  Stack,
11
12
  StackProps,
@@ -56,6 +57,8 @@ export type PopoverProps = PopperProps & {
56
57
  keepChildrenMounted?: boolean
57
58
  }
58
59
 
60
+ type ScopedPopoverProps<P> = ScopedProps<P, 'Popover'>
61
+
59
62
  type PopoverContextValue = {
60
63
  id: string
61
64
  triggerRef: React.RefObject<any>
@@ -72,9 +75,11 @@ type PopoverContextValue = {
72
75
  keepChildrenMounted?: boolean
73
76
  }
74
77
 
78
+ const POPOVER_SCOPE = 'PopoverScope'
79
+
75
80
  export const PopoverContext = createStyledContext<PopoverContextValue>({} as any)
76
81
 
77
- export const usePopoverContext = () => React.useContext(PopoverContext)
82
+ export const usePopoverContext = PopoverContext.useStyledContext
78
83
 
79
84
  /* -------------------------------------------------------------------------------------------------
80
85
  * PopoverAnchor
@@ -82,19 +87,27 @@ export const usePopoverContext = () => React.useContext(PopoverContext)
82
87
 
83
88
  export type PopoverAnchorProps = YStackProps
84
89
 
85
- export const PopoverAnchor = React.forwardRef<TamaguiElement, PopoverAnchorProps>(
86
- function PopoverAnchor(props: PopoverAnchorProps, forwardedRef) {
87
- const context = usePopoverContext()
88
- const { onCustomAnchorAdd, onCustomAnchorRemove } = context
90
+ export const PopoverAnchor = React.forwardRef<
91
+ TamaguiElement,
92
+ ScopedPopoverProps<PopoverAnchorProps>
93
+ >(function PopoverAnchor(props: ScopedPopoverProps<PopoverAnchorProps>, forwardedRef) {
94
+ const { __scopePopover, ...rest } = props
95
+ const context = usePopoverContext(__scopePopover)
96
+ const { onCustomAnchorAdd, onCustomAnchorRemove } = context || {}
89
97
 
90
- React.useEffect(() => {
91
- onCustomAnchorAdd()
92
- return () => onCustomAnchorRemove()
93
- }, [onCustomAnchorAdd, onCustomAnchorRemove])
98
+ React.useEffect(() => {
99
+ onCustomAnchorAdd()
100
+ return () => onCustomAnchorRemove()
101
+ }, [onCustomAnchorAdd, onCustomAnchorRemove])
94
102
 
95
- return <PopperAnchor {...props} ref={forwardedRef} />
96
- }
97
- )
103
+ return (
104
+ <PopperAnchor
105
+ __scopePopper={__scopePopover || POPOVER_SCOPE}
106
+ {...rest}
107
+ ref={forwardedRef}
108
+ />
109
+ )
110
+ })
98
111
 
99
112
  /* -------------------------------------------------------------------------------------------------
100
113
  * PopoverTrigger
@@ -102,32 +115,36 @@ export const PopoverAnchor = React.forwardRef<TamaguiElement, PopoverAnchorProps
102
115
 
103
116
  export type PopoverTriggerProps = StackProps
104
117
 
105
- export const PopoverTrigger = React.forwardRef<TamaguiElement, PopoverTriggerProps>(
106
- function PopoverTrigger(props: PopoverTriggerProps, forwardedRef) {
107
- const context = usePopoverContext()
108
- const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef)
109
-
110
- const trigger = (
111
- <View
112
- aria-haspopup="dialog"
113
- aria-expanded={context.open}
114
- // TODO not matching
115
- // aria-controls={context.contentId}
116
- data-state={getState(context.open)}
117
- {...props}
118
- // @ts-ignore
119
- ref={composedTriggerRef}
120
- onPress={composeEventHandlers(props.onPress as any, context.onOpenToggle)}
121
- />
122
- )
118
+ export const PopoverTrigger = React.forwardRef<
119
+ TamaguiElement,
120
+ ScopedPopoverProps<PopoverTriggerProps>
121
+ >(function PopoverTrigger(props: ScopedPopoverProps<PopoverTriggerProps>, forwardedRef) {
122
+ const { __scopePopover, ...rest } = props
123
+ const context = usePopoverContext(__scopePopover)
124
+ const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef)
125
+
126
+ const trigger = (
127
+ <View
128
+ aria-haspopup="dialog"
129
+ aria-expanded={context.open}
130
+ // TODO not matching
131
+ // aria-controls={context.contentId}
132
+ data-state={getState(context.open)}
133
+ {...rest}
134
+ // @ts-ignore
135
+ ref={composedTriggerRef}
136
+ onPress={composeEventHandlers(props.onPress as any, context.onOpenToggle)}
137
+ />
138
+ )
123
139
 
124
- return context.hasCustomAnchor ? (
125
- trigger
126
- ) : (
127
- <PopperAnchor asChild>{trigger}</PopperAnchor>
128
- )
129
- }
130
- )
140
+ return context.hasCustomAnchor ? (
141
+ trigger
142
+ ) : (
143
+ <PopperAnchor __scopePopper={__scopePopover || POPOVER_SCOPE} asChild>
144
+ {trigger}
145
+ </PopperAnchor>
146
+ )
147
+ })
131
148
 
132
149
  /* -------------------------------------------------------------------------------------------------
133
150
  * PopoverContent
@@ -146,66 +163,72 @@ export interface PopoverContentTypeProps
146
163
  }
147
164
 
148
165
  export const PopoverContent = PopperContentFrame.extractable(
149
- React.forwardRef<PopoverContentTypeElement, PopoverContentTypeProps>(
150
- function PopoverContent(props: PopoverContentTypeProps, forwardedRef) {
151
- const {
152
- allowPinchZoom,
153
- trapFocus,
154
- disableRemoveScroll = true,
155
- zIndex,
156
- ...contentImplProps
157
- } = props
158
- const context = usePopoverContext()
159
- const contentRef = React.useRef<any>(null)
160
- const composedRefs = useComposedRefs(forwardedRef, contentRef)
161
- const isRightClickOutsideRef = React.useRef(false)
162
-
163
- // aria-hide everything except the content (better supported equivalent to setting aria-modal)
164
- React.useEffect(() => {
165
- if (!context.open) return
166
- const content = contentRef.current
167
- if (content) return hideOthers(content)
168
- }, [context.open])
169
-
170
- return (
171
- <PopoverContentPortal zIndex={props.zIndex}>
172
- <Stack pointerEvents={context.open ? 'auto' : 'none'}>
173
- <PopoverContentImpl
174
- {...contentImplProps}
175
- disableRemoveScroll={disableRemoveScroll}
176
- ref={composedRefs}
177
- // we make sure we're not trapping once it's been closed
178
- // (closed !== unmounted when animating out)
179
- trapFocus={trapFocus ?? context.open}
180
- disableOutsidePointerEvents
181
- onCloseAutoFocus={composeEventHandlers(props.onCloseAutoFocus, (event) => {
182
- event.preventDefault()
183
- if (!isRightClickOutsideRef.current) context.triggerRef.current?.focus()
184
- })}
185
- onPointerDownOutside={composeEventHandlers(
186
- props.onPointerDownOutside,
187
- (event) => {
188
- const originalEvent = event.detail.originalEvent
189
- const ctrlLeftClick =
190
- originalEvent.button === 0 && originalEvent.ctrlKey === true
191
- const isRightClick = originalEvent.button === 2 || ctrlLeftClick
192
- isRightClickOutsideRef.current = isRightClick
193
- },
194
- { checkDefaultPrevented: false }
195
- )}
196
- // When focus is trapped, a `focusout` event may still happen.
197
- // We make sure we don't trigger our `onDismiss` in such case.
198
- onFocusOutside={composeEventHandlers(
199
- props.onFocusOutside,
200
- (event) => event.preventDefault(),
201
- { checkDefaultPrevented: false }
202
- )}
203
- />
204
- </Stack>
205
- </PopoverContentPortal>
206
- )
207
- }
208
- )
166
+ React.forwardRef<
167
+ PopoverContentTypeElement,
168
+ ScopedPopoverProps<PopoverContentTypeProps>
169
+ >(function PopoverContent(
170
+ props: ScopedPopoverProps<PopoverContentTypeProps>,
171
+ forwardedRef
172
+ ) {
173
+ const {
174
+ allowPinchZoom,
175
+ trapFocus,
176
+ disableRemoveScroll = true,
177
+ zIndex,
178
+ __scopePopover,
179
+ ...contentImplProps
180
+ } = props
181
+ const context = usePopoverContext(__scopePopover)
182
+ const contentRef = React.useRef<any>(null)
183
+ const composedRefs = useComposedRefs(forwardedRef, contentRef)
184
+ const isRightClickOutsideRef = React.useRef(false)
185
+
186
+ // aria-hide everything except the content (better supported equivalent to setting aria-modal)
187
+ React.useEffect(() => {
188
+ if (!context.open) return
189
+ const content = contentRef.current
190
+ if (content) return hideOthers(content)
191
+ }, [context.open])
192
+
193
+ return (
194
+ <PopoverContentPortal __scopePopover={__scopePopover} zIndex={props.zIndex}>
195
+ <Stack pointerEvents={context.open ? 'auto' : 'none'}>
196
+ <PopoverContentImpl
197
+ {...contentImplProps}
198
+ disableRemoveScroll={disableRemoveScroll}
199
+ ref={composedRefs}
200
+ __scopePopover={__scopePopover}
201
+ // we make sure we're not trapping once it's been closed
202
+ // (closed !== unmounted when animating out)
203
+ trapFocus={trapFocus ?? context.open}
204
+ disableOutsidePointerEvents
205
+ onCloseAutoFocus={composeEventHandlers(props.onCloseAutoFocus, (event) => {
206
+ event.preventDefault()
207
+ if (!isRightClickOutsideRef.current) context.triggerRef.current?.focus()
208
+ })}
209
+ onPointerDownOutside={composeEventHandlers(
210
+ props.onPointerDownOutside,
211
+ (event) => {
212
+ const originalEvent = event.detail.originalEvent
213
+ const ctrlLeftClick =
214
+ originalEvent.button === 0 && originalEvent.ctrlKey === true
215
+ const isRightClick = originalEvent.button === 2 || ctrlLeftClick
216
+ isRightClickOutsideRef.current = isRightClick
217
+ },
218
+ { checkDefaultPrevented: false }
219
+ )}
220
+ // When focus is trapped, a `focusout` event may still happen.
221
+ // We make sure we don't trigger our `onDismiss` in such case.
222
+ onFocusOutside={composeEventHandlers(
223
+ props.onFocusOutside,
224
+ (event) => event.preventDefault(),
225
+ { checkDefaultPrevented: false }
226
+ )}
227
+ />
228
+ </Stack>
229
+ </PopoverContentPortal>
230
+ )
231
+ })
209
232
  )
210
233
 
211
234
  function PopoverRepropagateContext(props: {
@@ -222,10 +245,11 @@ function PopoverRepropagateContext(props: {
222
245
  )
223
246
  }
224
247
 
225
- function PopoverContentPortal(props: PopoverContentTypeProps) {
248
+ function PopoverContentPortal(props: ScopedPopoverProps<PopoverContentTypeProps>) {
249
+ const { __scopePopover } = props
226
250
  const zIndex = props.zIndex ?? 150_000
227
- const context = usePopoverContext()
228
- const popperContext = usePopperContext()
251
+ const context = usePopoverContext(__scopePopover)
252
+ const popperContext = usePopperContext(__scopePopover || POPOVER_SCOPE)
229
253
  const themeName = useThemeName()
230
254
 
231
255
  let contents = props.children
@@ -254,7 +278,6 @@ function PopoverContentPortal(props: PopoverContentTypeProps) {
254
278
  </Portal>
255
279
  )
256
280
  }
257
-
258
281
  /* -----------------------------------------------------------------------------------------------*/
259
282
 
260
283
  type PopoverContentImplElement = React.ElementRef<typeof PopperContent>
@@ -293,10 +316,14 @@ export interface PopoverContentImplProps
293
316
 
294
317
  const PopoverContentImpl = React.forwardRef<
295
318
  PopoverContentImplElement,
296
- PopoverContentImplProps
297
- >(function PopoverContentImpl(props: PopoverContentImplProps, forwardedRef) {
319
+ ScopedPopoverProps<PopoverContentImplProps>
320
+ >(function PopoverContentImpl(
321
+ props: ScopedPopoverProps<PopoverContentImplProps>,
322
+ forwardedRef
323
+ ) {
298
324
  const {
299
325
  trapFocus,
326
+ __scopePopover,
300
327
  onOpenAutoFocus,
301
328
  onCloseAutoFocus,
302
329
  disableOutsidePointerEvents,
@@ -311,9 +338,9 @@ const PopoverContentImpl = React.forwardRef<
311
338
  ...contentProps
312
339
  } = props
313
340
 
314
- const context = usePopoverContext()
341
+ const context = usePopoverContext(__scopePopover)
315
342
  const { open, keepChildrenMounted } = context
316
- const popperContext = usePopperContext()
343
+ const popperContext = usePopperContext(__scopePopover || POPOVER_SCOPE)
317
344
  const [isFullyHidden, setIsFullyHidden] = React.useState(!context.open)
318
345
 
319
346
  const contents = React.useMemo(() => {
@@ -346,7 +373,10 @@ const PopoverContentImpl = React.forwardRef<
346
373
 
347
374
  if (Platform.OS === 'android' || Platform.OS === 'ios') {
348
375
  content = (
349
- <PopperContext.Provider {...popperContext}>
376
+ <PopperContext.Provider
377
+ scope={__scopePopover || POPOVER_SCOPE}
378
+ {...popperContext}
379
+ >
350
380
  {childrenWithoutScrollView}
351
381
  </PopperContext.Provider>
352
382
  )
@@ -385,6 +415,7 @@ const PopoverContentImpl = React.forwardRef<
385
415
  freeze={freeze}
386
416
  >
387
417
  <PopperContent
418
+ __scopePopper={__scopePopover || POPOVER_SCOPE}
388
419
  key={context.contentId}
389
420
  data-state={getState(open)}
390
421
  id={context.contentId}
@@ -432,21 +463,23 @@ const FreezeToLastContents = (props: { freeze: boolean; children: any }) => {
432
463
 
433
464
  export type PopoverCloseProps = YStackProps
434
465
 
435
- export const PopoverClose = React.forwardRef<TamaguiElement, PopoverCloseProps>(
436
- function PopoverClose(props: PopoverCloseProps, forwardedRef) {
437
- const context = usePopoverContext()
438
- return (
439
- <YStack
440
- {...props}
441
- ref={forwardedRef}
442
- componentName="PopoverClose"
443
- onPress={composeEventHandlers(props.onPress as any, () =>
444
- context.onOpenChange(false)
445
- )}
446
- />
447
- )
448
- }
449
- )
466
+ export const PopoverClose = React.forwardRef<
467
+ TamaguiElement,
468
+ ScopedPopoverProps<PopoverCloseProps>
469
+ >(function PopoverClose(props: ScopedPopoverProps<PopoverCloseProps>, forwardedRef) {
470
+ const { __scopePopover, ...rest } = props
471
+ const context = usePopoverContext(__scopePopover)
472
+ return (
473
+ <YStack
474
+ {...rest}
475
+ ref={forwardedRef}
476
+ componentName="PopoverClose"
477
+ onPress={composeEventHandlers(props.onPress as any, () =>
478
+ context.onOpenChange(false)
479
+ )}
480
+ />
481
+ )
482
+ })
450
483
 
451
484
  /* -------------------------------------------------------------------------------------------------
452
485
  * PopoverArrow
@@ -454,23 +487,33 @@ export const PopoverClose = React.forwardRef<TamaguiElement, PopoverCloseProps>(
454
487
 
455
488
  export type PopoverArrowProps = PopperArrowProps
456
489
 
457
- export const PopoverArrow = React.forwardRef<TamaguiElement, PopoverArrowProps>(
458
- function PopoverArrow(props: PopoverArrowProps, forwardedRef) {
459
- return <PopperArrow componentName="PopoverArrow" {...props} ref={forwardedRef} />
460
- }
461
- )
490
+ export const PopoverArrow = React.forwardRef<
491
+ TamaguiElement,
492
+ ScopedPopoverProps<PopoverArrowProps>
493
+ >(function PopoverArrow(props: ScopedPopoverProps<PopoverArrowProps>, forwardedRef) {
494
+ const { __scopePopover, ...rest } = props
495
+ return (
496
+ <PopperArrow
497
+ __scopePopper={__scopePopover || POPOVER_SCOPE}
498
+ componentName="PopoverArrow"
499
+ {...rest}
500
+ ref={forwardedRef}
501
+ />
502
+ )
503
+ })
462
504
 
463
505
  /* -------------------------------------------------------------------------------------------------
464
506
  * Popover
465
507
  * -----------------------------------------------------------------------------------------------*/
466
508
 
467
509
  export const Popover = withStaticProperties(
468
- function Popover(props: PopoverProps) {
510
+ function Popover(props: ScopedPopoverProps<PopoverProps>) {
469
511
  const {
470
512
  children,
471
513
  open: openProp,
472
514
  defaultOpen,
473
515
  onOpenChange,
516
+ __scopePopover,
474
517
  keepChildrenMounted,
475
518
  ...restProps
476
519
  } = props
@@ -523,8 +566,8 @@ export const Popover = withStaticProperties(
523
566
  // }
524
567
 
525
568
  const contents = (
526
- <Popper stayInFrame {...restProps}>
527
- <PopoverContext.Provider {...popoverContext}>
569
+ <Popper __scopePopper={__scopePopover || POPOVER_SCOPE} stayInFrame {...restProps}>
570
+ <PopoverContext.Provider scope={__scopePopover} {...popoverContext}>
528
571
  <PopoverSheetController onOpenChange={setOpen}>
529
572
  {children}
530
573
  </PopoverSheetController>
@@ -562,11 +605,14 @@ function getState(open: boolean) {
562
605
  return open ? 'open' : 'closed'
563
606
  }
564
607
 
565
- const PopoverSheetController = (props: {
608
+ const PopoverSheetController = ({
609
+ __scopePopover,
610
+ ...props
611
+ }: ScopedPopoverProps<{
566
612
  children: React.ReactNode
567
613
  onOpenChange: React.Dispatch<React.SetStateAction<boolean>>
568
- }) => {
569
- const context = usePopoverContext()
614
+ }>) => {
615
+ const context = usePopoverContext(__scopePopover)
570
616
  const showSheet = useShowPopoverSheet(context)
571
617
  const breakpointActive = context.breakpointActive
572
618
  const getShowSheet = useGet(showSheet)
@@ -29,7 +29,7 @@ type PopoverContextValue = {
29
29
  keepChildrenMounted?: boolean;
30
30
  };
31
31
  export declare const PopoverContext: import("@tamagui/core").StyledContext<PopoverContextValue>;
32
- export declare const usePopoverContext: () => PopoverContextValue;
32
+ export declare const usePopoverContext: (scope?: string | undefined) => PopoverContextValue;
33
33
  export type PopoverAnchorProps = YStackProps;
34
34
  export declare const PopoverAnchor: React.ForwardRefExoticComponent<Omit<import("react-native").ViewProps, "display" | "children" | "onLayout" | keyof import("react-native").GestureResponderHandlers | "style"> & import("@tamagui/core").ExtendBaseStackProps & import("@tamagui/core").TamaguiComponentPropsBase & {
35
35
  style?: import("@tamagui/core").StyleProp<React.CSSProperties | import("react-native").ViewStyle | (React.CSSProperties & import("react-native").ViewStyle)>;
@@ -46,11 +46,15 @@ export declare const PopoverAnchor: React.ForwardRefExoticComponent<Omit<import(
46
46
  } & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & import("@tamagui/core").RNViewProps & Omit<{}, "elevation" | "fullscreen"> & {
47
47
  readonly fullscreen?: boolean | undefined;
48
48
  readonly elevation?: SizeTokens | undefined;
49
- }>> & React.RefAttributes<TamaguiElement>>;
49
+ }>> & {
50
+ __scopePopover?: string | undefined;
51
+ } & React.RefAttributes<TamaguiElement>>;
50
52
  export type PopoverTriggerProps = StackProps;
51
53
  export declare const PopoverTrigger: React.ForwardRefExoticComponent<Omit<import("react-native").ViewProps, "display" | "children" | "style" | ("onLayout" | keyof import("react-native").GestureResponderHandlers)> & import("@tamagui/core").ExtendBaseStackProps & import("@tamagui/core").TamaguiComponentPropsBase & {
52
54
  style?: import("@tamagui/core").StyleProp<React.CSSProperties | import("react-native").ViewStyle | (React.CSSProperties & import("react-native").ViewStyle)>;
53
- } & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & import("@tamagui/core").PseudoProps<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>>> & import("@tamagui/core").MediaProps<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & import("@tamagui/core").PseudoProps<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>>>> & React.RefAttributes<TamaguiElement>>;
55
+ } & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & import("@tamagui/core").PseudoProps<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>>> & import("@tamagui/core").MediaProps<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & import("@tamagui/core").PseudoProps<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>>>> & {
56
+ __scopePopover?: string | undefined;
57
+ } & React.RefAttributes<TamaguiElement>>;
54
58
  export type PopoverContentProps = PopoverContentTypeProps;
55
59
  export interface PopoverContentTypeProps extends Omit<PopoverContentImplProps, 'disableOutsidePointerEvents'> {
56
60
  /**
@@ -58,7 +62,9 @@ export interface PopoverContentTypeProps extends Omit<PopoverContentImplProps, '
58
62
  */
59
63
  allowPinchZoom?: RemoveScrollProps['allowPinchZoom'];
60
64
  }
61
- export declare const PopoverContent: React.ForwardRefExoticComponent<PopoverContentTypeProps & React.RefAttributes<HTMLElement | import("react-native").View>>;
65
+ export declare const PopoverContent: React.ForwardRefExoticComponent<PopoverContentTypeProps & {
66
+ __scopePopover?: string | undefined;
67
+ } & React.RefAttributes<HTMLElement | import("react-native").View>>;
62
68
  export interface PopoverContentImplProps extends PopperContentProps, Omit<DismissableProps, 'onDismiss' | 'children' | 'onPointerDownCapture'> {
63
69
  /**
64
70
  * Whether focus should be trapped within the `Popover`
@@ -99,7 +105,9 @@ export declare const PopoverClose: React.ForwardRefExoticComponent<Omit<import("
99
105
  } & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & import("@tamagui/core").RNViewProps & Omit<{}, "elevation" | "fullscreen"> & {
100
106
  readonly fullscreen?: boolean | undefined;
101
107
  readonly elevation?: SizeTokens | undefined;
102
- }>> & React.RefAttributes<TamaguiElement>>;
108
+ }>> & {
109
+ __scopePopover?: string | undefined;
110
+ } & React.RefAttributes<TamaguiElement>>;
103
111
  export type PopoverArrowProps = PopperArrowProps;
104
112
  export declare const PopoverArrow: React.ForwardRefExoticComponent<Omit<import("react-native").ViewProps, "display" | "children" | "onLayout" | keyof import("react-native").GestureResponderHandlers | "style"> & import("@tamagui/core").ExtendBaseStackProps & import("@tamagui/core").TamaguiComponentPropsBase & {
105
113
  style?: import("@tamagui/core").StyleProp<React.CSSProperties | import("react-native").ViewStyle | (React.CSSProperties & import("react-native").ViewStyle)>;
@@ -119,6 +127,8 @@ export declare const PopoverArrow: React.ForwardRefExoticComponent<Omit<import("
119
127
  }>> & {
120
128
  offset?: number | undefined;
121
129
  size?: SizeTokens | undefined;
130
+ } & {
131
+ __scopePopover?: string | undefined;
122
132
  } & React.RefAttributes<TamaguiElement>>;
123
133
  export declare const Popover: React.FC<PopoverProps> & {
124
134
  Anchor: React.ForwardRefExoticComponent<Omit<import("react-native").ViewProps, "display" | "children" | "onLayout" | keyof import("react-native").GestureResponderHandlers | "style"> & import("@tamagui/core").ExtendBaseStackProps & import("@tamagui/core").TamaguiComponentPropsBase & {
@@ -136,7 +146,9 @@ export declare const Popover: React.FC<PopoverProps> & {
136
146
  } & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & import("@tamagui/core").RNViewProps & Omit<{}, "elevation" | "fullscreen"> & {
137
147
  readonly fullscreen?: boolean | undefined;
138
148
  readonly elevation?: SizeTokens | undefined;
139
- }>> & React.RefAttributes<TamaguiElement>>;
149
+ }>> & {
150
+ __scopePopover?: string | undefined;
151
+ } & React.RefAttributes<TamaguiElement>>;
140
152
  Arrow: React.ForwardRefExoticComponent<Omit<import("react-native").ViewProps, "display" | "children" | "onLayout" | keyof import("react-native").GestureResponderHandlers | "style"> & import("@tamagui/core").ExtendBaseStackProps & import("@tamagui/core").TamaguiComponentPropsBase & {
141
153
  style?: import("@tamagui/core").StyleProp<React.CSSProperties | import("react-native").ViewStyle | (React.CSSProperties & import("react-native").ViewStyle)>;
142
154
  } & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & import("@tamagui/core").RNViewProps & Omit<{}, "elevation" | "fullscreen"> & {
@@ -155,11 +167,17 @@ export declare const Popover: React.FC<PopoverProps> & {
155
167
  }>> & {
156
168
  offset?: number | undefined;
157
169
  size?: SizeTokens | undefined;
170
+ } & {
171
+ __scopePopover?: string | undefined;
158
172
  } & React.RefAttributes<TamaguiElement>>;
159
173
  Trigger: React.ForwardRefExoticComponent<Omit<import("react-native").ViewProps, "display" | "children" | "style" | ("onLayout" | keyof import("react-native").GestureResponderHandlers)> & import("@tamagui/core").ExtendBaseStackProps & import("@tamagui/core").TamaguiComponentPropsBase & {
160
174
  style?: import("@tamagui/core").StyleProp<React.CSSProperties | import("react-native").ViewStyle | (React.CSSProperties & import("react-native").ViewStyle)>;
161
- } & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & import("@tamagui/core").PseudoProps<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>>> & import("@tamagui/core").MediaProps<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & import("@tamagui/core").PseudoProps<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>>>> & React.RefAttributes<TamaguiElement>>;
162
- Content: React.ForwardRefExoticComponent<PopoverContentTypeProps & React.RefAttributes<HTMLElement | import("react-native").View>>;
175
+ } & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & import("@tamagui/core").PseudoProps<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>>> & import("@tamagui/core").MediaProps<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & import("@tamagui/core").PseudoProps<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>>>> & {
176
+ __scopePopover?: string | undefined;
177
+ } & React.RefAttributes<TamaguiElement>>;
178
+ Content: React.ForwardRefExoticComponent<PopoverContentTypeProps & {
179
+ __scopePopover?: string | undefined;
180
+ } & React.RefAttributes<HTMLElement | import("react-native").View>>;
163
181
  Close: React.ForwardRefExoticComponent<Omit<import("react-native").ViewProps, "display" | "children" | "onLayout" | keyof import("react-native").GestureResponderHandlers | "style"> & import("@tamagui/core").ExtendBaseStackProps & import("@tamagui/core").TamaguiComponentPropsBase & {
164
182
  style?: import("@tamagui/core").StyleProp<React.CSSProperties | import("react-native").ViewStyle | (React.CSSProperties & import("react-native").ViewStyle)>;
165
183
  } & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & import("@tamagui/core").RNViewProps & Omit<{}, "elevation" | "fullscreen"> & {
@@ -175,7 +193,9 @@ export declare const Popover: React.FC<PopoverProps> & {
175
193
  } & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & import("@tamagui/core").RNViewProps & Omit<{}, "elevation" | "fullscreen"> & {
176
194
  readonly fullscreen?: boolean | undefined;
177
195
  readonly elevation?: SizeTokens | undefined;
178
- }>> & React.RefAttributes<TamaguiElement>>;
196
+ }>> & {
197
+ __scopePopover?: string | undefined;
198
+ } & React.RefAttributes<TamaguiElement>>;
179
199
  Adapt: (({ platform, when, children }: import("@tamagui/adapt").AdaptProps) => any) & {
180
200
  Contents: {
181
201
  (props: any): React.FunctionComponentElement<any>;
@@ -1 +1 @@
1
- {"version":3,"file":"Popover.d.ts","sourceRoot":"","sources":["../src/Popover.tsx"],"names":[],"mappings":"AAAA,OAAO,uBAAuB,CAAA;AAM9B,OAAO,EAEL,UAAU,EAEV,UAAU,EACV,cAAc,EAWf,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAEvD,OAAO,EAAc,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAClE,OAAO,EAIL,gBAAgB,EAGhB,kBAAkB,EAElB,WAAW,EAEZ,MAAM,iBAAiB,CAAA;AAExB,OAAO,EAAgB,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAEx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