{"version":3,"file":"reactjs-popup.cjs.production.min.js","sources":["../src/hooks.tsx","../src/styles.ts","../src/Utils.ts","../src/index.tsx"],"sourcesContent":["import { useEffect, RefObject, useLayoutEffect } from 'react';\n\nexport const useOnEscape = (\n handler: (event: KeyboardEvent) => void,\n active = true\n) => {\n useEffect(() => {\n if (!active) return;\n const listener = (event: KeyboardEvent) => {\n // check if key is an Escape\n if (event.key === 'Escape') handler(event);\n };\n document.addEventListener('keyup', listener);\n\n return () => {\n if (!active) return;\n document.removeEventListener('keyup', listener);\n };\n }, [handler, active]);\n};\n\nexport const useRepositionOnResize = (handler: () => void, active = true) => {\n useEffect(() => {\n if (!active) return;\n const listener = () => {\n handler();\n };\n\n window.addEventListener('resize', listener);\n\n return () => {\n if (!active) return;\n window.removeEventListener('resize', listener);\n };\n }, [handler, active]);\n};\n\nexport const useOnClickOutside = (\n ref: RefObject | RefObject[],\n handler: (event: TouchEvent | MouseEvent) => void,\n active = true\n) => {\n useEffect(() => {\n if (!active) return;\n const listener = (event: TouchEvent | MouseEvent) => {\n // Do nothing if clicking ref's element or descendent elements\n const refs = Array.isArray(ref) ? ref : [ref];\n\n let contains = false;\n refs.forEach(r => {\n if (!r.current || r.current.contains(event.target as Node)) {\n contains = true;\n return;\n }\n });\n event.stopPropagation();\n if (!contains) handler(event);\n };\n\n document.addEventListener('mousedown', listener);\n document.addEventListener('touchstart', listener);\n\n return () => {\n if (!active) return;\n document.removeEventListener('mousedown', listener);\n document.removeEventListener('touchstart', listener);\n };\n }, [ref, handler, active]);\n};\n\n// Make sure that user is not able TAB out of the Modal content on Open\nexport const useTabbing = (\n contentRef: RefObject,\n active = true\n) => {\n useEffect(() => {\n if (!active) return;\n const listener = (event: KeyboardEvent) => {\n // check if key is an Tab\n if (event.keyCode === 9) {\n const els = contentRef?.current?.querySelectorAll(\n 'a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), [tabindex=\"0\"]'\n );\n\n const focusableEls = Array.prototype.slice.call(els);\n if (focusableEls.length === 1) {\n event.preventDefault();\n return;\n }\n\n const firstFocusableEl = focusableEls[0];\n const lastFocusableEl = focusableEls[focusableEls.length - 1];\n if (event.shiftKey && document.activeElement === firstFocusableEl) {\n event.preventDefault();\n lastFocusableEl.focus();\n } else if (document.activeElement === lastFocusableEl) {\n event.preventDefault();\n firstFocusableEl.focus();\n }\n }\n };\n\n document.addEventListener('keydown', listener);\n\n return () => {\n if (!active) return;\n document.removeEventListener('keydown', listener);\n };\n }, [contentRef, active]);\n};\n\nexport const useIsomorphicLayoutEffect =\n typeof window !== 'undefined' ? useLayoutEffect : useEffect;\n","import React from 'react';\n\ntype PopupStyle = {\n popupContent: {\n tooltip: React.CSSProperties;\n modal: React.CSSProperties;\n };\n popupArrow: React.CSSProperties;\n overlay: {\n tooltip: React.CSSProperties;\n modal: React.CSSProperties;\n };\n};\n\nconst Style: PopupStyle = {\n popupContent: {\n tooltip: {\n position: 'absolute',\n zIndex: 999,\n },\n modal: {\n position: 'relative',\n margin: 'auto',\n },\n },\n popupArrow: {\n height: '8px',\n width: '16px',\n position: 'absolute',\n background: 'transparent',\n color: '#FFF',\n zIndex: -1,\n },\n overlay: {\n tooltip: {\n position: 'fixed',\n top: '0',\n bottom: '0',\n left: '0',\n right: '0',\n zIndex: 999,\n },\n modal: {\n position: 'fixed',\n top: '0',\n bottom: '0',\n left: '0',\n right: '0',\n display: 'flex',\n zIndex: 999,\n },\n },\n};\n\nexport default Style;\n","/* Algo to calculate position\n 1. center position for popup content : the center of the trigger will be the center of the content content\n so the popup content position will be like this :\n top => the y of the center for the trigger element : trigger.top + trigger.height/2\n left => the x of the center for the trigger element : trigger.left + trigger.width/2\n\n 2. translate position according to the first position attribute passed in the function argument\n for example :\n position = 'left top'\n we need to handle the first argument in the position: 'left' => that's mean we need to translate the popup content according to the X axis by - content.width/2\n\n 3.translate position according to the first position attribute passed in the function argument\n for example :\n position = 'left top'\n the second argument 'top' => translate popup content by + content.height*4/5\n\n 4. check if calculated position is going out of bounds of wrapper box or not. If yes repeat 1-3 for next position enum. By default wrapper box is window element\n*/\nimport { PopupPosition } from './types';\n\nexport const POSITION_TYPES: PopupPosition[] = [\n 'top left',\n 'top center',\n 'top right',\n 'right top',\n 'right center',\n 'right bottom',\n 'bottom left',\n 'bottom center',\n 'bottom right',\n 'left top',\n 'left center',\n 'left bottom',\n //'center center',\n];\n\ntype CordsType = {\n top: number;\n left: number;\n transform: string;\n arrowLeft: string;\n arrowTop: string;\n};\n\nconst getCoordinatesForPosition = (\n triggerBounding: DOMRect,\n ContentBounding: DOMRect,\n position: PopupPosition, //PopupPosition | PopupPosition[],\n arrow: boolean,\n { offsetX, offsetY }: { offsetX: number; offsetY: number }\n): CordsType => {\n const margin = arrow ? 8 : 0;\n const args = position.split(' ');\n // the step N 1 : center the popup content => ok\n const CenterTop = triggerBounding.top + triggerBounding.height / 2;\n const CenterLeft = triggerBounding.left + triggerBounding.width / 2;\n const { height, width } = ContentBounding;\n let top = CenterTop - height / 2;\n let left = CenterLeft - width / 2;\n let transform = '';\n let arrowTop = '0%';\n let arrowLeft = '0%';\n // the step N 2 : => ok\n switch (args[0]) {\n case 'top':\n top -= height / 2 + triggerBounding.height / 2 + margin;\n transform = `rotate(180deg) translateX(50%)`;\n arrowTop = '100%';\n arrowLeft = '50%';\n break;\n case 'bottom':\n top += height / 2 + triggerBounding.height / 2 + margin;\n transform = `rotate(0deg) translateY(-100%) translateX(-50%)`;\n arrowLeft = '50%';\n break;\n case 'left':\n left -= width / 2 + triggerBounding.width / 2 + margin;\n transform = ` rotate(90deg) translateY(50%) translateX(-25%)`;\n arrowLeft = '100%';\n arrowTop = '50%';\n break;\n case 'right':\n left += width / 2 + triggerBounding.width / 2 + margin;\n transform = `rotate(-90deg) translateY(-150%) translateX(25%)`;\n arrowTop = '50%';\n break;\n default:\n }\n switch (args[1]) {\n case 'top':\n top = triggerBounding.top;\n arrowTop = `${triggerBounding.height / 2}px`;\n break;\n case 'bottom':\n top = triggerBounding.top - height + triggerBounding.height;\n arrowTop = `${height - triggerBounding.height / 2}px`;\n break;\n case 'left':\n left = triggerBounding.left;\n arrowLeft = `${triggerBounding.width / 2}px`;\n break;\n case 'right':\n left = triggerBounding.left - width + triggerBounding.width;\n arrowLeft = `${width - triggerBounding.width / 2}px`;\n break;\n default:\n }\n\n top = args[0] === 'top' ? top - offsetY : top + offsetY;\n left = args[0] === 'left' ? left - offsetX : left + offsetX;\n\n return { top, left, transform, arrowLeft, arrowTop };\n};\n\nexport const getTooltipBoundary = (keepTooltipInside: string | Boolean) => {\n // add viewport\n let boundingBox = {\n top: 0,\n left: 0,\n /* eslint-disable-next-line no-undef */\n width: window.innerWidth,\n /* eslint-disable-next-line no-undef */\n height: window.innerHeight,\n };\n if (typeof keepTooltipInside === 'string') {\n /* eslint-disable-next-line no-undef */\n const selector = document.querySelector(keepTooltipInside);\n if (process.env.NODE_ENV !== 'production') {\n if (selector === null)\n throw new Error(\n `${keepTooltipInside} selector does not exist : keepTooltipInside must be a valid html selector 'class' or 'Id' or a boolean value`\n );\n }\n if (selector !== null) boundingBox = selector.getBoundingClientRect();\n }\n\n return boundingBox;\n};\n\nconst calculatePosition = (\n triggerBounding: DOMRect,\n ContentBounding: DOMRect,\n position: PopupPosition | PopupPosition[],\n arrow: boolean,\n { offsetX, offsetY }: { offsetX: number; offsetY: number },\n keepTooltipInside: string | boolean\n): CordsType => {\n let bestCoords: CordsType = {\n arrowLeft: '0%',\n arrowTop: '0%',\n left: 0,\n top: 0,\n transform: 'rotate(135deg)',\n };\n let i = 0;\n const wrapperBox = getTooltipBoundary(keepTooltipInside);\n let positions = Array.isArray(position) ? position : [position];\n\n // keepTooltipInside would be activated if the keepTooltipInside exist or the position is Array\n if (keepTooltipInside || Array.isArray(position))\n positions = [...positions, ...POSITION_TYPES];\n\n // add viewPort for WarpperBox\n // wrapperBox.top = wrapperBox.top + window.scrollY;\n // wrapperBox.left = wrapperBox.left + window.scrollX;\n\n while (i < positions.length) {\n bestCoords = getCoordinatesForPosition(\n triggerBounding,\n ContentBounding,\n positions[i],\n arrow,\n { offsetX, offsetY }\n );\n\n const contentBox = {\n top: bestCoords.top,\n left: bestCoords.left,\n width: ContentBounding.width,\n height: ContentBounding.height,\n };\n\n if (\n contentBox.top <= wrapperBox.top ||\n contentBox.left <= wrapperBox.left ||\n contentBox.top + contentBox.height >=\n wrapperBox.top + wrapperBox.height ||\n contentBox.left + contentBox.width >= wrapperBox.left + wrapperBox.width\n ) {\n i++;\n } else {\n break;\n }\n }\n\n return bestCoords;\n};\n\nexport default calculatePosition;\n","import React, {\n useState,\n useRef,\n useEffect,\n forwardRef,\n useImperativeHandle,\n} from 'react';\nimport ReactDOM from 'react-dom';\nimport { PopupProps, PopupActions } from './types';\nimport {\n useOnEscape,\n useRepositionOnResize,\n useOnClickOutside,\n useTabbing,\n useIsomorphicLayoutEffect,\n} from './hooks';\n\nimport './index.css';\n\nimport styles from './styles';\nimport calculatePosition from './Utils';\n\nlet popupIdCounter = 0;\n\nconst getRootPopup = () => {\n let PopupRoot = document.getElementById('popup-root');\n\n if (PopupRoot === null) {\n PopupRoot = document.createElement('div');\n PopupRoot.setAttribute('id', 'popup-root');\n document.body.appendChild(PopupRoot);\n }\n\n return PopupRoot;\n};\n\nexport const Popup = forwardRef(\n (\n {\n trigger = null,\n onOpen = () => {},\n onClose = () => {},\n defaultOpen = false,\n open = undefined,\n disabled = false,\n nested = false,\n closeOnDocumentClick = true,\n repositionOnResize = true,\n closeOnEscape = true,\n on = ['click'],\n contentStyle = {},\n arrowStyle = {},\n overlayStyle = {},\n className = '',\n position = 'bottom center',\n modal = false,\n lockScroll = false,\n arrow = true,\n offsetX = 0,\n offsetY = 0,\n mouseEnterDelay = 100,\n mouseLeaveDelay = 100,\n keepTooltipInside = false,\n children,\n },\n ref\n ) => {\n const [isOpen, setIsOpen] = useState(open || defaultOpen);\n const triggerRef = useRef(null);\n const contentRef = useRef(null);\n const arrowRef = useRef(null);\n const focusedElBeforeOpen = useRef(null);\n const popupId = useRef(`popup-${++popupIdCounter}`);\n\n const isModal = modal ? true : !trigger;\n const timeOut = useRef(0);\n\n useIsomorphicLayoutEffect(() => {\n if (isOpen) {\n focusedElBeforeOpen.current = document.activeElement;\n setPosition();\n focusContentOnOpen(); // for accessibility\n lockScrolll();\n } else {\n resetScroll();\n }\n return () => {\n clearTimeout(timeOut.current);\n };\n }, [isOpen]);\n\n // for uncontrolled popup we need to sync isOpen with open prop\n useEffect(() => {\n if (typeof open === 'boolean') {\n if (open) openPopup();\n else closePopup();\n }\n }, [open, disabled]);\n\n const openPopup = (event?: React.SyntheticEvent) => {\n if (isOpen || disabled) return;\n setIsOpen(true);\n setTimeout(() => onOpen(event), 0);\n };\n\n const closePopup = (\n event?: React.SyntheticEvent | KeyboardEvent | TouchEvent | MouseEvent\n ) => {\n if (!isOpen || disabled) return;\n setIsOpen(false);\n if (isModal) (focusedElBeforeOpen.current as HTMLElement)?.focus();\n setTimeout(() => onClose(event), 0);\n };\n\n const togglePopup = (event?: React.SyntheticEvent) => {\n event?.stopPropagation();\n if (!isOpen) openPopup(event);\n else closePopup(event);\n };\n\n const onMouseEnter = (event?: React.SyntheticEvent) => {\n clearTimeout(timeOut.current);\n timeOut.current = setTimeout(() => openPopup(event), mouseEnterDelay);\n };\n\n const onContextMenu = (event?: React.SyntheticEvent) => {\n event?.preventDefault();\n togglePopup();\n };\n\n const onMouseLeave = (event?: React.SyntheticEvent) => {\n clearTimeout(timeOut.current);\n timeOut.current = setTimeout(() => closePopup(event), mouseLeaveDelay);\n };\n\n const lockScrolll = () => {\n if (isModal && lockScroll)\n document.getElementsByTagName('body')[0].style.overflow = 'hidden'; // migrate to document.body\n };\n\n const resetScroll = () => {\n if (isModal && lockScroll)\n document.getElementsByTagName('body')[0].style.overflow = 'auto';\n };\n const focusContentOnOpen = () => {\n const focusableEls = contentRef?.current?.querySelectorAll(\n 'a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), [tabindex=\"0\"]'\n );\n const firstEl = Array.prototype.slice.call(focusableEls)[0];\n firstEl?.focus();\n };\n\n useImperativeHandle(ref, () => ({\n open: () => {\n openPopup();\n },\n close: () => {\n closePopup();\n },\n toggle: () => {\n togglePopup();\n },\n }));\n\n // set Position\n const setPosition = () => {\n if (isModal || !isOpen) return;\n if (!triggerRef?.current || !triggerRef?.current || !contentRef?.current)\n return; /// show error as one of ref is undefined\n const trigger = triggerRef.current.getBoundingClientRect();\n const content = contentRef.current.getBoundingClientRect();\n\n const cords = calculatePosition(\n trigger,\n content,\n position,\n arrow,\n {\n offsetX,\n offsetY,\n },\n keepTooltipInside\n );\n contentRef.current.style.top = `${cords.top + window.scrollY}px`;\n contentRef.current.style.left = `${cords.left + window.scrollX}px`;\n if (arrow && !!arrowRef.current) {\n arrowRef.current.style.transform = cords.transform;\n arrowRef.current.style.setProperty('-ms-transform', cords.transform);\n arrowRef.current.style.setProperty(\n '-webkit-transform',\n cords.transform\n );\n arrowRef.current.style.top =\n arrowStyle.top?.toString() || cords.arrowTop;\n arrowRef.current.style.left =\n arrowStyle.left?.toString() || cords.arrowLeft;\n }\n };\n // hooks\n useOnEscape(closePopup, closeOnEscape); // can be optimized if we disabled for hover\n useTabbing(contentRef, isOpen && isModal);\n useRepositionOnResize(setPosition, repositionOnResize);\n useOnClickOutside(\n !!trigger ? [contentRef, triggerRef] : [contentRef],\n closePopup,\n closeOnDocumentClick && !nested\n ); // we need to add a ne\n // render the trigger element and add events\n const renderTrigger = () => {\n const triggerProps: any = {\n key: 'T',\n ref: triggerRef,\n 'aria-describedby': popupId.current,\n };\n const onAsArray = Array.isArray(on) ? on : [on];\n for (let i = 0, len = onAsArray.length; i < len; i++) {\n switch (onAsArray[i]) {\n case 'click':\n triggerProps.onClick = togglePopup;\n break;\n case 'right-click':\n triggerProps.onContextMenu = onContextMenu;\n break;\n case 'hover':\n triggerProps.onMouseEnter = onMouseEnter;\n triggerProps.onMouseLeave = onMouseLeave;\n break;\n case 'focus':\n triggerProps.onFocus = onMouseEnter;\n triggerProps.onBlur = onMouseLeave;\n break;\n default:\n }\n }\n\n if (typeof trigger === 'function') {\n const comp = trigger(isOpen);\n return !!trigger && React.cloneElement(comp, triggerProps);\n }\n\n return !!trigger && React.cloneElement(trigger, triggerProps);\n };\n\n const addWarperAction = () => {\n const popupContentStyle = isModal\n ? styles.popupContent.modal\n : styles.popupContent.tooltip;\n\n const childrenElementProps: any = {\n className: `popup-content ${\n className !== ''\n ? className\n .split(' ')\n .map(c => `${c}-content`)\n .join(' ')\n : ''\n }`,\n style: {\n ...popupContentStyle,\n ...contentStyle,\n pointerEvents: 'auto', //closeOnDocumentClick && nested ? 'auto' : 'none',\n },\n ref: contentRef,\n onClick: (e: any) => {\n e.stopPropagation();\n },\n };\n if (!modal && on.indexOf('hover') >= 0) {\n childrenElementProps.onMouseEnter = onMouseEnter;\n childrenElementProps.onMouseLeave = onMouseLeave;\n }\n return childrenElementProps;\n };\n\n const renderContent = () => {\n return (\n \n {arrow && !isModal && (\n
\n `${c}-arrow`)\n .join(' ')\n : ''\n }`}\n viewBox=\"0 0 32 16\"\n style={{\n position: 'absolute',\n ...arrowStyle,\n }}\n >\n \n \n
\n )}\n {children && typeof children === 'function'\n ? children(closePopup, isOpen)\n : children}\n \n );\n };\n\n const overlay = !(on.indexOf('hover') >= 0);\n const ovStyle = isModal ? styles.overlay.modal : styles.overlay.tooltip;\n\n const content = [\n overlay && (\n `${c}-overlay`)\n .join(' ')\n : ''\n }`}\n style={{\n ...ovStyle,\n ...overlayStyle,\n pointerEvents:\n (closeOnDocumentClick && nested) || isModal ? 'auto' : 'none',\n }}\n onClick={closeOnDocumentClick && nested ? closePopup : undefined}\n tabIndex={-1}\n >\n {isModal && renderContent()}\n \n ),\n\n !isModal && renderContent(),\n ];\n\n return (\n <>\n {renderTrigger()}\n {isOpen && ReactDOM.createPortal(content, getRootPopup())}\n \n );\n }\n);\n\nexport default Popup;\n"],"names":["useIsomorphicLayoutEffect","window","useLayoutEffect","useEffect","Style","popupContent","tooltip","position","zIndex","modal","margin","popupArrow","height","width","background","color","overlay","top","bottom","left","right","display","POSITION_TYPES","getCoordinatesForPosition","triggerBounding","ContentBounding","arrow","offsetX","offsetY","args","split","transform","arrowTop","arrowLeft","popupIdCounter","Popup","forwardRef","ref","trigger","onOpen","onClose","defaultOpen","open","undefined","disabled","nested","closeOnDocumentClick","repositionOnResize","closeOnEscape","on","contentStyle","arrowStyle","overlayStyle","className","lockScroll","mouseEnterDelay","mouseLeaveDelay","keepTooltipInside","children","useState","isOpen","setIsOpen","triggerRef","useRef","contentRef","arrowRef","focusedElBeforeOpen","popupId","isModal","timeOut","current","document","activeElement","setPosition","focusContentOnOpen","lockScrolll","resetScroll","clearTimeout","openPopup","closePopup","event","setTimeout","focus","togglePopup","stopPropagation","onMouseEnter","onContextMenu","preventDefault","onMouseLeave","getElementsByTagName","style","overflow","focusableEls","_contentRef$current","querySelectorAll","firstEl","Array","prototype","slice","call","useImperativeHandle","close","toggle","handler","active","cords","bestCoords","i","wrapperBox","boundingBox","innerWidth","innerHeight","selector","querySelector","getBoundingClientRect","getTooltipBoundary","positions","isArray","length","contentBox","calculatePosition","scrollY","scrollX","setProperty","toString","listener","key","addEventListener","removeEventListener","keyCode","els","firstFocusableEl","lastFocusableEl","shiftKey","useTabbing","useRepositionOnResize","refs","contains","forEach","r","target","useOnClickOutside","PopupRoot","renderContent","React","popupContentStyle","styles","childrenElementProps","map","c","join","pointerEvents","onClick","e","indexOf","role","id","viewBox","d","fill","ovStyle","content","tabIndex","triggerProps","onAsArray","len","onFocus","onBlur","comp","cloneElement","renderTrigger","ReactDOM","createPortal","getElementById","createElement","setAttribute","body","appendChild"],"mappings":"iZAEO,IA6GMA,EACO,oBAAXC,OAAyBC,kBAAkBC,YClG9CC,EAAoB,CACxBC,aAAc,CACZC,QAAS,CACPC,SAAU,WACVC,OAAQ,KAEVC,MAAO,CACLF,SAAU,WACVG,OAAQ,SAGZC,WAAY,CACV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