@fluentui/react-positioning 9.9.16 → 9.9.18
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +38 -2
- package/CHANGELOG.md +22 -3
- package/lib/createPositionManager.js +5 -3
- package/lib/createPositionManager.js.map +1 -1
- package/lib/utils/listScrollParents.js +15 -0
- package/lib/utils/listScrollParents.js.map +1 -0
- package/lib-commonjs/createPositionManager.js +4 -2
- package/lib-commonjs/createPositionManager.js.map +1 -1
- package/lib-commonjs/utils/listScrollParents.js +25 -0
- package/lib-commonjs/utils/listScrollParents.js.map +1 -0
- package/package.json +2 -2
package/CHANGELOG.json
CHANGED
@@ -2,7 +2,43 @@
|
|
2
2
|
"name": "@fluentui/react-positioning",
|
3
3
|
"entries": [
|
4
4
|
{
|
5
|
-
"date": "
|
5
|
+
"date": "Thu, 05 Oct 2023 15:17:58 GMT",
|
6
|
+
"tag": "@fluentui/react-positioning_v9.9.18",
|
7
|
+
"version": "9.9.18",
|
8
|
+
"comments": {
|
9
|
+
"patch": [
|
10
|
+
{
|
11
|
+
"author": "lingfan.gao@microsoft.com",
|
12
|
+
"package": "@fluentui/react-positioning",
|
13
|
+
"commit": "401ff6d9af9536b24ab3c52c658127d19706e030",
|
14
|
+
"comment": "fix: Consider all parents as scroll parents"
|
15
|
+
},
|
16
|
+
{
|
17
|
+
"author": "beachball",
|
18
|
+
"package": "@fluentui/react-positioning",
|
19
|
+
"comment": "Bump @fluentui/react-utilities to v9.14.1",
|
20
|
+
"commit": "690590449dc3d65cd40b2b06a990fd920180919d"
|
21
|
+
}
|
22
|
+
]
|
23
|
+
}
|
24
|
+
},
|
25
|
+
{
|
26
|
+
"date": "Wed, 04 Oct 2023 08:45:47 GMT",
|
27
|
+
"tag": "@fluentui/react-positioning_v9.9.17",
|
28
|
+
"version": "9.9.17",
|
29
|
+
"comments": {
|
30
|
+
"patch": [
|
31
|
+
{
|
32
|
+
"author": "beachball",
|
33
|
+
"package": "@fluentui/react-positioning",
|
34
|
+
"comment": "Bump @fluentui/react-utilities to v9.14.0",
|
35
|
+
"commit": "67b6cc6534e684ed32704dc6c0faee632bb840dc"
|
36
|
+
}
|
37
|
+
]
|
38
|
+
}
|
39
|
+
},
|
40
|
+
{
|
41
|
+
"date": "Mon, 02 Oct 2023 08:56:05 GMT",
|
6
42
|
"tag": "@fluentui/react-positioning_v9.9.16",
|
7
43
|
"version": "9.9.16",
|
8
44
|
"comments": {
|
@@ -11,7 +47,7 @@
|
|
11
47
|
"author": "beachball",
|
12
48
|
"package": "@fluentui/react-positioning",
|
13
49
|
"comment": "Bump @fluentui/react-shared-contexts to v9.9.2",
|
14
|
-
"commit": "
|
50
|
+
"commit": "da9a08817e5de95639e2dd7aa6d6709d47faa7f4"
|
15
51
|
}
|
16
52
|
]
|
17
53
|
}
|
package/CHANGELOG.md
CHANGED
@@ -1,17 +1,36 @@
|
|
1
1
|
# Change Log - @fluentui/react-positioning
|
2
2
|
|
3
|
-
This log was last generated on
|
3
|
+
This log was last generated on Thu, 05 Oct 2023 15:17:58 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
+
## [9.9.18](https://github.com/microsoft/fluentui/tree/@fluentui/react-positioning_v9.9.18)
|
8
|
+
|
9
|
+
Thu, 05 Oct 2023 15:17:58 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-positioning_v9.9.17..@fluentui/react-positioning_v9.9.18)
|
11
|
+
|
12
|
+
### Patches
|
13
|
+
|
14
|
+
- fix: Consider all parents as scroll parents ([PR #29378](https://github.com/microsoft/fluentui/pull/29378) by lingfan.gao@microsoft.com)
|
15
|
+
- Bump @fluentui/react-utilities to v9.14.1 ([PR #29412](https://github.com/microsoft/fluentui/pull/29412) by beachball)
|
16
|
+
|
17
|
+
## [9.9.17](https://github.com/microsoft/fluentui/tree/@fluentui/react-positioning_v9.9.17)
|
18
|
+
|
19
|
+
Wed, 04 Oct 2023 08:45:47 GMT
|
20
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-positioning_v9.9.16..@fluentui/react-positioning_v9.9.17)
|
21
|
+
|
22
|
+
### Patches
|
23
|
+
|
24
|
+
- Bump @fluentui/react-utilities to v9.14.0 ([commit](https://github.com/microsoft/fluentui/commit/67b6cc6534e684ed32704dc6c0faee632bb840dc) by beachball)
|
25
|
+
|
7
26
|
## [9.9.16](https://github.com/microsoft/fluentui/tree/@fluentui/react-positioning_v9.9.16)
|
8
27
|
|
9
|
-
Mon, 02 Oct 2023 08:
|
28
|
+
Mon, 02 Oct 2023 08:56:05 GMT
|
10
29
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-positioning_v9.9.15..@fluentui/react-positioning_v9.9.16)
|
11
30
|
|
12
31
|
### Patches
|
13
32
|
|
14
|
-
- Bump @fluentui/react-shared-contexts to v9.9.2 ([PR #
|
33
|
+
- Bump @fluentui/react-shared-contexts to v9.9.2 ([PR #29301](https://github.com/microsoft/fluentui/pull/29301) by beachball)
|
15
34
|
|
16
35
|
## [9.9.15](https://github.com/microsoft/fluentui/tree/@fluentui/react-positioning_v9.9.15)
|
17
36
|
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { computePosition } from '@floating-ui/dom';
|
2
|
-
import { debounce, writeArrowUpdates, writeContainerUpdates
|
2
|
+
import { debounce, writeArrowUpdates, writeContainerUpdates } from './utils';
|
3
3
|
import { isHTMLElement } from '@fluentui/react-utilities';
|
4
|
+
import { listScrollParents } from './utils/listScrollParents';
|
4
5
|
/**
|
5
6
|
* @internal
|
6
7
|
* @returns manager that handles positioning out of the react lifecycle
|
@@ -31,9 +32,9 @@ import { isHTMLElement } from '@fluentui/react-utilities';
|
|
31
32
|
return;
|
32
33
|
}
|
33
34
|
if (isFirstUpdate) {
|
34
|
-
scrollParents.add(
|
35
|
+
listScrollParents(container).forEach((scrollParent)=>scrollParents.add(scrollParent));
|
35
36
|
if (isHTMLElement(target)) {
|
36
|
-
scrollParents.add(
|
37
|
+
listScrollParents(target).forEach((scrollParent)=>scrollParents.add(scrollParent));
|
37
38
|
}
|
38
39
|
scrollParents.forEach((scrollParent)=>{
|
39
40
|
scrollParent.addEventListener('scroll', updatePosition, {
|
@@ -95,6 +96,7 @@ import { isHTMLElement } from '@fluentui/react-utilities';
|
|
95
96
|
scrollParents.forEach((scrollParent)=>{
|
96
97
|
scrollParent.removeEventListener('scroll', updatePosition);
|
97
98
|
});
|
99
|
+
scrollParents.clear();
|
98
100
|
};
|
99
101
|
if (targetWindow) {
|
100
102
|
targetWindow.addEventListener('scroll', updatePosition, {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["createPositionManager.ts"],"sourcesContent":["import { computePosition } from '@floating-ui/dom';\nimport type { Middleware, Placement, Strategy } from '@floating-ui/dom';\nimport type { PositionManager, TargetElement } from './types';\nimport { debounce, writeArrowUpdates, writeContainerUpdates
|
1
|
+
{"version":3,"sources":["createPositionManager.ts"],"sourcesContent":["import { computePosition } from '@floating-ui/dom';\nimport type { Middleware, Placement, Strategy } from '@floating-ui/dom';\nimport type { PositionManager, TargetElement } from './types';\nimport { debounce, writeArrowUpdates, writeContainerUpdates } from './utils';\nimport { isHTMLElement } from '@fluentui/react-utilities';\nimport { listScrollParents } from './utils/listScrollParents';\n\ninterface PositionManagerOptions {\n /**\n * The positioned element\n */\n container: HTMLElement;\n /**\n * Element that the container will be anchored to\n */\n target: TargetElement;\n /**\n * Arrow that points from the container to the target\n */\n arrow: HTMLElement | null;\n /**\n * The value of the css `position` property\n * @default absolute\n */\n strategy: Strategy;\n /**\n * [Floating UI middleware](https://floating-ui.com/docs/middleware)\n */\n middleware: Middleware[];\n /**\n * [Floating UI placement](https://floating-ui.com/docs/computePosition#placement)\n */\n placement?: Placement;\n /**\n * Modifies whether popover is positioned using transform.\n * @default true\n */\n useTransform?: boolean;\n}\n\n/**\n * @internal\n * @returns manager that handles positioning out of the react lifecycle\n */\nexport function createPositionManager(options: PositionManagerOptions): PositionManager {\n const { container, target, arrow, strategy, middleware, placement, useTransform = true } = options;\n let isDestroyed = false;\n if (!target || !container) {\n return {\n updatePosition: () => undefined,\n dispose: () => undefined,\n };\n }\n\n let isFirstUpdate = true;\n const scrollParents: Set<HTMLElement> = new Set<HTMLElement>();\n const targetWindow = container.ownerDocument.defaultView;\n\n // When the container is first resolved, set position `fixed` to avoid scroll jumps.\n // Without this scroll jumps can occur when the element is rendered initially and receives focus\n Object.assign(container.style, { position: 'fixed', left: 0, top: 0, margin: 0 });\n\n const forceUpdate = () => {\n // debounced update can still occur afterwards\n // early return to avoid memory leaks\n if (isDestroyed) {\n return;\n }\n\n if (isFirstUpdate) {\n listScrollParents(container).forEach(scrollParent => scrollParents.add(scrollParent));\n if (isHTMLElement(target)) {\n listScrollParents(target).forEach(scrollParent => scrollParents.add(scrollParent));\n }\n\n scrollParents.forEach(scrollParent => {\n scrollParent.addEventListener('scroll', updatePosition, { passive: true });\n });\n\n isFirstUpdate = false;\n }\n\n Object.assign(container.style, { position: strategy });\n computePosition(target, container, { placement, middleware, strategy })\n .then(({ x, y, middlewareData, placement: computedPlacement }) => {\n // Promise can still resolve after destruction\n // early return to avoid applying outdated position\n if (isDestroyed) {\n return;\n }\n\n writeArrowUpdates({ arrow, middlewareData });\n writeContainerUpdates({\n container,\n middlewareData,\n placement: computedPlacement,\n coordinates: { x, y },\n lowPPI: (targetWindow?.devicePixelRatio || 1) <= 1,\n strategy,\n useTransform,\n });\n })\n .catch(err => {\n // https://github.com/floating-ui/floating-ui/issues/1845\n // FIXME for node > 14\n // node 15 introduces promise rejection which means that any components\n // tests need to be `it('', async () => {})` otherwise there can be race conditions with\n // JSDOM being torn down before this promise is resolved so globals like `window` and `document` don't exist\n // Unless all tests that ever use `usePositioning` are turned into async tests, any logging during testing\n // will actually be counter productive\n if (process.env.NODE_ENV === 'development') {\n // eslint-disable-next-line no-console\n console.error('[usePositioning]: Failed to calculate position', err);\n }\n });\n };\n\n const updatePosition = debounce(() => forceUpdate());\n\n const dispose = () => {\n isDestroyed = true;\n\n if (targetWindow) {\n targetWindow.removeEventListener('scroll', updatePosition);\n targetWindow.removeEventListener('resize', updatePosition);\n }\n\n scrollParents.forEach(scrollParent => {\n scrollParent.removeEventListener('scroll', updatePosition);\n });\n scrollParents.clear();\n };\n\n if (targetWindow) {\n targetWindow.addEventListener('scroll', updatePosition, { passive: true });\n targetWindow.addEventListener('resize', updatePosition);\n }\n\n // Update the position on initialization\n updatePosition();\n\n return {\n updatePosition,\n dispose,\n };\n}\n"],"names":["computePosition","debounce","writeArrowUpdates","writeContainerUpdates","isHTMLElement","listScrollParents","createPositionManager","options","container","target","arrow","strategy","middleware","placement","useTransform","isDestroyed","updatePosition","undefined","dispose","isFirstUpdate","scrollParents","Set","targetWindow","ownerDocument","defaultView","Object","assign","style","position","left","top","margin","forceUpdate","forEach","scrollParent","add","addEventListener","passive","then","x","y","middlewareData","computedPlacement","coordinates","lowPPI","devicePixelRatio","catch","err","process","env","NODE_ENV","console","error","removeEventListener","clear"],"mappings":"AAAA,SAASA,eAAe,QAAQ,mBAAmB;AAGnD,SAASC,QAAQ,EAAEC,iBAAiB,EAAEC,qBAAqB,QAAQ,UAAU;AAC7E,SAASC,aAAa,QAAQ,4BAA4B;AAC1D,SAASC,iBAAiB,QAAQ,4BAA4B;AAmC9D;;;CAGC,GACD,OAAO,SAASC,sBAAsBC,OAA+B;IACnE,MAAM,EAAEC,SAAS,EAAEC,MAAM,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,UAAU,EAAEC,SAAS,EAAEC,eAAe,IAAI,EAAE,GAAGP;IAC3F,IAAIQ,cAAc;IAClB,IAAI,CAACN,UAAU,CAACD,WAAW;QACzB,OAAO;YACLQ,gBAAgB,IAAMC;YACtBC,SAAS,IAAMD;QACjB;IACF;IAEA,IAAIE,gBAAgB;IACpB,MAAMC,gBAAkC,IAAIC;IAC5C,MAAMC,eAAed,UAAUe,aAAa,CAACC,WAAW;IAExD,oFAAoF;IACpF,gGAAgG;IAChGC,OAAOC,MAAM,CA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,QAAQC,KAAK,CAAC,kDAAkDL;YAClE;QACF;IACJ;IAEA,MAAM/B,iBAAiBf,SAAS,IAAM+B;IAEtC,MAAMd,UAAU;QACdH,cAAc;QAEd,IAAIO,cAAc;YAChBA,aAAa+B,mBAAmB,CAAC,UAAUrC;YAC3CM,aAAa+B,mBAAmB,CAAC,UAAUrC;QAC7C;QAEAI,cAAca,OAAO,CAACC,CAAAA;YACpBA,aAAamB,mBAAmB,CAAC,UAAUrC;QAC7C;QACAI,cAAckC,KAAK;IACrB;IAEA,IAAIhC,cAAc;QAChBA,aAAac,gBAAgB,CAAC,UAAUpB,gBAAgB;YAAEqB,SAAS;QAAK;QACxEf,aAAac,gBAAgB,CAAC,UAAUpB;IAC1C;IAEA,wCAAwC;IACxCA;IAEA,OAAO;QACLA;QACAE;IACF;AACF"}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { getScrollParent } from './getScrollParent';
|
2
|
+
export function listScrollParents(node) {
|
3
|
+
const scrollParents = [];
|
4
|
+
let cur = node;
|
5
|
+
while(cur){
|
6
|
+
const scrollParent = getScrollParent(cur);
|
7
|
+
if (node.ownerDocument.body === scrollParent) {
|
8
|
+
scrollParents.push(scrollParent);
|
9
|
+
break;
|
10
|
+
}
|
11
|
+
scrollParents.push(scrollParent);
|
12
|
+
cur = scrollParent;
|
13
|
+
}
|
14
|
+
return scrollParents;
|
15
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["listScrollParents.ts"],"sourcesContent":["import { getScrollParent } from './getScrollParent';\n\nexport function listScrollParents(node: HTMLElement): HTMLElement[] {\n const scrollParents: HTMLElement[] = [];\n\n let cur: HTMLElement | null = node;\n while (cur) {\n const scrollParent = getScrollParent(cur);\n\n if (node.ownerDocument.body === scrollParent) {\n scrollParents.push(scrollParent);\n break;\n }\n\n scrollParents.push(scrollParent);\n cur = scrollParent;\n }\n\n return scrollParents;\n}\n"],"names":["getScrollParent","listScrollParents","node","scrollParents","cur","scrollParent","ownerDocument","body","push"],"mappings":"AAAA,SAASA,eAAe,QAAQ,oBAAoB;AAEpD,OAAO,SAASC,kBAAkBC,IAAiB;IACjD,MAAMC,gBAA+B,EAAE;IAEvC,IAAIC,MAA0BF;IAC9B,MAAOE,IAAK;QACV,MAAMC,eAAeL,gBAAgBI;QAErC,IAAIF,KAAKI,aAAa,CAACC,IAAI,KAAKF,cAAc;YAC5CF,cAAcK,IAAI,CAACH;YACnB;QACF;QAEAF,cAAcK,IAAI,CAACH;QACnBD,MAAMC;IACR;IAEA,OAAOF;AACT"}
|
@@ -11,6 +11,7 @@ Object.defineProperty(exports, "createPositionManager", {
|
|
11
11
|
const _dom = require("@floating-ui/dom");
|
12
12
|
const _utils = require("./utils");
|
13
13
|
const _reactutilities = require("@fluentui/react-utilities");
|
14
|
+
const _listScrollParents = require("./utils/listScrollParents");
|
14
15
|
function createPositionManager(options) {
|
15
16
|
const { container, target, arrow, strategy, middleware, placement, useTransform = true } = options;
|
16
17
|
let isDestroyed = false;
|
@@ -38,9 +39,9 @@ function createPositionManager(options) {
|
|
38
39
|
return;
|
39
40
|
}
|
40
41
|
if (isFirstUpdate) {
|
41
|
-
|
42
|
+
(0, _listScrollParents.listScrollParents)(container).forEach((scrollParent)=>scrollParents.add(scrollParent));
|
42
43
|
if ((0, _reactutilities.isHTMLElement)(target)) {
|
43
|
-
|
44
|
+
(0, _listScrollParents.listScrollParents)(target).forEach((scrollParent)=>scrollParents.add(scrollParent));
|
44
45
|
}
|
45
46
|
scrollParents.forEach((scrollParent)=>{
|
46
47
|
scrollParent.addEventListener('scroll', updatePosition, {
|
@@ -102,6 +103,7 @@ function createPositionManager(options) {
|
|
102
103
|
scrollParents.forEach((scrollParent)=>{
|
103
104
|
scrollParent.removeEventListener('scroll', updatePosition);
|
104
105
|
});
|
106
|
+
scrollParents.clear();
|
105
107
|
};
|
106
108
|
if (targetWindow) {
|
107
109
|
targetWindow.addEventListener('scroll', updatePosition, {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["createPositionManager.js"],"sourcesContent":["import { computePosition } from '@floating-ui/dom';\nimport { debounce, writeArrowUpdates, writeContainerUpdates
|
1
|
+
{"version":3,"sources":["createPositionManager.js"],"sourcesContent":["import { computePosition } from '@floating-ui/dom';\nimport { debounce, writeArrowUpdates, writeContainerUpdates } from './utils';\nimport { isHTMLElement } from '@fluentui/react-utilities';\nimport { listScrollParents } from './utils/listScrollParents';\n/**\n * @internal\n * @returns manager that handles positioning out of the react lifecycle\n */ export function createPositionManager(options) {\n const { container, target, arrow, strategy, middleware, placement, useTransform = true } = options;\n let isDestroyed = false;\n if (!target || !container) {\n return {\n updatePosition: ()=>undefined,\n dispose: ()=>undefined\n };\n }\n let isFirstUpdate = true;\n const scrollParents = new Set();\n const targetWindow = container.ownerDocument.defaultView;\n // When the container is first resolved, set position `fixed` to avoid scroll jumps.\n // Without this scroll jumps can occur when the element is rendered initially and receives focus\n Object.assign(container.style, {\n position: 'fixed',\n left: 0,\n top: 0,\n margin: 0\n });\n const forceUpdate = ()=>{\n // debounced update can still occur afterwards\n // early return to avoid memory leaks\n if (isDestroyed) {\n return;\n }\n if (isFirstUpdate) {\n listScrollParents(container).forEach((scrollParent)=>scrollParents.add(scrollParent));\n if (isHTMLElement(target)) {\n listScrollParents(target).forEach((scrollParent)=>scrollParents.add(scrollParent));\n }\n scrollParents.forEach((scrollParent)=>{\n scrollParent.addEventListener('scroll', updatePosition, {\n passive: true\n });\n });\n isFirstUpdate = false;\n }\n Object.assign(container.style, {\n position: strategy\n });\n computePosition(target, container, {\n placement,\n middleware,\n strategy\n }).then(({ x, y, middlewareData, placement: computedPlacement })=>{\n // Promise can still resolve after destruction\n // early return to avoid applying outdated position\n if (isDestroyed) {\n return;\n }\n writeArrowUpdates({\n arrow,\n middlewareData\n });\n writeContainerUpdates({\n container,\n middlewareData,\n placement: computedPlacement,\n coordinates: {\n x,\n y\n },\n lowPPI: ((targetWindow === null || targetWindow === void 0 ? void 0 : targetWindow.devicePixelRatio) || 1) <= 1,\n strategy,\n useTransform\n });\n }).catch((err)=>{\n // https://github.com/floating-ui/floating-ui/issues/1845\n // FIXME for node > 14\n // node 15 introduces promise rejection which means that any components\n // tests need to be `it('', async () => {})` otherwise there can be race conditions with\n // JSDOM being torn down before this promise is resolved so globals like `window` and `document` don't exist\n // Unless all tests that ever use `usePositioning` are turned into async tests, any logging during testing\n // will actually be counter productive\n if (process.env.NODE_ENV === 'development') {\n // eslint-disable-next-line no-console\n console.error('[usePositioning]: Failed to calculate position', err);\n }\n });\n };\n const updatePosition = debounce(()=>forceUpdate());\n const dispose = ()=>{\n isDestroyed = true;\n if (targetWindow) {\n targetWindow.removeEventListener('scroll', updatePosition);\n targetWindow.removeEventListener('resize', updatePosition);\n }\n scrollParents.forEach((scrollParent)=>{\n scrollParent.removeEventListener('scroll', updatePosition);\n });\n scrollParents.clear();\n };\n if (targetWindow) {\n targetWindow.addEventListener('scroll', updatePosition, {\n passive: true\n });\n targetWindow.addEventListener('resize', updatePosition);\n }\n // Update the position on initialization\n updatePosition();\n return {\n updatePosition,\n dispose\n };\n}\n"],"names":["createPositionManager","options","container","target","arrow","strategy","middleware","placement","useTransform","isDestroyed","updatePosition","undefined","dispose","isFirstUpdate","scrollParents","Set","targetWindow","ownerDocument","defaultView","Object","assign","style","position","left","top","margin","forceUpdate","listScrollParents","forEach","scrollParent","add","isHTMLElement","addEventListener","passive","computePosition","then","x","y","middlewareData","computedPlacement","writeArrowUpdates","writeContainerUpdates","coordinates","lowPPI","devicePixelRatio","catch","err","process","env","NODE_ENV","console","error","debounce","removeEventListener","clear"],"mappings":";;;;+BAOoBA;;;eAAAA;;;qBAPY;uBACmC;gCACrC;mCACI;AAIvB,SAASA,sBAAsBC,OAAO;IAC7C,MAAM,EAAEC,SAAS,EAAEC,MAAM,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,UAAU,EAAEC,SAAS,EAAEC,eAAe,IAAI,EAAE,GAAGP;IAC3F,IAAIQ,cAAc;IAClB,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,CAAA,AAAC3B,CAAAA,iBAAiB,QAAQA,iBAAiB,KAAK,IAAI,KAAK,IAAIA,aAAa4B,gBAAgB,AAAD,KAAM,CAAA,KAAM;gBAC9GvC;gBACAG;YACJ;QACJ,GAAGqC,KAAK,CAAC,CAACC;YACN,yDAAyD;YACzD,sBAAsB;YACtB,uEAAuE;YACvE,wFAAwF;YACxF,4GAA4G;YAC5G,0GAA0G;YAC1G,sCAAsC;YACtC,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,eAAe;gBACxC,sCAAsC;gBACtCC,QAAQC,KAAK,CAAC,kDAAkDL;YACpE;QACJ;IACJ;IACA,MAAMpC,iBAAiB0C,IAAAA,eAAQ,EAAC,IAAI1B;IACpC,MAAMd,UAAU;QACZH,cAAc;QACd,IAAIO,cAAc;YACdA,aAAaqC,mBAAmB,CAAC,UAAU3C;YAC3CM,aAAaqC,mBAAmB,CAAC,UAAU3C;QAC/C;QACAI,cAAcc,OAAO,CAAC,CAACC;YACnBA,aAAawB,mBAAmB,CAAC,UAAU3C;QAC/C;QACAI,cAAcwC,KAAK;IACvB;IACA,IAAItC,cAAc;QACdA,aAAagB,gBAAgB,CAAC,UAAUtB,gBAAgB;YACpDuB,SAAS;QACb;QACAjB,aAAagB,gBAAgB,CAAC,UAAUtB;IAC5C;IACA,wCAAwC;IACxCA;IACA,OAAO;QACHA;QACAE;IACJ;AACJ"}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "listScrollParents", {
|
6
|
+
enumerable: true,
|
7
|
+
get: function() {
|
8
|
+
return listScrollParents;
|
9
|
+
}
|
10
|
+
});
|
11
|
+
const _getScrollParent = require("./getScrollParent");
|
12
|
+
function listScrollParents(node) {
|
13
|
+
const scrollParents = [];
|
14
|
+
let cur = node;
|
15
|
+
while(cur){
|
16
|
+
const scrollParent = (0, _getScrollParent.getScrollParent)(cur);
|
17
|
+
if (node.ownerDocument.body === scrollParent) {
|
18
|
+
scrollParents.push(scrollParent);
|
19
|
+
break;
|
20
|
+
}
|
21
|
+
scrollParents.push(scrollParent);
|
22
|
+
cur = scrollParent;
|
23
|
+
}
|
24
|
+
return scrollParents;
|
25
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["listScrollParents.js"],"sourcesContent":["import { getScrollParent } from './getScrollParent';\nexport function listScrollParents(node) {\n const scrollParents = [];\n let cur = node;\n while(cur){\n const scrollParent = getScrollParent(cur);\n if (node.ownerDocument.body === scrollParent) {\n scrollParents.push(scrollParent);\n break;\n }\n scrollParents.push(scrollParent);\n cur = scrollParent;\n }\n return scrollParents;\n}\n"],"names":["listScrollParents","node","scrollParents","cur","scrollParent","getScrollParent","ownerDocument","body","push"],"mappings":";;;;+BACgBA;;;eAAAA;;;iCADgB;AACzB,SAASA,kBAAkBC,IAAI;IAClC,MAAMC,gBAAgB,EAAE;IACxB,IAAIC,MAAMF;IACV,MAAME,IAAI;QACN,MAAMC,eAAeC,IAAAA,gCAAe,EAACF;QACrC,IAAIF,KAAKK,aAAa,CAACC,IAAI,KAAKH,cAAc;YAC1CF,cAAcM,IAAI,CAACJ;YACnB;QACJ;QACAF,cAAcM,IAAI,CAACJ;QACnBD,MAAMC;IACV;IACA,OAAOF;AACX"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fluentui/react-positioning",
|
3
|
-
"version": "9.9.
|
3
|
+
"version": "9.9.18",
|
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",
|
@@ -32,7 +32,7 @@
|
|
32
32
|
"@floating-ui/dom": "^1.2.0",
|
33
33
|
"@fluentui/react-shared-contexts": "^9.9.2",
|
34
34
|
"@fluentui/react-theme": "^9.1.14",
|
35
|
-
"@fluentui/react-utilities": "^9.
|
35
|
+
"@fluentui/react-utilities": "^9.14.1",
|
36
36
|
"@griffel/react": "^1.5.14",
|
37
37
|
"@swc/helpers": "^0.5.1"
|
38
38
|
},
|