@fluentui/react-positioning 9.0.0-rc.1 → 9.0.0-rc.10
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +281 -1
- package/CHANGELOG.md +164 -69
- package/dist/{react-positioning.d.ts → index.d.ts} +72 -46
- package/{lib → dist}/tsdoc-metadata.json +0 -0
- package/lib/createArrowStyles.js.map +1 -1
- package/lib/createVirtualElementFromClick.js +2 -0
- package/lib/createVirtualElementFromClick.js.map +1 -1
- package/lib/index.js +4 -5
- package/lib/index.js.map +1 -1
- package/lib/isIntersectingModifier.js +26 -0
- package/lib/isIntersectingModifier.js.map +1 -0
- package/lib/types.js.map +1 -1
- package/lib/{usePopper.js → usePositioning.js} +10 -8
- package/lib/usePositioning.js.map +1 -0
- package/lib/{usePopperMouseTarget.js → usePositioningMouseTarget.js} +3 -3
- package/lib/usePositioningMouseTarget.js.map +1 -0
- package/lib/utils/fromPopperPlacement.js +40 -0
- package/lib/utils/fromPopperPlacement.js.map +1 -0
- package/lib/utils/getBoundary.js.map +1 -1
- package/lib/utils/getPopperOffset.js +44 -0
- package/lib/utils/getPopperOffset.js.map +1 -0
- package/lib/utils/getReactFiberFromNode.js.map +1 -1
- package/lib/utils/getScrollParent.js.map +1 -1
- package/lib/utils/index.js +1 -1
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/mergeArrowOffset.js +23 -22
- package/lib/utils/mergeArrowOffset.js.map +1 -1
- package/lib/utils/parsePopperPlacement.js +14 -0
- package/lib/utils/parsePopperPlacement.js.map +1 -0
- package/lib/utils/positioningHelper.js.map +1 -1
- package/lib/utils/resolvePositioningShorthand.js.map +1 -1
- package/lib/utils/useCallbackRef.js.map +1 -1
- package/lib-commonjs/createArrowStyles.js.map +1 -1
- package/lib-commonjs/createVirtualElementFromClick.js +2 -0
- package/lib-commonjs/createVirtualElementFromClick.js.map +1 -1
- package/lib-commonjs/index.js +38 -8
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/isIntersectingModifier.js +34 -0
- package/lib-commonjs/isIntersectingModifier.js.map +1 -0
- package/lib-commonjs/types.js.map +1 -1
- package/lib-commonjs/{usePopper.js → usePositioning.js} +14 -10
- package/lib-commonjs/usePositioning.js.map +1 -0
- package/lib-commonjs/{usePopperMouseTarget.js → usePositioningMouseTarget.js} +5 -5
- package/lib-commonjs/usePositioningMouseTarget.js.map +1 -0
- package/lib-commonjs/utils/fromPopperPlacement.js +50 -0
- package/lib-commonjs/utils/fromPopperPlacement.js.map +1 -0
- package/lib-commonjs/utils/getBoundary.js.map +1 -1
- package/lib-commonjs/utils/getPopperOffset.js +54 -0
- package/lib-commonjs/utils/getPopperOffset.js.map +1 -0
- package/lib-commonjs/utils/getReactFiberFromNode.js.map +1 -1
- package/lib-commonjs/utils/getScrollParent.js.map +1 -1
- package/lib-commonjs/utils/index.js +2 -2
- package/lib-commonjs/utils/index.js.map +1 -1
- package/lib-commonjs/utils/mergeArrowOffset.js +23 -22
- package/lib-commonjs/utils/mergeArrowOffset.js.map +1 -1
- package/lib-commonjs/utils/parsePopperPlacement.js +23 -0
- package/lib-commonjs/utils/parsePopperPlacement.js.map +1 -0
- package/lib-commonjs/utils/positioningHelper.js.map +1 -1
- package/lib-commonjs/utils/resolvePositioningShorthand.js.map +1 -1
- package/lib-commonjs/utils/useCallbackRef.js.map +1 -1
- package/package.json +15 -11
- package/lib/createArrowStyles.d.ts +0 -64
- package/lib/createVirtualElementFromClick.d.ts +0 -6
- package/lib/index.d.ts +0 -6
- package/lib/types.d.ts +0 -89
- package/lib/usePopper.d.ts +0 -23
- package/lib/usePopper.js.map +0 -1
- package/lib/usePopperMouseTarget.d.ts +0 -11
- package/lib/usePopperMouseTarget.js.map +0 -1
- package/lib/utils/getBasePlacement.d.ts +0 -8
- package/lib/utils/getBasePlacement.js +0 -10
- package/lib/utils/getBasePlacement.js.map +0 -1
- package/lib/utils/getBoundary.d.ts +0 -6
- package/lib/utils/getReactFiberFromNode.d.ts +0 -108
- package/lib/utils/getScrollParent.d.ts +0 -12
- package/lib/utils/index.d.ts +0 -8
- package/lib/utils/mergeArrowOffset.d.ts +0 -10
- package/lib/utils/positioningHelper.d.ts +0 -7
- package/lib/utils/resolvePositioningShorthand.d.ts +0 -2
- package/lib/utils/useCallbackRef.d.ts +0 -19
- package/lib-commonjs/createArrowStyles.d.ts +0 -64
- package/lib-commonjs/createVirtualElementFromClick.d.ts +0 -6
- package/lib-commonjs/index.d.ts +0 -6
- package/lib-commonjs/types.d.ts +0 -89
- package/lib-commonjs/usePopper.d.ts +0 -23
- package/lib-commonjs/usePopper.js.map +0 -1
- package/lib-commonjs/usePopperMouseTarget.d.ts +0 -11
- package/lib-commonjs/usePopperMouseTarget.js.map +0 -1
- package/lib-commonjs/utils/getBasePlacement.d.ts +0 -8
- package/lib-commonjs/utils/getBasePlacement.js +0 -19
- package/lib-commonjs/utils/getBasePlacement.js.map +0 -1
- package/lib-commonjs/utils/getBoundary.d.ts +0 -6
- package/lib-commonjs/utils/getReactFiberFromNode.d.ts +0 -108
- package/lib-commonjs/utils/getScrollParent.d.ts +0 -12
- package/lib-commonjs/utils/index.d.ts +0 -8
- package/lib-commonjs/utils/mergeArrowOffset.d.ts +0 -10
- package/lib-commonjs/utils/positioningHelper.d.ts +0 -7
- package/lib-commonjs/utils/resolvePositioningShorthand.d.ts +0 -2
- package/lib-commonjs/utils/useCallbackRef.d.ts +0 -19
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["utils/fromPopperPlacement.ts"],"names":[],"mappings":";;;;;;;AAEA,MAAA,sBAAA,gBAAA,OAAA,CAAA,wBAAA,CAAA;;AAEA,MAAM,WAAW,GAAG;AAClB,EAAA,GAAG,EAAE,OADa;AAElB,EAAA,MAAM,EAAE,OAFU;AAGlB,EAAA,KAAK,EAAE,OAHW;AAIlB,EAAA,IAAI,EAAE;AAJY,CAApB;;AAOA,MAAM,eAAe,GAAI,QAAD,IAA2D;AACjF,MAAI,QAAQ,KAAK,OAAb,IAAwB,QAAQ,KAAK,OAAzC,EAAkD;AAChD,WAAO;AACL,MAAA,KAAK,EAAE,OADF;AAEL,MAAA,GAAG,EAAE;AAFA,KAAP;AAID;;AAED,SAAO;AACL,IAAA,KAAK,EAAE,KADF;AAEL,IAAA,GAAG,EAAE;AAFA,GAAP;AAID,CAZD;AAcA;;;AAGG;;;AACI,MAAM,mBAAmB,GAAI,SAAD,IAAwE;AACzG,QAAM;AAAE,IAAA,aAAF;AAAiB,IAAA,SAAS,EAAE;AAA5B,MAAgD,sBAAA,CAAA,oBAAA,CAAqB,SAArB,CAAtD;AACA,QAAM,QAAQ,GAAG,WAAW,CAAC,aAAD,CAA5B;AACA,QAAM,SAAS,GAAG,eAAe,IAAI,eAAe,CAAC,QAAD,CAAf,CAA0B,eAA1B,CAArC;AAEA,SAAO;AAAE,IAAA,QAAF;AAAY,IAAA;AAAZ,GAAP;AACD,CANM;;AAAM,OAAA,CAAA,mBAAA,GAAmB,mBAAnB","sourcesContent":["import type { Variation as PopperAlignment, Placement } from '@popperjs/core';\nimport type { Alignment, Position } from '../types';\nimport { parsePopperPlacement } from './parsePopperPlacement';\n\nconst positionMap = {\n top: 'above',\n bottom: 'below',\n right: 'after',\n left: 'before',\n} as const;\n\nconst getAlignmentMap = (position: Position): Record<PopperAlignment, Alignment> => {\n if (position === 'above' || position === 'below') {\n return {\n start: 'start',\n end: 'end',\n };\n }\n\n return {\n start: 'top',\n end: 'bottom',\n };\n};\n\n/**\n * Maps Popper.js placement to positioning values\n * @see positioningHelper.test.ts for expected placement values\n */\nexport const fromPopperPlacement = (placement: Placement): { position: Position; alignment?: Alignment } => {\n const { basePlacement, alignment: popperAlignment } = parsePopperPlacement(placement);\n const position = positionMap[basePlacement];\n const alignment = popperAlignment && getAlignmentMap(position)[popperAlignment];\n\n return { position, alignment };\n};\n"],"sourceRoot":"../src/"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["utils/getBoundary.ts"],"names":[],"mappings":";;;;;;;AAEA,MAAA,iBAAA,gBAAA,OAAA,CAAA,mBAAA,CAAA;AAGA;;AAEG;;;AACH,SAAgB,WAAhB,CAA4B,OAA5B,EAAyD,QAAzD,EAA4E;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,iBAAA,CAAA,eAAA,CAAgB,OAAhB,CAA9C;;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;;AAhBD,OAAA,CAAA,WAAA,GAAA,WAAA","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/"}
|
@@ -0,0 +1,54 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.getPopperOffset = void 0;
|
7
|
+
|
8
|
+
const fromPopperPlacement_1 = /*#__PURE__*/require("./fromPopperPlacement");
|
9
|
+
/**
|
10
|
+
* Shim to transform offset values from this library to Popper.js
|
11
|
+
* @param rawOffset Offset from this library
|
12
|
+
* @returns An offset value compatible with Popper.js
|
13
|
+
*/
|
14
|
+
|
15
|
+
|
16
|
+
function getPopperOffset(rawOffset) {
|
17
|
+
if (rawOffset === undefined || rawOffset === null) {
|
18
|
+
return rawOffset;
|
19
|
+
}
|
20
|
+
|
21
|
+
if (typeof rawOffset === 'number') {
|
22
|
+
return [0, rawOffset];
|
23
|
+
}
|
24
|
+
|
25
|
+
if (typeof rawOffset === 'object') {
|
26
|
+
return [rawOffset.crossAxis, rawOffset.mainAxis];
|
27
|
+
}
|
28
|
+
|
29
|
+
return ({
|
30
|
+
popper,
|
31
|
+
reference,
|
32
|
+
placement
|
33
|
+
}) => {
|
34
|
+
const {
|
35
|
+
position,
|
36
|
+
alignment
|
37
|
+
} = fromPopperPlacement_1.fromPopperPlacement(placement);
|
38
|
+
const computedOffset = rawOffset({
|
39
|
+
positionedRect: popper,
|
40
|
+
targetRect: reference,
|
41
|
+
position,
|
42
|
+
alignment
|
43
|
+
});
|
44
|
+
|
45
|
+
if (typeof computedOffset === 'number') {
|
46
|
+
return [0, computedOffset];
|
47
|
+
}
|
48
|
+
|
49
|
+
return [computedOffset.crossAxis, computedOffset.mainAxis];
|
50
|
+
};
|
51
|
+
}
|
52
|
+
|
53
|
+
exports.getPopperOffset = getPopperOffset;
|
54
|
+
//# sourceMappingURL=getPopperOffset.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["utils/getPopperOffset.ts"],"names":[],"mappings":";;;;;;;AAEA,MAAA,qBAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;AAyBA;;;;AAIG;;;AACH,SAAgB,eAAhB,CAAgC,SAAhC,EAA6D;AAC3D,MAAI,SAAS,KAAK,SAAd,IAA2B,SAAS,KAAK,IAA7C,EAAmD;AACjD,WAAO,SAAP;AACD;;AAED,MAAI,OAAO,SAAP,KAAqB,QAAzB,EAAmC;AACjC,WAAO,CAAC,CAAD,EAAI,SAAJ,CAAP;AACD;;AAED,MAAI,OAAO,SAAP,KAAqB,QAAzB,EAAmC;AACjC,WAAO,CAAC,SAAS,CAAC,SAAX,EAAsB,SAAS,CAAC,QAAhC,CAAP;AACD;;AAED,SAAO,CAAC;AAAE,IAAA,MAAF;AAAU,IAAA,SAAV;AAAqB,IAAA;AAArB,GAAD,KAAqC;AAC1C,UAAM;AAAE,MAAA,QAAF;AAAY,MAAA;AAAZ,QAA0B,qBAAA,CAAA,mBAAA,CAAoB,SAApB,CAAhC;AACA,UAAM,cAAc,GAAG,SAAS,CAAC;AAAE,MAAA,cAAc,EAAE,MAAlB;AAA0B,MAAA,UAAU,EAAE,SAAtC;AAAiD,MAAA,QAAjD;AAA2D,MAAA;AAA3D,KAAD,CAAhC;;AACA,QAAI,OAAO,cAAP,KAA0B,QAA9B,EAAwC;AACtC,aAAO,CAAC,CAAD,EAAI,cAAJ,CAAP;AACD;;AAED,WAAO,CAAC,cAAc,CAAC,SAAhB,EAA2B,cAAc,CAAC,QAA1C,CAAP;AACD,GARD;AASD;;AAtBD,OAAA,CAAA,eAAA,GAAA,eAAA","sourcesContent":["import type { Offset } from '../types';\nimport type { Rect, Placement } from '@popperjs/core';\nimport { fromPopperPlacement } from './fromPopperPlacement';\n/**\n * Type taken from Popper since it is not exported\n */\nexport type PopperOffsetValue = [number | null | undefined, number | null | undefined];\n\n/**\n * Type taken from Popper since it is not exported\n */\nexport type PopperOffset = PopperOffsetValue | PopperOffsetFunction;\n\n/**\n * Type taken from Popper.js since it is not exported\n */\nexport type PopperOffsetFunctionParam = {\n popper: Rect;\n reference: Rect;\n placement: Placement;\n};\n\n/**\n * Type taken from Popper.js since it is not exported\n */\nexport type PopperOffsetFunction = (args: { popper: Rect; reference: Rect; placement: Placement }) => PopperOffsetValue;\n\n/**\n * Shim to transform offset values from this library to Popper.js\n * @param rawOffset Offset from this library\n * @returns An offset value compatible with Popper.js\n */\nexport function getPopperOffset(rawOffset: Offset | undefined): PopperOffsetValue | PopperOffsetFunction | undefined {\n if (rawOffset === undefined || rawOffset === null) {\n return rawOffset;\n }\n\n if (typeof rawOffset === 'number') {\n return [0, rawOffset];\n }\n\n if (typeof rawOffset === 'object') {\n return [rawOffset.crossAxis, rawOffset.mainAxis];\n }\n\n return ({ popper, reference, placement }) => {\n const { position, alignment } = fromPopperPlacement(placement);\n const computedOffset = rawOffset({ positionedRect: popper, targetRect: reference, position, alignment });\n if (typeof computedOffset === 'number') {\n return [0, computedOffset];\n }\n\n return [computedOffset.crossAxis, computedOffset.mainAxis];\n };\n}\n"],"sourceRoot":"../src/"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/utils/getReactFiberFromNode.ts"],"names":[],"mappings":";;;;;;AAuEA,IAAK,OAAL;;AAAA,CAAA,UAAK,OAAL,EAAY;AACV,EAAA,OAAA,CAAA,OAAA,CAAA,mBAAA,CAAA,GAAA,CAAA,CAAA,GAAA,mBAAA;AACA,EAAA,OAAA,CAAA,OAAA,CAAA,gBAAA,CAAA,GAAA,CAAA,CAAA,GAAA,gBAAA;AACA,EAAA,OAAA,CAAA,OAAA,CAAA,wBAAA,CAAA,GAAA,CAAA,CAAA,GAAA,wBAAA;AACA,EAAA,OAAA,CAAA,OAAA,CAAA,UAAA,CAAA,GAAA,CAAA,CAAA,GAAA,UAAA;AACA,EAAA,OAAA,CAAA,OAAA,CAAA,YAAA,CAAA,GAAA,CAAA,CAAA,GAAA,YAAA;AACA,EAAA,OAAA,CAAA,OAAA,CAAA,eAAA,CAAA,GAAA,CAAA,CAAA,GAAA,eAAA;AACA,EAAA,OAAA,CAAA,OAAA,CAAA,UAAA,CAAA,GAAA,CAAA,CAAA,GAAA,UAAA;AACA,EAAA,OAAA,CAAA,OAAA,CAAA,UAAA,CAAA,GAAA,CAAA,CAAA,GAAA,UAAA;AACA,EAAA,OAAA,CAAA,OAAA,CAAA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V,MAA+B,CAAlF,EAAqF;AACnF;AACA;AACA,aAAO,GAAG,CAAC,CAAD,CAAV;AACD;AACF;;AAED,QAAM,IAAI,KAAJ,CAAU,yDAAV,CAAN;AACD;;AAjBD,OAAA,CAAA,qBAAA,GAAA,qBAAA","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/"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["utils/getScrollParent.ts"],"names":[],"mappings":";;;;;;AAAA;;;;AAIG;;AACI,MAAM,aAAa,GAAI,IAAD,IAAmC;AAC9D,MAAI,IAAI,CAAC,QAAL,KAAkB,MAAtB,EAA8B;AA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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/"}
|
@@ -6,8 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
|
7
7
|
const tslib_1 = /*#__PURE__*/require("tslib");
|
8
8
|
|
9
|
-
tslib_1.__exportStar(require("./getBasePlacement"), exports);
|
10
|
-
|
11
9
|
tslib_1.__exportStar(require("./getBoundary"), exports);
|
12
10
|
|
13
11
|
tslib_1.__exportStar(require("./getReactFiberFromNode"), exports);
|
@@ -21,4 +19,6 @@ tslib_1.__exportStar(require("./positioningHelper"), exports);
|
|
21
19
|
tslib_1.__exportStar(require("./resolvePositioningShorthand"), exports);
|
22
20
|
|
23
21
|
tslib_1.__exportStar(require("./useCallbackRef"), exports);
|
22
|
+
|
23
|
+
tslib_1.__exportStar(require("./parsePopperPlacement"), exports);
|
24
24
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["utils/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,eAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,yBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,mBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,oBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,qBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,+BAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,kBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,wBAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './getBoundary';\nexport * from './getReactFiberFromNode';\nexport * from './getScrollParent';\nexport * from './mergeArrowOffset';\nexport * from './positioningHelper';\nexport * from './resolvePositioningShorthand';\nexport * from './useCallbackRef';\nexport * from './parsePopperPlacement';\n"],"sourceRoot":"../src/"}
|
@@ -14,38 +14,39 @@ exports.mergeArrowOffset = void 0;
|
|
14
14
|
*/
|
15
15
|
|
16
16
|
function mergeArrowOffset(userOffset, arrowHeight) {
|
17
|
-
|
18
|
-
|
19
|
-
if (!userOffset) {
|
20
|
-
return [0, arrowHeight];
|
17
|
+
if (typeof userOffset === 'number') {
|
18
|
+
return addArrowOffset(userOffset, arrowHeight);
|
21
19
|
}
|
22
20
|
|
23
|
-
if (
|
24
|
-
|
25
|
-
return offsetWithArrow;
|
21
|
+
if (typeof userOffset === 'object' && userOffset !== null) {
|
22
|
+
return addArrowOffset(userOffset, arrowHeight);
|
26
23
|
}
|
27
24
|
|
28
|
-
if (typeof
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
const offset = userOffsetFn(offsetParams);
|
33
|
-
setArrowOffset(offset, arrowHeight);
|
34
|
-
return offset;
|
25
|
+
if (typeof userOffset === 'function') {
|
26
|
+
return offsetParams => {
|
27
|
+
const offset = userOffset(offsetParams);
|
28
|
+
return addArrowOffset(offset, arrowHeight);
|
35
29
|
};
|
36
|
-
}
|
37
|
-
|
30
|
+
}
|
38
31
|
|
39
|
-
return
|
32
|
+
return {
|
33
|
+
mainAxis: arrowHeight
|
34
|
+
};
|
40
35
|
}
|
41
36
|
|
42
37
|
exports.mergeArrowOffset = mergeArrowOffset;
|
43
38
|
|
44
|
-
const
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
39
|
+
const addArrowOffset = (offset, arrowHeight) => {
|
40
|
+
var _a;
|
41
|
+
|
42
|
+
if (typeof offset === 'number') {
|
43
|
+
return {
|
44
|
+
mainAxis: offset + arrowHeight
|
45
|
+
};
|
49
46
|
}
|
47
|
+
|
48
|
+
return { ...offset,
|
49
|
+
mainAxis: ((_a = offset.mainAxis) !== null && _a !== void 0 ? _a : 0) + arrowHeight
|
50
|
+
};
|
50
51
|
};
|
51
52
|
//# sourceMappingURL=mergeArrowOffset.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["utils/mergeArrowOffset.ts"],"names":[],"mappings":";;;;;;AAEA;;;;;;;AAOG;;AACH,SAAgB,gBAAhB,CAAiC,UAAjC,EAAwE,WAAxE,EAA2F;AACzF,MAAI,OAAO,UAAP,KAAsB,QAA1B,EAAoC;AAClC,WAAO,cAAc,CAAC,UAAD,EAAa,WAAb,CAArB;AACD;;AAED,MAAI,OAAO,UAAP,KAAsB,QAAtB,IAAkC,UAAU,KAAK,IAArD,EAA2D;AACzD,WAAO,cAAc,CAAC,UAAD,EAAa,WAAb,CAArB;AACD;;AAED,MAAI,OAAO,UAAP,KAAsB,UAA1B,EAAsC;AACpC,WAAO,YAAY,IAAG;AACpB,YAAM,MAAM,GAAG,UAAU,CAAC,YAAD,CAAzB;AACA,aAAO,cAAc,CAAC,MAAD,EAAS,WAAT,CAArB;AACD,KAHD;AAID;;AAED,SAAO;AAAE,IAAA,QAAQ,EAAE;AAAZ,GAAP;AACD;;AAjBD,OAAA,CAAA,gBAAA,GAAA,gBAAA;;AAmBA,MAAM,cAAc,GAAG,CAAC,MAAD,EAAgC,WAAhC,KAAqE;;;AAC1F,MAAI,OAAO,MAAP,KAAkB,QAAtB,EAAgC;AAC9B,WAAO;AAAE,MAAA,QAAQ,EAAE,MAAM,GAAG;AAArB,KAAP;AACD;;AAED,SAAO,EAAE,GAAG,MAAL;AAAa,IAAA,QAAQ,EAAE,CAAC,CAAA,EAAA,GAAA,MAAM,CAAC,QAAP,MAAe,IAAf,IAAe,EAAA,KAAA,KAAA,CAAf,GAAe,EAAf,GAAmB,CAApB,IAAyB;AAAhD,GAAP;AACD,CAND","sourcesContent":["import type { Offset, OffsetObject } 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 if (typeof userOffset === 'number') {\n return addArrowOffset(userOffset, arrowHeight);\n }\n\n if (typeof userOffset === 'object' && userOffset !== null) {\n return addArrowOffset(userOffset, arrowHeight);\n }\n\n if (typeof userOffset === 'function') {\n return offsetParams => {\n const offset = userOffset(offsetParams);\n return addArrowOffset(offset, arrowHeight);\n };\n }\n\n return { mainAxis: arrowHeight };\n}\n\nconst addArrowOffset = (offset: OffsetObject | number, arrowHeight: number): OffsetObject => {\n if (typeof offset === 'number') {\n return { mainAxis: offset + arrowHeight };\n }\n\n return { ...offset, mainAxis: (offset.mainAxis ?? 0) + arrowHeight };\n};\n"],"sourceRoot":"../src/"}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.parsePopperPlacement = void 0;
|
7
|
+
/**
|
8
|
+
* Parses Popper placement and returns the different components
|
9
|
+
* @param placement - the Popper.js placement (i.e. bottom-start)
|
10
|
+
*
|
11
|
+
* @returns side and alignment components of the placement
|
12
|
+
*/
|
13
|
+
|
14
|
+
function parsePopperPlacement(placement) {
|
15
|
+
const tokens = placement.split('-');
|
16
|
+
return {
|
17
|
+
basePlacement: tokens[0],
|
18
|
+
alignment: tokens[1]
|
19
|
+
};
|
20
|
+
}
|
21
|
+
|
22
|
+
exports.parsePopperPlacement = parsePopperPlacement;
|
23
|
+
//# sourceMappingURL=parsePopperPlacement.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["utils/parsePopperPlacement.ts"],"names":[],"mappings":";;;;;;AAEA;;;;;AAKG;;AACH,SAAgB,oBAAhB,CAAqC,SAArC,EAAyD;AACvD,QAAM,MAAM,GAAG,SAAS,CAAC,KAAV,CAAgB,GAAhB,CAAf;AACA,SAAO;AACL,IAAA,aAAa,EAAE,MAAM,CAAC,CAAD,CADhB;AAEL,IAAA,SAAS,EAAE,MAAM,CAAC,CAAD;AAFZ,GAAP;AAID;;AAND,OAAA,CAAA,oBAAA,GAAA,oBAAA","sourcesContent":["import type { BasePlacement, Placement, Variation } from '@popperjs/core';\n\n/**\n * Parses Popper placement and returns the different components\n * @param placement - the Popper.js placement (i.e. bottom-start)\n *\n * @returns side and alignment components of the placement\n */\nexport function parsePopperPlacement(placement: Placement): { basePlacement: BasePlacement; alignment: Variation } {\n const tokens = placement.split('-');\n return {\n basePlacement: tokens[0] as BasePlacement,\n alignment: tokens[1] as Variation,\n };\n}\n"],"sourceRoot":"../src/"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["utils/positioningHelper.ts"],"names":[],"mappings":";;;;;;;AAOA,MAAM,cAAc,GAAI,GAAD,KAAyD;AAC9E,EAAA,KAAK,EAAE,KADuE;AAE9E,EAAA,KAAK,EAAE,QAFuE;AAG9E,EAAA,MAAM,EAAE,GAAG,GAAG,OAAH,GAAa,MAHsD;AAI9E,EAAA,KAAK,EAAE,GAAG,GAAG,MAAH,GAAY;AAJwD,CAAzD,CAAvB;;AAOA,MAAM,eAAe,GAAI,GAAD,KAAuD;AAC7E,EAAA,KAAK,EAAE,GAAG,GAAG,KAAH,GAAW,OADwD;AAE7E,EAAA,GAAG,EAAE,GAAG,GAAG,OAAH,GAAa,KAFwD;AAG7E,EAAA,GAAG,EAAE,OAHwE;AAI7E,EAAA,MAAM,EAAE,KAJqE;AAK7E,EAAA,MAAM,EAAE;AALqE,CAAvD,CAAxB;;AAQA,MAAM,mBAAmB,GAAG,CAAC,CAAD,EAAe,CAAf,KAAyC;AACnE,QAAM,oBAAoB,GAAG,CAAC,KAAK,OAAN,IAAiB,CAAC,KAAK,OAApD;AACA,QAAM,iBAAiB,GAAG,CAAC,KAAK,KAAN,IAAe,CAAC,KAAK,QAA/C;AAEA,SAAQ,oBAAoB,IAAI,iBAAzB,IAAgD,CAAC,oBAAD,IAAyB,CAAC,iBAAjF;AACD,CALD;AAOA;;AAEG;;;AACI,MAAM,YAAY,GAAG,CAAC,KAAD,EAAoB,QAApB,EAAyC,GAAzC,KAA8E;AACxG,QAAM,SAAS,GAAG,mBAAmB,CAAC,QAAD,EAAW,KAAX,CAAnB,GAAuC,QAAvC,GAAkD,KAApE;AAEA,QAAM,gBAAgB,GAAG,QAAQ,IAAI,cAAc,CAAC,GAAD,CAAd,CAAoB,QAApB,CAArC;AACA,QAAM,kBAAkB,GAAG,SAAS,IAAI,eAAe,CAAC,GAAD,CAAf,CAAqB,SAArB,CAAxC;;AAEA,MAAI,gBAAgB,IAAI,kBAAxB,EAA4C;AAC1C,WAAO,GAAG,gBAAgB,IAAI,kBAAkB,EAAhD;AACD;;AAED,SAAO,gBAAgB,IAAK,MAA5B;AACD,CAXM;;AAAM,OAAA,CAAA,YAAA,GAAY,YAAZ;;AAaN,MAAM,gBAAgB,GAAI,MAAD,IAA+D;AAC7F,MAAI,OAAO,MAAP,KAAkB,WAAtB,EAAmC;AACjC,WAAO,SAAP;AACD;;AAED,MAAI,KAAK,CAAC,OAAN,CAAc,MAAd,CAAJ,EAA2B;AACzB,IAAA,MAAM,CAAC,CAAD,CAAN,GAAY,MAAM,CAAC,CAAD,CAAN,GAAa,CAAC,CAA1B;AAEA,WAAO,MAAP;AACD;;AAED,SAAS,KAAD,IAAsC,OAAA,CAAA,gBAAA,CAAiB,MAAM,CAAC,KAAD,CAAvB,CAA9C;AACD,CAZM;;AAAM,OAAA,CAAA,gBAAA,GAAgB,gBAAhB","sourcesContent":["import * as PopperJs from '@popperjs/core';\nimport type { Alignment, Position } from '../types';\nimport { PopperOffset, PopperOffsetFunction, PopperOffsetFunctionParam } from './getPopperOffset';\n\ntype PlacementPosition = 'top' | 'bottom' | 'left' | 'right';\ntype PlacementAlign = 'start' | 'end' | ''; // '' represents center\n\nconst getPositionMap = (rtl?: boolean): Record<Position, PlacementPosition> => ({\n above: 'top',\n below: 'bottom',\n before: rtl ? 'right' : 'left',\n after: rtl ? 'left' : 'right',\n});\n\nconst getAlignmentMap = (rtl?: boolean): Record<Alignment, PlacementAlign> => ({\n start: rtl ? 'end' : 'start',\n end: rtl ? 'start' : 'end',\n top: 'start',\n bottom: 'end',\n center: '',\n});\n\nconst shouldAlignToCenter = (p?: Position, a?: Alignment): boolean => {\n const positionedVertically = p === 'above' || p === 'below';\n const alignedVertically = a === 'top' || a === 'bottom';\n\n return (positionedVertically && alignedVertically) || (!positionedVertically && !alignedVertically);\n};\n\n/**\n * @see positioninHelper.test.ts for expected placement values\n */\nexport const getPlacement = (align?: Alignment, position?: Position, rtl?: boolean): PopperJs.Placement => {\n const alignment = shouldAlignToCenter(position, align) ? 'center' : align;\n\n const computedPosition = position && getPositionMap(rtl)[position];\n const computedAlignmnent = alignment && getAlignmentMap(rtl)[alignment];\n\n if (computedPosition && computedAlignmnent) {\n return `${computedPosition}-${computedAlignmnent}` as PopperJs.Placement;\n }\n\n return computedPosition || ('auto' as PopperJs.Placement);\n};\n\nexport const applyRtlToOffset = (offset: PopperOffset | undefined): PopperOffset | undefined => {\n if (typeof offset === 'undefined') {\n return undefined;\n }\n\n if (Array.isArray(offset)) {\n offset[0] = offset[0]! * -1;\n\n return offset;\n }\n\n return ((param: PopperOffsetFunctionParam) => applyRtlToOffset(offset(param))) as PopperOffsetFunction;\n};\n"],"sourceRoot":"../src/"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["utils/resolvePositioningShorthand.ts"],"names":[],"mappings":";;;;;8CAEA;;AACA,MAAM,eAAe,GAAoF;AACvG,EAAA,KAAK,EAAE;AAAE,IAAA,QAAQ,EAAE,OAAZ;AAAqB,IAAA,KAAK,EAAE;AAA5B,GADgG;AAEvG,iBAAe;AAAE,IAAA,QAAQ,EAAE,OAAZ;AAAqB,IAAA,KAAK,EAAE;AAA5B,GAFwF;AAGvG,eAAa;AAAE,IAAA,QAAQ,EAAE,OAAZ;AAAqB,IAAA,KAAK,EAAE;AAA5B,GAH0F;AAIvG,EAAA,KAAK,EAAE;AAAE,IAAA,QAAQ,EAAE,OAAZ;AAAqB,IAAA,KAAK,EAAE;AAA5B,GAJgG;AAKvG,iBAAe;AAAE,IAAA,QAAQ,EAAE,OAAZ;AAAqB,IAAA,KAAK,EAAE;AAA5B,GALwF;AAMvG,eAAa;AAAE,IAAA,QAAQ,EAAE,OAAZ;AAAqB,IAAA,KAAK,EAAE;AAA5B,GAN0F;AAOvG,EAAA,MAAM,EAAE;AAAE,IAAA,QAAQ,EAAE,QAAZ;AAAsB,IAAA,KAAK,EAAE;AAA7B,GAP+F;AAQvG,gBAAc;AAAE,IAAA,QAAQ,EAAE,QAAZ;AAAsB,IAAA,KAAK,EAAE;AAA7B,GARyF;AASvG,mBAAiB;AAAE,IAAA,QAAQ,EAAE,QAAZ;AAAsB,IAAA,KAAK,EAAE;AAA7B,GATsF;AAUvG,EAAA,KAAK,EAAE;AAAE,IAAA,QAAQ,EAAE,OAAZ;AAAqB,IAAA,KAAK,EAAE;AAA5B,GAVgG;AAWvG,eAAa;AAAE,IAAA,QAAQ,EAAE,OAAZ;AAAqB,IAAA,KAAK,EAAE;AAA5B,GAX0F;AAYvG,kBAAgB;AAAE,IAAA,QAAQ,EAAE,OAAZ;AAAqB,IAAA,KAAK,EAAE;AAA5B;AAZuF,CAAzG;;AAeA,SAAgB,2BAAhB,CACE,SADF,EACoD;AAElD,MAAI,SAAS,KAAK,SAAd,IAA2B,SAAS,KAAK,IAA7C,EAAmD;AACjD,WAAO,EAAP;AACD;;AAED,MAAI,OAAO,SAAP,KAAqB,QAAzB,EAAmC;AACjC,WAAO,eAAe,CAAC,SAAD,CAAtB;AACD;;AAED,SAAO,SAAP;AACD;;AAZD,OAAA,CAAA,2BAAA,GAAA,2BAAA","sourcesContent":["import type { PositioningShorthand, PositioningShorthandValue, PositioningProps } from '../types';\n\n// Look up table for shorthand to avoid parsing strings\nconst shorthandLookup: Record<PositioningShorthandValue, Pick<PositioningProps, 'position' | 'align'>> = {\n above: { position: 'above', align: 'center' },\n 'above-start': { position: 'above', align: 'start' },\n 'above-end': { position: 'above', align: 'end' },\n below: { position: 'below', align: 'center' },\n 'below-start': { position: 'below', align: 'start' },\n 'below-end': { position: 'below', align: 'end' },\n before: { position: 'before', align: 'center' },\n 'before-top': { position: 'before', align: 'top' },\n 'before-bottom': { position: 'before', align: 'bottom' },\n after: { position: 'after', align: 'center' },\n 'after-top': { position: 'after', align: 'top' },\n 'after-bottom': { position: 'after', align: 'bottom' },\n};\n\nexport function resolvePositioningShorthand(\n shorthand: PositioningShorthand | undefined | null,\n): Readonly<PositioningProps> {\n if (shorthand === undefined || shorthand === null) {\n return {};\n }\n\n if (typeof shorthand === 'string') {\n return shorthandLookup[shorthand];\n }\n\n return shorthand as Readonly<PositioningProps>;\n}\n"],"sourceRoot":"../src/"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["utils/useCallbackRef.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;AAEA;;;;;;;;;;;;;;;;AAgBG;;;AACH,SAAgB,cAAhB,CACE,YADF,EAEE,QAFF,EAGE,kBAHF,EAG8B;AAE5B,QAAM,OAAO,GAAG,KAAK,CAAC,MAAN,CAAa,IAAb,CAAhB;AACA,QAAM,CAAC,GAAD,IAAQ,KAAK,CAAC,QAAN,CAAe,OAAO;AAClC;AACA,IAAA,KAAK,EAAE,YAF2B;AAGlC;AACA,IAAA,QAJkC;AAKlC;AACA,IAAA,MAAM,EAAE;AACN,UAAI,OAAJ,GAAW;AACT,eAAO,GAAG,CAAC,KAAX;AACD,OAHK;;AAIN,UAAI,OAAJ,CAAY,KAAZ,EAAiB;AACf,cAAM,IAAI,GAAG,GAAG,CAAC,KAAjB;;AAEA,YAAI,IAAI,KAAK,KAAb,EAAoB;AAClB,UAAA,GAAG,CAAC,KAAJ,GAAY,KAAZ;;AAEA,cAAI,kBAAkB,IAAI,OAAO,CAAC,OAAlC,EAA2C;AACzC;AACD;;AAED,UAAA,GAAG,CAAC,QAAJ,CAAa,KAAb,EAAoB,IAApB;AACD;AACF;;AAhBK;AAN0B,GAAP,CAAf,CAAd;AA0BA,EAAA,iBAAA,CAAA,yBAAA,CAA0B,MAAK;AAC7B,IAAA,OAAO,CAAC,OAAR,GAAkB,KAAlB;AACD,GAFD,EAEG,EAFH,EA7B4B,CAiC5B;;AACA,EAAA,GAAG,CAAC,QAAJ,GAAe,QAAf;AAEA,SAAO,GAAG,CAAC,MAAX;AACD;;AAxCD,OAAA,CAAA,cAAA,GAAA,cAAA","sourcesContent":["import * as React from 'react';\nimport { useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\n\n/**\n * Creates a MutableRef with ref change callback. Is useful as React.useRef() doesn't notify you when its content\n * changes and mutating the .current property doesn't cause a re-render. An opt-out will be use a callback ref via\n * React.useState(), but it will cause re-renders always.\n *\n * https://reactjs.org/docs/hooks-reference.html#useref\n * https://github.com/theKashey/use-callback-ref#usecallbackref---to-replace-reactuseref\n *\n * @param initialValue - initial ref value\n * @param callback - a callback to run when value changes\n * @param skipInitialResolve - a flag to skip an initial ref report\n *\n * @example\n * const ref = useCallbackRef(0, (newValue, oldValue) => console.log(oldValue, '->', newValue);\n * ref.current = 1;\n * // prints 0 -> 1\n */\nexport function useCallbackRef<T>(\n initialValue: T | null,\n callback: (newValue: T | null, lastValue: T | null) => void,\n skipInitialResolve?: boolean,\n): React.MutableRefObject<T | null> {\n const isFirst = React.useRef(true);\n const [ref] = React.useState(() => ({\n // value\n value: initialValue,\n // last callback\n callback,\n // \"memoized\" public interface\n facade: {\n get current() {\n return ref.value;\n },\n set current(value) {\n const last = ref.value;\n\n if (last !== value) {\n ref.value = value;\n\n if (skipInitialResolve && isFirst.current) {\n return;\n }\n\n ref.callback(value, last);\n }\n },\n },\n }));\n\n useIsomorphicLayoutEffect(() => {\n isFirst.current = false;\n }, []);\n\n // update callback\n ref.callback = callback;\n\n return ref.facade;\n}\n"],"sourceRoot":"../src/"}
|
package/package.json
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fluentui/react-positioning",
|
3
|
-
"version": "9.0.0-rc.
|
3
|
+
"version": "9.0.0-rc.10",
|
4
4
|
"description": "A react wrapper around Popper.js for Fluent UI",
|
5
5
|
"main": "lib-commonjs/index.js",
|
6
6
|
"module": "lib/index.js",
|
7
|
-
"typings": "
|
7
|
+
"typings": "dist/index.d.ts",
|
8
8
|
"sideEffects": false,
|
9
9
|
"repository": {
|
10
10
|
"type": "git",
|
@@ -20,21 +20,18 @@
|
|
20
20
|
"lint": "just-scripts lint",
|
21
21
|
"test": "jest --passWithNoTests",
|
22
22
|
"docs": "api-extractor run --config=config/api-extractor.local.json --local",
|
23
|
-
"build:local": "tsc -p ./tsconfig.lib.json --module esnext --emitDeclarationOnly && node
|
23
|
+
"build:local": "tsc -p ./tsconfig.lib.json --module esnext --emitDeclarationOnly && node ../../../scripts/typescript/normalize-import --output ./dist/packages/react-components/react-positioning/src && yarn docs",
|
24
24
|
"type-check": "tsc -b tsconfig.json"
|
25
25
|
},
|
26
26
|
"devDependencies": {
|
27
27
|
"@fluentui/eslint-plugin": "*",
|
28
|
-
"@fluentui/scripts": "^1.0.0"
|
29
|
-
"@types/react": "16.9.42",
|
30
|
-
"@types/react-dom": "16.9.10",
|
31
|
-
"react": "16.8.6",
|
32
|
-
"react-dom": "16.8.6"
|
28
|
+
"@fluentui/scripts": "^1.0.0"
|
33
29
|
},
|
34
30
|
"dependencies": {
|
35
|
-
"@griffel/react": "1.0.
|
36
|
-
"@fluentui/react-shared-contexts": "9.0.0-rc.
|
37
|
-
"@fluentui/react-
|
31
|
+
"@griffel/react": "1.0.5",
|
32
|
+
"@fluentui/react-shared-contexts": "9.0.0-rc.9",
|
33
|
+
"@fluentui/react-theme": "9.0.0-rc.9",
|
34
|
+
"@fluentui/react-utilities": "9.0.0-rc.9",
|
38
35
|
"@popperjs/core": "~2.4.3",
|
39
36
|
"tslib": "^2.1.0"
|
40
37
|
},
|
@@ -50,5 +47,12 @@
|
|
50
47
|
"minor",
|
51
48
|
"patch"
|
52
49
|
]
|
50
|
+
},
|
51
|
+
"exports": {
|
52
|
+
".": {
|
53
|
+
"types": "./lib/index.d.ts",
|
54
|
+
"import": "./lib/index.js",
|
55
|
+
"require": "./lib-commonjs/index.js"
|
56
|
+
}
|
53
57
|
}
|
54
58
|
}
|
@@ -1,64 +0,0 @@
|
|
1
|
-
import type { GriffelStyle } from '@griffel/react';
|
2
|
-
/**
|
3
|
-
* Options parameter for the createArrowStyles function
|
4
|
-
*/
|
5
|
-
export declare type CreateArrowStylesOptions = {
|
6
|
-
/**
|
7
|
-
* The height of the arrow from the base to the tip, in px. The base width of the arrow is always twice its height.
|
8
|
-
*
|
9
|
-
* This can be undefined to leave out the arrow size styles. You must then add styles created by
|
10
|
-
* createArrowHeightStyles to set the arrow's size correctly. This can be useful if the arrow can be different sizes.
|
11
|
-
*/
|
12
|
-
arrowHeight: number | undefined;
|
13
|
-
/**
|
14
|
-
* The borderWidth of the arrow. Should be the same borderWidth as the parent element.
|
15
|
-
*
|
16
|
-
* @defaultvalue 1px
|
17
|
-
*/
|
18
|
-
borderWidth?: GriffelStyle['borderBottomWidth'];
|
19
|
-
/**
|
20
|
-
* The borderStyle for the arrow. Should be the same borderStyle as the parent element.
|
21
|
-
*
|
22
|
-
* @defaultvalue solid
|
23
|
-
*/
|
24
|
-
borderStyle?: GriffelStyle['borderBottomStyle'];
|
25
|
-
/**
|
26
|
-
* The borderColor of the arrow. Should be the same borderColor as the parent element.
|
27
|
-
*
|
28
|
-
* @defaultvalue tokens.colorTransparentStroke
|
29
|
-
*/
|
30
|
-
borderColor?: GriffelStyle['borderBottomColor'];
|
31
|
-
};
|
32
|
-
/**
|
33
|
-
* Helper that creates a makeStyles rule for an arrow element.
|
34
|
-
* For runtime arrow size toggling simply create extra classnames to apply to the arrow element
|
35
|
-
*
|
36
|
-
* ```ts
|
37
|
-
* makeStyles({
|
38
|
-
* arrowWithSize: createArrowStyles({ arrowHeight: 6 }),
|
39
|
-
*
|
40
|
-
* arrowWithoutSize: createArrowStyles({ arrowHeight: undefined }),
|
41
|
-
* mediumArrow: createArrowHeightStyles(4),
|
42
|
-
* smallArrow: createArrowHeightStyles(2),
|
43
|
-
* })
|
44
|
-
* ...
|
45
|
-
*
|
46
|
-
* state.arrowWithSize.className = styles.arrowWithSize;
|
47
|
-
* state.arrowWithoutSize.className = mergeClasses(
|
48
|
-
* styles.arrowWithoutSize,
|
49
|
-
* state.smallArrow && styles.smallArrow,
|
50
|
-
* state.mediumArrow && styles.mediumArrow,
|
51
|
-
* )
|
52
|
-
* ```
|
53
|
-
*/
|
54
|
-
export declare function createArrowStyles(options: CreateArrowStylesOptions): GriffelStyle;
|
55
|
-
/**
|
56
|
-
* Creates CSS styles to size the arrow created by createArrowStyles to the given height.
|
57
|
-
*
|
58
|
-
* Use this when you need to create classes for several different arrow sizes. If you only need a
|
59
|
-
* constant arrow size, you can pass the `arrowHeight` param to createArrowStyles instead.
|
60
|
-
*/
|
61
|
-
export declare function createArrowHeightStyles(arrowHeight: number): {
|
62
|
-
width: string;
|
63
|
-
height: string;
|
64
|
-
};
|
@@ -1,6 +0,0 @@
|
|
1
|
-
import type { PopperVirtualElement } from './types';
|
2
|
-
/**
|
3
|
-
* Creates a virtual element based on the position of a click event
|
4
|
-
* Can be used as a target for popper in scenarios such as context menus
|
5
|
-
*/
|
6
|
-
export declare function createVirtualElementFromClick(nativeEvent: MouseEvent): PopperVirtualElement;
|
package/lib/index.d.ts
DELETED
package/lib/types.d.ts
DELETED
@@ -1,89 +0,0 @@
|
|
1
|
-
import * as PopperJs from '@popperjs/core';
|
2
|
-
import * as React from 'react';
|
3
|
-
export declare type OffsetFunctionParam = {
|
4
|
-
popper: PopperJs.Rect;
|
5
|
-
reference: PopperJs.Rect;
|
6
|
-
placement: PopperJs.Placement;
|
7
|
-
};
|
8
|
-
export declare type OffsetFunction = (param: OffsetFunctionParam) => [number | null | undefined, number | null | undefined];
|
9
|
-
export declare type Offset = OffsetFunction | [number | null | undefined, number | null | undefined];
|
10
|
-
export declare type Position = 'above' | 'below' | 'before' | 'after';
|
11
|
-
export declare type Alignment = 'top' | 'bottom' | 'start' | 'end' | 'center';
|
12
|
-
export declare type AutoSize = 'height' | 'height-always' | 'width' | 'width-always' | 'always' | boolean;
|
13
|
-
export declare type Boundary = PopperJs.Boundary | 'scrollParent' | 'window';
|
14
|
-
export declare type PopperRefHandle = {
|
15
|
-
/**
|
16
|
-
* Updates the position of the popper imperatively.
|
17
|
-
* Useful when the position of the target changes from other factors than scrolling of window resize.
|
18
|
-
*/
|
19
|
-
updatePosition: () => void;
|
20
|
-
/**
|
21
|
-
* Sets the target and updates positioning imperatively.
|
22
|
-
* Useful for avoiding double renders with the target option.
|
23
|
-
*/
|
24
|
-
setTarget: (target: HTMLElement) => void;
|
25
|
-
};
|
26
|
-
export declare type PopperVirtualElement = PopperJs.VirtualElement;
|
27
|
-
export interface PopperOptions {
|
28
|
-
/** Alignment for the component. Only has an effect if used with the @see position option */
|
29
|
-
align?: Alignment;
|
30
|
-
/** The element which will define the boundaries of the popper position for the flip behavior. */
|
31
|
-
flipBoundary?: Boundary;
|
32
|
-
/** The element which will define the boundaries of the popper position for the overflow behavior. */
|
33
|
-
overflowBoundary?: Boundary;
|
34
|
-
/**
|
35
|
-
* Position for the component. Position has higher priority than align. If position is vertical ('above' | 'below')
|
36
|
-
* and align is also vertical ('top' | 'bottom') or if both position and align are horizontal ('before' | 'after'
|
37
|
-
* and 'start' | 'end' respectively),
|
38
|
-
* then provided value for 'align' will be ignored and 'center' will be used instead.
|
39
|
-
*/
|
40
|
-
position?: Position;
|
41
|
-
/**
|
42
|
-
* Enables the Popper box to position itself in 'fixed' mode (default value is position: 'absolute')
|
43
|
-
* @default false
|
44
|
-
*/
|
45
|
-
positionFixed?: boolean;
|
46
|
-
/**
|
47
|
-
* Lets you displace a popper element from its reference element.
|
48
|
-
* This can be useful if you need to apply some margin between them or if you need to fine tune the
|
49
|
-
* position according to some custom logic.
|
50
|
-
*/
|
51
|
-
offset?: Offset;
|
52
|
-
/**
|
53
|
-
* Defines padding between the corner of the popup element and the arrow.
|
54
|
-
* Use to prevent the arrow from overlapping a rounded corner, for example.
|
55
|
-
*/
|
56
|
-
arrowPadding?: number;
|
57
|
-
/**
|
58
|
-
* Applies max-height and max-width on popper to fit it within the available space in viewport.
|
59
|
-
* true enables this for both width and height when overflow happens.
|
60
|
-
* 'always' applies `max-height`/`max-width` regardless of overflow.
|
61
|
-
* 'height' applies `max-height` when overflow happens, and 'width' for `max-width`
|
62
|
-
* `height-always` applies `max-height` regardless of overflow, and 'width-always' for always applying `max-width`
|
63
|
-
*/
|
64
|
-
autoSize?: AutoSize;
|
65
|
-
/**
|
66
|
-
* Modifies position and alignment to cover the target
|
67
|
-
*/
|
68
|
-
coverTarget?: boolean;
|
69
|
-
/**
|
70
|
-
* Disables automatic repositioning of the component; it will always be placed according to the values of `align` and
|
71
|
-
* `position` props, regardless of the size of the component, the reference element or the viewport.
|
72
|
-
*/
|
73
|
-
pinned?: boolean;
|
74
|
-
/**
|
75
|
-
* When the reference element or the viewport is outside viewport allows a popper element to be fully in viewport.
|
76
|
-
* "all" enables this behavior for all axis.
|
77
|
-
*/
|
78
|
-
unstable_disableTether?: boolean | 'all';
|
79
|
-
}
|
80
|
-
export interface PositioningProps extends Omit<PopperOptions, 'positionFixed' | 'unstable_disableTether'> {
|
81
|
-
/** An imperative handle to Popper methods. */
|
82
|
-
popperRef?: React.Ref<PopperRefHandle>;
|
83
|
-
/**
|
84
|
-
* Manual override for popper target. Useful for scenarios where a component accepts user prop to override target
|
85
|
-
*/
|
86
|
-
target?: HTMLElement | PopperVirtualElement | null;
|
87
|
-
}
|
88
|
-
export declare type PositioningShorthandValue = 'above' | 'above-start' | 'above-end' | 'below' | 'below-start' | 'below-end' | 'before' | 'before-top' | 'before-bottom' | 'after' | 'after-top' | 'after-bottom';
|
89
|
-
export declare type PositioningShorthand = PositioningProps | PositioningShorthandValue;
|
package/lib/usePopper.d.ts
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import type { PositioningProps } from './types';
|
3
|
-
interface UsePopperOptions extends PositioningProps {
|
4
|
-
/**
|
5
|
-
* If false, delays Popper's creation.
|
6
|
-
* @default true
|
7
|
-
*/
|
8
|
-
enabled?: boolean;
|
9
|
-
}
|
10
|
-
/**
|
11
|
-
* Exposes Popper positioning API via React hook. Contains few important differences between an official "react-popper"
|
12
|
-
* package:
|
13
|
-
* - style attributes are applied directly on DOM to avoid re-renders
|
14
|
-
* - refs changes and resolution is handled properly without re-renders
|
15
|
-
* - contains a specific to React fix related to initial positioning when containers have components with managed focus
|
16
|
-
* to avoid focus jumps
|
17
|
-
*/
|
18
|
-
export declare function usePopper(options?: UsePopperOptions): {
|
19
|
-
targetRef: React.MutableRefObject<any>;
|
20
|
-
containerRef: React.MutableRefObject<any>;
|
21
|
-
arrowRef: React.MutableRefObject<any>;
|
22
|
-
};
|
23
|
-
export {};
|
package/lib/usePopper.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../src/usePopper.ts"],"names":[],"mappings":"AAAA,SAAS,gBAAT,EAA2B,yBAA3B,EAAsD,aAAtD,EAAqE,SAArE,QAAsF,2BAAtF;AACA,SAAS,SAAT,QAA0B,iCAA1B;AACA,OAAO,KAAK,QAAZ,MAA0B,gBAA1B;AACA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AAEA,SACE,eADF,EAEE,gBAFF,EAGE,YAHF,EAIE,qBAJF,EAKE,WALF,EAME,cANF,EAOE,gBAPF,QAQO,eARP,C,CAqBA;AACA;AACA;;AAEA;;;AAGG;;AACH,SAAS,gBAAT,CAA0B,IAA1B,EAAoC;SAAA,CAClC;;;AACA,QAAM,sBAAsB,GAC1B,IAAI,CAAC,QAAL,KAAkB,QAAlB,IACA,IAAI,CAAC,QAAL,KAAkB,OADlB,IAEA,IAAI,CAAC,QAAL,KAAkB,QAFlB,IAGA,IAAI,CAAC,QAAL,KAAkB,UAJpB;;AAMA,MAAI,sBAAJ,EAA4B;AAC1B,WAAO,CAAC,EAAC,CAAA,EAAA,GAAA,qBAAqB,CAAC,IAAD,CAArB,MAA2B,IAA3B,IAA2B,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C;AACA;AACA,IAAA,KAAK,CAAC,SAAN,CAAgB,MAAK;;;AACnB,UAAI,YAAY,CAAC,OAAjB,EAA0B;AACxB,cAAM,WAAW,GAAG,YAAY,CAAC,OAAjC;AACA,cAAM,UAAU,GAAG,CAAA,EAAA,GAAA,WAAW,CAAC,aAAZ,MAAyB,IAAzB,IAAyB,EAAA,KAAA,KAAA,CAAzB,GAAyB,KAAA,CAAzB,GAAyB,EAAA,CAAE,gBAAF,CAAmB,WAAnB,EAAgC,UAAU,CAAC,YAA3C,EAAyD;AACnG,UAAA,UAAU,EAAE;AADuF,SAAzD,CAA5C;;AAIA,eAAO,UAAU,KAAA,IAAV,IAAA,UAAU,KAAA,KAAA,CAAV,GAAU,KAAA,CAAV,GAAA,UAAU,CAAE,QAAZ,EAAP,EAA+B;AAC7B,gBAAM,IAAI,GAAG,UAAU,CAAC,WAAxB,CAD6B,CAE7B;;AACA,UAAA,OAAO,CAAC,IAAR,CAAa,WAAb,EAA0B,IAA1B,EAH6B,CAI7B;;AACA,UAAA,OAAO,CAAC,IAAR,CACE,CACE,gGADF,EAEE,qGAFF,EAGE,2EAHF,EAIE,uEAJF,EAKE,IALF,EAME,yFANF,EAOE,oGAPF,EAQE,kGARF,EASE,WATF,EAUE,4FAVF,EAWE,6FAXF,EAYE,IAZF,EAaE,2FAbF,EAcE,2CAdF,EAeE,8EAfF,EAgBE,IAhBF,CAgBO,GAhBP,CADF;AAmBD;AACF,OAhCkB,CAiCnB;AACA;AACA;;AACD,KApCD,EAoCG,EApCH;AAqCD;;AAED,SAAO;AAAE,IAAA,SAAF;AAAa,IAAA,YAAb;AAA2B,IAAA;AAA3B,GAAP;AACD","sourceRoot":""}
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import * as PopperJs from '@popperjs/core';
|
3
|
-
/**
|
4
|
-
* A state hook that manages a popper virtual element from mouseevents.
|
5
|
-
* Useful for scenarios where a component needs to be positioned by mouse click (e.g. contextmenu)
|
6
|
-
* React synthetic events are not persisted by this hook
|
7
|
-
*
|
8
|
-
* @param initialState - initializes a user provided state similare to useState
|
9
|
-
* @returns state and dispatcher for a Popper virtual element that uses native/synthetic mouse events
|
10
|
-
*/
|
11
|
-
export declare const usePopperMouseTarget: (initialState?: PopperJs.VirtualElement | (() => PopperJs.VirtualElement) | undefined) => readonly [PopperJs.VirtualElement | undefined, (event: React.MouseEvent | MouseEvent | undefined | null) => void];
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../src/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","sourceRoot":""}
|
@@ -1,8 +0,0 @@
|
|
1
|
-
import * as PopperJs from '@popperjs/core';
|
2
|
-
/**
|
3
|
-
* Returns the base placement value
|
4
|
-
* @param placement - the popper placement (i.e. bottom-start)
|
5
|
-
*
|
6
|
-
* @returns bottom-start -> bottom
|
7
|
-
*/
|
8
|
-
export declare function getBasePlacement(placement: PopperJs.Placement): PopperJs.BasePlacement;
|
@@ -1,10 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Returns the base placement value
|
3
|
-
* @param placement - the popper placement (i.e. bottom-start)
|
4
|
-
*
|
5
|
-
* @returns bottom-start -> bottom
|
6
|
-
*/
|
7
|
-
export function getBasePlacement(placement) {
|
8
|
-
return placement.split('-')[0];
|
9
|
-
}
|
10
|
-
//# sourceMappingURL=getBasePlacement.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../../src/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","sourceRoot":""}
|
@@ -1,6 +0,0 @@
|
|
1
|
-
import * as PopperJs from '@popperjs/core';
|
2
|
-
import type { Boundary } from '../types';
|
3
|
-
/**
|
4
|
-
* Allows to mimic a behavior from V1 of Popper and accept `window` and `scrollParent` as strings.
|
5
|
-
*/
|
6
|
-
export declare function getBoundary(element: HTMLElement | null, boundary?: Boundary): PopperJs.Boundary | undefined;
|