@fluentui/react-positioning 9.9.8 → 9.9.9
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +40 -1
- package/CHANGELOG.md +15 -2
- package/lib/createArrowStyles.js +1 -1
- package/lib/createArrowStyles.js.map +1 -1
- package/lib/createPositionManager.js +4 -3
- package/lib/createPositionManager.js.map +1 -1
- package/lib/createSlideStyles.js.map +1 -1
- package/lib/createVirtualElementFromClick.js.map +1 -1
- package/lib/middleware/coverTarget.js +1 -1
- package/lib/middleware/coverTarget.js.map +1 -1
- package/lib/middleware/flip.js +2 -2
- package/lib/middleware/flip.js.map +1 -1
- package/lib/middleware/intersecting.js.map +1 -1
- package/lib/middleware/maxSize.js +7 -9
- package/lib/middleware/maxSize.js.map +1 -1
- package/lib/middleware/offset.js.map +1 -1
- package/lib/middleware/shift.js +1 -1
- package/lib/middleware/shift.js.map +1 -1
- package/lib/usePositioning.js +6 -8
- package/lib/usePositioning.js.map +1 -1
- package/lib/usePositioningMouseTarget.js.map +1 -1
- package/lib/utils/debounce.js.map +1 -1
- package/lib/utils/fromFloatingUIPlacement.js +1 -1
- package/lib/utils/fromFloatingUIPlacement.js.map +1 -1
- package/lib/utils/getBoundary.js +4 -2
- package/lib/utils/getBoundary.js.map +1 -1
- package/lib/utils/getFloatingUIOffset.js +2 -2
- package/lib/utils/getFloatingUIOffset.js.map +1 -1
- package/lib/utils/getReactFiberFromNode.js.map +1 -1
- package/lib/utils/getScrollParent.js +1 -1
- package/lib/utils/getScrollParent.js.map +1 -1
- package/lib/utils/hasAutoFocusFilter.js.map +1 -1
- package/lib/utils/mergeArrowOffset.js.map +1 -1
- package/lib/utils/normalizeAutoSize.js.map +1 -1
- package/lib/utils/parseFloatingUIPlacement.js.map +1 -1
- package/lib/utils/resolvePositioningShorthand.js.map +1 -1
- package/lib/utils/toFloatingUIPadding.js +1 -1
- package/lib/utils/toFloatingUIPadding.js.map +1 -1
- package/lib/utils/toFloatingUIPlacement.js.map +1 -1
- package/lib/utils/toggleScrollListener.js.map +1 -1
- package/lib/utils/useCallbackRef.js.map +1 -1
- package/lib/utils/writeArrowUpdates.js +2 -2
- package/lib/utils/writeArrowUpdates.js.map +1 -1
- package/lib/utils/writeContainerupdates.js +1 -1
- package/lib/utils/writeContainerupdates.js.map +1 -1
- package/lib-commonjs/constants.js +12 -4
- package/lib-commonjs/constants.js.map +1 -1
- package/lib-commonjs/createArrowStyles.js +9 -5
- package/lib-commonjs/createArrowStyles.js.map +1 -1
- package/lib-commonjs/createPositionManager.js +9 -6
- package/lib-commonjs/createPositionManager.js.map +1 -1
- package/lib-commonjs/createSlideStyles.js +6 -4
- package/lib-commonjs/createSlideStyles.js.map +1 -1
- package/lib-commonjs/createVirtualElementFromClick.js +3 -1
- package/lib-commonjs/createVirtualElementFromClick.js.map +1 -1
- package/lib-commonjs/index.js +24 -8
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/middleware/coverTarget.js +4 -2
- package/lib-commonjs/middleware/coverTarget.js.map +1 -1
- package/lib-commonjs/middleware/flip.js +5 -3
- package/lib-commonjs/middleware/flip.js.map +1 -1
- package/lib-commonjs/middleware/index.js +7 -7
- package/lib-commonjs/middleware/index.js.map +1 -1
- package/lib-commonjs/middleware/intersecting.js +3 -1
- package/lib-commonjs/middleware/intersecting.js.map +1 -1
- package/lib-commonjs/middleware/maxSize.js +13 -11
- package/lib-commonjs/middleware/maxSize.js.map +1 -1
- package/lib-commonjs/middleware/offset.js +3 -1
- package/lib-commonjs/middleware/offset.js.map +1 -1
- package/lib-commonjs/middleware/shift.js +4 -2
- package/lib-commonjs/middleware/shift.js.map +1 -1
- package/lib-commonjs/types.js +2 -2
- package/lib-commonjs/types.js.map +1 -1
- package/lib-commonjs/usePositioning.js +16 -16
- package/lib-commonjs/usePositioning.js.map +1 -1
- package/lib-commonjs/usePositioningMouseTarget.js +5 -3
- package/lib-commonjs/usePositioningMouseTarget.js.map +1 -1
- package/lib-commonjs/utils/debounce.js +3 -1
- package/lib-commonjs/utils/debounce.js.map +1 -1
- package/lib-commonjs/utils/fromFloatingUIPlacement.js +4 -2
- package/lib-commonjs/utils/fromFloatingUIPlacement.js.map +1 -1
- package/lib-commonjs/utils/getBoundary.js +7 -3
- package/lib-commonjs/utils/getBoundary.js.map +1 -1
- package/lib-commonjs/utils/getFloatingUIOffset.js +5 -3
- package/lib-commonjs/utils/getFloatingUIOffset.js.map +1 -1
- package/lib-commonjs/utils/getReactFiberFromNode.js +5 -3
- package/lib-commonjs/utils/getReactFiberFromNode.js.map +1 -1
- package/lib-commonjs/utils/getScrollParent.js +10 -4
- package/lib-commonjs/utils/getScrollParent.js.map +1 -1
- package/lib-commonjs/utils/hasAutoFocusFilter.js +3 -1
- package/lib-commonjs/utils/hasAutoFocusFilter.js.map +1 -1
- package/lib-commonjs/utils/index.js +17 -17
- package/lib-commonjs/utils/index.js.map +1 -1
- package/lib-commonjs/utils/mergeArrowOffset.js +3 -1
- package/lib-commonjs/utils/mergeArrowOffset.js.map +1 -1
- package/lib-commonjs/utils/normalizeAutoSize.js +3 -1
- package/lib-commonjs/utils/normalizeAutoSize.js.map +1 -1
- package/lib-commonjs/utils/parseFloatingUIPlacement.js +3 -1
- package/lib-commonjs/utils/parseFloatingUIPlacement.js.map +1 -1
- package/lib-commonjs/utils/resolvePositioningShorthand.js +3 -1
- package/lib-commonjs/utils/resolvePositioningShorthand.js.map +1 -1
- package/lib-commonjs/utils/toFloatingUIPadding.js +4 -2
- package/lib-commonjs/utils/toFloatingUIPadding.js.map +1 -1
- package/lib-commonjs/utils/toFloatingUIPlacement.js +3 -1
- package/lib-commonjs/utils/toFloatingUIPlacement.js.map +1 -1
- package/lib-commonjs/utils/toggleScrollListener.js +6 -4
- package/lib-commonjs/utils/toggleScrollListener.js.map +1 -1
- package/lib-commonjs/utils/useCallbackRef.js +7 -5
- package/lib-commonjs/utils/useCallbackRef.js.map +1 -1
- package/lib-commonjs/utils/writeArrowUpdates.js +5 -3
- package/lib-commonjs/utils/writeArrowUpdates.js.map +1 -1
- package/lib-commonjs/utils/writeContainerupdates.js +4 -2
- package/lib-commonjs/utils/writeContainerupdates.js.map +1 -1
- package/package.json +9 -9
package/lib-commonjs/index.js
CHANGED
@@ -9,14 +9,30 @@ function _export(target, all) {
|
|
9
9
|
});
|
10
10
|
}
|
11
11
|
_export(exports, {
|
12
|
-
createVirtualElementFromClick: ()
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
12
|
+
createVirtualElementFromClick: function() {
|
13
|
+
return _createVirtualElementFromClick.createVirtualElementFromClick;
|
14
|
+
},
|
15
|
+
createArrowHeightStyles: function() {
|
16
|
+
return _createArrowStyles.createArrowHeightStyles;
|
17
|
+
},
|
18
|
+
createArrowStyles: function() {
|
19
|
+
return _createArrowStyles.createArrowStyles;
|
20
|
+
},
|
21
|
+
createSlideStyles: function() {
|
22
|
+
return _createSlideStyles.createSlideStyles;
|
23
|
+
},
|
24
|
+
usePositioning: function() {
|
25
|
+
return _usePositioning.usePositioning;
|
26
|
+
},
|
27
|
+
usePositioningMouseTarget: function() {
|
28
|
+
return _usePositioningMouseTarget.usePositioningMouseTarget;
|
29
|
+
},
|
30
|
+
resolvePositioningShorthand: function() {
|
31
|
+
return _index.resolvePositioningShorthand;
|
32
|
+
},
|
33
|
+
mergeArrowOffset: function() {
|
34
|
+
return _index.mergeArrowOffset;
|
35
|
+
}
|
20
36
|
});
|
21
37
|
const _createVirtualElementFromClick = require("./createVirtualElementFromClick");
|
22
38
|
const _createArrowStyles = require("./createArrowStyles");
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.js"],"sourcesContent":["export { createVirtualElementFromClick } from './createVirtualElementFromClick';\nexport { createArrowHeightStyles, createArrowStyles } from './createArrowStyles';\nexport { createSlideStyles } from './createSlideStyles';\nexport { usePositioning } from './usePositioning';\nexport { usePositioningMouseTarget } from './usePositioningMouseTarget';\nexport { resolvePositioningShorthand, mergeArrowOffset } from './utils/index';\n"],"names":["createVirtualElementFromClick","createArrowHeightStyles","createArrowStyles","createSlideStyles","usePositioning","usePositioningMouseTarget","resolvePositioningShorthand","mergeArrowOffset"],"mappings":";;;;;;;;;;;IAASA,6BAA6B,
|
1
|
+
{"version":3,"sources":["index.js"],"sourcesContent":["export { createVirtualElementFromClick } from './createVirtualElementFromClick';\nexport { createArrowHeightStyles, createArrowStyles } from './createArrowStyles';\nexport { createSlideStyles } from './createSlideStyles';\nexport { usePositioning } from './usePositioning';\nexport { usePositioningMouseTarget } from './usePositioningMouseTarget';\nexport { resolvePositioningShorthand, mergeArrowOffset } from './utils/index';\n"],"names":["createVirtualElementFromClick","createArrowHeightStyles","createArrowStyles","createSlideStyles","usePositioning","usePositioningMouseTarget","resolvePositioningShorthand","mergeArrowOffset"],"mappings":";;;;;;;;;;;IAASA,6BAA6B;eAA7BA,4DAA6B;;IAC7BC,uBAAuB;eAAvBA,0CAAuB;;IAAEC,iBAAiB;eAAjBA,oCAAiB;;IAC1CC,iBAAiB;eAAjBA,oCAAiB;;IACjBC,cAAc;eAAdA,8BAAc;;IACdC,yBAAyB;eAAzBA,oDAAyB;;IACzBC,2BAA2B;eAA3BA,kCAA2B;;IAAEC,gBAAgB;eAAhBA,uBAAgB;;;+CALR;mCACa;mCACzB;gCACH;2CACW;uBACoB"}
|
@@ -4,14 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
});
|
5
5
|
Object.defineProperty(exports, "coverTarget", {
|
6
6
|
enumerable: true,
|
7
|
-
get: ()
|
7
|
+
get: function() {
|
8
|
+
return coverTarget;
|
9
|
+
}
|
8
10
|
});
|
9
11
|
const _index = require("../utils/index");
|
10
12
|
function coverTarget() {
|
11
13
|
return {
|
12
14
|
name: 'coverTarget',
|
13
15
|
fn: (middlewareArguments)=>{
|
14
|
-
const { placement
|
16
|
+
const { placement, rects, x, y } = middlewareArguments;
|
15
17
|
const basePlacement = (0, _index.parseFloatingUIPlacement)(placement).side;
|
16
18
|
const newCoords = {
|
17
19
|
x,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["coverTarget.js"],"sourcesContent":["import { parseFloatingUIPlacement } from '../utils/index';\nexport function coverTarget() {\n return {\n name: 'coverTarget',\n fn: (middlewareArguments)=>{\n const { placement
|
1
|
+
{"version":3,"sources":["coverTarget.js"],"sourcesContent":["import { parseFloatingUIPlacement } from '../utils/index';\nexport function coverTarget() {\n return {\n name: 'coverTarget',\n fn: (middlewareArguments)=>{\n const { placement, rects, x, y } = middlewareArguments;\n const basePlacement = parseFloatingUIPlacement(placement).side;\n const newCoords = {\n x,\n y\n };\n switch(basePlacement){\n case 'bottom':\n newCoords.y -= rects.reference.height;\n break;\n case 'top':\n newCoords.y += rects.reference.height;\n break;\n case 'left':\n newCoords.x += rects.reference.width;\n break;\n case 'right':\n newCoords.x -= rects.reference.width;\n break;\n }\n return newCoords;\n }\n };\n}\n"],"names":["coverTarget","name","fn","middlewareArguments","placement","rects","x","y","basePlacement","parseFloatingUIPlacement","side","newCoords","reference","height","width"],"mappings":";;;;+BACgBA;;;eAAAA;;;uBADyB;AAClC,SAASA;IACZ,OAAO;QACHC,MAAM;QACNC,IAAI,CAACC;YACD,MAAM,EAAEC,SAAS,EAAEC,KAAK,EAAEC,CAAC,EAAEC,CAAC,EAAE,GAAGJ;YACnC,MAAMK,gBAAgBC,IAAAA,+BAAwB,EAACL,WAAWM,IAAI;YAC9D,MAAMC,YAAY;gBACdL;gBACAC;YACJ;YACA,OAAOC;gBACH,KAAK;oBACDG,UAAUJ,CAAC,IAAIF,MAAMO,SAAS,CAACC,MAAM;oBACrC;gBACJ,KAAK;oBACDF,UAAUJ,CAAC,IAAIF,MAAMO,SAAS,CAACC,MAAM;oBACrC;gBACJ,KAAK;oBACDF,UAAUL,CAAC,IAAID,MAAMO,SAAS,CAACE,KAAK;oBACpC;gBACJ,KAAK;oBACDH,UAAUL,CAAC,IAAID,MAAMO,SAAS,CAACE,KAAK;oBACpC;YACR;YACA,OAAOH;QACX;IACJ;AACJ"}
|
@@ -4,14 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
});
|
5
5
|
Object.defineProperty(exports, "flip", {
|
6
6
|
enumerable: true,
|
7
|
-
get: ()
|
7
|
+
get: function() {
|
8
|
+
return flip;
|
9
|
+
}
|
8
10
|
});
|
9
11
|
const _dom = require("@floating-ui/dom");
|
10
12
|
const _index = require("../utils/index");
|
11
13
|
function flip(options) {
|
12
|
-
const { hasScrollableElement
|
14
|
+
const { hasScrollableElement, flipBoundary, container, fallbackPositions = [], isRtl } = options;
|
13
15
|
const fallbackPlacements = fallbackPositions.reduce((acc, shorthand)=>{
|
14
|
-
const { position
|
16
|
+
const { position, align } = (0, _index.resolvePositioningShorthand)(shorthand);
|
15
17
|
const placement = (0, _index.toFloatingUIPlacement)(align, position, isRtl);
|
16
18
|
if (placement) {
|
17
19
|
acc.push(placement);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["flip.js"],"sourcesContent":["import { flip as baseFlip } from '@floating-ui/dom';\nimport { getBoundary, resolvePositioningShorthand, toFloatingUIPlacement } from '../utils/index';\nexport function flip(options) {\n const { hasScrollableElement
|
1
|
+
{"version":3,"sources":["flip.js"],"sourcesContent":["import { flip as baseFlip } from '@floating-ui/dom';\nimport { getBoundary, resolvePositioningShorthand, toFloatingUIPlacement } from '../utils/index';\nexport function flip(options) {\n const { hasScrollableElement, flipBoundary, container, fallbackPositions = [], isRtl } = options;\n const fallbackPlacements = fallbackPositions.reduce((acc, shorthand)=>{\n const { position, align } = resolvePositioningShorthand(shorthand);\n const placement = toFloatingUIPlacement(align, position, isRtl);\n if (placement) {\n acc.push(placement);\n }\n return acc;\n }, []);\n return baseFlip({\n ...hasScrollableElement && {\n boundary: 'clippingAncestors'\n },\n ...flipBoundary && {\n altBoundary: true,\n boundary: getBoundary(container, flipBoundary)\n },\n fallbackStrategy: 'bestFit',\n ...fallbackPlacements.length && {\n fallbackPlacements\n }\n });\n}\n"],"names":["flip","options","hasScrollableElement","flipBoundary","container","fallbackPositions","isRtl","fallbackPlacements","reduce","acc","shorthand","position","align","resolvePositioningShorthand","placement","toFloatingUIPlacement","push","baseFlip","boundary","altBoundary","getBoundary","fallbackStrategy","length"],"mappings":";;;;+BAEgBA;;;eAAAA;;;qBAFiB;uBAC+C;AACzE,SAASA,KAAKC,OAAO;IACxB,MAAM,EAAEC,oBAAoB,EAAEC,YAAY,EAAEC,SAAS,EAAEC,oBAAoB,EAAE,EAAEC,KAAK,EAAE,GAAGL;IACzF,MAAMM,qBAAqBF,kBAAkBG,MAAM,CAAC,CAACC,KAAKC;QACtD,MAAM,EAAEC,QAAQ,EAAEC,KAAK,EAAE,GAAGC,IAAAA,kCAA2B,EAACH;QACxD,MAAMI,YAAYC,IAAAA,4BAAqB,EAACH,OAAOD,UAAUL;QACzD,IAAIQ,WAAW;YACXL,IAAIO,IAAI,CAACF;QACb;QACA,OAAOL;IACX,GAAG,EAAE;IACL,OAAOQ,IAAAA,SAAQ,EAAC;QACZ,GAAGf,wBAAwB;YACvBgB,UAAU;QACd,CAAC;QACD,GAAGf,gBAAgB;YACfgB,aAAa;YACbD,UAAUE,IAAAA,kBAAW,EAAChB,WAAWD;QACrC,CAAC;QACDkB,kBAAkB;QAClB,GAAGd,mBAAmBe,MAAM,IAAI;YAC5Bf;QACJ,CAAC;IACL;AACJ"}
|
@@ -2,10 +2,10 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
3
3
|
value: true
|
4
4
|
});
|
5
|
-
const
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
5
|
+
const _export_star = require("@swc/helpers/_/_export_star");
|
6
|
+
_export_star._(require("./coverTarget"), exports);
|
7
|
+
_export_star._(require("./flip"), exports);
|
8
|
+
_export_star._(require("./intersecting"), exports);
|
9
|
+
_export_star._(require("./maxSize"), exports);
|
10
|
+
_export_star._(require("./offset"), exports);
|
11
|
+
_export_star._(require("./shift"), exports);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.js"],"sourcesContent":["export * from './coverTarget';\nexport * from './flip';\nexport * from './intersecting';\nexport * from './maxSize';\nexport * from './offset';\nexport * from './shift';\n"],"names":[],"mappings":";;;;;
|
1
|
+
{"version":3,"sources":["index.js"],"sourcesContent":["export * from './coverTarget';\nexport * from './flip';\nexport * from './intersecting';\nexport * from './maxSize';\nexport * from './offset';\nexport * from './shift';\n"],"names":[],"mappings":";;;;;uBAAc;uBACA;uBACA;uBACA;uBACA;uBACA"}
|
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
});
|
5
5
|
Object.defineProperty(exports, "intersecting", {
|
6
6
|
enumerable: true,
|
7
|
-
get: ()
|
7
|
+
get: function() {
|
8
|
+
return intersecting;
|
9
|
+
}
|
8
10
|
});
|
9
11
|
const _dom = require("@floating-ui/dom");
|
10
12
|
function intersecting() {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["intersecting.js"],"sourcesContent":["import { detectOverflow } from '@floating-ui/dom';\nexport function intersecting() {\n return {\n name: 'intersectionObserver',\n fn: async (middlewareArguments)=>{\n const floatingRect = middlewareArguments.rects.floating;\n const altOverflow = await detectOverflow(middlewareArguments, {\n altBoundary: true\n });\n const isIntersectingTop = altOverflow.top < floatingRect.height && altOverflow.top > 0;\n const isIntersectingBottom = altOverflow.bottom < floatingRect.height && altOverflow.bottom > 0;\n const isIntersecting = isIntersectingTop || isIntersectingBottom;\n return {\n data: {\n intersecting: isIntersecting\n }\n };\n }\n };\n}\n"],"names":["intersecting","name","fn","middlewareArguments","floatingRect","rects","floating","altOverflow","detectOverflow","altBoundary","isIntersectingTop","top","height","isIntersectingBottom","bottom","isIntersecting","data"],"mappings":";;;;+BACgBA
|
1
|
+
{"version":3,"sources":["intersecting.js"],"sourcesContent":["import { detectOverflow } from '@floating-ui/dom';\nexport function intersecting() {\n return {\n name: 'intersectionObserver',\n fn: async (middlewareArguments)=>{\n const floatingRect = middlewareArguments.rects.floating;\n const altOverflow = await detectOverflow(middlewareArguments, {\n altBoundary: true\n });\n const isIntersectingTop = altOverflow.top < floatingRect.height && altOverflow.top > 0;\n const isIntersectingBottom = altOverflow.bottom < floatingRect.height && altOverflow.bottom > 0;\n const isIntersecting = isIntersectingTop || isIntersectingBottom;\n return {\n data: {\n intersecting: isIntersecting\n }\n };\n }\n };\n}\n"],"names":["intersecting","name","fn","middlewareArguments","floatingRect","rects","floating","altOverflow","detectOverflow","altBoundary","isIntersectingTop","top","height","isIntersectingBottom","bottom","isIntersecting","data"],"mappings":";;;;+BACgBA;;;eAAAA;;;qBADe;AACxB,SAASA;IACZ,OAAO;QACHC,MAAM;QACNC,IAAI,OAAOC;YACP,MAAMC,eAAeD,oBAAoBE,KAAK,CAACC,QAAQ;YACvD,MAAMC,cAAc,MAAMC,IAAAA,mBAAc,EAACL,qBAAqB;gBAC1DM,aAAa;YACjB;YACA,MAAMC,oBAAoBH,YAAYI,GAAG,GAAGP,aAAaQ,MAAM,IAAIL,YAAYI,GAAG,GAAG;YACrF,MAAME,uBAAuBN,YAAYO,MAAM,GAAGV,aAAaQ,MAAM,IAAIL,YAAYO,MAAM,GAAG;YAC9F,MAAMC,iBAAiBL,qBAAqBG;YAC5C,OAAO;gBACHG,MAAM;oBACFhB,cAAce;gBAClB;YACJ;QACJ;IACJ;AACJ"}
|
@@ -9,20 +9,23 @@ function _export(target, all) {
|
|
9
9
|
});
|
10
10
|
}
|
11
11
|
_export(exports, {
|
12
|
-
resetMaxSize: ()
|
13
|
-
|
12
|
+
resetMaxSize: function() {
|
13
|
+
return resetMaxSize;
|
14
|
+
},
|
15
|
+
maxSize: function() {
|
16
|
+
return maxSize;
|
17
|
+
}
|
14
18
|
});
|
15
19
|
const _dom = require("@floating-ui/dom");
|
16
20
|
const _getBoundary = require("../utils/getBoundary");
|
17
|
-
const resetMaxSize = (autoSize)=>{
|
18
|
-
return {
|
21
|
+
const resetMaxSize = (autoSize)=>({
|
19
22
|
name: 'resetMaxSize',
|
20
|
-
fn ({ middlewareData
|
23
|
+
fn ({ middlewareData, elements }) {
|
21
24
|
var _middlewareData_resetMaxSize;
|
22
25
|
if ((_middlewareData_resetMaxSize = middlewareData.resetMaxSize) === null || _middlewareData_resetMaxSize === void 0 ? void 0 : _middlewareData_resetMaxSize.maxSizeAlreadyReset) {
|
23
26
|
return {};
|
24
27
|
}
|
25
|
-
const { applyMaxWidth
|
28
|
+
const { applyMaxWidth, applyMaxHeight } = autoSize;
|
26
29
|
if (applyMaxWidth) {
|
27
30
|
elements.floating.style.removeProperty('box-sizing');
|
28
31
|
elements.floating.style.removeProperty('max-width');
|
@@ -42,16 +45,15 @@ const resetMaxSize = (autoSize)=>{
|
|
42
45
|
}
|
43
46
|
};
|
44
47
|
}
|
45
|
-
};
|
46
|
-
};
|
48
|
+
});
|
47
49
|
function maxSize(autoSize, options) {
|
48
|
-
const { container
|
50
|
+
const { container, overflowBoundary } = options;
|
49
51
|
return (0, _dom.size)({
|
50
52
|
...overflowBoundary && {
|
51
53
|
altBoundary: true,
|
52
54
|
boundary: (0, _getBoundary.getBoundary)(container, overflowBoundary)
|
53
55
|
},
|
54
|
-
apply ({ availableHeight
|
56
|
+
apply ({ availableHeight, availableWidth, elements, rects }) {
|
55
57
|
const applyMaxSizeStyles = (apply, dimension, availableSize)=>{
|
56
58
|
if (!apply) {
|
57
59
|
return;
|
@@ -66,7 +68,7 @@ function maxSize(autoSize, options) {
|
|
66
68
|
}
|
67
69
|
}
|
68
70
|
};
|
69
|
-
const { applyMaxWidth
|
71
|
+
const { applyMaxWidth, applyMaxHeight } = autoSize;
|
70
72
|
applyMaxSizeStyles(applyMaxWidth, 'width', availableWidth);
|
71
73
|
applyMaxSizeStyles(applyMaxHeight, 'height', availableHeight);
|
72
74
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["maxSize.js"],"sourcesContent":["import { size } from '@floating-ui/dom';\nimport { getBoundary } from '../utils/getBoundary';\n/**\n * floating-ui `size` middleware uses floating element's height/width to calculate available height/width.\n * This middleware only runs once per lifecycle, resetting styles applied by maxSize from previous lifecycle.\n * Then floating element's original size is restored and `size` middleware can calculate available height/width correctly.\n */ export const resetMaxSize = (autoSize)=>{\n
|
1
|
+
{"version":3,"sources":["maxSize.js"],"sourcesContent":["import { size } from '@floating-ui/dom';\nimport { getBoundary } from '../utils/getBoundary';\n/**\n * floating-ui `size` middleware uses floating element's height/width to calculate available height/width.\n * This middleware only runs once per lifecycle, resetting styles applied by maxSize from previous lifecycle.\n * Then floating element's original size is restored and `size` middleware can calculate available height/width correctly.\n */ export const resetMaxSize = (autoSize)=>({\n name: 'resetMaxSize',\n fn ({ middlewareData, elements }) {\n var _middlewareData_resetMaxSize;\n if ((_middlewareData_resetMaxSize = middlewareData.resetMaxSize) === null || _middlewareData_resetMaxSize === void 0 ? void 0 : _middlewareData_resetMaxSize.maxSizeAlreadyReset) {\n return {};\n }\n const { applyMaxWidth, applyMaxHeight } = autoSize;\n if (applyMaxWidth) {\n elements.floating.style.removeProperty('box-sizing');\n elements.floating.style.removeProperty('max-width');\n elements.floating.style.removeProperty('width');\n }\n if (applyMaxHeight) {\n elements.floating.style.removeProperty('box-sizing');\n elements.floating.style.removeProperty('max-height');\n elements.floating.style.removeProperty('height');\n }\n return {\n data: {\n maxSizeAlreadyReset: true\n },\n reset: {\n rects: true\n }\n };\n }\n });\nexport function maxSize(autoSize, options) {\n const { container, overflowBoundary } = options;\n return size({\n ...overflowBoundary && {\n altBoundary: true,\n boundary: getBoundary(container, overflowBoundary)\n },\n apply ({ availableHeight, availableWidth, elements, rects }) {\n const applyMaxSizeStyles = (apply, dimension, availableSize)=>{\n if (!apply) {\n return;\n }\n elements.floating.style.setProperty('box-sizing', 'border-box');\n elements.floating.style.setProperty(`max-${dimension}`, `${availableSize}px`);\n if (rects.floating[dimension] > availableSize) {\n elements.floating.style.setProperty(dimension, `${availableSize}px`);\n const axis = dimension === 'width' ? 'x' : 'y';\n if (!elements.floating.style.getPropertyValue(`overflow-${axis}`)) {\n elements.floating.style.setProperty(`overflow-${axis}`, 'auto');\n }\n }\n };\n const { applyMaxWidth, applyMaxHeight } = autoSize;\n applyMaxSizeStyles(applyMaxWidth, 'width', availableWidth);\n applyMaxSizeStyles(applyMaxHeight, 'height', availableHeight);\n }\n });\n}\n"],"names":["resetMaxSize","maxSize","autoSize","name","fn","middlewareData","elements","_middlewareData_resetMaxSize","maxSizeAlreadyReset","applyMaxWidth","applyMaxHeight","floating","style","removeProperty","data","reset","rects","options","container","overflowBoundary","size","altBoundary","boundary","getBoundary","apply","availableHeight","availableWidth","applyMaxSizeStyles","dimension","availableSize","setProperty","axis","getPropertyValue"],"mappings":";;;;;;;;;;;IAMiBA,YAAY;eAAZA;;IA4BDC,OAAO;eAAPA;;;qBAlCK;6BACO;AAKjB,MAAMD,eAAe,CAACE,WAAY,CAAA;QACrCC,MAAM;QACNC,IAAI,EAAEC,cAAc,EAAEC,QAAQ,EAAE;YAC5B,IAAIC;YACJ,IAAI,AAACA,CAAAA,+BAA+BF,eAAeL,YAAY,AAAD,MAAO,QAAQO,iCAAiC,KAAK,IAAI,KAAK,IAAIA,6BAA6BC,mBAAmB,EAAE;gBAC9K,OAAO,CAAC;YACZ;YACA,MAAM,EAAEC,aAAa,EAAEC,cAAc,EAAE,GAAGR;YAC1C,IAAIO,eAAe;gBACfH,SAASK,QAAQ,CAACC,KAAK,CAACC,cAAc,CAAC;gBACvCP,SAASK,QAAQ,CAACC,KAAK,CAACC,cAAc,CAAC;gBACvCP,SAASK,QAAQ,CAACC,KAAK,CAACC,cAAc,CAAC;YAC3C;YACA,IAAIH,gBAAgB;gBAChBJ,SAASK,QAAQ,CAACC,KAAK,CAACC,cAAc,CAAC;gBACvCP,SAASK,QAAQ,CAACC,KAAK,CAACC,cAAc,CAAC;gBACvCP,SAASK,QAAQ,CAACC,KAAK,CAACC,cAAc,CAAC;YAC3C;YACA,OAAO;gBACHC,MAAM;oBACFN,qBAAqB;gB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Property(exports, "offset", {
|
6
6
|
enumerable: true,
|
7
|
-
get: ()
|
7
|
+
get: function() {
|
8
|
+
return offset;
|
9
|
+
}
|
8
10
|
});
|
9
11
|
const _dom = require("@floating-ui/dom");
|
10
12
|
const _getFloatingUIOffset = require("../utils/getFloatingUIOffset");
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["offset.js"],"sourcesContent":["import { offset as baseOffset } from '@floating-ui/dom';\nimport { getFloatingUIOffset } from '../utils/getFloatingUIOffset';\n/**\n * Wraps floating UI offset middleware to to transform offset value\n */ export function offset(offsetValue) {\n const floatingUIOffset = getFloatingUIOffset(offsetValue);\n return baseOffset(floatingUIOffset);\n}\n"],"names":["offset","offsetValue","floatingUIOffset","getFloatingUIOffset","baseOffset"],"mappings":";;;;+BAIoBA
|
1
|
+
{"version":3,"sources":["offset.js"],"sourcesContent":["import { offset as baseOffset } from '@floating-ui/dom';\nimport { getFloatingUIOffset } from '../utils/getFloatingUIOffset';\n/**\n * Wraps floating UI offset middleware to to transform offset value\n */ export function offset(offsetValue) {\n const floatingUIOffset = getFloatingUIOffset(offsetValue);\n return baseOffset(floatingUIOffset);\n}\n"],"names":["offset","offsetValue","floatingUIOffset","getFloatingUIOffset","baseOffset"],"mappings":";;;;+BAIoBA;;;eAAAA;;;qBAJiB;qCACD;AAGzB,SAASA,OAAOC,WAAW;IAClC,MAAMC,mBAAmBC,IAAAA,wCAAmB,EAACF;IAC7C,OAAOG,IAAAA,WAAU,EAACF;AACtB"}
|
@@ -4,12 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
});
|
5
5
|
Object.defineProperty(exports, "shift", {
|
6
6
|
enumerable: true,
|
7
|
-
get: ()
|
7
|
+
get: function() {
|
8
|
+
return shift;
|
9
|
+
}
|
8
10
|
});
|
9
11
|
const _dom = require("@floating-ui/dom");
|
10
12
|
const _index = require("../utils/index");
|
11
13
|
function shift(options) {
|
12
|
-
const { hasScrollableElement
|
14
|
+
const { hasScrollableElement, disableTether, overflowBoundary, container, overflowBoundaryPadding, isRtl } = options;
|
13
15
|
return (0, _dom.shift)({
|
14
16
|
...hasScrollableElement && {
|
15
17
|
boundary: 'clippingAncestors'
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["shift.js"],"sourcesContent":["import { shift as baseShift, limitShift } from '@floating-ui/dom';\nimport { getBoundary, toFloatingUIPadding } from '../utils/index';\n/**\n * Wraps the floating UI shift middleware for easier usage of our options\n */ export function shift(options) {\n const { hasScrollableElement
|
1
|
+
{"version":3,"sources":["shift.js"],"sourcesContent":["import { shift as baseShift, limitShift } from '@floating-ui/dom';\nimport { getBoundary, toFloatingUIPadding } from '../utils/index';\n/**\n * Wraps the floating UI shift middleware for easier usage of our options\n */ export function shift(options) {\n const { hasScrollableElement, disableTether, overflowBoundary, container, overflowBoundaryPadding, isRtl } = options;\n return baseShift({\n ...hasScrollableElement && {\n boundary: 'clippingAncestors'\n },\n ...disableTether && {\n crossAxis: disableTether === 'all',\n limiter: limitShift({\n crossAxis: disableTether !== 'all',\n mainAxis: false\n })\n },\n ...overflowBoundaryPadding && {\n padding: toFloatingUIPadding(overflowBoundaryPadding, isRtl)\n },\n ...overflowBoundary && {\n altBoundary: true,\n boundary: getBoundary(container, overflowBoundary)\n }\n });\n}\n"],"names":["shift","options","hasScrollableElement","disableTether","overflowBoundary","container","overflowBoundaryPadding","isRtl","baseShift","boundary","crossAxis","limiter","limitShift","mainAxis","padding","toFloatingUIPadding","altBoundary","getBoundary"],"mappings":";;;;+BAIoBA;;;eAAAA;;;qBAJ2B;uBACE;AAGtC,SAASA,MAAMC,OAAO;IAC7B,MAAM,EAAEC,oBAAoB,EAAEC,aAAa,EAAEC,gBAAgB,EAAEC,SAAS,EAAEC,uBAAuB,EAAEC,KAAK,EAAE,GAAGN;IAC7G,OAAOO,IAAAA,UAAS,EAAC;QACb,GAAGN,wBAAwB;YACvBO,UAAU;QACd,CAAC;QACD,GAAGN,iBAAiB;YAChBO,WAAWP,kBAAkB;YAC7BQ,SAASC,IAAAA,eAAU,EAAC;gBAChBF,WAAWP,kBAAkB;gBAC7BU,UAAU;YACd;QACJ,CAAC;QACD,GAAGP,2BAA2B;YAC1BQ,SAASC,IAAAA,0BAAmB,EAACT,yBAAyBC;QAC1D,CAAC;QACD,GAAGH,oBAAoB;YACnBY,aAAa;YACbP,UAAUQ,IAAAA,kBAAW,EAACZ,WAAWD;QACrC,CAAC;IACL;AACJ"}
|
package/lib-commonjs/types.js
CHANGED
@@ -2,5 +2,5 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
3
3
|
value: true
|
4
4
|
});
|
5
|
-
const
|
6
|
-
const _react = /*#__PURE__*/
|
5
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
6
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["types.js"],"sourcesContent":["import * as React from 'react';\n"],"names":[],"mappings":";;;;;
|
1
|
+
{"version":3,"sources":["types.js"],"sourcesContent":["import * as React from 'react';\n"],"names":[],"mappings":";;;;;iEAAuB"}
|
@@ -4,13 +4,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
});
|
5
5
|
Object.defineProperty(exports, "usePositioning", {
|
6
6
|
enumerable: true,
|
7
|
-
get: ()
|
7
|
+
get: function() {
|
8
|
+
return usePositioning;
|
9
|
+
}
|
8
10
|
});
|
9
|
-
const
|
11
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
10
12
|
const _dom = require("@floating-ui/dom");
|
11
|
-
const
|
12
|
-
const
|
13
|
-
const _react = /*#__PURE__*/
|
13
|
+
const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
|
14
|
+
const _reactutilities = require("@fluentui/react-utilities");
|
15
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
14
16
|
const _utils = require("./utils");
|
15
17
|
const _middleware = require("./middleware");
|
16
18
|
const _createPositionManager = require("./createPositionManager");
|
@@ -20,7 +22,7 @@ function usePositioning(options) {
|
|
20
22
|
const overrideTargetRef = _react.useRef(null);
|
21
23
|
const containerRef = _react.useRef(null);
|
22
24
|
const arrowRef = _react.useRef(null);
|
23
|
-
const { enabled =true
|
25
|
+
const { enabled = true } = options;
|
24
26
|
const resolvePositioningOptions = usePositioningOptions(options);
|
25
27
|
const updatePositionManager = _react.useCallback(()=>{
|
26
28
|
if (managerRef.current) {
|
@@ -29,7 +31,7 @@ function usePositioning(options) {
|
|
29
31
|
managerRef.current = null;
|
30
32
|
var _overrideTargetRef_current;
|
31
33
|
const target = (_overrideTargetRef_current = overrideTargetRef.current) !== null && _overrideTargetRef_current !== void 0 ? _overrideTargetRef_current : targetRef.current;
|
32
|
-
if (enabled && (0,
|
34
|
+
if (enabled && (0, _reactutilities.canUseDOM)() && target && containerRef.current) {
|
33
35
|
managerRef.current = (0, _createPositionManager.createPositionManager)({
|
34
36
|
container: containerRef.current,
|
35
37
|
target,
|
@@ -41,12 +43,11 @@ function usePositioning(options) {
|
|
41
43
|
enabled,
|
42
44
|
resolvePositioningOptions
|
43
45
|
]);
|
44
|
-
const setOverrideTarget = (0,
|
46
|
+
const setOverrideTarget = (0, _reactutilities.useEventCallback)((target)=>{
|
45
47
|
overrideTargetRef.current = target;
|
46
48
|
updatePositionManager();
|
47
49
|
});
|
48
|
-
_react.useImperativeHandle(options.positioningRef, ()=>{
|
49
|
-
return {
|
50
|
+
_react.useImperativeHandle(options.positioningRef, ()=>({
|
50
51
|
updatePosition: ()=>{
|
51
52
|
var _managerRef_current;
|
52
53
|
return (_managerRef_current = managerRef.current) === null || _managerRef_current === void 0 ? void 0 : _managerRef_current.updatePosition();
|
@@ -61,19 +62,18 @@ function usePositioning(options) {
|
|
61
62
|
}
|
62
63
|
setOverrideTarget(target);
|
63
64
|
}
|
64
|
-
}
|
65
|
-
}, [
|
65
|
+
}), [
|
66
66
|
options.target,
|
67
67
|
setOverrideTarget
|
68
68
|
]);
|
69
|
-
(0,
|
69
|
+
(0, _reactutilities.useIsomorphicLayoutEffect)(()=>{
|
70
70
|
var _options_target;
|
71
71
|
setOverrideTarget((_options_target = options.target) !== null && _options_target !== void 0 ? _options_target : null);
|
72
72
|
}, [
|
73
73
|
options.target,
|
74
74
|
setOverrideTarget
|
75
75
|
]);
|
76
|
-
(0,
|
76
|
+
(0, _reactutilities.useIsomorphicLayoutEffect)(()=>{
|
77
77
|
updatePositionManager();
|
78
78
|
}, [
|
79
79
|
updatePositionManager
|
@@ -142,8 +142,8 @@ function usePositioning(options) {
|
|
142
142
|
};
|
143
143
|
}
|
144
144
|
function usePositioningOptions(options) {
|
145
|
-
const { align
|
146
|
-
const { dir
|
145
|
+
const { align, arrowPadding, autoSize: rawAutoSize, coverTarget, flipBoundary, offset, overflowBoundary, pinned, position, unstable_disableTether: disableTether, positionFixed, strategy, overflowBoundaryPadding, fallbackPositions, useTransform } = options;
|
146
|
+
const { dir } = (0, _reactsharedcontexts.useFluent_unstable)();
|
147
147
|
const isRtl = dir === 'rtl';
|
148
148
|
const positionStrategy = (strategy !== null && strategy !== void 0 ? strategy : positionFixed) ? 'fixed' : 'absolute';
|
149
149
|
const autoSize = (0, _utils.normalizeAutoSize)(rawAutoSize);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["usePositioning.js"],"sourcesContent":["import { hide as hideMiddleware, arrow as arrowMiddleware } from '@floating-ui/dom';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { canUseDOM, useEventCallback, useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\nimport * as React from 'react';\nimport { useCallbackRef, toFloatingUIPlacement, hasAutofocusFilter, hasScrollParent, normalizeAutoSize } from './utils';\nimport { shift as shiftMiddleware, flip as flipMiddleware, coverTarget as coverTargetMiddleware, maxSize as maxSizeMiddleware, resetMaxSize as resetMaxSizeMiddleware, offset as offsetMiddleware, intersecting as intersectingMiddleware } from './middleware';\nimport { createPositionManager } from './createPositionManager';\n/**\n * @internal\n */ export function usePositioning(options) {\n const managerRef = React.useRef(null);\n const targetRef = React.useRef(null);\n const overrideTargetRef = React.useRef(null);\n const containerRef = React.useRef(null);\n const arrowRef = React.useRef(null);\n const { enabled =true } = options;\n const resolvePositioningOptions = usePositioningOptions(options);\n const updatePositionManager = React.useCallback(()=>{\n if (managerRef.current) {\n managerRef.current.dispose();\n }\n managerRef.current = null;\n var _overrideTargetRef_current;\n const target = (_overrideTargetRef_current = overrideTargetRef.current) !== null && _overrideTargetRef_current !== void 0 ? _overrideTargetRef_current : targetRef.current;\n if (enabled && canUseDOM() && target && containerRef.current) {\n managerRef.current = createPositionManager({\n container: containerRef.current,\n target,\n arrow: arrowRef.current,\n ...resolvePositioningOptions(containerRef.current, arrowRef.current)\n });\n }\n }, [\n enabled,\n resolvePositioningOptions\n ]);\n const setOverrideTarget = useEventCallback((target)=>{\n overrideTargetRef.current = target;\n updatePositionManager();\n });\n React.useImperativeHandle(options.positioningRef, ()=>{\n return {\n updatePosition: ()=>{\n var _managerRef_current;\n return (_managerRef_current = managerRef.current) === null || _managerRef_current === void 0 ? void 0 : _managerRef_current.updatePosition();\n },\n setTarget: (target)=>{\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 setOverrideTarget(target);\n }\n };\n }, [\n options.target,\n setOverrideTarget\n ]);\n useIsomorphicLayoutEffect(()=>{\n var _options_target;\n setOverrideTarget((_options_target = options.target) !== null && _options_target !== void 0 ? _options_target : null);\n }, [\n options.target,\n setOverrideTarget\n ]);\n useIsomorphicLayoutEffect(()=>{\n updatePositionManager();\n }, [\n updatePositionManager\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 var _contentNode_ownerDocument;\n const contentNode = containerRef.current;\n const treeWalker = (_contentNode_ownerDocument = contentNode.ownerDocument) === null || _contentNode_ownerDocument === void 0 ? void 0 : _contentNode_ownerDocument.createTreeWalker(contentNode, NodeFilter.SHOW_ELEMENT, {\n acceptNode: hasAutofocusFilter\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 '<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 // We run this check once, no need to add deps here\n // TODO: Should be rework to handle options.enabled and contentRef updates\n }, []);\n }\n const setTarget = useCallbackRef(null, (target)=>{\n if (targetRef.current !== target) {\n targetRef.current = target;\n updatePositionManager();\n }\n });\n const setContainer = useCallbackRef(null, (container)=>{\n if (containerRef.current !== container) {\n containerRef.current = container;\n updatePositionManager();\n }\n });\n const setArrow = useCallbackRef(null, (arrow)=>{\n if (arrowRef.current !== arrow) {\n arrowRef.current = arrow;\n updatePositionManager();\n }\n });\n // Let users use callback refs so they feel like 'normal' DOM refs\n return {\n targetRef: setTarget,\n containerRef: setContainer,\n arrowRef: setArrow\n };\n}\nfunction usePositioningOptions(options) {\n const { align , arrowPadding , autoSize: rawAutoSize , coverTarget , flipBoundary , offset , overflowBoundary , pinned , position , unstable_disableTether: disableTether , // eslint-disable-next-line deprecation/deprecation\n positionFixed , strategy , overflowBoundaryPadding , fallbackPositions , useTransform } = options;\n const { dir } = useFluent();\n const isRtl = dir === 'rtl';\n const positionStrategy = (strategy !== null && strategy !== void 0 ? strategy : positionFixed) ? 'fixed' : 'absolute';\n const autoSize = normalizeAutoSize(rawAutoSize);\n return React.useCallback((container, arrow)=>{\n const hasScrollableElement = hasScrollParent(container);\n const middleware = [\n autoSize && resetMaxSizeMiddleware(autoSize),\n offset && offsetMiddleware(offset),\n coverTarget && coverTargetMiddleware(),\n !pinned && flipMiddleware({\n container,\n flipBoundary,\n hasScrollableElement,\n isRtl,\n fallbackPositions\n }),\n shiftMiddleware({\n container,\n hasScrollableElement,\n overflowBoundary,\n disableTether,\n overflowBoundaryPadding,\n isRtl\n }),\n autoSize && maxSizeMiddleware(autoSize, {\n container,\n overflowBoundary\n }),\n intersectingMiddleware(),\n arrow && arrowMiddleware({\n element: arrow,\n padding: arrowPadding\n }),\n hideMiddleware({\n strategy: 'referenceHidden'\n }),\n hideMiddleware({\n strategy: 'escaped'\n })\n ].filter(Boolean);\n const placement = toFloatingUIPlacement(align, position, isRtl);\n return {\n placement,\n middleware,\n strategy: positionStrategy,\n useTransform\n };\n }, [\n align,\n arrowPadding,\n autoSize,\n coverTarget,\n disableTether,\n flipBoundary,\n isRtl,\n offset,\n overflowBoundary,\n pinned,\n position,\n positionStrategy,\n overflowBoundaryPadding,\n fallbackPositions,\n useTransform\n ]);\n}\n"],"names":["usePositioning","options","managerRef","React","useRef","targetRef","overrideTargetRef","containerRef","arrowRef","enabled","resolvePositioningOptions","usePositioningOptions","updatePositionManager","useCallback","current","dispose","_overrideTargetRef_current","target","canUseDOM","createPositionManager","container","arrow","setOverrideTarget","useEventCallback","useImperativeHandle","positioningRef","updatePosition","_managerRef_current","setTarget","process","env","NODE_ENV","err","Error","console","warn","stack","useIsomorphicLayoutEffect","_options_target","useEffect","_contentNode_ownerDocument","contentNode","treeWalker","ownerDocument","createTreeWalker","NodeFilter","SHOW_ELEMENT","acceptNode","hasAutofocusFilter","nextNode","node","currentNode","join","useCallbackRef","setContainer","setArrow","align","arrowPadding","autoSize","rawAutoSize","coverTarget","flipBoundary","offset","overflowBoundary","pinned","position","unstable_disableTether","disableTether","positionFixed","strategy","overflowBoundaryPadding","fallbackPositions","useTransform","dir","useFluent","isRtl","positionStrategy","normalizeAutoSize","hasScrollableElement","hasScrollParent","middleware","resetMaxSizeMiddleware","offsetMiddleware","coverTargetMiddleware","flipMiddleware","shiftMiddleware","maxSizeMiddleware","intersectingMiddleware","arrowMiddleware","element","padding","hideMiddleware","filter","Boolean","placement","toFloatingUIPlacement"],"mappings":";;;;+BASoBA;;aAAAA;;;qBAT6C;qCACjB;gCACuB;6DAChD;uBACuF;4BACmI;uCAC3M;AAG3B,SAASA,eAAeC,OAAO,EAAE;IACxC,MAAMC,aAAaC,OAAMC,MAAM,CAAC,IAAI;IACpC,MAAMC,YAAYF,OAAMC,MAAM,CAAC,IAAI;IACnC,MAAME,oBAAoBH,OAAMC,MAAM,CAAC,IAAI;IAC3C,MAAMG,eAAeJ,OAAMC,MAAM,CAAC,IAAI;IACtC,MAAMI,WAAWL,OAAMC,MAAM,CAAC,IAAI;IAClC,MAAM,EAAEK,SAAS,IAAI,CAAA,EAAG,GAAGR;IAC3B,MAAMS,4BAA4BC,sBAAsBV;IACxD,MAAMW,wBAAwBT,OAAMU,WAAW,CAAC,IAAI;QAChD,IAAIX,WAAWY,OAAO,EAAE;YACpBZ,WAAWY,OAAO,CAACC,OAAO;QAC9B,CAAC;QACDb,WAAWY,OAAO,GAAG,IAAI;QACzB,IAAIE;QACJ,MAAMC,SAAS,AAACD,CAAAA,6BAA6BV,kBAAkBQ,OAAO,AAAD,MAAO,IAAI,I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ACTqE,SAASjC;YACb;YACAkC,IAAAA,SAAc,EAAC;gBACXtB,UAAU;YACd;YACAsB,IAAAA,SAAc,EAAC;gBACXtB,UAAU;YACd;SACH,CAACuB,MAAM,CAACC;QACT,MAAMC,YAAYC,IAAAA,4BAAqB,EAACvC,OAAOS,UAAUU;QACzD,OAAO;YACHmB;YACAd;YACAX,UAAUO;YACVJ;QACJ;IACJ,GAAG;QACChB;QACAC;QACAC;QACAE;QACAO;QACAN;QACAc;QACAb;QACAC;QACAC;QACAC;QACAW;QACAN;QACAC;QACAC;KACH;AACL"}
|
1
|
+
{"version":3,"sources":["usePositioning.js"],"sourcesContent":["import { hide as hideMiddleware, arrow as arrowMiddleware } from '@floating-ui/dom';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { canUseDOM, useEventCallback, useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\nimport * as React from 'react';\nimport { useCallbackRef, toFloatingUIPlacement, hasAutofocusFilter, hasScrollParent, normalizeAutoSize } from './utils';\nimport { shift as shiftMiddleware, flip as flipMiddleware, coverTarget as coverTargetMiddleware, maxSize as maxSizeMiddleware, resetMaxSize as resetMaxSizeMiddleware, offset as offsetMiddleware, intersecting as intersectingMiddleware } from './middleware';\nimport { createPositionManager } from './createPositionManager';\n/**\n * @internal\n */ export function usePositioning(options) {\n const managerRef = React.useRef(null);\n const targetRef = React.useRef(null);\n const overrideTargetRef = React.useRef(null);\n const containerRef = React.useRef(null);\n const arrowRef = React.useRef(null);\n const { enabled = true } = options;\n const resolvePositioningOptions = usePositioningOptions(options);\n const updatePositionManager = React.useCallback(()=>{\n if (managerRef.current) {\n managerRef.current.dispose();\n }\n managerRef.current = null;\n var _overrideTargetRef_current;\n const target = (_overrideTargetRef_current = overrideTargetRef.current) !== null && _overrideTargetRef_current !== void 0 ? _overrideTargetRef_current : targetRef.current;\n if (enabled && canUseDOM() && target && containerRef.current) {\n managerRef.current = createPositionManager({\n container: containerRef.current,\n target,\n arrow: arrowRef.current,\n ...resolvePositioningOptions(containerRef.current, arrowRef.current)\n });\n }\n }, [\n enabled,\n resolvePositioningOptions\n ]);\n const setOverrideTarget = useEventCallback((target)=>{\n overrideTargetRef.current = target;\n updatePositionManager();\n });\n React.useImperativeHandle(options.positioningRef, ()=>({\n updatePosition: ()=>{\n var _managerRef_current;\n return (_managerRef_current = managerRef.current) === null || _managerRef_current === void 0 ? void 0 : _managerRef_current.updatePosition();\n },\n setTarget: (target)=>{\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 setOverrideTarget(target);\n }\n }), [\n options.target,\n setOverrideTarget\n ]);\n useIsomorphicLayoutEffect(()=>{\n var _options_target;\n setOverrideTarget((_options_target = options.target) !== null && _options_target !== void 0 ? _options_target : null);\n }, [\n options.target,\n setOverrideTarget\n ]);\n useIsomorphicLayoutEffect(()=>{\n updatePositionManager();\n }, [\n updatePositionManager\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 var _contentNode_ownerDocument;\n const contentNode = containerRef.current;\n const treeWalker = (_contentNode_ownerDocument = contentNode.ownerDocument) === null || _contentNode_ownerDocument === void 0 ? void 0 : _contentNode_ownerDocument.createTreeWalker(contentNode, NodeFilter.SHOW_ELEMENT, {\n acceptNode: hasAutofocusFilter\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 '<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 // We run this check once, no need to add deps here\n // TODO: Should be rework to handle options.enabled and contentRef updates\n }, []);\n }\n const setTarget = useCallbackRef(null, (target)=>{\n if (targetRef.current !== target) {\n targetRef.current = target;\n updatePositionManager();\n }\n });\n const setContainer = useCallbackRef(null, (container)=>{\n if (containerRef.current !== container) {\n containerRef.current = container;\n updatePositionManager();\n }\n });\n const setArrow = useCallbackRef(null, (arrow)=>{\n if (arrowRef.current !== arrow) {\n arrowRef.current = arrow;\n updatePositionManager();\n }\n });\n // Let users use callback refs so they feel like 'normal' DOM refs\n return {\n targetRef: setTarget,\n containerRef: setContainer,\n arrowRef: setArrow\n };\n}\nfunction usePositioningOptions(options) {\n const { align, arrowPadding, autoSize: rawAutoSize, coverTarget, flipBoundary, offset, overflowBoundary, pinned, position, unstable_disableTether: disableTether, // eslint-disable-next-line deprecation/deprecation\n positionFixed, strategy, overflowBoundaryPadding, fallbackPositions, useTransform } = options;\n const { dir } = useFluent();\n const isRtl = dir === 'rtl';\n const positionStrategy = (strategy !== null && strategy !== void 0 ? strategy : positionFixed) ? 'fixed' : 'absolute';\n const autoSize = normalizeAutoSize(rawAutoSize);\n return React.useCallback((container, arrow)=>{\n const hasScrollableElement = hasScrollParent(container);\n const middleware = [\n autoSize && resetMaxSizeMiddleware(autoSize),\n offset && offsetMiddleware(offset),\n coverTarget && coverTargetMiddleware(),\n !pinned && flipMiddleware({\n container,\n flipBoundary,\n hasScrollableElement,\n isRtl,\n fallbackPositions\n }),\n shiftMiddleware({\n container,\n hasScrollableElement,\n overflowBoundary,\n disableTether,\n overflowBoundaryPadding,\n isRtl\n }),\n autoSize && maxSizeMiddleware(autoSize, {\n container,\n overflowBoundary\n }),\n intersectingMiddleware(),\n arrow && arrowMiddleware({\n element: arrow,\n padding: arrowPadding\n }),\n hideMiddleware({\n strategy: 'referenceHidden'\n }),\n hideMiddleware({\n strategy: 'escaped'\n })\n ].filter(Boolean);\n const placement = toFloatingUIPlacement(align, position, isRtl);\n return {\n placement,\n middleware,\n strategy: positionStrategy,\n useTransform\n };\n }, [\n align,\n arrowPadding,\n autoSize,\n coverTarget,\n disableTether,\n flipBoundary,\n isRtl,\n offset,\n overflowBoundary,\n pinned,\n position,\n positionStrategy,\n overflowBoundaryPadding,\n fallbackPositions,\n useTransform\n ]);\n}\n"],"names":["usePositioning","options","managerRef","React","useRef","targetRef","overrideTargetRef","containerRef","arrowRef","enabled","resolvePositioningOptions","usePositioningOptions","updatePositionManager","useCallback","current","dispose","_overrideTargetRef_current","target","canUseDOM","createPositionManager","container","arrow","setOverrideTarget","useEventCallback","useImperativeHandle","positioningRef","updatePosition","_managerRef_current","setTarget","process","env","NODE_ENV","err","Error","console","warn","stack","useIsomorphicLayoutEffect","_options_target","useEffect","_contentNode_ownerDocument","contentNode","treeWalker","ownerDocument","createTreeWalker","NodeFilter","SHOW_ELEMENT","acceptNode","hasAutofocusFilter","nextNode","node","currentNode","join","useCallbackRef","setContainer","setArrow","align","arrowPadding","autoSize","rawAutoSize","coverTarget","flipBoundary","offset","overflowBoundary","pinned","position","unstable_disableTether","disableTether","positionFixed","strategy","overflowBoundaryPadding","fallbackPositions","useTransform","dir","useFluent","isRtl","positionStrategy","normalizeAutoSize","hasScrollableElement","hasScrollParent","middleware","resetMaxSizeMiddleware","offsetMiddleware","coverTargetMiddleware","flipMiddleware","shiftMiddleware","maxSizeMiddleware","intersectingMiddleware","arrowMiddleware","element","padding","hideMiddleware","filter","Boolean","placement","toFloatingUIPlacement"],"mappings":";;;;+BASoBA;;;eAAAA;;;;qBAT6C;qCACjB;gCACuB;iEAChD;uBACuF;4BACmI;uCAC3M;AAG3B,SAASA,eAAeC,OAAO;IACtC,MAAMC,aAAaC,OAAMC,MAAM,CAAC;IAChC,MAAMC,YAAYF,OAAMC,MAAM,CAAC;IAC/B,MAAME,oBAAoBH,OAAMC,MAAM,CAAC;IACvC,MAAMG,eAAeJ,OAAMC,MAAM,CAAC;IAClC,MAAMI,WAAWL,OAAMC,MAAM,CAAC;IAC9B,MAAM,EAAEK,UAAU,IAAI,EAAE,GAAGR;IAC3B,MAAMS,4BAA4BC,sBAAsBV;IACxD,MAAMW,wBAAwBT,OAAMU,WAAW,CAAC;QAC5C,IAAIX,WAAWY,OAAO,EAAE;YACpBZ,WAAWY,OAAO,CAACC,OAAO;QAC9B;QACAb,WAAWY,OAAO,GAAG;QACrB,IAAIE;QACJ,MAAMC,SAAS,AAACD,CAAAA,6BAA6BV,kBAAkBQ,OAAO,AAAD,MAAO,QAAQE,+BAA+B,KAAK,IAAIA,6BAA6BX,UAAUS,OAAO;QAC1K,IAAIL,WAAWS,IAAAA,yBAAS,OAAMD,UAAUV,aAAaO,OAAO,EAAE;YAC1DZ,WAAWY,OAAO,GAAGK,IAAAA,4CAAqB,EAAC;gBACvCC,WAAWb,aAAaO,OAAO;gBAC/BG;gBACAI,OAAOb,SAASM,OAAO;gBACvB,GAAGJ,0BAA0BH,aAAaO,OAAO,EAAEN,SAASM,OAAO,CAAC;YACxE;QACJ;IACJ,GAAG;QACCL;QACAC;KACH;IACD,MAAMY,oBAAoBC,IAAAA,gCAAgB,EAAC,CAACN;QACxCX,kBAAkBQ,OAAO,GAAGG;QAC5BL;IACJ;IACAT,OAAMqB,mBAAmB,CAACvB,QAAQwB,cAAc,EAAE,IAAK,CAAA;YAC/CC,gBAAgB;gBACZ,IA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MU,WAAW,CAAC,CAACO,WAAWC;QACjC,MAAMyD,uBAAuBC,IAAAA,sBAAe,EAAC3D;QAC7C,MAAM4D,aAAa;YACftB,YAAYuB,IAAAA,wBAAsB,EAACvB;YACnCI,UAAUoB,IAAAA,kBAAgB,EAACpB;YAC3BF,eAAeuB,IAAAA,uBAAqB;YACpC,CAACnB,UAAUoB,IAAAA,gBAAc,EAAC;gBACtBhE;gBACAyC;gBACAiB;gBACAH;gBACAJ;YACJ;YACAc,IAAAA,iBAAe,EAAC;gBACZjE;gBACA0D;gBACAf;gBACAI;gBACAG;gBACAK;YACJ;YACAjB,YAAY4B,IAAAA,mBAAiB,EAAC5B,UAAU;gBACpCtC;gBACA2C;YACJ;YACAwB,IAAAA,wBAAsB;YACtBlE,SAASmE,IAAAA,UAAe,EAAC;gBACrBC,SAASpE;gBACTqE,SAASjC;YACb;YACAkC,IAAAA,SAAc,EAAC;gBACXtB,UAAU;YACd;YACAsB,IAAAA,SAAc,EAAC;gBACXtB,UAAU;YACd;SACH,CAACuB,MAAM,CAACC;QACT,MAAMC,YAAYC,IAAAA,4BAAqB,EAACvC,OAAOS,UAAUU;QACzD,OAAO;YACHmB;YACAd;YACAX,UAAUO;YACVJ;QACJ;IACJ,GAAG;QACChB;QACAC;QACAC;QACAE;QACAO;QACAN;QACAc;QACAb;QACAC;QACAC;QACAC;QACAW;QACAN;QACAC;QACAC;KACH;AACL"}
|
@@ -4,10 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
});
|
5
5
|
Object.defineProperty(exports, "usePositioningMouseTarget", {
|
6
6
|
enumerable: true,
|
7
|
-
get: ()
|
7
|
+
get: function() {
|
8
|
+
return usePositioningMouseTarget;
|
9
|
+
}
|
8
10
|
});
|
9
|
-
const
|
10
|
-
const _react = /*#__PURE__*/
|
11
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
12
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
11
13
|
const _createVirtualElementFromClick = require("./createVirtualElementFromClick");
|
12
14
|
const usePositioningMouseTarget = (initialState)=>{
|
13
15
|
const [virtualElement, setVirtualElement] = _react.useState(initialState);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["usePositioningMouseTarget.js"],"sourcesContent":["import * as React from 'react';\nimport { createVirtualElementFromClick } from './createVirtualElementFromClick';\n/**\n * @internal\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 */ export const usePositioningMouseTarget = (initialState)=>{\n const [virtualElement, setVirtualElement] = React.useState(initialState);\n const setVirtualMouseTarget = (event)=>{\n if (event === undefined || event === null) {\n setVirtualElement(undefined);\n return;\n }\n let mouseevent;\n if (!(event instanceof MouseEvent)) {\n mouseevent = event.nativeEvent;\n } else {\n mouseevent = event;\n }\n if (!(mouseevent instanceof MouseEvent) && process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.error('usePositioningMouseTarget should only be used with MouseEvent');\n }\n const contextTarget = createVirtualElementFromClick(mouseevent);\n setVirtualElement(contextTarget);\n };\n return [\n virtualElement,\n setVirtualMouseTarget\n ];\n};\n"],"names":["usePositioningMouseTarget","initialState","virtualElement","setVirtualElement","React","useState","setVirtualMouseTarget","event","undefined","mouseevent","MouseEvent","nativeEvent","process","env","NODE_ENV","console","error","contextTarget","createVirtualElementFromClick"],"mappings":";;;;+BAUiBA
|
1
|
+
{"version":3,"sources":["usePositioningMouseTarget.js"],"sourcesContent":["import * as React from 'react';\nimport { createVirtualElementFromClick } from './createVirtualElementFromClick';\n/**\n * @internal\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 */ export const usePositioningMouseTarget = (initialState)=>{\n const [virtualElement, setVirtualElement] = React.useState(initialState);\n const setVirtualMouseTarget = (event)=>{\n if (event === undefined || event === null) {\n setVirtualElement(undefined);\n return;\n }\n let mouseevent;\n if (!(event instanceof MouseEvent)) {\n mouseevent = event.nativeEvent;\n } else {\n mouseevent = event;\n }\n if (!(mouseevent instanceof MouseEvent) && process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.error('usePositioningMouseTarget should only be used with MouseEvent');\n }\n const contextTarget = createVirtualElementFromClick(mouseevent);\n setVirtualElement(contextTarget);\n };\n return [\n virtualElement,\n setVirtualMouseTarget\n ];\n};\n"],"names":["usePositioningMouseTarget","initialState","virtualElement","setVirtualElement","React","useState","setVirtualMouseTarget","event","undefined","mouseevent","MouseEvent","nativeEvent","process","env","NODE_ENV","console","error","contextTarget","createVirtualElementFromClick"],"mappings":";;;;+BAUiBA;;;eAAAA;;;;iEAVM;+CACuB;AASnC,MAAMA,4BAA4B,CAACC;IAC1C,MAAM,CAACC,gBAAgBC,kBAAkB,GAAGC,OAAMC,QAAQ,CAACJ;IAC3D,MAAMK,wBAAwB,CAACC;QAC3B,IAAIA,UAAUC,aAAaD,UAAU,MAAM;YACvCJ,kBAAkBK;YAClB;QACJ;QACA,IAAIC;QACJ,IAAI,CAAEF,CAAAA,iBAAiBG,UAAS,GAAI;YAChCD,aAAaF,MAAMI,WAAW;QAClC,OAAO;YACHF,aAAaF;QACjB;QACA,IAAI,CAAEE,CAAAA,sBAAsBC,UAAS,KAAME,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;YAC9E,sCAAsC;YACtCC,QAAQC,KAAK,CAAC;QAClB;QACA,MAAMC,gBAAgBC,IAAAA,4DAA6B,EAACT;QACpDN,kBAAkBc;IACtB;IACA,OAAO;QACHf;QACAI;KACH;AACL"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["debounce.js"],"sourcesContent":["/**\n * Promise microtask debouncer used by Popper.js v2\n * This is no longer exported in Floating UI (Popper.js v3)\n * https://github.com/floating-ui/floating-ui/blob/v2.x/src/utils/debounce.js\n * @param fn function that will be debounced\n */ export function debounce(fn) {\n let pending;\n return ()=>{\n if (!pending) {\n pending = new Promise((resolve)=>{\n Promise.resolve().then(()=>{\n pending = undefined;\n resolve(fn());\n });\n });\n }\n return pending;\n };\n}\n"],"names":["debounce","fn","pending","Promise","resolve","then","undefined"],"mappings":"AAAA;;;;;CAKC;;;;+BAAmBA
|
1
|
+
{"version":3,"sources":["debounce.js"],"sourcesContent":["/**\n * Promise microtask debouncer used by Popper.js v2\n * This is no longer exported in Floating UI (Popper.js v3)\n * https://github.com/floating-ui/floating-ui/blob/v2.x/src/utils/debounce.js\n * @param fn function that will be debounced\n */ export function debounce(fn) {\n let pending;\n return ()=>{\n if (!pending) {\n pending = new Promise((resolve)=>{\n Promise.resolve().then(()=>{\n pending = undefined;\n resolve(fn());\n });\n });\n }\n return pending;\n };\n}\n"],"names":["debounce","fn","pending","Promise","resolve","then","undefined"],"mappings":"AAAA;;;;;CAKC;;;;+BAAmBA;;;eAAAA;;;AAAT,SAASA,SAASC,EAAE;IAC3B,IAAIC;IACJ,OAAO;QACH,IAAI,CAACA,SAAS;YACVA,UAAU,IAAIC,QAAQ,CAACC;gBACnBD,QAAQC,OAAO,GAAGC,IAAI,CAAC;oBACnBH,UAAUI;oBACVF,QAAQH;gBACZ;YACJ;QACJ;QACA,OAAOC;IACX;AACJ"}
|
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
});
|
5
5
|
Object.defineProperty(exports, "fromFloatingUIPlacement", {
|
6
6
|
enumerable: true,
|
7
|
-
get: ()
|
7
|
+
get: function() {
|
8
|
+
return fromFloatingUIPlacement;
|
9
|
+
}
|
8
10
|
});
|
9
11
|
const _parseFloatingUIPlacement = require("./parseFloatingUIPlacement");
|
10
12
|
const getPositionMap = ()=>({
|
@@ -28,7 +30,7 @@ const getAlignmentMap = (position)=>{
|
|
28
30
|
};
|
29
31
|
};
|
30
32
|
const fromFloatingUIPlacement = (placement)=>{
|
31
|
-
const { side
|
33
|
+
const { side, alignment: floatingUIAlignment } = (0, _parseFloatingUIPlacement.parseFloatingUIPlacement)(placement);
|
32
34
|
const position = getPositionMap()[side];
|
33
35
|
const alignment = floatingUIAlignment && getAlignmentMap(position)[floatingUIAlignment];
|
34
36
|
return {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["fromFloatingUIPlacement.js"],"sourcesContent":["import { parseFloatingUIPlacement } from './parseFloatingUIPlacement';\nconst getPositionMap = ()=>({\n top: 'above',\n bottom: 'below',\n right: 'after',\n left: 'before'\n });\n// Floating UI automatically flips alignment\n// https://github.com/floating-ui/floating-ui/issues/1563\nconst getAlignmentMap = (position)=>{\n if (position === 'above' || position === 'below') {\n return {\n start: 'start',\n end: 'end'\n };\n }\n return {\n start: 'top',\n end: 'bottom'\n };\n};\n/**\n * Maps Floating UI placement to positioning values\n * @see positioningHelper.test.ts for expected placement values\n */ export const fromFloatingUIPlacement = (placement)=>{\n const { side
|
1
|
+
{"version":3,"sources":["fromFloatingUIPlacement.js"],"sourcesContent":["import { parseFloatingUIPlacement } from './parseFloatingUIPlacement';\nconst getPositionMap = ()=>({\n top: 'above',\n bottom: 'below',\n right: 'after',\n left: 'before'\n });\n// Floating UI automatically flips alignment\n// https://github.com/floating-ui/floating-ui/issues/1563\nconst getAlignmentMap = (position)=>{\n if (position === 'above' || position === 'below') {\n return {\n start: 'start',\n end: 'end'\n };\n }\n return {\n start: 'top',\n end: 'bottom'\n };\n};\n/**\n * Maps Floating UI placement to positioning values\n * @see positioningHelper.test.ts for expected placement values\n */ export const fromFloatingUIPlacement = (placement)=>{\n const { side, alignment: floatingUIAlignment } = parseFloatingUIPlacement(placement);\n const position = getPositionMap()[side];\n const alignment = floatingUIAlignment && getAlignmentMap(position)[floatingUIAlignment];\n return {\n position,\n alignment\n };\n};\n"],"names":["fromFloatingUIPlacement","getPositionMap","top","bottom","right","left","getAlignmentMap","position","start","end","placement","side","alignment","floatingUIAlignment","parseFloatingUIPlacement"],"mappings":";;;;+BAwBiBA;;;eAAAA;;;0CAxBwB;AACzC,MAAMC,iBAAiB,IAAK,CAAA;QACpBC,KAAK;QACLC,QAAQ;QACRC,OAAO;QACPC,MAAM;IACV,CAAA;AACJ,4CAA4C;AAC5C,yDAAyD;AACzD,MAAMC,kBAAkB,CAACC;IACrB,IAAIA,aAAa,WAAWA,aAAa,SAAS;QAC9C,OAAO;YACHC,OAAO;YACPC,KAAK;QACT;IACJ;IACA,OAAO;QACHD,OAAO;QACPC,KAAK;IACT;AACJ;AAIW,MAAMT,0BAA0B,CAACU;IACxC,MAAM,EAAEC,IAAI,EAAEC,WAAWC,mBAAmB,EAAE,GAAGC,IAAAA,kDAAwB,EAACJ;IAC1E,MAAMH,WAAWN,gBAAgB,CAACU,KAAK;IACvC,MAAMC,YAAYC,uBAAuBP,gBAAgBC,SAAS,CAACM,oBAAoB;IACvF,OAAO;QACHN;QACAK;IACJ;AACJ"}
|
@@ -4,12 +4,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
});
|
5
5
|
Object.defineProperty(exports, "getBoundary", {
|
6
6
|
enumerable: true,
|
7
|
-
get: ()
|
7
|
+
get: function() {
|
8
|
+
return getBoundary;
|
9
|
+
}
|
8
10
|
});
|
9
11
|
const _getScrollParent = require("./getScrollParent");
|
10
12
|
function getBoundary(element, boundary) {
|
11
13
|
if (boundary === 'window') {
|
12
|
-
|
14
|
+
var _element;
|
15
|
+
return (_element = element) === null || _element === void 0 ? void 0 : _element.ownerDocument.documentElement;
|
13
16
|
}
|
14
17
|
if (boundary === 'clippingParents') {
|
15
18
|
return 'clippingAncestors';
|
@@ -17,7 +20,8 @@ function getBoundary(element, boundary) {
|
|
17
20
|
if (boundary === 'scrollParent') {
|
18
21
|
let boundariesNode = (0, _getScrollParent.getScrollParent)(element);
|
19
22
|
if (boundariesNode.nodeName === 'BODY') {
|
20
|
-
|
23
|
+
var _element1;
|
24
|
+
boundariesNode = (_element1 = element) === null || _element1 === void 0 ? void 0 : _element1.ownerDocument.documentElement;
|
21
25
|
}
|
22
26
|
return boundariesNode;
|
23
27
|
}
|