@frank-auth/react
Version:
Flexible and customizable React UI components for Frank Authentication
1 lines • 23.2 kB
Source Map (JSON)
{"version":3,"file":"popover.cjs","sources":["../../../../../src/components/ui/popover/popover.tsx"],"sourcesContent":["import { useTheme } from \"@/theme/context\";\nimport type { StyledProps } from \"@/theme/styled\";\nimport { css, keyframes } from \"@emotion/react\";\nimport styled from \"@emotion/styled\";\nimport React, { useState, useRef, useEffect, useCallback } from \"react\";\nimport { createPortal } from \"react-dom\";\n\nexport interface PopoverProps extends React.HTMLAttributes<HTMLDivElement> {\n\t/** Popover open state */\n\tisOpen?: boolean;\n\t/** Default open state */\n\tdefaultOpen?: boolean;\n\t/** Open state change handler */\n\tonOpenChange?: (open: boolean) => void;\n\t/** Popover placement */\n\tplacement?:\n\t\t| \"top\"\n\t\t| \"top-start\"\n\t\t| \"top-end\"\n\t\t| \"bottom\"\n\t\t| \"bottom-start\"\n\t\t| \"bottom-end\"\n\t\t| \"left\"\n\t\t| \"left-start\"\n\t\t| \"left-end\"\n\t\t| \"right\"\n\t\t| \"right-start\"\n\t\t| \"right-end\";\n\t/** Popover trigger */\n\ttrigger?: \"click\" | \"hover\" | \"focus\" | \"manual\";\n\t/** Show arrow */\n\tshowArrow?: boolean;\n\t/** Offset from trigger */\n\toffset?: number;\n\t/** Cross axis offset */\n\tcrossOffset?: number;\n\t/** Close on blur */\n\tshouldCloseOnBlur?: boolean;\n\t/** Close on interaction outside */\n\tshouldCloseOnInteractOutside?: boolean;\n\t/** Backdrop type */\n\tbackdrop?: \"transparent\" | \"opaque\" | \"blur\";\n\t/** Custom class name */\n\tclassName?: string;\n\t/** Custom styles */\n\tcss?: any;\n\t/** Portal container */\n\tportalContainer?: Element;\n\t/** Trigger element */\n\tchildren?: React.ReactNode;\n}\n\nexport interface PopoverTriggerProps\n\textends React.HTMLAttributes<HTMLDivElement> {\n\tchildren: React.ReactNode;\n\tclassName?: string;\n\tcss?: any;\n}\n\nexport interface PopoverContentProps\n\textends React.HTMLAttributes<HTMLDivElement> {\n\tchildren: React.ReactNode;\n\tclassName?: string;\n\tcss?: any;\n}\n\ntype StyledPopoverProps = StyledProps<PopoverProps>;\n\n// Animation keyframes\nconst fadeIn = keyframes`\n from {\n opacity: 0;\n transform: scale(0.95);\n }\n to {\n opacity: 1;\n transform: scale(1);\n }\n`;\n\nconst fadeOut = keyframes`\n from {\n opacity: 1;\n transform: scale(1);\n }\n to {\n opacity: 0;\n transform: scale(0.95);\n }\n`;\n\nconst getPopoverPlacementStyles = (\n\tplacement: PopoverProps[\"placement\"],\n\ttriggerRect: DOMRect | null,\n\toffset: number,\n\tcrossOffset: number,\n) => {\n\tif (!triggerRect) return {};\n\n\tconst styles: React.CSSProperties = {\n\t\tposition: \"absolute\",\n\t\tzIndex: 1500,\n\t};\n\n\tswitch (placement) {\n\t\tcase \"top\":\n\t\t\tstyles.bottom = `${window.innerHeight - triggerRect.top + offset}px`;\n\t\t\tstyles.left = `${triggerRect.left + triggerRect.width / 2}px`;\n\t\t\tstyles.transform = `translateX(-50%) translateX(${crossOffset}px)`;\n\t\t\tbreak;\n\t\tcase \"top-start\":\n\t\t\tstyles.bottom = `${window.innerHeight - triggerRect.top + offset}px`;\n\t\t\tstyles.left = `${triggerRect.left + crossOffset}px`;\n\t\t\tbreak;\n\t\tcase \"top-end\":\n\t\t\tstyles.bottom = `${window.innerHeight - triggerRect.top + offset}px`;\n\t\t\tstyles.right = `${window.innerWidth - triggerRect.right - crossOffset}px`;\n\t\t\tbreak;\n\t\tcase \"bottom\":\n\t\t\tstyles.top = `${triggerRect.bottom + offset}px`;\n\t\t\tstyles.left = `${triggerRect.left + triggerRect.width / 2}px`;\n\t\t\tstyles.transform = `translateX(-50%) translateX(${crossOffset}px)`;\n\t\t\tbreak;\n\t\tcase \"bottom-start\":\n\t\t\tstyles.top = `${triggerRect.bottom + offset}px`;\n\t\t\tstyles.left = `${triggerRect.left + crossOffset}px`;\n\t\t\tbreak;\n\t\tcase \"bottom-end\":\n\t\t\tstyles.top = `${triggerRect.bottom + offset}px`;\n\t\t\tstyles.right = `${window.innerWidth - triggerRect.right - crossOffset}px`;\n\t\t\tbreak;\n\t\tcase \"left\":\n\t\t\tstyles.right = `${window.innerWidth - triggerRect.left + offset}px`;\n\t\t\tstyles.top = `${triggerRect.top + triggerRect.height / 2}px`;\n\t\t\tstyles.transform = `translateY(-50%) translateY(${crossOffset}px)`;\n\t\t\tbreak;\n\t\tcase \"left-start\":\n\t\t\tstyles.right = `${window.innerWidth - triggerRect.left + offset}px`;\n\t\t\tstyles.top = `${triggerRect.top + crossOffset}px`;\n\t\t\tbreak;\n\t\tcase \"left-end\":\n\t\t\tstyles.right = `${window.innerWidth - triggerRect.left + offset}px`;\n\t\t\tstyles.bottom = `${window.innerHeight - triggerRect.bottom - crossOffset}px`;\n\t\t\tbreak;\n\t\tcase \"right\":\n\t\t\tstyles.left = `${triggerRect.right + offset}px`;\n\t\t\tstyles.top = `${triggerRect.top + triggerRect.height / 2}px`;\n\t\t\tstyles.transform = `translateY(-50%) translateY(${crossOffset}px)`;\n\t\t\tbreak;\n\t\tcase \"right-start\":\n\t\t\tstyles.left = `${triggerRect.right + offset}px`;\n\t\t\tstyles.top = `${triggerRect.top + crossOffset}px`;\n\t\t\tbreak;\n\t\tcase \"right-end\":\n\t\t\tstyles.left = `${triggerRect.right + offset}px`;\n\t\t\tstyles.bottom = `${window.innerHeight - triggerRect.bottom - crossOffset}px`;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\t// Default to bottom\n\t\t\tstyles.top = `${triggerRect.bottom + offset}px`;\n\t\t\tstyles.left = `${triggerRect.left + triggerRect.width / 2}px`;\n\t\t\tstyles.transform = `translateX(-50%) translateX(${crossOffset}px)`;\n\t}\n\n\treturn styles;\n};\n\nconst getArrowStyles = (placement: PopoverProps[\"placement\"]) => {\n\tconst arrowSize = 8;\n\n\tswitch (placement) {\n\t\tcase \"top\":\n\t\tcase \"top-start\":\n\t\tcase \"top-end\":\n\t\t\treturn css`\n &::after {\n content: '';\n position: absolute;\n top: 100%;\n left: ${placement === \"top\" ? \"50%\" : placement === \"top-start\" ? \"16px\" : \"auto\"};\n right: ${placement === \"top-end\" ? \"16px\" : \"auto\"};\n transform: ${placement === \"top\" ? \"translateX(-50%)\" : \"none\"};\n width: 0;\n height: 0;\n border-left: ${arrowSize}px solid transparent;\n border-right: ${arrowSize}px solid transparent;\n border-top: ${arrowSize}px solid currentColor;\n }\n `;\n\t\tcase \"bottom\":\n\t\tcase \"bottom-start\":\n\t\tcase \"bottom-end\":\n\t\t\treturn css`\n &::after {\n content: '';\n position: absolute;\n bottom: 100%;\n left: ${placement === \"bottom\" ? \"50%\" : placement === \"bottom-start\" ? \"16px\" : \"auto\"};\n right: ${placement === \"bottom-end\" ? \"16px\" : \"auto\"};\n transform: ${placement === \"bottom\" ? \"translateX(-50%)\" : \"none\"};\n width: 0;\n height: 0;\n border-left: ${arrowSize}px solid transparent;\n border-right: ${arrowSize}px solid transparent;\n border-bottom: ${arrowSize}px solid currentColor;\n }\n `;\n\t\tcase \"left\":\n\t\tcase \"left-start\":\n\t\tcase \"left-end\":\n\t\t\treturn css`\n &::after {\n content: '';\n position: absolute;\n left: 100%;\n top: ${placement === \"left\" ? \"50%\" : placement === \"left-start\" ? \"16px\" : \"auto\"};\n bottom: ${placement === \"left-end\" ? \"16px\" : \"auto\"};\n transform: ${placement === \"left\" ? \"translateY(-50%)\" : \"none\"};\n width: 0;\n height: 0;\n border-top: ${arrowSize}px solid transparent;\n border-bottom: ${arrowSize}px solid transparent;\n border-left: ${arrowSize}px solid currentColor;\n }\n `;\n\t\tcase \"right\":\n\t\tcase \"right-start\":\n\t\tcase \"right-end\":\n\t\t\treturn css`\n &::after {\n content: '';\n position: absolute;\n right: 100%;\n top: ${placement === \"right\" ? \"50%\" : placement === \"right-start\" ? \"16px\" : \"auto\"};\n bottom: ${placement === \"right-end\" ? \"16px\" : \"auto\"};\n transform: ${placement === \"right\" ? \"translateY(-50%)\" : \"none\"};\n width: 0;\n height: 0;\n border-top: ${arrowSize}px solid transparent;\n border-bottom: ${arrowSize}px solid transparent;\n border-right: ${arrowSize}px solid currentColor;\n }\n `;\n\t\tdefault:\n\t\t\treturn css``;\n\t}\n};\n\nconst getBackdropStyles = (props: StyledPopoverProps) => {\n\tconst { theme, backdrop = \"transparent\" } = props;\n\n\tswitch (backdrop) {\n\t\tcase \"transparent\":\n\t\t\treturn css`\n background-color: transparent;\n `;\n\t\tcase \"opaque\":\n\t\t\treturn css`\n background-color: rgba(0, 0, 0, 0.1);\n `;\n\t\tcase \"blur\":\n\t\t\treturn css`\n background-color: rgba(0, 0, 0, 0.05);\n backdrop-filter: blur(2px);\n `;\n\t\tdefault:\n\t\t\treturn css`\n background-color: transparent;\n `;\n\t}\n};\n\nconst PopoverBackdrop = styled.div<StyledPopoverProps>`\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: ${(props) => props.theme.zIndex.overlay};\n\n ${getBackdropStyles}\n`;\n\nconst PopoverContent = styled.div<\n\tStyledPopoverProps & {\n\t\tisClosing?: boolean;\n\t\tplacement?: PopoverProps[\"placement\"];\n\t\tshowArrow?: boolean;\n\t}\n>`\n background-color: ${(props) => props.theme.colors.background.primary};\n border: 1px solid ${(props) => props.theme.colors.border.primary};\n border-radius: ${(props) => props.theme.borderRadius.lg};\n box-shadow: ${(props) => props.theme.shadows.lg};\n padding: ${(props) => props.theme.spacing[4]};\n max-width: 320px;\n animation: ${(props) => (props.isClosing ? fadeOut : fadeIn)} \n ${(props) => props.theme.transitions.fast};\n color: ${(props) => props.theme.colors.background.primary};\n\n ${(props) => props.showArrow && getArrowStyles(props.placement)}\n\n /* Custom CSS prop */\n ${(props) => props.css}\n`;\n\nconst PopoverTrigger = styled.div<StyledProps<PopoverTriggerProps>>`\n display: inline-block;\n cursor: pointer;\n\n /* Custom CSS prop */\n ${(props) => props.css}\n`;\n\n// Context for popover state\nconst PopoverContext = React.createContext<{\n\tisOpen: boolean;\n\tonOpenChange: (open: boolean) => void;\n\ttriggerRef: React.RefObject<HTMLDivElement>;\n\tplacement: PopoverProps[\"placement\"];\n\ttrigger: PopoverProps[\"trigger\"];\n\tshowArrow: boolean;\n\toffset: number;\n\tcrossOffset: number;\n} | null>(null);\n\nexport const Popover: React.FC<PopoverProps> & {\n\tTrigger: React.FC<PopoverTriggerProps>;\n\tContent: React.FC<PopoverContentProps>;\n} = ({\n\tchildren,\n\tisOpen: controlledOpen,\n\tdefaultOpen = false,\n\tonOpenChange,\n\tplacement = \"bottom\",\n\ttrigger = \"click\",\n\tshowArrow = true,\n\toffset = 8,\n\tcrossOffset = 0,\n\tshouldCloseOnBlur = true,\n\tshouldCloseOnInteractOutside = true,\n\tbackdrop = \"transparent\",\n\tclassName,\n\tcss,\n\tportalContainer,\n\t...props\n}) => {\n\tconst [internalOpen, setInternalOpen] = useState(defaultOpen);\n\tconst triggerRef = useRef<HTMLDivElement>(null);\n\tconst isControlled = controlledOpen !== undefined;\n\tconst isOpen = isControlled ? controlledOpen : internalOpen;\n\n\tconst handleOpenChange = useCallback(\n\t\t(open: boolean) => {\n\t\t\tif (!isControlled) {\n\t\t\t\tsetInternalOpen(open);\n\t\t\t}\n\t\t\tonOpenChange?.(open);\n\t\t},\n\t\t[isControlled, onOpenChange],\n\t);\n\n\t// Close on click outside\n\tuseEffect(() => {\n\t\tif (!isOpen || !shouldCloseOnInteractOutside) return;\n\n\t\tconst handleClickOutside = (event: MouseEvent) => {\n\t\t\tif (\n\t\t\t\ttriggerRef.current &&\n\t\t\t\t!triggerRef.current.contains(event.target as Node)\n\t\t\t) {\n\t\t\t\tconst popoverContent = document.querySelector(\"[data-popover-content]\");\n\t\t\t\tif (popoverContent && !popoverContent.contains(event.target as Node)) {\n\t\t\t\t\thandleOpenChange(false);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tdocument.addEventListener(\"mousedown\", handleClickOutside);\n\t\treturn () => document.removeEventListener(\"mousedown\", handleClickOutside);\n\t}, [isOpen, shouldCloseOnInteractOutside, handleOpenChange]);\n\n\t// Close on escape\n\tuseEffect(() => {\n\t\tif (!isOpen) return;\n\n\t\tconst handleEscape = (event: KeyboardEvent) => {\n\t\t\tif (event.key === \"Escape\") {\n\t\t\t\thandleOpenChange(false);\n\t\t\t}\n\t\t};\n\n\t\tdocument.addEventListener(\"keydown\", handleEscape);\n\t\treturn () => document.removeEventListener(\"keydown\", handleEscape);\n\t}, [isOpen, handleOpenChange]);\n\n\tconst contextValue = {\n\t\tisOpen,\n\t\tonOpenChange: handleOpenChange,\n\t\ttriggerRef,\n\t\tplacement,\n\t\ttrigger,\n\t\tshowArrow,\n\t\toffset,\n\t\tcrossOffset,\n\t};\n\n\treturn (\n\t\t<PopoverContext.Provider value={contextValue}>\n\t\t\t<div className={className} {...props}>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t</PopoverContext.Provider>\n\t);\n};\n\nconst PopoverTriggerComponent: React.FC<PopoverTriggerProps> = ({\n\tchildren,\n\tclassName,\n\tcss,\n\t...props\n}) => {\n\tconst { theme } = useTheme();\n\tconst context = React.useContext(PopoverContext);\n\tif (!context) {\n\t\tthrow new Error(\"PopoverTrigger must be used within a Popover\");\n\t}\n\n\tconst { isOpen, onOpenChange, triggerRef, trigger } = context;\n\n\tconst handleClick = () => {\n\t\tif (trigger === \"click\") {\n\t\t\tonOpenChange(!isOpen);\n\t\t}\n\t};\n\n\tconst handleMouseEnter = () => {\n\t\tif (trigger === \"hover\") {\n\t\t\tonOpenChange(true);\n\t\t}\n\t};\n\n\tconst handleMouseLeave = () => {\n\t\tif (trigger === \"hover\") {\n\t\t\tonOpenChange(false);\n\t\t}\n\t};\n\n\tconst handleFocus = () => {\n\t\tif (trigger === \"focus\") {\n\t\t\tonOpenChange(true);\n\t\t}\n\t};\n\n\tconst handleBlur = () => {\n\t\tif (trigger === \"focus\") {\n\t\t\tonOpenChange(false);\n\t\t}\n\t};\n\n\treturn (\n\t\t<PopoverTrigger\n\t\t\tref={triggerRef}\n\t\t\ttheme={theme}\n\t\t\tclassName={className}\n\t\t\tcss={css}\n\t\t\tonClick={handleClick}\n\t\t\tonMouseEnter={handleMouseEnter}\n\t\t\tonMouseLeave={handleMouseLeave}\n\t\t\tonFocus={handleFocus}\n\t\t\tonBlur={handleBlur}\n\t\t\t{...props}\n\t\t>\n\t\t\t{children}\n\t\t</PopoverTrigger>\n\t);\n};\n\nconst PopoverContentComponent: React.FC<PopoverContentProps> = ({\n\tchildren,\n\tclassName,\n\tcss,\n\t...props\n}) => {\n\tconst { theme } = useTheme();\n\tconst context = React.useContext(PopoverContext);\n\tif (!context) {\n\t\tthrow new Error(\"PopoverContent must be used within a Popover\");\n\t}\n\n\tconst { isOpen, triggerRef, placement, showArrow, offset, crossOffset } =\n\t\tcontext;\n\n\tconst [triggerRect, setTriggerRect] = useState<DOMRect | null>(null);\n\n\tuseEffect(() => {\n\t\tif (isOpen && triggerRef.current) {\n\t\t\tsetTriggerRect(triggerRef.current.getBoundingClientRect());\n\t\t}\n\t}, [isOpen, triggerRef]);\n\n\tif (!isOpen) return null;\n\n\tconst positionStyles = getPopoverPlacementStyles(\n\t\tplacement,\n\t\ttriggerRect,\n\t\toffset,\n\t\tcrossOffset,\n\t);\n\n\tconst container = document.body;\n\n\tconst content = (\n\t\t<>\n\t\t\t{context && <PopoverBackdrop theme={theme} />}\n\t\t\t<PopoverContent\n\t\t\t\ttheme={theme}\n\t\t\t\tdata-popover-content\n\t\t\t\tclassName={className}\n\t\t\t\tcss={css}\n\t\t\t\tplacement={placement}\n\t\t\t\tshowArrow={showArrow}\n\t\t\t\tstyle={positionStyles}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</PopoverContent>\n\t\t</>\n\t);\n\n\treturn createPortal(content, container);\n};\n\nPopover.Trigger = PopoverTriggerComponent;\nPopover.Content = PopoverContentComponent;\n\nPopover.displayName = \"Popover\";\nPopoverTriggerComponent.displayName = \"PopoverTrigger\";\nPopoverContentComponent.displayName = \"PopoverContent\";\n"],"names":["fadeIn","keyframes","fadeOut","getPopoverPlacementStyles","placement","triggerRect","offset","crossOffset","styles","getArrowStyles","css","getBackdropStyles","props","theme","backdrop","PopoverBackdrop","styled","PopoverContent","PopoverTrigger","PopoverContext","React","Popover","children","controlledOpen","defaultOpen","onOpenChange","trigger","showArrow","shouldCloseOnBlur","shouldCloseOnInteractOutside","className","portalContainer","internalOpen","setInternalOpen","useState","triggerRef","useRef","isControlled","isOpen","handleOpenChange","useCallback","open","useEffect","handleClickOutside","event","popoverContent","handleEscape","contextValue","jsx","PopoverTriggerComponent","useTheme","context","handleClick","handleMouseEnter","handleMouseLeave","handleFocus","handleBlur","PopoverContentComponent","setTriggerRect","positionStyles","container","content","jsxs","Fragment","createPortal"],"mappings":"iTAqEMA,EAASC,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWTC,EAAUD,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWVE,EAA4B,CACjCC,EACAC,EACAC,EACAC,IACI,CACA,GAAA,CAACF,EAAa,MAAO,CAAC,EAE1B,MAAMG,EAA8B,CACnC,SAAU,WACV,OAAQ,IACT,EAEA,OAAQJ,EAAW,CAClB,IAAK,MACJI,EAAO,OAAS,GAAG,OAAO,YAAcH,EAAY,IAAMC,CAAM,KAChEE,EAAO,KAAO,GAAGH,EAAY,KAAOA,EAAY,MAAQ,CAAC,KAClDG,EAAA,UAAY,+BAA+BD,CAAW,MAC7D,MACD,IAAK,YACJC,EAAO,OAAS,GAAG,OAAO,YAAcH,EAAY,IAAMC,CAAM,KAChEE,EAAO,KAAO,GAAGH,EAAY,KAAOE,CAAW,KAC/C,MACD,IAAK,UACJC,EAAO,OAAS,GAAG,OAAO,YAAcH,EAAY,IAAMC,CAAM,KAChEE,EAAO,MAAQ,GAAG,OAAO,WAAaH,EAAY,MAAQE,CAAW,KACrE,MACD,IAAK,SACJC,EAAO,IAAM,GAAGH,E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