@tamagui/popover 1.5.20 → 1.5.21

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.
@@ -23,6 +23,7 @@ import {
23
23
  PopperAnchor,
24
24
  PopperArrow,
25
25
  PopperContent,
26
+ PopperContentFrame,
26
27
  PopperProvider,
27
28
  createPopperScope,
28
29
  usePopperContext
@@ -77,53 +78,57 @@ const PopoverTrigger = React.forwardRef((props, forwardedRef) => {
77
78
  });
78
79
  PopoverTrigger.displayName = TRIGGER_NAME;
79
80
  const CONTENT_NAME = "PopoverContent";
80
- const PopoverContent = React.forwardRef(function PopoverContent2(props, forwardedRef) {
81
- const {
82
- allowPinchZoom,
83
- trapFocus,
84
- disableRemoveScroll = true,
85
- zIndex,
86
- ...contentImplProps
87
- } = props;
88
- const context = usePopoverInternalContext(CONTENT_NAME, props.__scopePopover);
89
- const contentRef = React.useRef(null);
90
- const composedRefs = useComposedRefs(forwardedRef, contentRef);
91
- const isRightClickOutsideRef = React.useRef(false);
92
- React.useEffect(() => {
93
- if (!context.open)
94
- return;
95
- const content = contentRef.current;
96
- if (content)
97
- return hideOthers(content);
98
- }, [context.open]);
99
- return <PopoverContentPortal zIndex={zIndex}><PopoverContentImpl
100
- {...contentImplProps}
101
- disableRemoveScroll={disableRemoveScroll}
102
- ref={composedRefs}
103
- trapFocus={trapFocus ?? context.open}
104
- disableOutsidePointerEvents
105
- onCloseAutoFocus={composeEventHandlers(props.onCloseAutoFocus, (event) => {
106
- event.preventDefault();
107
- if (!isRightClickOutsideRef.current)
108
- context.triggerRef.current?.focus();
109
- })}
110
- onPointerDownOutside={composeEventHandlers(
111
- props.onPointerDownOutside,
112
- (event) => {
113
- const originalEvent = event.detail.originalEvent;
114
- const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
115
- const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
116
- isRightClickOutsideRef.current = isRightClick;
117
- },
118
- { checkDefaultPrevented: false }
119
- )}
120
- onFocusOutside={composeEventHandlers(
121
- props.onFocusOutside,
122
- (event) => event.preventDefault(),
123
- { checkDefaultPrevented: false }
124
- )}
125
- /></PopoverContentPortal>;
126
- });
81
+ const PopoverContent = PopperContentFrame.extractable(
82
+ React.forwardRef(
83
+ function PopoverContent2(props, forwardedRef) {
84
+ const {
85
+ allowPinchZoom,
86
+ trapFocus,
87
+ disableRemoveScroll = true,
88
+ zIndex,
89
+ ...contentImplProps
90
+ } = props;
91
+ const context = usePopoverInternalContext(CONTENT_NAME, props.__scopePopover);
92
+ const contentRef = React.useRef(null);
93
+ const composedRefs = useComposedRefs(forwardedRef, contentRef);
94
+ const isRightClickOutsideRef = React.useRef(false);
95
+ React.useEffect(() => {
96
+ if (!context.open)
97
+ return;
98
+ const content = contentRef.current;
99
+ if (content)
100
+ return hideOthers(content);
101
+ }, [context.open]);
102
+ return <PopoverContentPortal zIndex={zIndex}><PopoverContentImpl
103
+ {...contentImplProps}
104
+ disableRemoveScroll={disableRemoveScroll}
105
+ ref={composedRefs}
106
+ trapFocus={trapFocus ?? context.open}
107
+ disableOutsidePointerEvents
108
+ onCloseAutoFocus={composeEventHandlers(props.onCloseAutoFocus, (event) => {
109
+ event.preventDefault();
110
+ if (!isRightClickOutsideRef.current)
111
+ context.triggerRef.current?.focus();
112
+ })}
113
+ onPointerDownOutside={composeEventHandlers(
114
+ props.onPointerDownOutside,
115
+ (event) => {
116
+ const originalEvent = event.detail.originalEvent;
117
+ const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
118
+ const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
119
+ isRightClickOutsideRef.current = isRightClick;
120
+ },
121
+ { checkDefaultPrevented: false }
122
+ )}
123
+ onFocusOutside={composeEventHandlers(
124
+ props.onFocusOutside,
125
+ (event) => event.preventDefault(),
126
+ { checkDefaultPrevented: false }
127
+ )}
128
+ /></PopoverContentPortal>;
129
+ }
130
+ )
131
+ );
127
132
  function PopoverContentPortal(props) {
128
133
  const themeName = useThemeName();
129
134
  const context = usePopoverInternalContext(CONTENT_NAME, props.__scopePopover);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/Popover.tsx"],
4
- "sourcesContent": ["// adapted from radix-ui popover\n\nimport '@tamagui/polyfill-dev'\n\nimport { Adapt, useAdaptParent } from '@tamagui/adapt'\nimport { AnimatePresence } from '@tamagui/animate-presence'\nimport { hideOthers } from '@tamagui/aria-hidden'\nimport { useComposedRefs } from '@tamagui/compose-refs'\nimport {\n MediaQueryKey,\n SizeTokens,\n Stack,\n TamaguiElement,\n Theme,\n composeEventHandlers,\n isWeb,\n useEvent,\n useGet,\n useId,\n useMedia,\n useThemeName,\n withStaticProperties,\n} from '@tamagui/core'\nimport type { Scope } from '@tamagui/create-context'\nimport { createContextScope } from '@tamagui/create-context'\nimport { DismissableProps } from '@tamagui/dismissable'\nimport { FloatingOverrideContext } from '@tamagui/floating'\nimport { FocusScope, FocusScopeProps } from '@tamagui/focus-scope'\nimport {\n Popper,\n PopperAnchor,\n PopperArrow,\n PopperArrowProps,\n PopperContent,\n PopperContentFrame,\n PopperContentProps,\n PopperProps,\n PopperProvider,\n createPopperScope,\n usePopperContext,\n} from '@tamagui/popper'\nimport { Portal, PortalHost, PortalItem } from '@tamagui/portal'\nimport { RemoveScroll, RemoveScrollProps } from '@tamagui/remove-scroll'\nimport { ControlledSheet, SheetController } from '@tamagui/sheet'\nimport { YStack, YStackProps } from '@tamagui/stacks'\nimport { useControllableState } from '@tamagui/use-controllable-state'\nimport * as React from 'react'\nimport { Platform, ScrollView, ScrollViewProps, View } from 'react-native'\n\nimport { useFloatingContext } from './useFloatingContext'\n\nconst POPOVER_NAME = 'Popover'\n\ntype ScopedProps<P> = P & { __scopePopover?: Scope }\n\nexport type PopoverProps = PopperProps & {\n open?: boolean\n defaultOpen?: boolean\n onOpenChange?: (open: boolean) => void\n}\n\ntype PopoverContextValue = {\n triggerRef: React.RefObject<any>\n contentId?: string\n open: boolean\n onOpenChange(open: boolean): void\n onOpenToggle(): void\n hasCustomAnchor: boolean\n onCustomAnchorAdd(): void\n onCustomAnchorRemove(): void\n size?: SizeTokens\n sheetBreakpoint: any\n scopeKey: string\n popperScope: any\n breakpointActive?: boolean\n}\n\nconst [createPopoverContext, createPopoverScopeInternal] = createContextScope(\n POPOVER_NAME,\n [createPopperScope]\n)\nexport const usePopoverScope = createPopperScope()\nexport const createPopoverScope = createPopoverScopeInternal\n\nconst [PopoverProviderInternal, usePopoverInternalContext] =\n createPopoverContext<PopoverContextValue>(POPOVER_NAME)\n\nexport const __PopoverProviderInternal = PopoverProviderInternal\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverAnchor\n * -----------------------------------------------------------------------------------------------*/\n\nconst ANCHOR_NAME = 'PopoverAnchor'\n\ntype PopoverAnchorElement = HTMLElement | View\nexport type PopoverAnchorProps = YStackProps\n\nexport const PopoverAnchor = React.forwardRef<PopoverAnchorElement, PopoverAnchorProps>(\n (props: ScopedProps<PopoverAnchorProps>, forwardedRef) => {\n const { __scopePopover, ...anchorProps } = props\n const context = usePopoverInternalContext(ANCHOR_NAME, __scopePopover)\n const popperScope = usePopoverScope(__scopePopover)\n const { onCustomAnchorAdd, onCustomAnchorRemove } = context\n\n React.useEffect(() => {\n onCustomAnchorAdd()\n return () => onCustomAnchorRemove()\n }, [onCustomAnchorAdd, onCustomAnchorRemove])\n\n return <PopperAnchor {...popperScope} {...anchorProps} ref={forwardedRef} />\n }\n)\n\nPopoverAnchor.displayName = ANCHOR_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'PopoverTrigger'\n\ntype PopoverTriggerElement = HTMLElement | View\nexport type PopoverTriggerProps = YStackProps\n\nexport const PopoverTrigger = React.forwardRef<\n PopoverTriggerElement,\n PopoverTriggerProps\n>((props: ScopedProps<PopoverTriggerProps>, forwardedRef) => {\n const { __scopePopover, ...triggerProps } = props\n const context = usePopoverInternalContext(TRIGGER_NAME, __scopePopover)\n const popperScope = usePopoverScope(__scopePopover)\n const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef)\n\n const trigger = (\n <YStack\n aria-haspopup=\"dialog\"\n aria-expanded={context.open}\n // TODO not matching\n // aria-controls={context.contentId}\n data-state={getState(context.open)}\n {...triggerProps}\n ref={composedTriggerRef}\n onPress={composeEventHandlers(props.onPress as any, context.onOpenToggle)}\n />\n )\n\n return context.hasCustomAnchor ? (\n trigger\n ) : (\n <PopperAnchor asChild {...popperScope}>\n {trigger}\n </PopperAnchor>\n )\n})\n\nPopoverTrigger.displayName = TRIGGER_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'PopoverContent'\n\nexport type PopoverContentProps = PopoverContentTypeProps\n\ntype PopoverContentTypeElement = PopoverContentImplElement\n\nexport interface PopoverContentTypeProps\n extends Omit<PopoverContentImplProps, 'disableOutsidePointerEvents'> {\n /**\n * @see https://github.com/theKashey/react-remove-scroll#usage\n */\n allowPinchZoom?: RemoveScrollProps['allowPinchZoom']\n}\n\nexport const PopoverContent = React.forwardRef<\n PopoverContentTypeElement,\n PopoverContentTypeProps\n>(function PopoverContent(props: ScopedProps<PopoverContentTypeProps>, forwardedRef) {\n const {\n allowPinchZoom,\n trapFocus,\n disableRemoveScroll = true,\n zIndex,\n ...contentImplProps\n } = props\n const context = usePopoverInternalContext(CONTENT_NAME, props.__scopePopover)\n const contentRef = React.useRef<any>(null)\n const composedRefs = useComposedRefs(forwardedRef, contentRef)\n const isRightClickOutsideRef = React.useRef(false)\n\n // aria-hide everything except the content (better supported equivalent to setting aria-modal)\n React.useEffect(() => {\n if (!context.open) return\n const content = contentRef.current\n if (content) return hideOthers(content)\n }, [context.open])\n\n return (\n <PopoverContentPortal zIndex={zIndex}>\n <PopoverContentImpl\n {...contentImplProps}\n disableRemoveScroll={disableRemoveScroll}\n ref={composedRefs}\n // we make sure we're not trapping once it's been closed\n // (closed !== unmounted when animating out)\n trapFocus={trapFocus ?? context.open}\n disableOutsidePointerEvents\n onCloseAutoFocus={composeEventHandlers(props.onCloseAutoFocus, (event) => {\n event.preventDefault()\n if (!isRightClickOutsideRef.current) context.triggerRef.current?.focus()\n })}\n onPointerDownOutside={composeEventHandlers(\n props.onPointerDownOutside,\n (event) => {\n const originalEvent = event.detail.originalEvent\n const ctrlLeftClick =\n originalEvent.button === 0 && originalEvent.ctrlKey === true\n const isRightClick = originalEvent.button === 2 || ctrlLeftClick\n isRightClickOutsideRef.current = isRightClick\n },\n { checkDefaultPrevented: false }\n )}\n // When focus is trapped, a `focusout` event may still happen.\n // We make sure we don't trigger our `onDismiss` in such case.\n onFocusOutside={composeEventHandlers(\n props.onFocusOutside,\n (event) => event.preventDefault(),\n { checkDefaultPrevented: false }\n )}\n />\n </PopoverContentPortal>\n )\n})\n\nfunction PopoverContentPortal(props: ScopedProps<PopoverContentTypeProps>) {\n const themeName = useThemeName()\n const context = usePopoverInternalContext(CONTENT_NAME, props.__scopePopover)\n\n // on android we have to re-pass context\n let contents = props.children\n\n if (Platform.OS === 'android') {\n // ok conditional hooks by platform\n const popperContext = usePopperContext(CONTENT_NAME, context.popperScope)\n\n contents = (\n <PopperProvider {...popperContext} scope={context.popperScope}>\n <PopoverProviderInternal scope={props.__scopePopover} {...context}>\n {/* does this need to be props.__scopePopper? */}\n {props.children}\n </PopoverProviderInternal>\n </PopperProvider>\n )\n }\n\n const zIndex = props.zIndex ?? 1000\n\n // Portal the contents and add a transparent bg overlay to handle dismiss on native\n return (\n <Portal zIndex={zIndex}>\n <Theme forceClassName name={themeName}>\n {!!context.open && !context.breakpointActive && (\n <YStack\n fullscreen\n onPress={composeEventHandlers(props.onPress as any, context.onOpenToggle)}\n />\n )}\n <Stack zIndex={(zIndex as number) + 1}>{contents}</Stack>\n </Theme>\n </Portal>\n )\n}\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype PopoverContentImplElement = React.ElementRef<typeof PopperContent>\n\nexport interface PopoverContentImplProps\n extends PopperContentProps,\n Omit<DismissableProps, 'onDismiss' | 'children'> {\n /**\n * Whether focus should be trapped within the `Popover`\n * (default: false)\n */\n trapFocus?: FocusScopeProps['trapped']\n\n /**\n * Event handler called when auto-focusing on open.\n * Can be prevented.\n */\n onOpenAutoFocus?: FocusScopeProps['onMountAutoFocus']\n\n /**\n * Event handler called when auto-focusing on close.\n * Can be prevented.\n */\n onCloseAutoFocus?: FocusScopeProps['onUnmountAutoFocus']\n\n disableRemoveScroll?: boolean\n}\n\nconst PopoverContentImpl = React.forwardRef<\n PopoverContentImplElement,\n PopoverContentImplProps\n>((props: ScopedProps<PopoverContentImplProps>, forwardedRef) => {\n const {\n __scopePopover,\n trapFocus,\n onOpenAutoFocus,\n onCloseAutoFocus,\n disableOutsidePointerEvents,\n onEscapeKeyDown,\n onPointerDownOutside,\n onFocusOutside,\n onInteractOutside,\n children,\n disableRemoveScroll,\n ...contentProps\n } = props\n const popperScope = usePopoverScope(__scopePopover)\n const context = usePopoverInternalContext(CONTENT_NAME, popperScope.__scopePopover)\n\n if (context.breakpointActive) {\n // unwrap the PopoverScrollView if used, as it will use the SheetScrollView if that exists\n const childrenWithoutScrollView = React.Children.toArray(children).map((child) => {\n if (React.isValidElement(child)) {\n if (child.type === PopoverScrollView) {\n return child.props.children\n }\n }\n return child\n })\n\n // doesn't show as popover yet on native, must use as sheet\n return (\n <PortalItem hostName={`${context.scopeKey}PopoverContents`}>\n {childrenWithoutScrollView}\n </PortalItem>\n )\n }\n\n // const handleDismiss = React.useCallback((event: GestureResponderEvent) =>{\n // context.onOpenChange(false);\n // }, [])\n // <Dismissable\n // disableOutsidePointerEvents={disableOutsidePointerEvents}\n // // onInteractOutside={onInteractOutside}\n // onEscapeKeyDown={onEscapeKeyDown}\n // // onPointerDownOutside={onPointerDownOutside}\n // // onFocusOutside={onFocusOutside}\n // onDismiss={handleDismiss}\n // >\n\n return (\n <AnimatePresence>\n {!!context.open && (\n <PopperContent\n key={context.contentId}\n data-state={getState(context.open)}\n id={context.contentId}\n pointerEvents=\"auto\"\n ref={forwardedRef}\n {...popperScope}\n {...contentProps}\n >\n <RemoveScroll\n enabled={disableRemoveScroll ? false : context.open}\n allowPinchZoom\n // causes lots of bugs on touch web on site\n removeScrollBar={false}\n style={{\n display: 'contents',\n }}\n >\n {trapFocus === false ? (\n children\n ) : (\n <FocusScope\n loop\n trapped={trapFocus ?? context.open}\n onMountAutoFocus={onOpenAutoFocus}\n onUnmountAutoFocus={onCloseAutoFocus}\n >\n {isWeb ? <div style={{ display: 'contents' }}>{children}</div> : children}\n </FocusScope>\n )}\n </RemoveScroll>\n </PopperContent>\n )}\n </AnimatePresence>\n )\n})\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverClose\n * -----------------------------------------------------------------------------------------------*/\n\nconst CLOSE_NAME = 'PopoverClose'\n\ntype PopoverCloseElement = HTMLElement | View\nexport type PopoverCloseProps = YStackProps\n\nexport const PopoverClose = React.forwardRef<PopoverCloseElement, PopoverCloseProps>(\n (props: ScopedProps<PopoverCloseProps>, forwardedRef) => {\n const { __scopePopover, ...closeProps } = props\n const context = usePopoverInternalContext(CLOSE_NAME, __scopePopover)\n return (\n <YStack\n {...closeProps}\n ref={forwardedRef}\n onPress={composeEventHandlers(props.onPress as any, () =>\n context.onOpenChange(false)\n )}\n />\n )\n }\n)\n\nPopoverClose.displayName = CLOSE_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverArrow\n * -----------------------------------------------------------------------------------------------*/\n\nconst ARROW_NAME = 'PopoverArrow'\n\ntype PopoverArrowElement = HTMLElement | View\nexport type PopoverArrowProps = PopperArrowProps\n\nexport const PopoverArrow = React.forwardRef<PopoverArrowElement, PopoverArrowProps>(\n (props: ScopedProps<PopoverArrowProps>, forwardedRef) => {\n const { __scopePopover, ...arrowProps } = props\n const popperScope = usePopoverScope(__scopePopover)\n return <PopperArrow {...popperScope} {...arrowProps} ref={forwardedRef} />\n }\n)\n\nPopoverArrow.displayName = ARROW_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverScrollView\n * -----------------------------------------------------------------------------------------------*/\n\nconst PopoverScrollView = React.forwardRef<ScrollView, ScrollViewProps>((props, ref) => {\n return <ScrollView ref={ref} {...props} />\n})\n\n/* -------------------------------------------------------------------------------------------------\n * Popover\n * -----------------------------------------------------------------------------------------------*/\n\nexport const Popover = withStaticProperties(\n function Popover(props: ScopedProps<PopoverProps>) {\n const {\n __scopePopover,\n children,\n open: openProp,\n defaultOpen,\n onOpenChange,\n ...restProps\n } = props\n\n const internalId = useId()\n const id = __scopePopover ? Object.keys(__scopePopover)[0] : internalId\n\n const { when, AdaptProvider } = useAdaptParent({\n Contents: React.useCallback(() => {\n return <PortalHost name={`${id}PopoverContents`} />\n }, []),\n })\n\n const sheetBreakpoint = when\n const popperScope = usePopoverScope(__scopePopover)\n const triggerRef = React.useRef<TamaguiElement>(null)\n const [hasCustomAnchor, setHasCustomAnchor] = React.useState(false)\n const [open, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen || false,\n onChange: onOpenChange,\n transition: true,\n })\n\n const breakpointActive = useSheetBreakpointActive(sheetBreakpoint)\n\n const floatingContext = useFloatingContext({ open, setOpen, breakpointActive }) as any\n\n const popoverContext = {\n scope: __scopePopover,\n scopeKey: id,\n popperScope: popperScope.__scopePopper,\n sheetBreakpoint,\n contentId: useId(),\n triggerRef,\n open,\n breakpointActive,\n onOpenChange: setOpen,\n onOpenToggle: useEvent(() => {\n if (open && breakpointActive) {\n return\n }\n setOpen(!open)\n }),\n hasCustomAnchor,\n onCustomAnchorAdd: React.useCallback(() => setHasCustomAnchor(true), []),\n onCustomAnchorRemove: React.useCallback(() => setHasCustomAnchor(false), []),\n }\n\n // debug if changing too often\n // if (process.env.NODE_ENV === 'development') {\n // Object.keys(popoverContext).forEach((key) => {\n // React.useEffect(() => console.log(`changed`, key), [popoverContext[key]])\n // })\n // }\n\n const contents = (\n <Popper {...popperScope} stayInFrame {...restProps}>\n <PopoverProviderInternal {...popoverContext}>\n <PopoverSheetController onOpenChange={setOpen} __scopePopover={__scopePopover}>\n {children}\n </PopoverSheetController>\n </PopoverProviderInternal>\n </Popper>\n )\n\n return (\n <AdaptProvider>\n {isWeb ? (\n <FloatingOverrideContext.Provider value={floatingContext}>\n {contents}\n </FloatingOverrideContext.Provider>\n ) : (\n contents\n )}\n </AdaptProvider>\n )\n } as React.FC<PopoverProps>,\n {\n Anchor: PopoverAnchor,\n Arrow: PopoverArrow,\n Trigger: PopoverTrigger,\n Content: PopoverContent,\n Close: PopoverClose,\n Adapt,\n ScrollView: PopoverScrollView,\n Sheet: ControlledSheet,\n }\n)\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction getState(open: boolean) {\n return open ? 'open' : 'closed'\n}\n\nconst PopoverSheetController = (\n props: ScopedProps<{\n children: React.ReactNode\n onOpenChange: React.Dispatch<React.SetStateAction<boolean>>\n }>\n) => {\n const context = usePopoverInternalContext(\n 'PopoverSheetController',\n props.__scopePopover\n )\n const showSheet = useShowPopoverSheet(context)\n const breakpointActive = context.breakpointActive\n const getShowSheet = useGet(showSheet)\n return (\n <SheetController\n onOpenChange={(val) => {\n if (getShowSheet()) {\n props.onOpenChange(val)\n }\n }}\n open={context.open}\n hidden={breakpointActive === false}\n >\n {props.children}\n </SheetController>\n )\n}\n\nconst useSheetBreakpointActive = (breakpoint?: MediaQueryKey | null | boolean) => {\n const media = useMedia()\n if (typeof breakpoint === 'boolean' || !breakpoint) {\n return !!breakpoint\n }\n return media[breakpoint]\n}\n\nconst useShowPopoverSheet = (context: PopoverContextValue) => {\n const breakpointActive = useSheetBreakpointActive(context.sheetBreakpoint)\n return context.open === false ? false : breakpointActive\n}\n"],
5
- "mappings": "AAEA,OAAO;AAEP,SAAS,OAAO,sBAAsB;AACtC,SAAS,uBAAuB;AAChC,SAAS,kBAAkB;AAC3B,SAAS,uBAAuB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AC,QAAQ;AACrB,UAAI,aAAa,GAAG;AAClB,cAAM,aAAa,GAAG;AAAA,MACxB;AAAA,IACF;AAAA,IACA,MAAM,QAAQ;AAAA,IACd,QAAQ,qBAAqB;AAAA,IAE5B,MAAM,SACT,EAVC;AAYL;AAEA,MAAM,2BAA2B,CAAC,eAAgD;AAChF,QAAM,QAAQ,SAAS;AACvB,MAAI,OAAO,eAAe,aAAa,CAAC,YAAY;AAClD,WAAO,CAAC,CAAC;AAAA,EACX;AACA,SAAO,MAAM,UAAU;AACzB;AAEA,MAAM,sBAAsB,CAAC,YAAiC;AAC5D,QAAM,mBAAmB,yBAAyB,QAAQ,eAAe;AACzE,SAAO,QAAQ,SAAS,QAAQ,QAAQ;AAC1C;",
4
+ "sourcesContent": ["// adapted from radix-ui popover\n\nimport '@tamagui/polyfill-dev'\n\nimport { Adapt, useAdaptParent } from '@tamagui/adapt'\nimport { AnimatePresence } from '@tamagui/animate-presence'\nimport { hideOthers } from '@tamagui/aria-hidden'\nimport { useComposedRefs } from '@tamagui/compose-refs'\nimport {\n MediaQueryKey,\n SizeTokens,\n Stack,\n TamaguiElement,\n Theme,\n composeEventHandlers,\n isWeb,\n useEvent,\n useGet,\n useId,\n useMedia,\n useThemeName,\n withStaticProperties,\n} from '@tamagui/core'\nimport type { Scope } from '@tamagui/create-context'\nimport { createContextScope } from '@tamagui/create-context'\nimport { DismissableProps } from '@tamagui/dismissable'\nimport { FloatingOverrideContext } from '@tamagui/floating'\nimport { FocusScope, FocusScopeProps } from '@tamagui/focus-scope'\nimport {\n Popper,\n PopperAnchor,\n PopperArrow,\n PopperArrowProps,\n PopperContent,\n PopperContentFrame,\n PopperContentProps,\n PopperProps,\n PopperProvider,\n createPopperScope,\n usePopperContext,\n} from '@tamagui/popper'\nimport { Portal, PortalHost, PortalItem } from '@tamagui/portal'\nimport { RemoveScroll, RemoveScrollProps } from '@tamagui/remove-scroll'\nimport { ControlledSheet, SheetController } from '@tamagui/sheet'\nimport { YStack, YStackProps } from '@tamagui/stacks'\nimport { useControllableState } from '@tamagui/use-controllable-state'\nimport * as React from 'react'\nimport { Platform, ScrollView, ScrollViewProps, View } from 'react-native'\n\nimport { useFloatingContext } from './useFloatingContext'\n\nconst POPOVER_NAME = 'Popover'\n\ntype ScopedProps<P> = P & { __scopePopover?: Scope }\n\nexport type PopoverProps = PopperProps & {\n open?: boolean\n defaultOpen?: boolean\n onOpenChange?: (open: boolean) => void\n}\n\ntype PopoverContextValue = {\n triggerRef: React.RefObject<any>\n contentId?: string\n open: boolean\n onOpenChange(open: boolean): void\n onOpenToggle(): void\n hasCustomAnchor: boolean\n onCustomAnchorAdd(): void\n onCustomAnchorRemove(): void\n size?: SizeTokens\n sheetBreakpoint: any\n scopeKey: string\n popperScope: any\n breakpointActive?: boolean\n}\n\nconst [createPopoverContext, createPopoverScopeInternal] = createContextScope(\n POPOVER_NAME,\n [createPopperScope]\n)\nexport const usePopoverScope = createPopperScope()\nexport const createPopoverScope = createPopoverScopeInternal\n\nconst [PopoverProviderInternal, usePopoverInternalContext] =\n createPopoverContext<PopoverContextValue>(POPOVER_NAME)\n\nexport const __PopoverProviderInternal = PopoverProviderInternal\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverAnchor\n * -----------------------------------------------------------------------------------------------*/\n\nconst ANCHOR_NAME = 'PopoverAnchor'\n\ntype PopoverAnchorElement = HTMLElement | View\nexport type PopoverAnchorProps = YStackProps\n\nexport const PopoverAnchor = React.forwardRef<PopoverAnchorElement, PopoverAnchorProps>(\n (props: ScopedProps<PopoverAnchorProps>, forwardedRef) => {\n const { __scopePopover, ...anchorProps } = props\n const context = usePopoverInternalContext(ANCHOR_NAME, __scopePopover)\n const popperScope = usePopoverScope(__scopePopover)\n const { onCustomAnchorAdd, onCustomAnchorRemove } = context\n\n React.useEffect(() => {\n onCustomAnchorAdd()\n return () => onCustomAnchorRemove()\n }, [onCustomAnchorAdd, onCustomAnchorRemove])\n\n return <PopperAnchor {...popperScope} {...anchorProps} ref={forwardedRef} />\n }\n)\n\nPopoverAnchor.displayName = ANCHOR_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'PopoverTrigger'\n\ntype PopoverTriggerElement = HTMLElement | View\nexport type PopoverTriggerProps = YStackProps\n\nexport const PopoverTrigger = React.forwardRef<\n PopoverTriggerElement,\n PopoverTriggerProps\n>((props: ScopedProps<PopoverTriggerProps>, forwardedRef) => {\n const { __scopePopover, ...triggerProps } = props\n const context = usePopoverInternalContext(TRIGGER_NAME, __scopePopover)\n const popperScope = usePopoverScope(__scopePopover)\n const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef)\n\n const trigger = (\n <YStack\n aria-haspopup=\"dialog\"\n aria-expanded={context.open}\n // TODO not matching\n // aria-controls={context.contentId}\n data-state={getState(context.open)}\n {...triggerProps}\n ref={composedTriggerRef}\n onPress={composeEventHandlers(props.onPress as any, context.onOpenToggle)}\n />\n )\n\n return context.hasCustomAnchor ? (\n trigger\n ) : (\n <PopperAnchor asChild {...popperScope}>\n {trigger}\n </PopperAnchor>\n )\n})\n\nPopoverTrigger.displayName = TRIGGER_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'PopoverContent'\n\nexport type PopoverContentProps = PopoverContentTypeProps\n\ntype PopoverContentTypeElement = PopoverContentImplElement\n\nexport interface PopoverContentTypeProps\n extends Omit<PopoverContentImplProps, 'disableOutsidePointerEvents'> {\n /**\n * @see https://github.com/theKashey/react-remove-scroll#usage\n */\n allowPinchZoom?: RemoveScrollProps['allowPinchZoom']\n}\n\nexport const PopoverContent = PopperContentFrame.extractable(\n React.forwardRef<PopoverContentTypeElement, PopoverContentTypeProps>(\n function PopoverContent(props: ScopedProps<PopoverContentTypeProps>, forwardedRef) {\n const {\n allowPinchZoom,\n trapFocus,\n disableRemoveScroll = true,\n zIndex,\n ...contentImplProps\n } = props\n const context = usePopoverInternalContext(CONTENT_NAME, props.__scopePopover)\n const contentRef = React.useRef<any>(null)\n const composedRefs = useComposedRefs(forwardedRef, contentRef)\n const isRightClickOutsideRef = React.useRef(false)\n\n // aria-hide everything except the content (better supported equivalent to setting aria-modal)\n React.useEffect(() => {\n if (!context.open) return\n const content = contentRef.current\n if (content) return hideOthers(content)\n }, [context.open])\n\n return (\n <PopoverContentPortal zIndex={zIndex}>\n <PopoverContentImpl\n {...contentImplProps}\n disableRemoveScroll={disableRemoveScroll}\n ref={composedRefs}\n // we make sure we're not trapping once it's been closed\n // (closed !== unmounted when animating out)\n trapFocus={trapFocus ?? context.open}\n disableOutsidePointerEvents\n onCloseAutoFocus={composeEventHandlers(props.onCloseAutoFocus, (event) => {\n event.preventDefault()\n if (!isRightClickOutsideRef.current) context.triggerRef.current?.focus()\n })}\n onPointerDownOutside={composeEventHandlers(\n props.onPointerDownOutside,\n (event) => {\n const originalEvent = event.detail.originalEvent\n const ctrlLeftClick =\n originalEvent.button === 0 && originalEvent.ctrlKey === true\n const isRightClick = originalEvent.button === 2 || ctrlLeftClick\n isRightClickOutsideRef.current = isRightClick\n },\n { checkDefaultPrevented: false }\n )}\n // When focus is trapped, a `focusout` event may still happen.\n // We make sure we don't trigger our `onDismiss` in such case.\n onFocusOutside={composeEventHandlers(\n props.onFocusOutside,\n (event) => event.preventDefault(),\n { checkDefaultPrevented: false }\n )}\n />\n </PopoverContentPortal>\n )\n }\n )\n)\n\nfunction PopoverContentPortal(props: ScopedProps<PopoverContentTypeProps>) {\n const themeName = useThemeName()\n const context = usePopoverInternalContext(CONTENT_NAME, props.__scopePopover)\n\n // on android we have to re-pass context\n let contents = props.children\n\n if (Platform.OS === 'android') {\n // ok conditional hooks by platform\n const popperContext = usePopperContext(CONTENT_NAME, context.popperScope)\n\n contents = (\n <PopperProvider {...popperContext} scope={context.popperScope}>\n <PopoverProviderInternal scope={props.__scopePopover} {...context}>\n {/* does this need to be props.__scopePopper? */}\n {props.children}\n </PopoverProviderInternal>\n </PopperProvider>\n )\n }\n\n const zIndex = props.zIndex ?? 1000\n\n // Portal the contents and add a transparent bg overlay to handle dismiss on native\n return (\n <Portal zIndex={zIndex}>\n <Theme forceClassName name={themeName}>\n {!!context.open && !context.breakpointActive && (\n <YStack\n fullscreen\n onPress={composeEventHandlers(props.onPress as any, context.onOpenToggle)}\n />\n )}\n <Stack zIndex={(zIndex as number) + 1}>{contents}</Stack>\n </Theme>\n </Portal>\n )\n}\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype PopoverContentImplElement = React.ElementRef<typeof PopperContent>\n\nexport interface PopoverContentImplProps\n extends PopperContentProps,\n Omit<DismissableProps, 'onDismiss' | 'children'> {\n /**\n * Whether focus should be trapped within the `Popover`\n * (default: false)\n */\n trapFocus?: FocusScopeProps['trapped']\n\n /**\n * Event handler called when auto-focusing on open.\n * Can be prevented.\n */\n onOpenAutoFocus?: FocusScopeProps['onMountAutoFocus']\n\n /**\n * Event handler called when auto-focusing on close.\n * Can be prevented.\n */\n onCloseAutoFocus?: FocusScopeProps['onUnmountAutoFocus']\n\n disableRemoveScroll?: boolean\n}\n\nconst PopoverContentImpl = React.forwardRef<\n PopoverContentImplElement,\n PopoverContentImplProps\n>((props: ScopedProps<PopoverContentImplProps>, forwardedRef) => {\n const {\n __scopePopover,\n trapFocus,\n onOpenAutoFocus,\n onCloseAutoFocus,\n disableOutsidePointerEvents,\n onEscapeKeyDown,\n onPointerDownOutside,\n onFocusOutside,\n onInteractOutside,\n children,\n disableRemoveScroll,\n ...contentProps\n } = props\n const popperScope = usePopoverScope(__scopePopover)\n const context = usePopoverInternalContext(CONTENT_NAME, popperScope.__scopePopover)\n\n if (context.breakpointActive) {\n // unwrap the PopoverScrollView if used, as it will use the SheetScrollView if that exists\n const childrenWithoutScrollView = React.Children.toArray(children).map((child) => {\n if (React.isValidElement(child)) {\n if (child.type === PopoverScrollView) {\n return child.props.children\n }\n }\n return child\n })\n\n // doesn't show as popover yet on native, must use as sheet\n return (\n <PortalItem hostName={`${context.scopeKey}PopoverContents`}>\n {childrenWithoutScrollView}\n </PortalItem>\n )\n }\n\n // const handleDismiss = React.useCallback((event: GestureResponderEvent) =>{\n // context.onOpenChange(false);\n // }, [])\n // <Dismissable\n // disableOutsidePointerEvents={disableOutsidePointerEvents}\n // // onInteractOutside={onInteractOutside}\n // onEscapeKeyDown={onEscapeKeyDown}\n // // onPointerDownOutside={onPointerDownOutside}\n // // onFocusOutside={onFocusOutside}\n // onDismiss={handleDismiss}\n // >\n\n return (\n <AnimatePresence>\n {!!context.open && (\n <PopperContent\n key={context.contentId}\n data-state={getState(context.open)}\n id={context.contentId}\n pointerEvents=\"auto\"\n ref={forwardedRef}\n {...popperScope}\n {...contentProps}\n >\n <RemoveScroll\n enabled={disableRemoveScroll ? false : context.open}\n allowPinchZoom\n // causes lots of bugs on touch web on site\n removeScrollBar={false}\n style={{\n display: 'contents',\n }}\n >\n {trapFocus === false ? (\n children\n ) : (\n <FocusScope\n loop\n trapped={trapFocus ?? context.open}\n onMountAutoFocus={onOpenAutoFocus}\n onUnmountAutoFocus={onCloseAutoFocus}\n >\n {isWeb ? <div style={{ display: 'contents' }}>{children}</div> : children}\n </FocusScope>\n )}\n </RemoveScroll>\n </PopperContent>\n )}\n </AnimatePresence>\n )\n})\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverClose\n * -----------------------------------------------------------------------------------------------*/\n\nconst CLOSE_NAME = 'PopoverClose'\n\ntype PopoverCloseElement = HTMLElement | View\nexport type PopoverCloseProps = YStackProps\n\nexport const PopoverClose = React.forwardRef<PopoverCloseElement, PopoverCloseProps>(\n (props: ScopedProps<PopoverCloseProps>, forwardedRef) => {\n const { __scopePopover, ...closeProps } = props\n const context = usePopoverInternalContext(CLOSE_NAME, __scopePopover)\n return (\n <YStack\n {...closeProps}\n ref={forwardedRef}\n onPress={composeEventHandlers(props.onPress as any, () =>\n context.onOpenChange(false)\n )}\n />\n )\n }\n)\n\nPopoverClose.displayName = CLOSE_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverArrow\n * -----------------------------------------------------------------------------------------------*/\n\nconst ARROW_NAME = 'PopoverArrow'\n\ntype PopoverArrowElement = HTMLElement | View\nexport type PopoverArrowProps = PopperArrowProps\n\nexport const PopoverArrow = React.forwardRef<PopoverArrowElement, PopoverArrowProps>(\n (props: ScopedProps<PopoverArrowProps>, forwardedRef) => {\n const { __scopePopover, ...arrowProps } = props\n const popperScope = usePopoverScope(__scopePopover)\n return <PopperArrow {...popperScope} {...arrowProps} ref={forwardedRef} />\n }\n)\n\nPopoverArrow.displayName = ARROW_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverScrollView\n * -----------------------------------------------------------------------------------------------*/\n\nconst PopoverScrollView = React.forwardRef<ScrollView, ScrollViewProps>((props, ref) => {\n return <ScrollView ref={ref} {...props} />\n})\n\n/* -------------------------------------------------------------------------------------------------\n * Popover\n * -----------------------------------------------------------------------------------------------*/\n\nexport const Popover = withStaticProperties(\n function Popover(props: ScopedProps<PopoverProps>) {\n const {\n __scopePopover,\n children,\n open: openProp,\n defaultOpen,\n onOpenChange,\n ...restProps\n } = props\n\n const internalId = useId()\n const id = __scopePopover ? Object.keys(__scopePopover)[0] : internalId\n\n const { when, AdaptProvider } = useAdaptParent({\n Contents: React.useCallback(() => {\n return <PortalHost name={`${id}PopoverContents`} />\n }, []),\n })\n\n const sheetBreakpoint = when\n const popperScope = usePopoverScope(__scopePopover)\n const triggerRef = React.useRef<TamaguiElement>(null)\n const [hasCustomAnchor, setHasCustomAnchor] = React.useState(false)\n const [open, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen || false,\n onChange: onOpenChange,\n transition: true,\n })\n\n const breakpointActive = useSheetBreakpointActive(sheetBreakpoint)\n\n const floatingContext = useFloatingContext({ open, setOpen, breakpointActive }) as any\n\n const popoverContext = {\n scope: __scopePopover,\n scopeKey: id,\n popperScope: popperScope.__scopePopper,\n sheetBreakpoint,\n contentId: useId(),\n triggerRef,\n open,\n breakpointActive,\n onOpenChange: setOpen,\n onOpenToggle: useEvent(() => {\n if (open && breakpointActive) {\n return\n }\n setOpen(!open)\n }),\n hasCustomAnchor,\n onCustomAnchorAdd: React.useCallback(() => setHasCustomAnchor(true), []),\n onCustomAnchorRemove: React.useCallback(() => setHasCustomAnchor(false), []),\n }\n\n // debug if changing too often\n // if (process.env.NODE_ENV === 'development') {\n // Object.keys(popoverContext).forEach((key) => {\n // React.useEffect(() => console.log(`changed`, key), [popoverContext[key]])\n // })\n // }\n\n const contents = (\n <Popper {...popperScope} stayInFrame {...restProps}>\n <PopoverProviderInternal {...popoverContext}>\n <PopoverSheetController onOpenChange={setOpen} __scopePopover={__scopePopover}>\n {children}\n </PopoverSheetController>\n </PopoverProviderInternal>\n </Popper>\n )\n\n return (\n <AdaptProvider>\n {isWeb ? (\n <FloatingOverrideContext.Provider value={floatingContext}>\n {contents}\n </FloatingOverrideContext.Provider>\n ) : (\n contents\n )}\n </AdaptProvider>\n )\n } as React.FC<PopoverProps>,\n {\n Anchor: PopoverAnchor,\n Arrow: PopoverArrow,\n Trigger: PopoverTrigger,\n Content: PopoverContent,\n Close: PopoverClose,\n Adapt,\n ScrollView: PopoverScrollView,\n Sheet: ControlledSheet,\n }\n)\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction getState(open: boolean) {\n return open ? 'open' : 'closed'\n}\n\nconst PopoverSheetController = (\n props: ScopedProps<{\n children: React.ReactNode\n onOpenChange: React.Dispatch<React.SetStateAction<boolean>>\n }>\n) => {\n const context = usePopoverInternalContext(\n 'PopoverSheetController',\n props.__scopePopover\n )\n const showSheet = useShowPopoverSheet(context)\n const breakpointActive = context.breakpointActive\n const getShowSheet = useGet(showSheet)\n return (\n <SheetController\n onOpenChange={(val) => {\n if (getShowSheet()) {\n props.onOpenChange(val)\n }\n }}\n open={context.open}\n hidden={breakpointActive === false}\n >\n {props.children}\n </SheetController>\n )\n}\n\nconst useSheetBreakpointActive = (breakpoint?: MediaQueryKey | null | boolean) => {\n const media = useMedia()\n if (typeof breakpoint === 'boolean' || !breakpoint) {\n return !!breakpoint\n }\n return media[breakpoint]\n}\n\nconst useShowPopoverSheet = (context: PopoverContextValue) => {\n const breakpointActive = useSheetBreakpointActive(context.sheetBreakpoint)\n return context.open === false ? false : breakpointActive\n}\n"],
5
+ "mappings": "AAEA,OAAO;AAEP,SAAS,OAAO,sBAAsB;AACtC,SAAS,uBAAuB;AAChC,SAAS,kBAAkB;AAC3B,SAAS,uBAAuB;AAChC;AAAA,EAGE;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,0BAA0B;AAEnC,SAAS,+BAA+B;AACxC,SAAS,kBAAmC;AAC5C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,QAAQ,YAAY,kBAAkB;AAC/C,SAAS,oBAAuC;AAChD,SAAS,iBAAiB,uBAAuB;AACjD,SAAS,cAA2B;AACpC,SAAS,4BAA4B;AACrC,YAAY,WAAW;AACvB,SAAS,UAAU,kBAAyC;AAE5D,SAAS,0BAA0B;AAEnC,MAAM,eAAe;AA0BrB,MAAM,CAAC,sBAAsB,0BAA0B,IAAI;AAAA,EACzD;AAAA,EACA,CAAC,iBAAiB;AACpB;AACO,MAAM,kBAAkB,kBAAkB;AAC1C,MAAM,qBAAqB;AAElC,MAAM,CAAC,yBAAyB,yBAAyB,IACvD,qBAA0C,YAAY;AAEjD,MAAM,4BAA4B;AAMzC,MAAM,cAAc;AAKb,MAAM,gBAAgB,MAAM;AAAA,EACjC,CAAC,OAAwC,iBAAiB;AACxD,UAAM,EAAE,gBAAgB,GAAG,YAAY,IAAI;AAC3C,UAAM,UAAU,0BAA0B,aAAa,cAAc;AACrE,UAAM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AAA,IACR,OAAO;AAAA,IACP,SAAS;AAAA,IACT,SAAS;AAAA,IACT,OAAO;AAAA,IACP;AAAA,IACA,YAAY;AAAA,IACZ,OAAO;AAAA,EACT;AACF;AAIA,SAAS,SAAS,MAAe;AAC/B,SAAO,OAAO,SAAS;AACzB;AAEA,MAAM,yBAAyB,CAC7B,UAIG;AACH,QAAM,UAAU;AAAA,IACd;AAAA,IACA,MAAM;AAAA,EACR;AACA,QAAM,YAAY,oBAAoB,OAAO;AAC7C,QAAM,mBAAmB,QAAQ;AACjC,QAAM,eAAe,OAAO,SAAS;AACrC,SACE,CAAC;AAAA,IACC,cAAc,CAAC,QAAQ;AACrB,UAAI,aAAa,GAAG;AAClB,cAAM,aAAa,GAAG;AAAA,MACxB;AAAA,IACF;AAAA,IACA,MAAM,QAAQ;AAAA,IACd,QAAQ,qBAAqB;AAAA,IAE5B,MAAM,SACT,EAVC;AAYL;AAEA,MAAM,2BAA2B,CAAC,eAAgD;AAChF,QAAM,QAAQ,SAAS;AACvB,MAAI,OAAO,eAAe,aAAa,CAAC,YAAY;AAClD,WAAO,CAAC,CAAC;AAAA,EACX;AACA,SAAO,MAAM,UAAU;AACzB;AAEA,MAAM,sBAAsB,CAAC,YAAiC;AAC5D,QAAM,mBAAmB,yBAAyB,QAAQ,eAAe;AACzE,SAAO,QAAQ,SAAS,QAAQ,QAAQ;AAC1C;",
6
6
  "names": ["PopoverContent", "Popover"]
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/popover",
3
- "version": "1.5.20",
3
+ "version": "1.5.21",
4
4
  "sideEffects": [
5
5
  "*.css"
6
6
  ],
@@ -24,30 +24,30 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@floating-ui/react": "^0.19.1",
27
- "@tamagui/adapt": "^1.5.20",
28
- "@tamagui/animate-presence": "^1.5.20",
29
- "@tamagui/aria-hidden": "^1.5.20",
30
- "@tamagui/compose-refs": "^1.5.20",
31
- "@tamagui/core": "^1.5.20",
32
- "@tamagui/create-context": "^1.5.20",
33
- "@tamagui/dismissable": "^1.5.20",
34
- "@tamagui/floating": "^1.5.20",
35
- "@tamagui/focus-scope": "^1.5.20",
36
- "@tamagui/polyfill-dev": "^1.5.20",
37
- "@tamagui/popper": "^1.5.20",
38
- "@tamagui/portal": "^1.5.20",
39
- "@tamagui/remove-scroll": "^1.5.20",
40
- "@tamagui/scroll-view": "^1.5.20",
41
- "@tamagui/sheet": "^1.5.20",
42
- "@tamagui/stacks": "^1.5.20",
43
- "@tamagui/use-controllable-state": "^1.5.20"
27
+ "@tamagui/adapt": "^1.5.21",
28
+ "@tamagui/animate-presence": "^1.5.21",
29
+ "@tamagui/aria-hidden": "^1.5.21",
30
+ "@tamagui/compose-refs": "^1.5.21",
31
+ "@tamagui/core": "^1.5.21",
32
+ "@tamagui/create-context": "^1.5.21",
33
+ "@tamagui/dismissable": "^1.5.21",
34
+ "@tamagui/floating": "^1.5.21",
35
+ "@tamagui/focus-scope": "^1.5.21",
36
+ "@tamagui/polyfill-dev": "^1.5.21",
37
+ "@tamagui/popper": "^1.5.21",
38
+ "@tamagui/portal": "^1.5.21",
39
+ "@tamagui/remove-scroll": "^1.5.21",
40
+ "@tamagui/scroll-view": "^1.5.21",
41
+ "@tamagui/sheet": "^1.5.21",
42
+ "@tamagui/stacks": "^1.5.21",
43
+ "@tamagui/use-controllable-state": "^1.5.21"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "react": "*",
47
47
  "react-native": "*"
48
48
  },
49
49
  "devDependencies": {
50
- "@tamagui/build": "^1.5.20",
50
+ "@tamagui/build": "^1.5.21",
51
51
  "react": "^18.2.0",
52
52
  "react-native": "*"
53
53
  },
package/src/Popover.tsx CHANGED
@@ -174,65 +174,66 @@ export interface PopoverContentTypeProps
174
174
  allowPinchZoom?: RemoveScrollProps['allowPinchZoom']
175
175
  }
176
176
 
177
- export const PopoverContent = React.forwardRef<
178
- PopoverContentTypeElement,
179
- PopoverContentTypeProps
180
- >(function PopoverContent(props: ScopedProps<PopoverContentTypeProps>, forwardedRef) {
181
- const {
182
- allowPinchZoom,
183
- trapFocus,
184
- disableRemoveScroll = true,
185
- zIndex,
186
- ...contentImplProps
187
- } = props
188
- const context = usePopoverInternalContext(CONTENT_NAME, props.__scopePopover)
189
- const contentRef = React.useRef<any>(null)
190
- const composedRefs = useComposedRefs(forwardedRef, contentRef)
191
- const isRightClickOutsideRef = React.useRef(false)
192
-
193
- // aria-hide everything except the content (better supported equivalent to setting aria-modal)
194
- React.useEffect(() => {
195
- if (!context.open) return
196
- const content = contentRef.current
197
- if (content) return hideOthers(content)
198
- }, [context.open])
199
-
200
- return (
201
- <PopoverContentPortal zIndex={zIndex}>
202
- <PopoverContentImpl
203
- {...contentImplProps}
204
- disableRemoveScroll={disableRemoveScroll}
205
- ref={composedRefs}
206
- // we make sure we're not trapping once it's been closed
207
- // (closed !== unmounted when animating out)
208
- trapFocus={trapFocus ?? context.open}
209
- disableOutsidePointerEvents
210
- onCloseAutoFocus={composeEventHandlers(props.onCloseAutoFocus, (event) => {
211
- event.preventDefault()
212
- if (!isRightClickOutsideRef.current) context.triggerRef.current?.focus()
213
- })}
214
- onPointerDownOutside={composeEventHandlers(
215
- props.onPointerDownOutside,
216
- (event) => {
217
- const originalEvent = event.detail.originalEvent
218
- const ctrlLeftClick =
219
- originalEvent.button === 0 && originalEvent.ctrlKey === true
220
- const isRightClick = originalEvent.button === 2 || ctrlLeftClick
221
- isRightClickOutsideRef.current = isRightClick
222
- },
223
- { checkDefaultPrevented: false }
224
- )}
225
- // When focus is trapped, a `focusout` event may still happen.
226
- // We make sure we don't trigger our `onDismiss` in such case.
227
- onFocusOutside={composeEventHandlers(
228
- props.onFocusOutside,
229
- (event) => event.preventDefault(),
230
- { checkDefaultPrevented: false }
231
- )}
232
- />
233
- </PopoverContentPortal>
177
+ export const PopoverContent = PopperContentFrame.extractable(
178
+ React.forwardRef<PopoverContentTypeElement, PopoverContentTypeProps>(
179
+ function PopoverContent(props: ScopedProps<PopoverContentTypeProps>, forwardedRef) {
180
+ const {
181
+ allowPinchZoom,
182
+ trapFocus,
183
+ disableRemoveScroll = true,
184
+ zIndex,
185
+ ...contentImplProps
186
+ } = props
187
+ const context = usePopoverInternalContext(CONTENT_NAME, props.__scopePopover)
188
+ const contentRef = React.useRef<any>(null)
189
+ const composedRefs = useComposedRefs(forwardedRef, contentRef)
190
+ const isRightClickOutsideRef = React.useRef(false)
191
+
192
+ // aria-hide everything except the content (better supported equivalent to setting aria-modal)
193
+ React.useEffect(() => {
194
+ if (!context.open) return
195
+ const content = contentRef.current
196
+ if (content) return hideOthers(content)
197
+ }, [context.open])
198
+
199
+ return (
200
+ <PopoverContentPortal zIndex={zIndex}>
201
+ <PopoverContentImpl
202
+ {...contentImplProps}
203
+ disableRemoveScroll={disableRemoveScroll}
204
+ ref={composedRefs}
205
+ // we make sure we're not trapping once it's been closed
206
+ // (closed !== unmounted when animating out)
207
+ trapFocus={trapFocus ?? context.open}
208
+ disableOutsidePointerEvents
209
+ onCloseAutoFocus={composeEventHandlers(props.onCloseAutoFocus, (event) => {
210
+ event.preventDefault()
211
+ if (!isRightClickOutsideRef.current) context.triggerRef.current?.focus()
212
+ })}
213
+ onPointerDownOutside={composeEventHandlers(
214
+ props.onPointerDownOutside,
215
+ (event) => {
216
+ const originalEvent = event.detail.originalEvent
217
+ const ctrlLeftClick =
218
+ originalEvent.button === 0 && originalEvent.ctrlKey === true
219
+ const isRightClick = originalEvent.button === 2 || ctrlLeftClick
220
+ isRightClickOutsideRef.current = isRightClick
221
+ },
222
+ { checkDefaultPrevented: false }
223
+ )}
224
+ // When focus is trapped, a `focusout` event may still happen.
225
+ // We make sure we don't trigger our `onDismiss` in such case.
226
+ onFocusOutside={composeEventHandlers(
227
+ props.onFocusOutside,
228
+ (event) => event.preventDefault(),
229
+ { checkDefaultPrevented: false }
230
+ )}
231
+ />
232
+ </PopoverContentPortal>
233
+ )
234
+ }
234
235
  )
235
- })
236
+ )
236
237
 
237
238
  function PopoverContentPortal(props: ScopedProps<PopoverContentTypeProps>) {
238
239
  const themeName = useThemeName()
@@ -1 +1 @@
1
- {"version":3,"file":"Popover.d.ts","sourceRoot":"","sources":["../src/Popover.tsx"],"names":[],"mappings":"AAEA,OAAO,uBAAuB,CAAA;AAM9B,OAAO,EAEL,UAAU,EAEV,cAAc,EAUf,MAAM,eAAe,CAAA;AACtB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAEpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAEvD,OAAO,EAAc,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAClE,OAAO,EAIL,gBAAgB,EAGhB,kBAAkB,EAClB,WAAW,EAIZ,MAAM,iBAAiB,CAAA;AAExB,OAAO,EAAgB,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAExE,OAAO,EAAU,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAErD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAY,UAAU,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAQ1E,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG;IACvC,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;CACvC,CAAA;AAED,KAAK,mBAAmB,GAAG;IACzB,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA;IAChC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAAA;IACjC,YAAY,IAAI,IAAI,CAAA;IACpB,eAAe,EAAE,OAAO,CAAA;IACxB,iBAAiB,IAAI,IAAI,CAAA;IACzB,oBAAoB,IAAI,IA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