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B,AAAA;AACA,MAAMM,yCAAM,GAAGL,yCAAf,AAAA;AACA,MAAMM,yCAAO,GAAGL,wCAAhB,AAAA;AACA,MAAMM,yCAAK,GAAGL,yCAAd,AAAA;;AD3ZA","sources":["packages/react/hover-card/src/index.ts","packages/react/hover-card/src/HoverCard.tsx"],"sourcesContent":["export {\n createHoverCardScope,\n //\n HoverCard,\n HoverCardTrigger,\n HoverCardPortal,\n HoverCardContent,\n HoverCardArrow,\n //\n Root,\n Trigger,\n Portal,\n Content,\n Arrow,\n} from './HoverCard';\nexport type {\n HoverCardProps,\n HoverCardTriggerProps,\n HoverCardPortalProps,\n HoverCardContentProps,\n HoverCardArrowProps,\n} from './HoverCard';\n","import * as React from 'react';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport * as PopperPrimitive from '@radix-ui/react-popper';\nimport { createPopperScope } from '@radix-ui/react-popper';\nimport { Portal as PortalPrimitive } from '@radix-ui/react-portal';\nimport { Presence } from '@radix-ui/react-presence';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { DismissableLayer } from '@radix-ui/react-dismissable-layer';\n\nimport type * as Radix from '@radix-ui/react-primitive';\nimport type { Scope } from '@radix-ui/react-context';\n\n/* -------------------------------------------------------------------------------------------------\n * HoverCard\n * -----------------------------------------------------------------------------------------------*/\n\nlet originalBodyUserSelect: string;\n\nconst HOVERCARD_NAME = 'HoverCard';\n\ntype ScopedProps<P> = P & { __scopeHoverCard?: Scope };\nconst [createHoverCardContext, createHoverCardScope] = createContextScope(HOVERCARD_NAME, [\n createPopperScope,\n]);\nconst usePopperScope = createPopperScope();\n\ntype HoverCardContextValue = {\n open: boolean;\n onOpenChange(open: boolean): void;\n onOpen(): void;\n onClose(): void;\n onDismiss(): void;\n hasSelectionRef: React.MutableRefObject<boolean>;\n isPointerDownOnContentRef: React.MutableRefObject<boolean>;\n};\n\nconst [HoverCardProvider, useHoverCardContext] =\n createHoverCardContext<HoverCardContextValue>(HOVERCARD_NAME);\n\ninterface HoverCardProps {\n children?: React.ReactNode;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n openDelay?: number;\n closeDelay?: number;\n}\n\nconst HoverCard: React.FC<HoverCardProps> = (props: ScopedProps<HoverCardProps>) => {\n const {\n __scopeHoverCard,\n children,\n open: openProp,\n defaultOpen,\n onOpenChange,\n openDelay = 700,\n closeDelay = 300,\n } = props;\n const popperScope = usePopperScope(__scopeHoverCard);\n const openTimerRef = React.useRef(0);\n const closeTimerRef = React.useRef(0);\n const hasSelectionRef = React.useRef(false);\n const isPointerDownOnContentRef = React.useRef(false);\n\n const [open = false, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen,\n onChange: onOpenChange,\n });\n\n const handleOpen = React.useCallback(() => {\n clearTimeout(closeTimerRef.current);\n openTimerRef.current = window.setTimeout(() => setOpen(true), openDelay);\n }, [openDelay, setOpen]);\n\n const handleClose = React.useCallback(() => {\n clearTimeout(openTimerRef.current);\n if (!hasSelectionRef.current && !isPointerDownOnContentRef.current) {\n closeTimerRef.current = window.setTimeout(() => setOpen(false), closeDelay);\n }\n }, [closeDelay, setOpen]);\n\n const handleDismiss = React.useCallback(() => setOpen(false), [setOpen]);\n\n // cleanup any queued state updates on unmount\n React.useEffect(() => {\n return () => {\n clearTimeout(openTimerRef.current);\n clearTimeout(closeTimerRef.current);\n };\n }, []);\n\n return (\n <HoverCardProvider\n scope={__scopeHoverCard}\n open={open}\n onOpenChange={setOpen}\n onOpen={handleOpen}\n onClose={handleClose}\n onDismiss={handleDismiss}\n hasSelectionRef={hasSelectionRef}\n isPointerDownOnContentRef={isPointerDownOnContentRef}\n >\n <PopperPrimitive.Root {...popperScope}>{children}</PopperPrimitive.Root>\n </HoverCardProvider>\n );\n};\n\nHoverCard.displayName = HOVERCARD_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * HoverCardTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'HoverCardTrigger';\n\ntype HoverCardTriggerElement = React.ElementRef<typeof Primitive.a>;\ntype PrimitiveLinkProps = Radix.ComponentPropsWithoutRef<typeof Primitive.a>;\ninterface HoverCardTriggerProps extends PrimitiveLinkProps {}\n\nconst HoverCardTrigger = React.forwardRef<HoverCardTriggerElement, HoverCardTriggerProps>(\n (props: ScopedProps<HoverCardTriggerProps>, forwardedRef) => {\n const { __scopeHoverCard, ...triggerProps } = props;\n const context = useHoverCardContext(TRIGGER_NAME, __scopeHoverCard);\n const popperScope = usePopperScope(__scopeHoverCard);\n return (\n <PopperPrimitive.Anchor asChild {...popperScope}>\n <Primitive.a\n data-state={context.open ? 'open' : 'closed'}\n {...triggerProps}\n ref={forwardedRef}\n onPointerEnter={composeEventHandlers(props.onPointerEnter, excludeTouch(context.onOpen))}\n onPointerLeave={composeEventHandlers(props.onPointerLeave, excludeTouch(context.onClose))}\n onFocus={composeEventHandlers(props.onFocus, context.onOpen)}\n onBlur={composeEventHandlers(props.onBlur, context.onClose)}\n // prevent focus event on touch devices\n onTouchStart={composeEventHandlers(props.onTouchStart, (event) => event.preventDefault())}\n />\n </PopperPrimitive.Anchor>\n );\n }\n);\n\nHoverCardTrigger.displayName = TRIGGER_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * HoverCardPortal\n * -----------------------------------------------------------------------------------------------*/\n\nconst PORTAL_NAME = 'HoverCardPortal';\n\ntype PortalContextValue = { forceMount?: true };\nconst [PortalProvider, usePortalContext] = createHoverCardContext<PortalContextValue>(PORTAL_NAME, {\n forceMount: undefined,\n});\n\ntype PortalProps = React.ComponentPropsWithoutRef<typeof PortalPrimitive>;\ninterface HoverCardPortalProps {\n children?: React.ReactNode;\n /**\n * Specify a container element to portal the content into.\n */\n container?: PortalProps['container'];\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst HoverCardPortal: React.FC<HoverCardPortalProps> = (\n props: ScopedProps<HoverCardPortalProps>\n) => {\n const { __scopeHoverCard, forceMount, children, container } = props;\n const context = useHoverCardContext(PORTAL_NAME, __scopeHoverCard);\n return (\n <PortalProvider scope={__scopeHoverCard} forceMount={forceMount}>\n <Presence present={forceMount || context.open}>\n <PortalPrimitive asChild container={container}>\n {children}\n </PortalPrimitive>\n </Presence>\n </PortalProvider>\n );\n};\n\nHoverCardPortal.displayName = PORTAL_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * HoverCardContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'HoverCardContent';\n\ntype HoverCardContentElement = HoverCardContentImplElement;\ninterface HoverCardContentProps extends HoverCardContentImplProps {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst HoverCardContent = React.forwardRef<HoverCardContentElement, HoverCardContentProps>(\n (props: ScopedProps<HoverCardContentProps>, forwardedRef) => {\n const portalContext = usePortalContext(CONTENT_NAME, props.__scopeHoverCard);\n const { forceMount = portalContext.forceMount, ...contentProps } = props;\n const context = useHoverCardContext(CONTENT_NAME, props.__scopeHoverCard);\n return (\n <Presence present={forceMount || context.open}>\n <HoverCardContentImpl\n data-state={context.open ? 'open' : 'closed'}\n {...contentProps}\n onPointerEnter={composeEventHandlers(props.onPointerEnter, excludeTouch(context.onOpen))}\n onPointerLeave={composeEventHandlers(props.onPointerLeave, excludeTouch(context.onClose))}\n ref={forwardedRef}\n />\n </Presence>\n );\n }\n);\n\nHoverCardContent.displayName = CONTENT_NAME;\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype HoverCardContentImplElement = React.ElementRef<typeof PopperPrimitive.Content>;\ntype DismissableLayerProps = Radix.ComponentPropsWithoutRef<typeof DismissableLayer>;\ntype PopperContentProps = Radix.ComponentPropsWithoutRef<typeof PopperPrimitive.Content>;\ninterface HoverCardContentImplProps extends Omit<PopperContentProps, 'onPlaced'> {\n /**\n * Event handler called when the escape key is down.\n * Can be prevented.\n */\n onEscapeKeyDown?: DismissableLayerProps['onEscapeKeyDown'];\n /**\n * Event handler called when the a `pointerdown` event happens outside of the `HoverCard`.\n * Can be prevented.\n */\n onPointerDownOutside?: DismissableLayerProps['onPointerDownOutside'];\n /**\n * Event handler called when the focus moves outside of the `HoverCard`.\n * Can be prevented.\n */\n onFocusOutside?: DismissableLayerProps['onFocusOutside'];\n /**\n * Event handler called when an interaction happens outside the `HoverCard`.\n * Specifically, when a `pointerdown` event happens outside or focus moves outside of it.\n * Can be prevented.\n */\n onInteractOutside?: DismissableLayerProps['onInteractOutside'];\n}\n\nconst HoverCardContentImpl = React.forwardRef<\n HoverCardContentImplElement,\n HoverCardContentImplProps\n>((props: ScopedProps<HoverCardContentImplProps>, forwardedRef) => {\n const {\n __scopeHoverCard,\n onEscapeKeyDown,\n onPointerDownOutside,\n onFocusOutside,\n onInteractOutside,\n ...contentProps\n } = props;\n const context = useHoverCardContext(CONTENT_NAME, __scopeHoverCard);\n const popperScope = usePopperScope(__scopeHoverCard);\n const ref = React.useRef<HoverCardContentImplElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const [containSelection, setContainSelection] = React.useState(false);\n\n React.useEffect(() => {\n if (containSelection) {\n const body = document.body;\n\n // Safari requires prefix\n originalBodyUserSelect = body.style.userSelect || body.style.webkitUserSelect;\n\n body.style.userSelect = 'none';\n body.style.webkitUserSelect = 'none';\n return () => {\n body.style.userSelect = originalBodyUserSelect;\n body.style.webkitUserSelect = originalBodyUserSelect;\n };\n }\n }, [containSelection]);\n\n React.useEffect(() => {\n if (ref.current) {\n const handlePointerUp = () => {\n setContainSelection(false);\n context.isPointerDownOnContentRef.current = false;\n\n // Delay a frame to ensure we always access the latest selection\n setTimeout(() => {\n const hasSelection = document.getSelection()?.toString() !== '';\n if (hasSelection) context.hasSelectionRef.current = true;\n });\n };\n\n document.addEventListener('pointerup', handlePointerUp);\n return () => {\n document.removeEventListener('pointerup', handlePointerUp);\n context.hasSelectionRef.current = false;\n context.isPointerDownOnContentRef.current = false;\n };\n }\n }, [context.isPointerDownOnContentRef, context.hasSelectionRef]);\n\n React.useEffect(() => {\n if (ref.current) {\n const tabbables = getTabbableNodes(ref.current);\n tabbables.forEach((tabbable) => tabbable.setAttribute('tabindex', '-1'));\n }\n });\n\n return (\n <DismissableLayer\n asChild\n disableOutsidePointerEvents={false}\n onInteractOutside={onInteractOutside}\n onEscapeKeyDown={onEscapeKeyDown}\n onPointerDownOutside={onPointerDownOutside}\n onFocusOutside={composeEventHandlers(onFocusOutside, (event) => {\n event.preventDefault();\n })}\n onDismiss={context.onDismiss}\n >\n <PopperPrimitive.Content\n {...popperScope}\n {...contentProps}\n onPointerDown={composeEventHandlers(contentProps.onPointerDown, (event) => {\n // Contain selection to current layer\n if (event.currentTarget.contains(event.target as HTMLElement)) {\n setContainSelection(true);\n }\n context.hasSelectionRef.current = false;\n context.isPointerDownOnContentRef.current = true;\n })}\n ref={composedRefs}\n style={{\n ...contentProps.style,\n userSelect: containSelection ? 'text' : undefined,\n // Safari requires prefix\n WebkitUserSelect: containSelection ? 'text' : undefined,\n // re-namespace exposed content custom properties\n ...{\n '--radix-hover-card-content-transform-origin': 'var(--radix-popper-transform-origin)',\n '--radix-hover-card-content-available-width': 'var(--radix-popper-available-width)',\n '--radix-hover-card-content-available-height': 'var(--radix-popper-available-height)',\n '--radix-hover-card-trigger-width': 'var(--radix-popper-anchor-width)',\n '--radix-hover-card-trigger-height': 'var(--radix-popper-anchor-height)',\n },\n }}\n />\n </DismissableLayer>\n );\n});\n\n/* -------------------------------------------------------------------------------------------------\n * HoverCardArrow\n * -----------------------------------------------------------------------------------------------*/\n\nconst ARROW_NAME = 'HoverCardArrow';\n\ntype HoverCardArrowElement = React.ElementRef<typeof PopperPrimitive.Arrow>;\ntype PopperArrowProps = Radix.ComponentPropsWithoutRef<typeof PopperPrimitive.Arrow>;\ninterface HoverCardArrowProps extends PopperArrowProps {}\n\nconst HoverCardArrow = React.forwardRef<HoverCardArrowElement, HoverCardArrowProps>(\n (props: ScopedProps<HoverCardArrowProps>, forwardedRef) => {\n const { __scopeHoverCard, ...arrowProps } = props;\n const popperScope = usePopperScope(__scopeHoverCard);\n return <PopperPrimitive.Arrow {...popperScope} {...arrowProps} ref={forwardedRef} />;\n }\n);\n\nHoverCardArrow.displayName = ARROW_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction excludeTouch<E>(eventHandler: () => void) {\n return (event: React.PointerEvent<E>) =>\n event.pointerType === 'touch' ? undefined : eventHandler();\n}\n\n/**\n * Returns a list of nodes that can be in the tab sequence.\n * @see: https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker\n */\nfunction getTabbableNodes(container: HTMLElement) {\n const nodes: HTMLElement[] = [];\n const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {\n acceptNode: (node: any) => {\n // `.tabIndex` is not the same as the `tabindex` attribute. It works on the\n // runtime's understanding of tabbability, so this automatically accounts\n // for any kind of element that could be tabbed to.\n return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;\n },\n });\n while (walker.nextNode()) nodes.push(walker.currentNode as HTMLElement);\n return nodes;\n}\n\nconst Root = HoverCard;\nconst Trigger = HoverCardTrigger;\nconst Portal = HoverCardPortal;\nconst Content = HoverCardContent;\nconst Arrow = HoverCardArrow;\n\nexport {\n createHoverCardScope,\n //\n HoverCard,\n HoverCardTrigger,\n HoverCardPortal,\n HoverCardContent,\n HoverCardArrow,\n //\n Root,\n Trigger,\n Portal,\n Content,\n Arrow,\n};\nexport type {\n HoverCardProps,\n HoverCardTriggerProps,\n HoverCardPortalProps,\n HoverCardContentProps,\n HoverCardArrowProps,\n};\n"],"names":["createHoverCardScope","HoverCard","HoverCardTrigger","HoverCardPortal","HoverCardContent","HoverCardArrow","Root","Trigger","Portal","Content","Arrow","React","composeEventHandlers","createContextScope","useControllableState","useComposedRefs","PopperPrimitive","createPopperScope","PortalPrimitive","Presence","Primitive","DismissableLayer","originalBodyUserSelect","HOVERCARD_NAME","createHoverCardContext","usePopperScope","HoverCardProvider","useHoverCardContext","props","__scopeHoverCard","children","open","openProp","defaultOpen","onOpenChange","openDelay","closeDelay","popperScope","openTimerRef","useRef","closeTimerRef","hasSelectionRef","isPointerDownOnContentRef","setOpen","prop","defaultProp","onChange","handleOpen","useCallback","clearTimeout","current","window","setTimeout","handleClose","handleDismiss","useEffect","TRIGGER_NAME","forwardRef","forwardedRef","triggerProps","context","onPointerEnter","excludeTouch","onOpen","onPointerLeave","onClose","onFocus","onBlur","onTouchStart","event","preventDefault","PORTAL_NAME","PortalProvider","usePortalContext","forceMount","undefined","container","CONTENT_NAME","portalContext","contentProps","HoverCardContentImpl","onEscapeKeyDown","onPointerDownOutside","onFocusOutside","onInteractOutside","ref","composedRefs","containSelection","setContainSelection","useState","body","document","style","userSelect","webkitUserSelect","handlePointerUp","hasSelection","getSelection","toString","addEventListener","removeEventListener","tabbables","getTabbableNodes","forEach","tabbable","setAttribute","onDismiss","onPointerDown","currentTarget","contains","target","WebkitUserSelect","ARROW_NAME","arrowProps","eventHandler","pointerType","nodes","walker","createTreeWalker","NodeFilter","SHOW_ELEMENT","acceptNode","node","tabIndex","FILTER_ACCEPT","FILTER_SKIP","nextNode","push","currentNode"],"version":3,"file":"index.js.map"}