@fluentui/react-positioning 0.0.0-nightly627ad67f1120211109.1 → 0.0.0-nightly6faffd280a20220221.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +200 -8
- package/CHANGELOG.md +60 -7
- package/dist/react-positioning.d.ts +113 -35
- package/lib/createArrowStyles.d.ts +64 -0
- package/lib/createArrowStyles.js +87 -0
- package/lib/createArrowStyles.js.map +1 -0
- package/lib/createVirtualElementFromClick.js +17 -15
- package/lib/createVirtualElementFromClick.js.map +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/types.d.ts +28 -7
- package/lib/types.js.map +1 -1
- package/lib/usePopper.d.ts +2 -14
- package/lib/usePopper.js +367 -311
- package/lib/usePopper.js.map +1 -1
- package/lib/usePopperMouseTarget.js +28 -22
- package/lib/usePopperMouseTarget.js.map +1 -1
- package/lib/utils/getBasePlacement.js +1 -1
- package/lib/utils/getBasePlacement.js.map +1 -1
- package/lib/utils/getBoundary.js +15 -10
- package/lib/utils/getBoundary.js.map +1 -1
- package/lib/utils/getReactFiberFromNode.js +39 -35
- package/lib/utils/getReactFiberFromNode.js.map +1 -1
- package/lib/utils/getScrollParent.js +46 -32
- package/lib/utils/getScrollParent.js.map +1 -1
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/mergeArrowOffset.js +29 -24
- package/lib/utils/mergeArrowOffset.js.map +1 -1
- package/lib/utils/positioningHelper.d.ts +2 -2
- package/lib/utils/positioningHelper.js +38 -30
- package/lib/utils/positioningHelper.js.map +1 -1
- package/lib/utils/resolvePositioningShorthand.js +57 -19
- package/lib/utils/resolvePositioningShorthand.js.map +1 -1
- package/lib/utils/useCallbackRef.js +35 -29
- package/lib/utils/useCallbackRef.js.map +1 -1
- package/lib-commonjs/createArrowStyles.d.ts +64 -0
- package/lib-commonjs/createArrowStyles.js +100 -0
- package/lib-commonjs/createArrowStyles.js.map +1 -0
- package/lib-commonjs/createVirtualElementFromClick.js +23 -16
- package/lib-commonjs/createVirtualElementFromClick.js.map +1 -1
- package/lib-commonjs/index.d.ts +2 -1
- package/lib-commonjs/index.js +28 -6
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/types.d.ts +28 -7
- package/lib-commonjs/types.js +4 -1
- package/lib-commonjs/types.js.map +1 -1
- package/lib-commonjs/usePopper.d.ts +2 -14
- package/lib-commonjs/usePopper.js +382 -316
- package/lib-commonjs/usePopper.js.map +1 -1
- package/lib-commonjs/usePopperMouseTarget.js +38 -25
- package/lib-commonjs/usePopperMouseTarget.js.map +1 -1
- package/lib-commonjs/utils/getBasePlacement.js +7 -2
- package/lib-commonjs/utils/getBasePlacement.js.map +1 -1
- package/lib-commonjs/utils/getBoundary.js +23 -12
- package/lib-commonjs/utils/getBoundary.js.map +1 -1
- package/lib-commonjs/utils/getReactFiberFromNode.js +44 -36
- package/lib-commonjs/utils/getReactFiberFromNode.js.map +1 -1
- package/lib-commonjs/utils/getScrollParent.js +53 -33
- package/lib-commonjs/utils/getScrollParent.js.map +1 -1
- package/lib-commonjs/utils/index.js +14 -2
- package/lib-commonjs/utils/index.js.map +1 -1
- package/lib-commonjs/utils/mergeArrowOffset.js +35 -25
- package/lib-commonjs/utils/mergeArrowOffset.js.map +1 -1
- package/lib-commonjs/utils/positioningHelper.d.ts +2 -2
- package/lib-commonjs/utils/positioningHelper.js +46 -31
- package/lib-commonjs/utils/positioningHelper.js.map +1 -1
- package/lib-commonjs/utils/resolvePositioningShorthand.js +65 -22
- package/lib-commonjs/utils/resolvePositioningShorthand.js.map +1 -1
- package/lib-commonjs/utils/useCallbackRef.js +45 -32
- package/lib-commonjs/utils/useCallbackRef.js.map +1 -1
- package/package.json +7 -8
package/lib/usePopper.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"usePopper.js","sourceRoot":"","sources":["../src/usePopper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,aAAa,EAAE,SAAS,EA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CkB,CAiCnB;AACA;AACA;;AACD,KApCD,EAoCG,EApCH;AAqCD;;AAED,SAAO;AAAE,IAAA,SAAF;AAAa,IAAA,YAAb;AAA2B,IAAA;AAA3B,GAAP;AACD","sourcesContent":["import { useEventCallback, useIsomorphicLayoutEffect, useFirstMount, canUseDOM } from '@fluentui/react-utilities';\nimport { useFluent } from '@fluentui/react-shared-contexts';\nimport * as PopperJs from '@popperjs/core';\nimport * as React from 'react';\n\nimport {\n getScrollParent,\n applyRtlToOffset,\n getPlacement,\n getReactFiberFromNode,\n getBoundary,\n useCallbackRef,\n getBasePlacement,\n} from './utils/index';\nimport type { PopperVirtualElement, PopperOptions, PositioningProps } from './types';\n\ntype PopperInstance = PopperJs.Instance & { isFirstRun?: boolean };\n\ninterface UsePopperOptions extends PositioningProps {\n /**\n * If false, delays Popper's creation.\n * @default true\n */\n enabled?: boolean;\n}\n\n//\n// Dev utils to detect if nodes have \"autoFocus\" props.\n//\n\n/**\n * Detects if a passed HTML node has \"autoFocus\" prop on a React's fiber. Is needed as React handles autofocus behavior\n * in React DOM and will not pass \"autoFocus\" to an actual HTML.\n */\nfunction hasAutofocusProp(node: Node): boolean {\n // https://github.com/facebook/react/blob/848bb2426e44606e0a55dfe44c7b3ece33772485/packages/react-dom/src/client/ReactDOMHostConfig.js#L157-L166\n const isAutoFocusableElement =\n node.nodeName === 'BUTTON' ||\n node.nodeName === 'INPUT' ||\n node.nodeName === 'SELECT' ||\n node.nodeName === 'TEXTAREA';\n\n if (isAutoFocusableElement) {\n return !!getReactFiberFromNode(node)?.pendingProps.autoFocus;\n }\n\n return false;\n}\n\nfunction hasAutofocusFilter(node: Node) {\n return hasAutofocusProp(node) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;\n}\n\n/**\n * Provides a callback to resolve Popper options, it's stable and should be used as a dependency to trigger updates\n * of Popper options.\n *\n * A callback is used there intentionally as some of Popper.js modifiers require DOM nodes (targer, container, arrow)\n * that can't be resolved properly during an initial rendering.\n */\nfunction usePopperOptions(options: PopperOptions, popperOriginalPositionRef: React.MutableRefObject<string>) {\n const {\n align,\n arrowPadding,\n autoSize,\n coverTarget,\n flipBoundary,\n offset,\n overflowBoundary,\n pinned,\n position,\n positionFixed,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n unstable_disableTether,\n } = options;\n\n const isRtl = useFluent().dir === 'rtl';\n const placement = getPlacement(align, position, isRtl);\n const strategy = positionFixed ? 'fixed' : 'absolute';\n\n const offsetModifier = React.useMemo(\n () =>\n offset\n ? {\n name: 'offset',\n options: { offset: isRtl ? applyRtlToOffset(offset) : offset },\n }\n : null,\n [offset, isRtl],\n );\n\n return React.useCallback(\n (\n target: HTMLElement | PopperJs.VirtualElement | null,\n container: HTMLElement | null,\n arrow: HTMLElement | null,\n ): PopperJs.Options => {\n const scrollParentElement: HTMLElement = getScrollParent(container);\n const hasScrollableElement = scrollParentElement\n ? scrollParentElement !== scrollParentElement.ownerDocument?.body\n : false;\n\n const modifiers: PopperJs.Options['modifiers'] = [\n /**\n * We are setting the position to `fixed` in the first effect to prevent scroll jumps in case of the content\n * with managed focus. Modifier sets the position to `fixed` before all other modifier effects. Another part of\n * a patch modifies \".forceUpdate()\" directly after a Popper will be created.\n */\n {\n name: 'positionStyleFix',\n enabled: true,\n phase: 'afterWrite' as PopperJs.ModifierPhases,\n effect: ({ state, instance }: { state: PopperJs.State; instance: PopperInstance }) => {\n // \".isFirstRun\" is a part of our patch, on a first evaluation it will \"undefined\"\n // should be disabled for subsequent runs as it breaks positioning for them\n if (instance.isFirstRun !== false) {\n popperOriginalPositionRef.current = state.elements.popper.style.position;\n state.elements.popper.style.position = 'fixed';\n }\n\n return () => undefined;\n },\n requires: [],\n },\n\n { name: 'flip', options: { flipVariations: true } },\n\n /**\n * pinned disables the flip modifier by setting flip.enabled to false; this\n * disables automatic repositioning of the popper box; it will always be placed according to\n * the values of `align` and `position` props, regardless of the size of the component, the\n * reference element or the viewport.\n */\n pinned && { name: 'flip', enabled: false },\n\n /**\n * When the popper box is placed in the context of a scrollable element, we need to set\n * preventOverflow.escapeWithReference to true and flip.boundariesElement to 'scrollParent'\n * (default is 'viewport') so that the popper box will stick with the targetRef when we\n * scroll targetRef out of the viewport.\n */\n hasScrollableElement && { name: 'flip', options: { boundary: 'clippingParents' } },\n hasScrollableElement && { name: 'preventOverflow', options: { boundary: 'clippingParents' } },\n\n offsetModifier,\n\n /**\n * This modifier is necessary to retain behaviour from popper v1 where untethered poppers are allowed by\n * default. i.e. popper is still rendered fully in the viewport even if anchor element is no longer in the\n * viewport.\n */\n unstable_disableTether && {\n name: 'preventOverflow',\n options: { altAxis: unstable_disableTether === 'all', tether: false },\n },\n\n flipBoundary && {\n name: 'flip',\n options: {\n altBoundary: true,\n boundary: getBoundary(container, flipBoundary),\n },\n },\n overflowBoundary && {\n name: 'preventOverflow',\n options: {\n altBoundary: true,\n boundary: getBoundary(container, overflowBoundary),\n },\n },\n\n {\n // Similar code as popper-maxsize-modifier: https://github.com/atomiks/popper.js/blob/master/src/modifiers/maxSize.js\n // popper-maxsize-modifier only calculates the max sizes.\n // This modifier can apply max sizes always, or apply the max sizes only when overflow is detected\n name: 'applyMaxSize',\n enabled: !!autoSize,\n phase: 'beforeWrite' as PopperJs.ModifierPhases,\n requiresIfExists: ['offset', 'preventOverflow', 'flip'],\n options: {\n altBoundary: true,\n boundary: getBoundary(container, overflowBoundary),\n },\n fn({ state, options: modifierOptions }: PopperJs.ModifierArguments<{}>) {\n const overflow = PopperJs.detectOverflow(state, modifierOptions);\n const { x, y } = state.modifiersData.preventOverflow || { x: 0, y: 0 };\n const { width, height } = state.rects.popper;\n const basePlacement = getBasePlacement(state.placement);\n\n const widthProp: keyof PopperJs.SideObject = basePlacement === 'left' ? 'left' : 'right';\n const heightProp: keyof PopperJs.SideObject = basePlacement === 'top' ? 'top' : 'bottom';\n\n const applyMaxWidth =\n autoSize === 'always' ||\n autoSize === 'width-always' ||\n (overflow[widthProp] > 0 && (autoSize === true || autoSize === 'width'));\n const applyMaxHeight =\n autoSize === 'always' ||\n autoSize === 'height-always' ||\n (overflow[heightProp] > 0 && (autoSize === true || autoSize === 'height'));\n\n if (applyMaxWidth) {\n state.styles.popper.maxWidth = `${width - overflow[widthProp] - x}px`;\n }\n if (applyMaxHeight) {\n state.styles.popper.maxHeight = `${height - overflow[heightProp] - y}px`;\n }\n },\n },\n\n /**\n * This modifier is necessary in order to render the pointer. Refs are resolved in effects, so it can't be\n * placed under computed modifiers. Deep merge is not required as this modifier has only these properties.\n */\n {\n name: 'arrow',\n enabled: !!arrow,\n options: { element: arrow, padding: arrowPadding },\n },\n\n /**\n * Modifies popper offsets to cover the reference rect, but still keep edge alignment\n */\n {\n name: 'coverTarget',\n enabled: !!coverTarget,\n phase: 'main',\n requiresIfExists: ['offset', 'preventOverflow', 'flip'],\n fn({ state }: PopperJs.ModifierArguments<{}>) {\n const basePlacement = getBasePlacement(state.placement);\n switch (basePlacement) {\n case 'bottom':\n state.modifiersData.popperOffsets!.y -= state.rects.reference.height;\n break;\n case 'top':\n state.modifiersData.popperOffsets!.y += state.rects.reference.height;\n break;\n case 'left':\n state.modifiersData.popperOffsets!.x += state.rects.reference.width;\n break;\n case 'right':\n state.modifiersData.popperOffsets!.x -= state.rects.reference.width;\n break;\n }\n },\n },\n ].filter(Boolean) as PopperJs.Options['modifiers']; // filter boolean conditional spreading values\n\n const popperOptions: PopperJs.Options = {\n modifiers,\n\n placement,\n strategy,\n };\n\n return popperOptions;\n },\n [\n arrowPadding,\n autoSize,\n coverTarget,\n flipBoundary,\n offsetModifier,\n overflowBoundary,\n placement,\n strategy,\n unstable_disableTether,\n pinned,\n\n // These can be skipped from deps as they will not ever change\n popperOriginalPositionRef,\n ],\n );\n}\n\n/**\n * Exposes Popper positioning API via React hook. Contains few important differences between an official \"react-popper\"\n * package:\n * - style attributes are applied directly on DOM to avoid re-renders\n * - refs changes and resolution is handled properly without re-renders\n * - contains a specific to React fix related to initial positioning when containers have components with managed focus\n * to avoid focus jumps\n */\nexport function usePopper(\n options: UsePopperOptions = {},\n): {\n // React refs are supposed to be contravariant\n // (allows a more general type to be passed rather than a more specific one)\n // However, Typescript currently can't infer that fact for refs\n // See https://github.com/microsoft/TypeScript/issues/30748 for more information\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n targetRef: React.MutableRefObject<any>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n containerRef: React.MutableRefObject<any>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n arrowRef: React.MutableRefObject<any>;\n} {\n const { enabled = true } = options;\n const isFirstMount = useFirstMount();\n\n const popperOriginalPositionRef = React.useRef<string>('absolute');\n const resolvePopperOptions = usePopperOptions(options, popperOriginalPositionRef);\n\n const popperInstanceRef = React.useRef<PopperInstance | null>(null);\n\n const handlePopperUpdate = useEventCallback(() => {\n popperInstanceRef.current?.destroy();\n popperInstanceRef.current = null;\n\n const target = overrideTargetRef.current ?? targetRef.current;\n\n let popperInstance: PopperInstance | null = null;\n\n if (canUseDOM() && enabled) {\n if (target && containerRef.current) {\n popperInstance = PopperJs.createPopper(\n target,\n containerRef.current,\n resolvePopperOptions(target, containerRef.current, arrowRef.current),\n );\n }\n }\n\n if (popperInstance) {\n /**\n * The patch updates `.forceUpdate()` Popper function which restores the original position before the first\n * forceUpdate() call. See also \"positionStyleFix\" modifier in usePopperOptions().\n */\n const originalForceUpdate = popperInstance.forceUpdate;\n\n popperInstance.isFirstRun = true;\n popperInstance.forceUpdate = () => {\n if (popperInstance?.isFirstRun) {\n popperInstance.state.elements.popper.style.position = popperOriginalPositionRef.current;\n popperInstance.isFirstRun = false;\n }\n\n originalForceUpdate();\n };\n }\n\n popperInstanceRef.current = popperInstance;\n });\n\n // Refs are managed by useCallbackRef() to handle ref updates scenarios.\n //\n // The first scenario are updates for a targetRef, we can handle it properly only via callback refs, but it causes\n // re-renders (we would like to avoid them).\n //\n // The second problem is related to refs resolution on React's layer: refs are resolved in the same order as effects\n // that causes an issue when you have a container inside a target, for example: a menu in ChatMessage.\n //\n // function ChatMessage(props) {\n // <div className=\"message\" ref={targetRef}> // 3) ref will be resolved only now, but it's too late already\n // <Popper target={targetRef}> // 2) create a popper instance\n // <div className=\"menu\" /> // 1) capture ref from this element\n // </Popper>\n // </div>\n // }\n //\n // Check a demo on CodeSandbox: https://codesandbox.io/s/popper-refs-emy60.\n //\n // This again can be solved with callback refs. It's not a huge issue as with hooks we are moving popper's creation\n // to ChatMessage itself, however, without `useCallback()` refs it's still a Pandora box.\n const targetRef = useCallbackRef<HTMLElement | PopperJs.VirtualElement | null>(null, handlePopperUpdate, true);\n const containerRef = useCallbackRef<HTMLElement | null>(null, handlePopperUpdate, true);\n const arrowRef = useCallbackRef<HTMLElement | null>(null, handlePopperUpdate, true);\n\n // Stores external target from options.target or setTarget\n const overrideTargetRef = useCallbackRef<HTMLElement | PopperVirtualElement | null>(null, handlePopperUpdate, true);\n\n React.useImperativeHandle(\n options.popperRef,\n () => ({\n updatePosition: () => {\n popperInstanceRef.current?.update();\n },\n setTarget: (target: HTMLElement | PopperVirtualElement) => {\n if (options.target && process.env.NODE_ENV !== 'production') {\n const err = new Error();\n // eslint-disable-next-line no-console\n console.warn('Imperative setTarget should not be used at the same time as target option');\n // eslint-disable-next-line no-console\n console.warn(err.stack);\n }\n\n overrideTargetRef.current = target;\n },\n }),\n // Missing deps:\n // options.target - only used for a runtime warning\n // targetRef - Stable between renders\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [],\n );\n\n useIsomorphicLayoutEffect(() => {\n if (options.target) {\n overrideTargetRef.current = options.target;\n }\n }, [options.target, overrideTargetRef]);\n useIsomorphicLayoutEffect(() => {\n handlePopperUpdate();\n\n return () => {\n popperInstanceRef.current?.destroy();\n popperInstanceRef.current = null;\n };\n }, [handlePopperUpdate, options.enabled]);\n useIsomorphicLayoutEffect(\n () => {\n if (!isFirstMount) {\n popperInstanceRef.current?.setOptions(\n resolvePopperOptions(overrideTargetRef.current ?? targetRef.current, containerRef.current, arrowRef.current),\n );\n }\n },\n // Missing deps:\n // isFirstMount - Should never change after mount\n // arrowRef, containerRef, targetRef - Stable between renders\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [resolvePopperOptions],\n );\n\n if (process.env.NODE_ENV !== 'production') {\n // This checked should run only in development mode\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useEffect(() => {\n if (containerRef.current) {\n const contentNode = containerRef.current;\n const treeWalker = contentNode.ownerDocument?.createTreeWalker(contentNode, NodeFilter.SHOW_ELEMENT, {\n acceptNode: hasAutofocusFilter,\n });\n\n while (treeWalker?.nextNode()) {\n const node = treeWalker.currentNode;\n // eslint-disable-next-line no-console\n console.warn('<Popper>:', node);\n // eslint-disable-next-line no-console\n console.warn(\n [\n '<Popper>: ^ this node contains \"autoFocus\" prop on a React element. This can break the initial',\n 'positioning of an element and cause a window jump effect. This issue occurs because React polyfills',\n '\"autoFocus\" behavior to solve inconsistencies between different browsers:',\n 'https://github.com/facebook/react/issues/11851#issuecomment-351787078',\n '\\n',\n 'However, \".focus()\" in this case occurs before any other React effects will be executed',\n '(React.useEffect(), componentDidMount(), etc.) and we can not prevent this behavior. If you really',\n 'want to use \"autoFocus\" please add \"position: fixed\" to styles of the element that is wrapped by',\n '\"Popper\".',\n `In general, it's not recommended to use \"autoFocus\" as it may break accessibility aspects:`,\n 'https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-autofocus.md',\n '\\n',\n 'We suggest to use the \"trapFocus\" prop on Fluent components or a catch \"ref\" and then use',\n '\"ref.current.focus\" in React.useEffect():',\n 'https://reactjs.org/docs/refs-and-the-dom.html#adding-a-ref-to-a-dom-element',\n ].join(' '),\n );\n }\n }\n // We run this check once, no need to add deps here\n // TODO: Should be rework to handle options.enabled and contentRef updates\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n }\n\n return { targetRef, containerRef, arrowRef };\n}\n"],"sourceRoot":"../src/"}
|
@@ -8,27 +8,33 @@ import { createVirtualElementFromClick } from './createVirtualElementFromClick';
|
|
8
8
|
* @param initialState - initializes a user provided state similare to useState
|
9
9
|
* @returns state and dispatcher for a Popper virtual element that uses native/synthetic mouse events
|
10
10
|
*/
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
11
|
+
|
12
|
+
export const usePopperMouseTarget = initialState => {
|
13
|
+
const [virtualElement, setVirtualElement] = React.useState(initialState);
|
14
|
+
|
15
|
+
const setVirtualMouseTarget = event => {
|
16
|
+
if (event === undefined || event === null) {
|
17
|
+
setVirtualElement(undefined);
|
18
|
+
return;
|
19
|
+
}
|
20
|
+
|
21
|
+
let mouseevent;
|
22
|
+
|
23
|
+
if (!(event instanceof MouseEvent)) {
|
24
|
+
mouseevent = event.nativeEvent;
|
25
|
+
} else {
|
26
|
+
mouseevent = event;
|
27
|
+
}
|
28
|
+
|
29
|
+
if (!(mouseevent instanceof MouseEvent) && process.env.NODE_ENV !== 'production') {
|
30
|
+
// eslint-disable-next-line no-console
|
31
|
+
console.error('usePopperMouseTarget should only be used with MouseEvent');
|
32
|
+
}
|
33
|
+
|
34
|
+
const contextTarget = createVirtualElementFromClick(mouseevent);
|
35
|
+
setVirtualElement(contextTarget);
|
36
|
+
};
|
37
|
+
|
38
|
+
return [virtualElement, setVirtualMouseTarget];
|
33
39
|
};
|
34
40
|
//# sourceMappingURL=usePopperMouseTarget.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["usePopperMouseTarget.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,6BAAT,QAA8C,iCAA9C;AAGA;;;;;;;AAOG;;AACH,OAAO,MAAM,oBAAoB,GAAI,YAAD,IAA6E;AAC/G,QAAM,CAAC,cAAD,EAAiB,iBAAjB,IAAsC,KAAK,CAAC,QAAN,CAAoD,YAApD,CAA5C;;AAEA,QAAM,qBAAqB,GAAI,KAAD,IAA4D;AACxF,QAAI,KAAK,KAAK,SAAV,IAAuB,KAAK,KAAK,IAArC,EAA2C;AACzC,MAAA,iBAAiB,CAAC,SAAD,CAAjB;AACA;AACD;;AAED,QAAI,UAAJ;;AACA,QAAI,EAAE,KAAK,YAAY,UAAnB,CAAJ,EAAoC;AAClC,MAAA,UAAU,GAAG,KAAK,CAAC,WAAnB;AACD,KAFD,MAEO;AACL,MAAA,UAAU,GAAG,KAAb;AACD;;AAED,QAAI,EAAE,UAAU,YAAY,UAAxB,KAAuC,OAAO,CAAC,GAAR,CAAY,QAAZ,KAAyB,YAApE,EAAkF;AAChF;AACA,MAAA,OAAO,CAAC,KAAR,CAAc,0DAAd;AACD;;AAED,UAAM,aAAa,GAAG,6BAA6B,CAAC,UAAD,CAAnD;AACA,IAAA,iBAAiB,CAAC,aAAD,CAAjB;AACD,GApBD;;AAsBA,SAAO,CAAC,cAAD,EAAiB,qBAAjB,CAAP;AACD,CA1BM","sourcesContent":["import * as React from 'react';\nimport { createVirtualElementFromClick } from './createVirtualElementFromClick';\nimport * as PopperJs from '@popperjs/core';\n\n/**\n * A state hook that manages a popper virtual element from mouseevents.\n * Useful for scenarios where a component needs to be positioned by mouse click (e.g. contextmenu)\n * React synthetic events are not persisted by this hook\n *\n * @param initialState - initializes a user provided state similare to useState\n * @returns state and dispatcher for a Popper virtual element that uses native/synthetic mouse events\n */\nexport const usePopperMouseTarget = (initialState?: PopperJs.VirtualElement | (() => PopperJs.VirtualElement)) => {\n const [virtualElement, setVirtualElement] = React.useState<PopperJs.VirtualElement | undefined>(initialState);\n\n const setVirtualMouseTarget = (event: React.MouseEvent | MouseEvent | undefined | null) => {\n if (event === undefined || event === null) {\n setVirtualElement(undefined);\n return;\n }\n\n let mouseevent: MouseEvent;\n if (!(event instanceof MouseEvent)) {\n mouseevent = event.nativeEvent;\n } else {\n mouseevent = event;\n }\n\n if (!(mouseevent instanceof MouseEvent) && process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.error('usePopperMouseTarget should only be used with MouseEvent');\n }\n\n const contextTarget = createVirtualElementFromClick(mouseevent);\n setVirtualElement(contextTarget);\n };\n\n return [virtualElement, setVirtualMouseTarget] as const;\n};\n"],"sourceRoot":"../src/"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["utils/getBasePlacement.ts"],"names":[],"mappings":"AAEA;;;;;AAKG;AACH,OAAM,SAAU,gBAAV,CAA2B,SAA3B,EAAwD;AAC5D,SAAO,SAAS,CAAC,KAAV,CAAgB,GAAhB,EAAqB,CAArB,CAAP;AACD","sourcesContent":["import * as PopperJs from '@popperjs/core';\n\n/**\n * Returns the base placement value\n * @param placement - the popper placement (i.e. bottom-start)\n *\n * @returns bottom-start -> bottom\n */\nexport function getBasePlacement(placement: PopperJs.Placement): PopperJs.BasePlacement {\n return placement.split('-')[0] as PopperJs.BasePlacement;\n}\n"],"sourceRoot":"../src/"}
|
package/lib/utils/getBoundary.js
CHANGED
@@ -2,17 +2,22 @@ import { getScrollParent } from './getScrollParent';
|
|
2
2
|
/**
|
3
3
|
* Allows to mimic a behavior from V1 of Popper and accept `window` and `scrollParent` as strings.
|
4
4
|
*/
|
5
|
+
|
5
6
|
export function getBoundary(element, boundary) {
|
6
|
-
|
7
|
-
|
7
|
+
if (boundary === 'window') {
|
8
|
+
return element === null || element === void 0 ? void 0 : element.ownerDocument.documentElement;
|
9
|
+
}
|
10
|
+
|
11
|
+
if (boundary === 'scrollParent') {
|
12
|
+
let boundariesNode = getScrollParent(element);
|
13
|
+
|
14
|
+
if (boundariesNode.nodeName === 'BODY') {
|
15
|
+
boundariesNode = element === null || element === void 0 ? void 0 : element.ownerDocument.documentElement;
|
8
16
|
}
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
return boundariesNode;
|
15
|
-
}
|
16
|
-
return boundary;
|
17
|
+
|
18
|
+
return boundariesNode;
|
19
|
+
}
|
20
|
+
|
21
|
+
return boundary;
|
17
22
|
}
|
18
23
|
//# sourceMappingURL=getBoundary.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["utils/getBoundary.ts"],"names":[],"mappings":"AAEA,SAAS,eAAT,QAAgC,mBAAhC;AAGA;;AAEG;;AACH,OAAM,SAAU,WAAV,CAAsB,OAAtB,EAAmD,QAAnD,EAAsE;AAC1E,MAAI,QAAQ,KAAK,QAAjB,EAA2B;AACzB,WAAO,OAAO,KAAA,IAAP,IAAA,OAAO,KAAA,KAAA,CAAP,GAAO,KAAA,CAAP,GAAA,OAAO,CAAE,aAAT,CAAwB,eAA/B;AACD;;AAED,MAAI,QAAQ,KAAK,cAAjB,EAAiC;AAC/B,QAAI,cAAc,GAA4B,eAAe,CAAC,OAAD,CAA7D;;AAEA,QAAI,cAAc,CAAC,QAAf,KAA4B,MAAhC,EAAwC;AACtC,MAAA,cAAc,GAAG,OAAO,KAAA,IAAP,IAAA,OAAO,KAAA,KAAA,CAAP,GAAO,KAAA,CAAP,GAAA,OAAO,CAAE,aAAT,CAAwB,eAAzC;AACD;;AAED,WAAO,cAAP;AACD;;AAED,SAAO,QAAP;AACD","sourcesContent":["import * as PopperJs from '@popperjs/core';\n\nimport { getScrollParent } from './getScrollParent';\nimport type { Boundary } from '../types';\n\n/**\n * Allows to mimic a behavior from V1 of Popper and accept `window` and `scrollParent` as strings.\n */\nexport function getBoundary(element: HTMLElement | null, boundary?: Boundary): PopperJs.Boundary | undefined {\n if (boundary === 'window') {\n return element?.ownerDocument!.documentElement;\n }\n\n if (boundary === 'scrollParent') {\n let boundariesNode: HTMLElement | undefined = getScrollParent(element);\n\n if (boundariesNode.nodeName === 'BODY') {\n boundariesNode = element?.ownerDocument!.documentElement;\n }\n\n return boundariesNode;\n }\n\n return boundary;\n}\n"],"sourceRoot":"../src/"}
|
@@ -1,42 +1,46 @@
|
|
1
1
|
var WorkTag;
|
2
|
+
|
2
3
|
(function (WorkTag) {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
4
|
+
WorkTag[WorkTag["FunctionComponent"] = 0] = "FunctionComponent";
|
5
|
+
WorkTag[WorkTag["ClassComponent"] = 1] = "ClassComponent";
|
6
|
+
WorkTag[WorkTag["IndeterminateComponent"] = 2] = "IndeterminateComponent";
|
7
|
+
WorkTag[WorkTag["HostRoot"] = 3] = "HostRoot";
|
8
|
+
WorkTag[WorkTag["HostPortal"] = 4] = "HostPortal";
|
9
|
+
WorkTag[WorkTag["HostComponent"] = 5] = "HostComponent";
|
10
|
+
WorkTag[WorkTag["HostText"] = 6] = "HostText";
|
11
|
+
WorkTag[WorkTag["Fragment"] = 7] = "Fragment";
|
12
|
+
WorkTag[WorkTag["Mode"] = 8] = "Mode";
|
13
|
+
WorkTag[WorkTag["ContextConsumer"] = 9] = "ContextConsumer";
|
14
|
+
WorkTag[WorkTag["ContextProvider"] = 10] = "ContextProvider";
|
15
|
+
WorkTag[WorkTag["ForwardRef"] = 11] = "ForwardRef";
|
16
|
+
WorkTag[WorkTag["Profiler"] = 12] = "Profiler";
|
17
|
+
WorkTag[WorkTag["SuspenseComponent"] = 13] = "SuspenseComponent";
|
18
|
+
WorkTag[WorkTag["MemoComponent"] = 14] = "MemoComponent";
|
19
|
+
WorkTag[WorkTag["SimpleMemoComponent"] = 15] = "SimpleMemoComponent";
|
20
|
+
WorkTag[WorkTag["LazyComponent"] = 16] = "LazyComponent";
|
21
|
+
WorkTag[WorkTag["IncompleteClassComponent"] = 17] = "IncompleteClassComponent";
|
22
|
+
WorkTag[WorkTag["DehydratedFragment"] = 18] = "DehydratedFragment";
|
23
|
+
WorkTag[WorkTag["SuspenseListComponent"] = 19] = "SuspenseListComponent";
|
24
|
+
WorkTag[WorkTag["FundamentalComponent"] = 20] = "FundamentalComponent";
|
25
|
+
WorkTag[WorkTag["ScopeComponent"] = 21] = "ScopeComponent";
|
25
26
|
})(WorkTag || (WorkTag = {}));
|
27
|
+
|
26
28
|
export function getReactFiberFromNode(elm) {
|
27
|
-
|
28
|
-
|
29
|
+
if (!elm) {
|
30
|
+
return null;
|
31
|
+
}
|
32
|
+
|
33
|
+
for (const k in elm) {
|
34
|
+
// React 16 uses "__reactInternalInstance$" prefix
|
35
|
+
// React 17 uses "__reactFiber$" prefix
|
36
|
+
// https://github.com/facebook/react/pull/18377
|
37
|
+
if (k.indexOf('__reactInternalInstance$') === 0 || k.indexOf('__reactFiber$') === 0) {
|
38
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
39
|
+
// @ts-ignore
|
40
|
+
return elm[k];
|
29
41
|
}
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
// https://github.com/facebook/react/pull/18377
|
34
|
-
if (k.indexOf('__reactInternalInstance$') === 0 || k.indexOf('__reactFiber$') === 0) {
|
35
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
36
|
-
// @ts-ignore
|
37
|
-
return elm[k];
|
38
|
-
}
|
39
|
-
}
|
40
|
-
throw new Error('getReactFiber(): Failed to find a React Fiber on a node');
|
42
|
+
}
|
43
|
+
|
44
|
+
throw new Error('getReactFiber(): Failed to find a React Fiber on a node');
|
41
45
|
}
|
42
46
|
//# sourceMappingURL=getReactFiberFromNode.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"getReactFiberFromNode.js","sourceRoot":"","sources":["../../src/utils/getReactFiberFromNode.ts"],"names":[],"mappings":"AAuEA,IAAK,OAuBJ;AAvBD,WAAK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A,OAAA,CAAA,OAAA,CAAA,oBAAA,CAAA,GAAA,EAAA,CAAA,GAAA,oBAAA;AACA,EAAA,OAAA,CAAA,OAAA,CAAA,uBAAA,CAAA,GAAA,EAAA,CAAA,GAAA,uBAAA;AACA,EAAA,OAAA,CAAA,OAAA,CAAA,sBAAA,CAAA,GAAA,EAAA,CAAA,GAAA,sBAAA;AACA,EAAA,OAAA,CAAA,OAAA,CAAA,gBAAA,CAAA,GAAA,EAAA,CAAA,GAAA,gBAAA;AACD,CAvBD,EAAK,OAAO,KAAP,OAAO,GAAA,EAAA,CAAZ;;AAsLA,OAAM,SAAU,qBAAV,CAAgC,GAAhC,EAAqD;AACzD,MAAI,CAAC,GAAL,EAAU;AACR,WAAO,IAAP;AACD;;AAED,OAAK,MAAM,CAAX,IAAgB,GAAhB,EAAqB;AACnB;AACA;AACA;AACA,QAAI,CAAC,CAAC,OAAF,CAAU,0BAAV,MAA0C,CAA1C,IAA+C,CAAC,CAAC,OAAF,CAAU,eAAV,MAA+B,CAAlF,EAAqF;AACnF;AACA;AACA,aAAO,GAAG,CAAC,CAAD,CAAV;AACD;AACF;;AAED,QAAM,IAAI,KAAJ,CAAU,yDAAV,CAAN;AACD","sourcesContent":["import * as React from 'react';\n\n// ========================================================\n// react/packages/shared/ReactTypes.js\n// ========================================================\n\ntype ReactEventResponder<E, C> = {\n $$typeof: Symbol | number;\n displayName: string;\n targetEventTypes: null | string[];\n rootEventTypes: null | string[];\n getInitialState: null | ((props: Object) => Object);\n onEvent: null | ((event: E, context: C, props: Object, state: Object) => void);\n onRootEvent: null | ((event: E, context: C, props: Object, state: Object) => void);\n onMount: null | ((context: C, props: Object, state: Object) => void);\n onUnmount: null | ((context: C, props: Object, state: Object) => void);\n};\n\ntype ReactEventResponderInstance<E, C> = {\n fiber: Object;\n props: Object;\n responder: ReactEventResponder<E, C>;\n rootEventTypes: null | Set<string>;\n state: Object;\n};\n\n// ========================================================\n// react/packages/react-reconciler/src/ReactFiberHooks.js\n// ========================================================\n\nexport type HookType =\n | 'useState'\n | 'useReducer'\n | 'useContext'\n | 'useRef'\n | 'useEffect'\n | 'useLayoutEffect'\n | 'useCallback'\n | 'useMemo'\n | 'useImperativeHandle'\n | 'useDebugValue'\n | 'useResponder';\n\ntype ReactProviderType<T> = {\n $$typeof: Symbol | number;\n _context: ReactContext<T>;\n};\n\ntype ReactContext<T> = {\n $$typeof: Symbol | number;\n Consumer: ReactContext<T>;\n Provider: ReactProviderType<T>;\n\n _calculateChangedBits: ((a: T, b: T) => number) | null;\n\n _currentValue: T;\n _currentValue2: T;\n _threadCount: number;\n\n // DEV only\n _currentRenderer?: Object | null;\n _currentRenderer2?: Object | null;\n};\n\ntype ContextDependency<T> = {\n context: ReactContext<T>;\n observedBits: number;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n next: ContextDependency<any> | null;\n};\n\nenum WorkTag {\n FunctionComponent = 0,\n ClassComponent = 1,\n IndeterminateComponent = 2, // Before we know whether it is function or class\n HostRoot = 3, // Root of a host tree. Could be nested inside another node.\n HostPortal = 4, // A subtree. Could be an entry point to a different renderer.\n HostComponent = 5,\n HostText = 6,\n Fragment = 7,\n Mode = 8,\n ContextConsumer = 9,\n ContextProvider = 10,\n ForwardRef = 11,\n Profiler = 12,\n SuspenseComponent = 13,\n MemoComponent = 14,\n SimpleMemoComponent = 15,\n LazyComponent = 16,\n IncompleteClassComponent = 17,\n DehydratedFragment = 18,\n SuspenseListComponent = 19,\n FundamentalComponent = 20,\n ScopeComponent = 21,\n}\n\ntype Source = {\n fileName: string;\n lineNumber: number;\n};\n\ntype ExpirationTime = number;\n\ntype Dependencies = {\n expirationTime: ExpirationTime;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n firstContext: ContextDependency<any> | null;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n responders: Map<ReactEventResponder<any, any>, ReactEventResponderInstance<any, any>> | null;\n};\n\n// ========================================================\n// react/packages/react-reconciler/src/ReactFiber.js\n// ========================================================\n\n// A Fiber is work on a Component that needs to be done or was done. There can\n// be more than one per component.\n\nexport type Fiber = {\n // These first fields are conceptually members of an Instance. This used to\n // be split into a separate type and intersected with the other Fiber fields,\n // but until Flow fixes its intersection bugs, we've merged them into a\n // single type.\n\n // An Instance is shared between all versions of a component. We can easily\n // break this out into a separate object to avoid copying so much to the\n // alternate versions of the tree. We put this on a single object for now to\n // minimize the number of objects created during the initial render.\n\n // Tag identifying the type of fiber.\n tag: WorkTag;\n\n // Unique identifier of this child.\n key: null | string;\n\n // The value of element.type which is used to preserve the identity during\n // reconciliation of this child.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n elementType: any;\n\n // The resolved function/class/ associated with this fiber.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n type: any;\n\n // The local state associated with this fiber.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n stateNode: any;\n\n // Conceptual aliases\n // parent : Instance -> return The parent happens to be the same as the\n // return fiber since we've merged the fiber and instance.\n\n // Remaining fields belong to Fiber\n\n // The Fiber to return to after finishing processing this one.\n // This is effectively the parent, but there can be multiple parents (two)\n // so this is only the parent of the thing we're currently processing.\n // It is conceptually the same as the return address of a stack frame.\n return: Fiber | null;\n\n // Singly Linked List Tree Structure.\n child: Fiber | null;\n sibling: Fiber | null;\n index: number;\n\n // The ref last used to attach this node.\n // I'll avoid adding an owner field for prod and model that as functions.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ref: React.Ref<any>;\n\n // Input is the data coming into process this fiber. Arguments. Props.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n pendingProps: any; // This type will be more specific once we overload the tag.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n memoizedProps: any; // The props used to create the output.\n\n // A queue of state updates and callbacks.\n // updateQueue: UpdateQueue<any> | null,\n\n // The state used to create the output\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n memoizedState: any;\n\n // Dependencies (contexts, events) for this fiber, if it has any\n dependencies: Dependencies | null;\n\n // // Bitfield that describes properties about the fiber and its subtree. E.g.\n // // the ConcurrentMode flag indicates whether the subtree should be async-by-\n // // default. When a fiber is created, it inherits the mode of its\n // // parent. Additional flags can be set at creation time, but after that the\n // // value should remain unchanged throughout the fiber's lifetime, particularly\n // // before its child fibers are created.\n // mode: TypeOfMode\n //\n // // Effect\n // effectTag: SideEffectTag\n\n // Singly linked list fast path to the next fiber with side-effects.\n nextEffect: Fiber | null;\n\n // The first and last fiber with side-effect within this subtree. This allows\n // us to reuse a slice of the linked list when we reuse the work done within\n // this fiber.\n firstEffect: Fiber | null;\n lastEffect: Fiber | null;\n\n // Represents a time in the future by which this work should be completed.\n // Does not include work found in its subtree.\n expirationTime: ExpirationTime;\n\n // This is used to quickly determine if a subtree has no pending changes.\n childExpirationTime: ExpirationTime;\n\n // This is a pooled version of a Fiber. Every fiber that gets updated will\n // eventually have a pair. There are cases when we can clean up pairs to save\n // memory if we need to.\n alternate: Fiber | null;\n\n // Time spent rendering this Fiber and its descendants for the current update.\n // This tells us how well the tree makes use of sCU for memoization.\n // It is reset to 0 each time we render and only updated when we don't bailout.\n // This field is only set when the enableProfilerTimer flag is enabled.\n actualDuration?: number;\n\n // If the Fiber is currently active in the \"render\" phase,\n // This marks the time at which the work began.\n // This field is only set when the enableProfilerTimer flag is enabled.\n actualStartTime?: number;\n\n // Duration of the most recent render time for this Fiber.\n // This value is not updated when we bailout for memoization purposes.\n // This field is only set when the enableProfilerTimer flag is enabled.\n selfBaseDuration?: number;\n\n // Sum of base times for all descendants of this Fiber.\n // This value bubbles up during the \"complete\" phase.\n // This field is only set when the enableProfilerTimer flag is enabled.\n treeBaseDuration?: number;\n\n // Conceptual aliases\n // workInProgress : Fiber -> alternate The alternate used for reuse happens\n // to be the same as work in progress.\n // __DEV__ only\n _debugID?: number;\n _debugSource?: Source | null;\n _debugOwner?: Fiber | null;\n _debugIsCurrentlyTiming?: boolean;\n _debugNeedsRemount?: boolean;\n\n // Used to verify that the order of hooks does not change between renders.\n _debugHookTypes?: HookType[] | null;\n};\n\nexport function getReactFiberFromNode(elm: Node | undefined): Fiber | null {\n if (!elm) {\n return null;\n }\n\n for (const k in elm) {\n // React 16 uses \"__reactInternalInstance$\" prefix\n // React 17 uses \"__reactFiber$\" prefix\n // https://github.com/facebook/react/pull/18377\n if (k.indexOf('__reactInternalInstance$') === 0 || k.indexOf('__reactFiber$') === 0) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return elm[k];\n }\n }\n\n throw new Error('getReactFiber(): Failed to find a React Fiber on a node');\n}\n"],"sourceRoot":"../src/"}
|
@@ -3,49 +3,63 @@
|
|
3
3
|
* @param node - DOM node.
|
4
4
|
* @returns - parent DOM node.
|
5
5
|
*/
|
6
|
-
export const getParentNode =
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
6
|
+
export const getParentNode = node => {
|
7
|
+
if (node.nodeName === 'HTML') {
|
8
|
+
return node;
|
9
|
+
} // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
10
|
+
|
11
|
+
|
12
|
+
return node.parentNode || node.host;
|
12
13
|
};
|
13
14
|
/**
|
14
15
|
* Returns CSS styles of the given node.
|
15
16
|
* @param node - DOM node.
|
16
17
|
* @returns - CSS styles.
|
17
18
|
*/
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
19
|
+
|
20
|
+
const getStyleComputedProperty = node => {
|
21
|
+
var _a;
|
22
|
+
|
23
|
+
if (node.nodeType !== 1) {
|
24
|
+
return {};
|
25
|
+
}
|
26
|
+
|
27
|
+
const window = (_a = node.ownerDocument) === null || _a === void 0 ? void 0 : _a.defaultView;
|
28
|
+
return window.getComputedStyle(node, null);
|
25
29
|
};
|
26
30
|
/**
|
27
31
|
* Returns the first scrollable parent of the given element.
|
28
32
|
* @param node - DOM node.
|
29
33
|
* @returns - the first scrollable parent.
|
30
34
|
*/
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
35
|
+
|
36
|
+
|
37
|
+
export const getScrollParent = node => {
|
38
|
+
// Return body, `getScroll` will take care to get the correct `scrollTop` from it
|
39
|
+
const parentNode = node && getParentNode(node); // eslint-disable-next-line
|
40
|
+
|
41
|
+
if (!parentNode) return document.body;
|
42
|
+
|
43
|
+
switch (parentNode.nodeName) {
|
44
|
+
case 'HTML':
|
45
|
+
case 'BODY':
|
46
|
+
return parentNode.ownerDocument.body;
|
47
|
+
|
48
|
+
case '#document':
|
49
|
+
return parentNode.body;
|
50
|
+
} // If any of the overflow props is defined for the node then we return it as the parent
|
51
|
+
|
52
|
+
|
53
|
+
const {
|
54
|
+
overflow,
|
55
|
+
overflowX,
|
56
|
+
overflowY
|
57
|
+
} = getStyleComputedProperty(parentNode);
|
58
|
+
|
59
|
+
if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
|
60
|
+
return parentNode;
|
61
|
+
}
|
62
|
+
|
63
|
+
return getScrollParent(parentNode);
|
50
64
|
};
|
51
65
|
//# sourceMappingURL=getScrollParent.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["utils/getScrollParent.ts"],"names":[],"mappings":"AAAA;;;;AAIG;AACH,OAAO,MAAM,aAAa,GAAI,IAAD,IAAmC;AAC9D,MAAI,IAAI,CAAC,QAAL,KAAkB,MAAtB,EAA8B;AAC5B,WAAO,IAAP;AACD,GAH6D,CAI9D;;;AACA,SAAO,IAAI,CAAC,UAAL,IAAoB,IAAY,CAAC,IAAxC;AACD,CANM;AAQP;;;;AAIG;;AACH,MAAM,wBAAwB,GAAI,IAAD,IAAoD;;;AACnF,MAAI,IAAI,CAAC,QAAL,KAAkB,CAAtB,EAAyB;AACvB,WAAO,EAAP;AACD;;AAED,QAAM,MAAM,GAAG,CAAA,EAAA,GAAA,IAAI,CAAC,aAAL,MAAkB,IAAlB,IAAkB,EAAA,KAAA,KAAA,CAAlB,GAAkB,KAAA,CAAlB,GAAkB,EAAA,CAAE,WAAnC;AACA,SAAO,MAAO,CAAC,gBAAR,CAAyB,IAAzB,EAA+B,IAA/B,CAAP;AACD,CAPD;AASA;;;;AAIG;;;AACH,OAAO,MAAM,eAAe,GAAI,IAAD,IAAqD;AAClF;AACA,QAAM,UAAU,GAAG,IAAI,IAAI,aAAa,CAAC,IAAD,CAAxC,CAFkF,CAGlF;;AACA,MAAI,CAAC,UAAL,EAAiB,OAAO,QAAQ,CAAC,IAAhB;;AAEjB,UAAQ,UAAU,CAAC,QAAnB;AACE,SAAK,MAAL;AACA,SAAK,MAAL;AACE,aAAO,UAAU,CAAC,aAAX,CAA0B,IAAjC;;AACF,SAAK,WAAL;AACE,aAAS,UAAmC,CAAC,IAA7C;AALJ,GANkF,CAclF;;;AACA,QAAM;AAAE,IAAA,QAAF;AAAY,IAAA,SAAZ;AAAuB,IAAA;AAAvB,MAAqC,wBAAwB,CAAC,UAAD,CAAnE;;AACA,MAAI,wBAAwB,IAAxB,CAA6B,QAAS,GAAG,SAAZ,GAAyB,SAAtD,CAAJ,EAAsE;AACpE,WAAO,UAAP;AACD;;AAED,SAAO,eAAe,CAAC,UAAD,CAAtB;AACD,CArBM","sourcesContent":["/**\n * Returns the parent node or the host of the node argument.\n * @param node - DOM node.\n * @returns - parent DOM node.\n */\nexport const getParentNode = (node: HTMLElement): HTMLElement => {\n if (node.nodeName === 'HTML') {\n return node;\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return node.parentNode || (node as any).host;\n};\n\n/**\n * Returns CSS styles of the given node.\n * @param node - DOM node.\n * @returns - CSS styles.\n */\nconst getStyleComputedProperty = (node: HTMLElement): Partial<CSSStyleDeclaration> => {\n if (node.nodeType !== 1) {\n return {};\n }\n\n const window = node.ownerDocument?.defaultView;\n return window!.getComputedStyle(node, null);\n};\n\n/**\n * Returns the first scrollable parent of the given element.\n * @param node - DOM node.\n * @returns - the first scrollable parent.\n */\nexport const getScrollParent = (node: Document | HTMLElement | null): HTMLElement => {\n // Return body, `getScroll` will take care to get the correct `scrollTop` from it\n const parentNode = node && getParentNode(node as HTMLElement);\n // eslint-disable-next-line\n if (!parentNode) return document.body;\n\n switch (parentNode.nodeName) {\n case 'HTML':\n case 'BODY':\n return parentNode.ownerDocument!.body;\n case '#document':\n return ((parentNode as unknown) as Document).body;\n }\n\n // If any of the overflow props is defined for the node then we return it as the parent\n const { overflow, overflowX, overflowY } = getStyleComputedProperty(parentNode);\n if (/(auto|scroll|overlay)/.test(overflow! + overflowY! + overflowX)) {\n return parentNode;\n }\n\n return getScrollParent(parentNode);\n};\n"],"sourceRoot":"../src/"}
|
package/lib/utils/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kBAAkB,CAAC","sourcesContent":["export * from './getBasePlacement';\nexport * from './getBoundary';\nexport * from './getReactFiberFromNode';\nexport * from './getScrollParent';\nexport * from './mergeArrowOffset';\nexport * from './positioningHelper';\nexport * from './resolvePositioningShorthand';\nexport * from './useCallbackRef';\n"]}
|
@@ -7,31 +7,36 @@
|
|
7
7
|
* @returns User offset augmented with arrow height
|
8
8
|
*/
|
9
9
|
export function mergeArrowOffset(userOffset, arrowHeight) {
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
10
|
+
let offsetWithArrow = userOffset;
|
11
|
+
|
12
|
+
if (!userOffset) {
|
13
|
+
return [0, arrowHeight];
|
14
|
+
}
|
15
|
+
|
16
|
+
if (Array.isArray(offsetWithArrow)) {
|
17
|
+
setArrowOffset(offsetWithArrow, arrowHeight);
|
18
|
+
return offsetWithArrow;
|
19
|
+
}
|
20
|
+
|
21
|
+
if (typeof offsetWithArrow === 'function') {
|
22
|
+
const userOffsetFn = offsetWithArrow;
|
23
|
+
|
24
|
+
offsetWithArrow = offsetParams => {
|
25
|
+
const offset = userOffsetFn(offsetParams);
|
26
|
+
setArrowOffset(offset, arrowHeight);
|
27
|
+
return offset;
|
28
|
+
};
|
29
|
+
} // This should never happen
|
30
|
+
|
31
|
+
|
32
|
+
return [0, 0];
|
28
33
|
}
|
34
|
+
|
29
35
|
const setArrowOffset = (offset, arrowHeight) => {
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
}
|
36
|
+
if (offset[1] !== null && offset[1] !== undefined) {
|
37
|
+
offset[1] += arrowHeight;
|
38
|
+
} else {
|
39
|
+
offset[1] = arrowHeight;
|
40
|
+
}
|
36
41
|
};
|
37
42
|
//# sourceMappingURL=mergeArrowOffset.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["utils/mergeArrowOffset.ts"],"names":[],"mappings":"AAEA;;;;;;;AAOG;AACH,OAAM,SAAU,gBAAV,CAA2B,UAA3B,EAAkE,WAAlE,EAAqF;AACzF,MAAI,eAAe,GAAG,UAAtB;;AACA,MAAI,CAAC,UAAL,EAAiB;AACf,WAAO,CAAC,CAAD,EAAI,WAAJ,CAAP;AACD;;AAED,MAAI,KAAK,CAAC,OAAN,CAAc,eAAd,CAAJ,EAAoC;AAClC,IAAA,cAAc,CAAC,eAAD,EAAkB,WAAlB,CAAd;AACA,WAAO,eAAP;AACD;;AAED,MAAI,OAAO,eAAP,KAA2B,UAA/B,EAA2C;AACzC,UAAM,YAAY,GAAG,eAArB;;AACA,IAAA,eAAe,GAAG,YAAY,IAAG;AAC/B,YAAM,MAAM,GAAG,YAAY,CAAC,YAAD,CAA3B;AACA,MAAA,cAAc,CAAC,MAAD,EAAS,WAAT,CAAd;AACA,aAAO,MAAP;AACD,KAJD;AAKD,GAlBwF,CAoBzF;;;AACA,SAAO,CAAC,CAAD,EAAI,CAAJ,CAAP;AACD;;AAED,MAAM,cAAc,GAAG,CAAC,MAAD,EAAiE,WAAjE,KAAwF;AAC7G,MAAI,MAAM,CAAC,CAAD,CAAN,KAAc,IAAd,IAAsB,MAAM,CAAC,CAAD,CAAN,KAAc,SAAxC,EAAmD;AACjD,IAAA,MAAM,CAAC,CAAD,CAAN,IAAa,WAAb;AACD,GAFD,MAEO;AACL,IAAA,MAAM,CAAC,CAAD,CAAN,GAAY,WAAZ;AACD;AACF,CAND","sourcesContent":["import type { Offset } from '../types';\n\n/**\n * Generally when adding an arrow to popper, it's necessary to offset the position of the popper by the\n * height of the arrow. A simple utility to merge a provided offset with an arrow height to return the final offset\n *\n * @param userOffset - The offset provided by the user\n * @param arrowHeight - The height of the arrow in px\n * @returns User offset augmented with arrow height\n */\nexport function mergeArrowOffset(userOffset: Offset | undefined | null, arrowHeight: number): Offset {\n let offsetWithArrow = userOffset;\n if (!userOffset) {\n return [0, arrowHeight];\n }\n\n if (Array.isArray(offsetWithArrow)) {\n setArrowOffset(offsetWithArrow, arrowHeight);\n return offsetWithArrow;\n }\n\n if (typeof offsetWithArrow === 'function') {\n const userOffsetFn = offsetWithArrow;\n offsetWithArrow = offsetParams => {\n const offset = userOffsetFn(offsetParams);\n setArrowOffset(offset, arrowHeight);\n return offset;\n };\n }\n\n // This should never happen\n return [0, 0] as never;\n}\n\nconst setArrowOffset = (offset: [number | null | undefined, number | null | undefined], arrowHeight: number) => {\n if (offset[1] !== null && offset[1] !== undefined) {\n offset[1] += arrowHeight;\n } else {\n offset[1] = arrowHeight;\n }\n};\n"],"sourceRoot":"../src/"}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import * as PopperJs from '@popperjs/core';
|
2
|
-
import type { Offset } from '../types';
|
2
|
+
import type { Alignment, Offset, Position } from '../types';
|
3
3
|
/**
|
4
4
|
* @see positioninHelper.test.ts for expected placement values
|
5
5
|
*/
|
6
|
-
export declare const getPlacement: (align?:
|
6
|
+
export declare const getPlacement: (align?: Alignment | undefined, position?: Position | undefined, rtl?: boolean | undefined) => PopperJs.Placement;
|
7
7
|
export declare const applyRtlToOffset: (offset: Offset | undefined) => Offset | undefined;
|