@fluentui/react-positioning 9.75.1-experimental.positioning-engine.20261103-19efe125d1.0 → 9.75.2-experimental.css-modules.20261113-ba13c87438.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -7
- package/README.md +7 -130
- package/lib/Arrow.module.css +43 -0
- package/lib/PositioningConfigurationContext.js +2 -1
- package/lib/PositioningConfigurationContext.js.map +1 -1
- package/lib/createPositionManager.js +82 -74
- package/lib/createPositionManager.js.map +1 -1
- package/lib/hooks/useSafeZoneArea/SafeZoneArea.module.css +26 -0
- package/lib/hooks/useSafeZoneArea/SafeZoneArea.styles.css.js +9 -0
- package/lib/hooks/useSafeZoneArea/SafeZoneArea.styles.css.js.map +1 -0
- package/lib/hooks/useSafeZoneArea/SafeZoneArea.styles.raw.css.js +9 -0
- package/lib/hooks/useSafeZoneArea/SafeZoneArea.styles.raw.css.js.map +1 -0
- package/lib/middleware/flip.js +1 -1
- package/lib/middleware/flip.js.map +1 -1
- package/lib/middleware/intersecting.js +1 -1
- package/lib/middleware/intersecting.js.map +1 -1
- package/lib/middleware/maxSize.js +1 -1
- package/lib/middleware/maxSize.js.map +1 -1
- package/lib/middleware/offset.js +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 +48 -38
- package/lib/usePositioning.js.map +1 -1
- package/lib/usePositioningOptions.js +117 -25
- package/lib/usePositioningOptions.js.map +1 -1
- package/lib/utils/createResizeObserver.js +2 -2
- package/lib/utils/createResizeObserver.js.map +1 -1
- package/lib/utils/debounce.js +13 -6
- package/lib/utils/debounce.js.map +1 -1
- package/lib/utils/fromFloatingUIPlacement.js +29 -10
- package/lib/utils/fromFloatingUIPlacement.js.map +1 -1
- package/lib/utils/getBoundary.js +17 -8
- package/lib/utils/getBoundary.js.map +1 -1
- package/lib/utils/index.js +2 -0
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/listScrollParents.js +20 -12
- package/lib/utils/listScrollParents.js.map +1 -1
- package/lib/utils/normalizeAutoSize.js +22 -15
- package/lib/utils/normalizeAutoSize.js.map +1 -1
- package/lib/utils/toFloatingUIPlacement.js +26 -9
- package/lib/utils/toFloatingUIPlacement.js.map +1 -1
- package/lib/utils/useCallbackRef.js +10 -1
- package/lib/utils/useCallbackRef.js.map +1 -1
- package/lib/utils/writeArrowUpdates.js +13 -0
- package/lib/utils/writeArrowUpdates.js.map +1 -0
- package/lib/utils/writeContainerupdates.js +43 -0
- package/lib/utils/writeContainerupdates.js.map +1 -0
- package/lib-commonjs/Arrow.module.css +43 -0
- package/lib-commonjs/PositioningConfigurationContext.cjs +2 -1
- package/lib-commonjs/PositioningConfigurationContext.cjs.map +1 -1
- package/lib-commonjs/createPositionManager.cjs +80 -72
- package/lib-commonjs/createPositionManager.cjs.map +1 -1
- package/lib-commonjs/hooks/useSafeZoneArea/SafeZoneArea.module.css +26 -0
- package/lib-commonjs/hooks/useSafeZoneArea/SafeZoneArea.styles.css.cjs +20 -0
- package/lib-commonjs/hooks/useSafeZoneArea/SafeZoneArea.styles.css.cjs.map +1 -0
- package/lib-commonjs/hooks/useSafeZoneArea/SafeZoneArea.styles.raw.css.cjs +20 -0
- package/lib-commonjs/hooks/useSafeZoneArea/SafeZoneArea.styles.raw.css.cjs.map +1 -0
- package/lib-commonjs/middleware/flip.cjs +6 -6
- package/lib-commonjs/middleware/flip.cjs.map +1 -1
- package/lib-commonjs/middleware/intersecting.cjs +2 -2
- package/lib-commonjs/middleware/intersecting.cjs.map +1 -1
- package/lib-commonjs/middleware/maxSize.cjs +4 -4
- package/lib-commonjs/middleware/maxSize.cjs.map +1 -1
- package/lib-commonjs/middleware/offset.cjs +2 -2
- package/lib-commonjs/middleware/offset.cjs.map +1 -1
- package/lib-commonjs/middleware/shift.cjs +7 -7
- package/lib-commonjs/middleware/shift.cjs.map +1 -1
- package/lib-commonjs/usePositioning.cjs +46 -37
- package/lib-commonjs/usePositioning.cjs.map +1 -1
- package/lib-commonjs/usePositioningOptions.cjs +112 -24
- package/lib-commonjs/usePositioningOptions.cjs.map +1 -1
- package/lib-commonjs/utils/createResizeObserver.cjs +2 -2
- package/lib-commonjs/utils/createResizeObserver.cjs.map +1 -1
- package/lib-commonjs/utils/debounce.cjs +13 -6
- package/lib-commonjs/utils/debounce.cjs.map +1 -1
- package/lib-commonjs/utils/fromFloatingUIPlacement.cjs +32 -21
- package/lib-commonjs/utils/fromFloatingUIPlacement.cjs.map +1 -1
- package/lib-commonjs/utils/getBoundary.cjs +17 -8
- package/lib-commonjs/utils/getBoundary.cjs.map +1 -1
- package/lib-commonjs/utils/index.cjs +8 -0
- package/lib-commonjs/utils/index.cjs.map +1 -1
- package/lib-commonjs/utils/listScrollParents.cjs +20 -12
- package/lib-commonjs/utils/listScrollParents.cjs.map +1 -1
- package/lib-commonjs/utils/normalizeAutoSize.cjs +25 -26
- package/lib-commonjs/utils/normalizeAutoSize.cjs.map +1 -1
- package/lib-commonjs/utils/toFloatingUIPlacement.cjs +27 -13
- package/lib-commonjs/utils/toFloatingUIPlacement.cjs.map +1 -1
- package/lib-commonjs/utils/useCallbackRef.cjs +9 -1
- package/lib-commonjs/utils/useCallbackRef.cjs.map +1 -1
- package/lib-commonjs/utils/writeArrowUpdates.cjs +23 -0
- package/lib-commonjs/utils/writeArrowUpdates.cjs.map +1 -0
- package/lib-commonjs/utils/writeContainerupdates.cjs +51 -0
- package/lib-commonjs/utils/writeContainerupdates.cjs.map +1 -0
- package/package.json +9 -5
- package/lib/engine/computePosition.js +0 -258
- package/lib/engine/computePosition.js.map +0 -1
- package/lib/engine/index.js +0 -260
- package/lib/engine/index.js.map +0 -1
- package/lib/engine/platform.js +0 -209
- package/lib/engine/platform.js.map +0 -1
- package/lib/usePositioning.raster.js +0 -45
- package/lib/usePositioning.raster.js.map +0 -1
- package/lib-commonjs/engine/computePosition.cjs +0 -265
- package/lib-commonjs/engine/computePosition.cjs.map +0 -1
- package/lib-commonjs/engine/index.cjs +0 -290
- package/lib-commonjs/engine/index.cjs.map +0 -1
- package/lib-commonjs/engine/platform.cjs +0 -264
- package/lib-commonjs/engine/platform.cjs.map +0 -1
- package/lib-commonjs/usePositioning.raster.cjs +0 -49
- package/lib-commonjs/usePositioning.raster.cjs.map +0 -1
package/lib/utils/getBoundary.js
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { listScrollParents } from "./listScrollParents.js";
|
|
1
|
+
import { getScrollParent } from "./getScrollParent.js";
|
|
3
2
|
/**
|
|
4
3
|
* Allows to mimic a behavior from V1 of Popper and accept `window` and `scrollParent` as strings.
|
|
5
|
-
*/ export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
*/ export function getBoundary(element, boundary) {
|
|
5
|
+
if (boundary === 'window') {
|
|
6
|
+
return element === null || element === void 0 ? void 0 : element.ownerDocument.documentElement;
|
|
7
|
+
}
|
|
8
|
+
if (boundary === 'clippingParents') {
|
|
9
|
+
return 'clippingAncestors';
|
|
10
|
+
}
|
|
11
|
+
if (boundary === 'scrollParent') {
|
|
12
|
+
let boundariesNode = getScrollParent(element);
|
|
13
|
+
if (boundariesNode.nodeName === 'BODY') {
|
|
14
|
+
boundariesNode = element === null || element === void 0 ? void 0 : element.ownerDocument.documentElement;
|
|
15
|
+
}
|
|
16
|
+
return boundariesNode;
|
|
17
|
+
}
|
|
18
|
+
return boundary;
|
|
19
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/getBoundary.ts"],"sourcesContent":["import type { Boundary as FloatingUIBoundary } from '@floating-ui/dom';\n\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/utils/getBoundary.ts"],"sourcesContent":["import type { Boundary as FloatingUIBoundary } from '@floating-ui/dom';\n\nimport { getScrollParent } from './getScrollParent';\nimport type { PositioningBoundary } 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(\n element: HTMLElement | null,\n boundary?: PositioningBoundary,\n): FloatingUIBoundary | undefined {\n if (boundary === 'window') {\n return element?.ownerDocument!.documentElement;\n }\n\n if (boundary === 'clippingParents') {\n return 'clippingAncestors';\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"],"names":["getScrollParent","getBoundary","element","boundary","ownerDocument","documentElement","boundariesNode","nodeName"],"mappings":"AAEA,SAASA,eAAe,QAAQ,uBAAoB;AAGpD;;CAEC,GACD,OAAO,SAASC,YACdC,OAA2B,EAC3BC,QAA8B;IAE9B,IAAIA,aAAa,UAAU;QACzB,OAAOD,oBAAAA,8BAAAA,QAASE,aAAa,CAAEC,eAAe;IAChD;IAEA,IAAIF,aAAa,mBAAmB;QAClC,OAAO;IACT;IAEA,IAAIA,aAAa,gBAAgB;QAC/B,IAAIG,iBAA0CN,gBAAgBE;QAE9D,IAAII,eAAeC,QAAQ,KAAK,QAAQ;YACtCD,iBAAiBJ,oBAAAA,8BAAAA,QAASE,aAAa,CAAEC,eAAe;QAC1D;QAEA,OAAOC;IACT;IAEA,OAAOH;AACT"}
|
package/lib/utils/index.js
CHANGED
|
@@ -11,4 +11,6 @@ export { useCallbackRef } from "./useCallbackRef.js";
|
|
|
11
11
|
export { debounce } from "./debounce.js";
|
|
12
12
|
export { toggleScrollListener } from "./toggleScrollListener.js";
|
|
13
13
|
export { hasAutofocusFilter } from "./hasAutoFocusFilter.js";
|
|
14
|
+
export { writeArrowUpdates } from "./writeArrowUpdates.js";
|
|
15
|
+
export { writeContainerUpdates } from "./writeContainerupdates.js";
|
|
14
16
|
export { normalizeAutoSize } from "./normalizeAutoSize.js";
|
package/lib/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/index.ts"],"sourcesContent":["export { parseFloatingUIPlacement } from './parseFloatingUIPlacement';\nexport { getBoundary } from './getBoundary';\nexport type { Fiber, HookType } from './getReactFiberFromNode';\nexport { getReactFiberFromNode } from './getReactFiberFromNode';\nexport { getParentNode, getScrollParent, hasScrollParent } from './getScrollParent';\nexport { mergeArrowOffset } from './mergeArrowOffset';\nexport { toFloatingUIPadding } from './toFloatingUIPadding';\nexport { toFloatingUIPlacement } from './toFloatingUIPlacement';\nexport { fromFloatingUIPlacement } from './fromFloatingUIPlacement';\nexport { resolvePositioningShorthand } from './resolvePositioningShorthand';\nexport { useCallbackRef } from './useCallbackRef';\nexport { debounce } from './debounce';\nexport { toggleScrollListener } from './toggleScrollListener';\nexport { hasAutofocusFilter } from './hasAutoFocusFilter';\nexport { normalizeAutoSize } from './normalizeAutoSize';\n"],"names":["parseFloatingUIPlacement","getBoundary","getReactFiberFromNode","getParentNode","getScrollParent","hasScrollParent","mergeArrowOffset","toFloatingUIPadding","toFloatingUIPlacement","fromFloatingUIPlacement","resolvePositioningShorthand","useCallbackRef","debounce","toggleScrollListener","hasAutofocusFilter","normalizeAutoSize"],"mappings":"AAAA,SAASA,wBAAwB,QAAQ,gCAA6B;AACtE,SAASC,WAAW,QAAQ,mBAAgB;AAE5C,SAASC,qBAAqB,QAAQ,6BAA0B;AAChE,SAASC,aAAa,EAAEC,eAAe,EAAEC,eAAe,QAAQ,uBAAoB;AACpF,SAASC,gBAAgB,QAAQ,wBAAqB;AACtD,SAASC,mBAAmB,QAAQ,2BAAwB;AAC5D,SAASC,qBAAqB,QAAQ,6BAA0B;AAChE,SAASC,uBAAuB,QAAQ,+BAA4B;AACpE,SAASC,2BAA2B,QAAQ,mCAAgC;AAC5E,SAASC,cAAc,QAAQ,sBAAmB;AAClD,SAASC,QAAQ,QAAQ,gBAAa;AACtC,SAASC,oBAAoB,QAAQ,4BAAyB;AAC9D,SAASC,kBAAkB,QAAQ,0BAAuB;AAC1D,SAASC,iBAAiB,QAAQ,yBAAsB"}
|
|
1
|
+
{"version":3,"sources":["../../src/utils/index.ts"],"sourcesContent":["export { parseFloatingUIPlacement } from './parseFloatingUIPlacement';\nexport { getBoundary } from './getBoundary';\nexport type { Fiber, HookType } from './getReactFiberFromNode';\nexport { getReactFiberFromNode } from './getReactFiberFromNode';\nexport { getParentNode, getScrollParent, hasScrollParent } from './getScrollParent';\nexport { mergeArrowOffset } from './mergeArrowOffset';\nexport { toFloatingUIPadding } from './toFloatingUIPadding';\nexport { toFloatingUIPlacement } from './toFloatingUIPlacement';\nexport { fromFloatingUIPlacement } from './fromFloatingUIPlacement';\nexport { resolvePositioningShorthand } from './resolvePositioningShorthand';\nexport { useCallbackRef } from './useCallbackRef';\nexport { debounce } from './debounce';\nexport { toggleScrollListener } from './toggleScrollListener';\nexport { hasAutofocusFilter } from './hasAutoFocusFilter';\nexport { writeArrowUpdates } from './writeArrowUpdates';\nexport { writeContainerUpdates } from './writeContainerupdates';\nexport { normalizeAutoSize } from './normalizeAutoSize';\n"],"names":["parseFloatingUIPlacement","getBoundary","getReactFiberFromNode","getParentNode","getScrollParent","hasScrollParent","mergeArrowOffset","toFloatingUIPadding","toFloatingUIPlacement","fromFloatingUIPlacement","resolvePositioningShorthand","useCallbackRef","debounce","toggleScrollListener","hasAutofocusFilter","writeArrowUpdates","writeContainerUpdates","normalizeAutoSize"],"mappings":"AAAA,SAASA,wBAAwB,QAAQ,gCAA6B;AACtE,SAASC,WAAW,QAAQ,mBAAgB;AAE5C,SAASC,qBAAqB,QAAQ,6BAA0B;AAChE,SAASC,aAAa,EAAEC,eAAe,EAAEC,eAAe,QAAQ,uBAAoB;AACpF,SAASC,gBAAgB,QAAQ,wBAAqB;AACtD,SAASC,mBAAmB,QAAQ,2BAAwB;AAC5D,SAASC,qBAAqB,QAAQ,6BAA0B;AAChE,SAASC,uBAAuB,QAAQ,+BAA4B;AACpE,SAASC,2BAA2B,QAAQ,mCAAgC;AAC5E,SAASC,cAAc,QAAQ,sBAAmB;AAClD,SAASC,QAAQ,QAAQ,gBAAa;AACtC,SAASC,oBAAoB,QAAQ,4BAAyB;AAC9D,SAASC,kBAAkB,QAAQ,0BAAuB;AAC1D,SAASC,iBAAiB,QAAQ,yBAAsB;AACxD,SAASC,qBAAqB,QAAQ,6BAA0B;AAChE,SAASC,iBAAiB,QAAQ,yBAAsB"}
|
|
@@ -1,14 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
const body = node.ownerDocument.body;
|
|
1
|
+
import { getScrollParent } from "./getScrollParent.js";
|
|
2
|
+
export function listScrollParents(node) {
|
|
4
3
|
const scrollParents = [];
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
let cur = node;
|
|
5
|
+
while(cur){
|
|
6
|
+
const scrollParent = getScrollParent(cur);
|
|
7
|
+
if (node.ownerDocument.body === scrollParent) {
|
|
8
|
+
scrollParents.push(scrollParent);
|
|
9
|
+
break;
|
|
8
10
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
if (scrollParent.nodeName === 'BODY' && scrollParent !== node.ownerDocument.body) {
|
|
12
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
13
|
+
// eslint-disable-next-line no-console
|
|
14
|
+
console.error('@fluentui/react-positioning: You are comparing two different documents! This is an unexpected error, please report this as a bug to the Fluent UI team ');
|
|
15
|
+
}
|
|
16
|
+
break;
|
|
17
|
+
}
|
|
18
|
+
scrollParents.push(scrollParent);
|
|
19
|
+
cur = scrollParent;
|
|
20
|
+
}
|
|
21
|
+
return scrollParents;
|
|
22
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/listScrollParents.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../src/utils/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 if (scrollParent.nodeName === 'BODY' && scrollParent !== node.ownerDocument.body) {\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.error(\n '@fluentui/react-positioning: You are comparing two different documents! This is an unexpected error, please report this as a bug to the Fluent UI team ',\n );\n }\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","nodeName","process","env","NODE_ENV","console","error"],"mappings":"AAAA,SAASA,eAAe,QAAQ,uBAAoB;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;QAEA,IAAIA,aAAaI,QAAQ,KAAK,UAAUJ,iBAAiBH,KAAKI,aAAa,CAACC,IAAI,EAAE;YAChF,IAAIG,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;gBACzC,sCAAsC;gBACtCC,QAAQC,KAAK,CACX;YAEJ;YACA;QACF;QAEAX,cAAcK,IAAI,CAACH;QACnBD,MAAMC;IACR;IAEA,OAAOF;AACT"}
|
|
@@ -3,19 +3,26 @@
|
|
|
3
3
|
* Now options 'always'/'height-always'/'width-always' are obsolete.
|
|
4
4
|
* This function maps them to true/'height'/'width'
|
|
5
5
|
*/ export const normalizeAutoSize = (autoSize)=>{
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
6
|
+
switch(autoSize){
|
|
7
|
+
case 'always':
|
|
8
|
+
case true:
|
|
9
|
+
return {
|
|
10
|
+
applyMaxWidth: true,
|
|
11
|
+
applyMaxHeight: true
|
|
12
|
+
};
|
|
13
|
+
case 'width-always':
|
|
14
|
+
case 'width':
|
|
15
|
+
return {
|
|
16
|
+
applyMaxWidth: true,
|
|
17
|
+
applyMaxHeight: false
|
|
18
|
+
};
|
|
19
|
+
case 'height-always':
|
|
20
|
+
case 'height':
|
|
21
|
+
return {
|
|
22
|
+
applyMaxWidth: false,
|
|
23
|
+
applyMaxHeight: true
|
|
24
|
+
};
|
|
25
|
+
default:
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
21
28
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/normalizeAutoSize.ts"],"sourcesContent":["import type { NormalizedAutoSize, PositioningOptions } from '../types';\n\n/**\n * AutoSizes contains many options from historic implementation.\n * Now options 'always'/'height-always'/'width-always' are obsolete.\n * This function maps them to true/'height'/'width'\n */\nexport const normalizeAutoSize = (autoSize?: PositioningOptions['autoSize']): NormalizedAutoSize | false => {\n
|
|
1
|
+
{"version":3,"sources":["../../src/utils/normalizeAutoSize.ts"],"sourcesContent":["import type { NormalizedAutoSize, PositioningOptions } from '../types';\n\n/**\n * AutoSizes contains many options from historic implementation.\n * Now options 'always'/'height-always'/'width-always' are obsolete.\n * This function maps them to true/'height'/'width'\n */\nexport const normalizeAutoSize = (autoSize?: PositioningOptions['autoSize']): NormalizedAutoSize | false => {\n switch (autoSize) {\n case 'always':\n case true:\n return {\n applyMaxWidth: true,\n applyMaxHeight: true,\n };\n\n case 'width-always':\n case 'width':\n return {\n applyMaxWidth: true,\n applyMaxHeight: false,\n };\n\n case 'height-always':\n case 'height':\n return {\n applyMaxWidth: false,\n applyMaxHeight: true,\n };\n\n default:\n return false;\n }\n};\n"],"names":["normalizeAutoSize","autoSize","applyMaxWidth","applyMaxHeight"],"mappings":"AAEA;;;;CAIC,GACD,OAAO,MAAMA,oBAAoB,CAACC;IAChC,OAAQA;QACN,KAAK;QACL,KAAK;YACH,OAAO;gBACLC,eAAe;gBACfC,gBAAgB;YAClB;QAEF,KAAK;QACL,KAAK;YACH,OAAO;gBACLD,eAAe;gBACfC,gBAAgB;YAClB;QAEF,KAAK;QACL,KAAK;YACH,OAAO;gBACLD,eAAe;gBACfC,gBAAgB;YAClB;QAEF;YACE,OAAO;IACX;AACF,EAAE"}
|
|
@@ -1,15 +1,32 @@
|
|
|
1
|
+
const getPositionMap = (rtl)=>({
|
|
2
|
+
above: 'top',
|
|
3
|
+
below: 'bottom',
|
|
4
|
+
before: rtl ? 'right' : 'left',
|
|
5
|
+
after: rtl ? 'left' : 'right'
|
|
6
|
+
});
|
|
7
|
+
// Floating UI automatically flips alignment
|
|
8
|
+
// https://github.com/floating-ui/floating-ui/issues/1563
|
|
9
|
+
const getAlignmentMap = ()=>({
|
|
10
|
+
start: 'start',
|
|
11
|
+
end: 'end',
|
|
12
|
+
top: 'start',
|
|
13
|
+
bottom: 'end',
|
|
14
|
+
center: undefined
|
|
15
|
+
});
|
|
16
|
+
const shouldAlignToCenter = (p, a)=>{
|
|
17
|
+
const positionedVertically = p === 'above' || p === 'below';
|
|
18
|
+
const alignedVertically = a === 'top' || a === 'bottom';
|
|
19
|
+
return positionedVertically && alignedVertically || !positionedVertically && !alignedVertically;
|
|
20
|
+
};
|
|
1
21
|
/**
|
|
2
22
|
* Maps internal positioning values to Floating UI placement
|
|
3
23
|
* @see positioningHelper.test.ts for expected placement values
|
|
4
24
|
*/ export const toFloatingUIPlacement = (align, position, rtl)=>{
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const alignedVertically = align === 'top' || align === 'bottom';
|
|
11
|
-
if (!align || align === 'center' || block === alignedVertically) {
|
|
12
|
-
return side;
|
|
25
|
+
const alignment = shouldAlignToCenter(position, align) ? 'center' : align;
|
|
26
|
+
const computedPosition = position && getPositionMap(rtl)[position];
|
|
27
|
+
const computedAlignment = alignment && getAlignmentMap()[alignment];
|
|
28
|
+
if (computedPosition && computedAlignment) {
|
|
29
|
+
return `${computedPosition}-${computedAlignment}`;
|
|
13
30
|
}
|
|
14
|
-
return
|
|
31
|
+
return computedPosition;
|
|
15
32
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/toFloatingUIPlacement.ts"],"sourcesContent":["import type { Placement, Side } from '@floating-ui/dom';\nimport type { Alignment, Position } from '../types';\n\n
|
|
1
|
+
{"version":3,"sources":["../../src/utils/toFloatingUIPlacement.ts"],"sourcesContent":["import type { Placement, Side, Alignment as FloatingUIAlignment } from '@floating-ui/dom';\nimport type { Alignment, Position } from '../types';\n\ntype PlacementPosition = Side;\ntype PlacementAlign = FloatingUIAlignment;\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\n// Floating UI automatically flips alignment\n// https://github.com/floating-ui/floating-ui/issues/1563\nconst getAlignmentMap = (): Record<Alignment, PlacementAlign | undefined> => ({\n start: 'start',\n end: 'end',\n top: 'start',\n bottom: 'end',\n center: undefined,\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 * Maps internal positioning values to Floating UI placement\n * @see positioningHelper.test.ts for expected placement values\n */\nexport const toFloatingUIPlacement = (align?: Alignment, position?: Position, rtl?: boolean): Placement | undefined => {\n const alignment = shouldAlignToCenter(position, align) ? 'center' : align;\n\n const computedPosition = position && getPositionMap(rtl)[position];\n const computedAlignment = alignment && getAlignmentMap()[alignment];\n\n if (computedPosition && computedAlignment) {\n return `${computedPosition}-${computedAlignment}` as Placement;\n }\n\n return computedPosition;\n};\n"],"names":["getPositionMap","rtl","above","below","before","after","getAlignmentMap","start","end","top","bottom","center","undefined","shouldAlignToCenter","p","a","positionedVertically","alignedVertically","toFloatingUIPlacement","align","position","alignment","computedPosition","computedAlignment"],"mappings":"AAMA,MAAMA,iBAAiB,CAACC,MAAwD,CAAA;QAC9EC,OAAO;QACPC,OAAO;QACPC,QAAQH,MAAM,UAAU;QACxBI,OAAOJ,MAAM,SAAS;IACxB,CAAA;AAEA,4CAA4C;AAC5C,yDAAyD;AACzD,MAAMK,kBAAkB,IAAsD,CAAA;QAC5EC,OAAO;QACPC,KAAK;QACLC,KAAK;QACLC,QAAQ;QACRC,QAAQC;IACV,CAAA;AAEA,MAAMC,sBAAsB,CAACC,GAAcC;IACzC,MAAMC,uBAAuBF,MAAM,WAAWA,MAAM;IACpD,MAAMG,oBAAoBF,MAAM,SAASA,MAAM;IAE/C,OAAO,AAACC,wBAAwBC,qBAAuB,CAACD,wBAAwB,CAACC;AACnF;AAEA;;;CAGC,GACD,OAAO,MAAMC,wBAAwB,CAACC,OAAmBC,UAAqBnB;IAC5E,MAAMoB,YAAYR,oBAAoBO,UAAUD,SAAS,WAAWA;IAEpE,MAAMG,mBAAmBF,YAAYpB,eAAeC,IAAI,CAACmB,SAAS;IAClE,MAAMG,oBAAoBF,aAAaf,iBAAiB,CAACe,UAAU;IAEnE,IAAIC,oBAAoBC,mBAAmB;QACzC,OAAO,GAAGD,iBAAiB,CAAC,EAAEC,mBAAmB;IACnD;IAEA,OAAOD;AACT,EAAE"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import * as React from "react";
|
|
3
|
+
import { useIsomorphicLayoutEffect } from "@fluentui/react-utilities";
|
|
3
4
|
/**
|
|
4
5
|
* Creates a MutableRef with ref change callback. Is useful as React.useRef() doesn't notify you when its content
|
|
5
6
|
* changes and mutating the .current property doesn't cause a re-render. An opt-out will be use a callback ref via
|
|
@@ -10,12 +11,14 @@ import * as React from "react";
|
|
|
10
11
|
*
|
|
11
12
|
* @param initialValue - initial ref value
|
|
12
13
|
* @param callback - a callback to run when value changes
|
|
14
|
+
* @param skipInitialResolve - a flag to skip an initial ref report
|
|
13
15
|
*
|
|
14
16
|
* @example
|
|
15
17
|
* const ref = useCallbackRef(0, (newValue, oldValue) => console.log(oldValue, '->', newValue);
|
|
16
18
|
* ref.current = 1;
|
|
17
19
|
* // prints 0 -> 1
|
|
18
|
-
*/ export function useCallbackRef(initialValue, callback) {
|
|
20
|
+
*/ export function useCallbackRef(initialValue, callback, skipInitialResolve) {
|
|
21
|
+
const isFirst = React.useRef(true);
|
|
19
22
|
const [ref] = React.useState(()=>({
|
|
20
23
|
// value
|
|
21
24
|
value: initialValue,
|
|
@@ -30,11 +33,17 @@ import * as React from "react";
|
|
|
30
33
|
const last = ref.value;
|
|
31
34
|
if (last !== value) {
|
|
32
35
|
ref.value = value;
|
|
36
|
+
if (skipInitialResolve && isFirst.current) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
33
39
|
ref.callback(value, last);
|
|
34
40
|
}
|
|
35
41
|
}
|
|
36
42
|
}
|
|
37
43
|
}));
|
|
44
|
+
useIsomorphicLayoutEffect(()=>{
|
|
45
|
+
isFirst.current = false;
|
|
46
|
+
}, []);
|
|
38
47
|
// update callback
|
|
39
48
|
ref.callback = callback;
|
|
40
49
|
return ref.facade;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/useCallbackRef.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\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 *\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 // eslint-disable-next-line @typescript-eslint/no-deprecated\n): React.MutableRefObject<T | null> {\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 ref.callback(value, last);\n }\n },\n },\n }));\n\n // update callback\n ref.callback = callback;\n\n return ref.facade;\n}\n"],"names":["React","useCallbackRef","initialValue","callback","ref","useState","value","facade","current","last"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;
|
|
1
|
+
{"version":3,"sources":["../../src/utils/useCallbackRef.ts"],"sourcesContent":["'use client';\n\nimport * 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 // eslint-disable-next-line @typescript-eslint/no-deprecated\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"],"names":["React","useIsomorphicLayoutEffect","useCallbackRef","initialValue","callback","skipInitialResolve","isFirst","useRef","ref","useState","value","facade","current","last"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,yBAAyB,QAAQ,4BAA4B;AAEtE;;;;;;;;;;;;;;;;CAgBC,GACD,OAAO,SAASC,eACdC,YAAsB,EACtBC,QAA2D,EAC3DC,kBAA4B;IAG5B,MAAMC,UAAUN,MAAMO,MAAM,CAAC;IAC7B,MAAM,CAACC,IAAI,GAAGR,MAAMS,QAAQ,CAAC,IAAO,CAAA;YAClC,QAAQ;YACRC,OAAOP;YACP,gBAAgB;YAChBC;YACA,8BAA8B;YAC9BO,QAAQ;gBACN,IAAIC,WAAU;oBACZ,OAAOJ,IAAIE,KAAK;gBAClB;gBACA,IAAIE,SAAQF,MAAO;oBACjB,MAAMG,OAAOL,IAAIE,KAAK;oBAEtB,IAAIG,SAASH,OAAO;wBAClBF,IAAIE,KAAK,GAAGA;wBAEZ,IAAIL,sBAAsBC,QAAQM,OAAO,EAAE;4BACzC;wBACF;wBAEAJ,IAAIJ,QAAQ,CAACM,OAAOG;oBACtB;gBACF;YACF;QACF,CAAA;IAEAZ,0BAA0B;QACxBK,QAAQM,OAAO,GAAG;IACpB,GAAG,EAAE;IAEL,kBAAkB;IAClBJ,IAAIJ,QAAQ,GAAGA;IAEf,OAAOI,IAAIG,MAAM;AACnB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Writes all DOM element updates after position is computed
|
|
3
|
+
*/ export function writeArrowUpdates(options) {
|
|
4
|
+
const { arrow, middlewareData } = options;
|
|
5
|
+
if (!middlewareData.arrow || !arrow) {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
const { x: arrowX, y: arrowY } = middlewareData.arrow;
|
|
9
|
+
Object.assign(arrow.style, {
|
|
10
|
+
left: arrowX !== null && arrowX !== undefined ? `${arrowX}px` : '',
|
|
11
|
+
top: arrowY !== null && arrowY !== undefined ? `${arrowY}px` : ''
|
|
12
|
+
});
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/writeArrowUpdates.ts"],"sourcesContent":["import type { MiddlewareData } from '@floating-ui/dom';\n\n/**\n * Writes all DOM element updates after position is computed\n */\nexport function writeArrowUpdates(options: { arrow: HTMLElement | null; middlewareData: MiddlewareData }): void {\n const { arrow, middlewareData } = options;\n if (!middlewareData.arrow || !arrow) {\n return;\n }\n\n const { x: arrowX, y: arrowY } = middlewareData.arrow;\n\n Object.assign(arrow.style, {\n left: arrowX !== null && arrowX !== undefined ? `${arrowX}px` : '',\n top: arrowY !== null && arrowY !== undefined ? `${arrowY}px` : '',\n });\n}\n"],"names":["writeArrowUpdates","options","arrow","middlewareData","x","arrowX","y","arrowY","Object","assign","style","left","undefined","top"],"mappings":"AAEA;;CAEC,GACD,OAAO,SAASA,kBAAkBC,OAAsE;IACtG,MAAM,EAAEC,KAAK,EAAEC,cAAc,EAAE,GAAGF;IAClC,IAAI,CAACE,eAAeD,KAAK,IAAI,CAACA,OAAO;QACnC;IACF;IAEA,MAAM,EAAEE,GAAGC,MAAM,EAAEC,GAAGC,MAAM,EAAE,GAAGJ,eAAeD,KAAK;IAErDM,OAAOC,MAAM,CAACP,MAAMQ,KAAK,EAAE;QACzBC,MAAMN,WAAW,QAAQA,WAAWO,YAAY,GAAGP,OAAO,EAAE,CAAC,GAAG;QAChEQ,KAAKN,WAAW,QAAQA,WAAWK,YAAY,GAAGL,OAAO,EAAE,CAAC,GAAG;IACjE;AACF"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { DATA_POSITIONING_ESCAPED, DATA_POSITIONING_HIDDEN, DATA_POSITIONING_INTERSECTING, DATA_POSITIONING_PLACEMENT } from "../constants.js";
|
|
2
|
+
/**
|
|
3
|
+
* Writes all container element position updates after the position is computed
|
|
4
|
+
*/ export function writeContainerUpdates(options) {
|
|
5
|
+
var _middlewareData_hide, _middlewareData_hide1, _container_ownerDocument_defaultView;
|
|
6
|
+
const { container, placement, middlewareData, strategy, lowPPI, coordinates, useTransform = true } = options;
|
|
7
|
+
if (!container) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
container.setAttribute(DATA_POSITIONING_PLACEMENT, placement);
|
|
11
|
+
container.removeAttribute(DATA_POSITIONING_INTERSECTING);
|
|
12
|
+
if (middlewareData.intersectionObserver.intersecting) {
|
|
13
|
+
container.setAttribute(DATA_POSITIONING_INTERSECTING, '');
|
|
14
|
+
}
|
|
15
|
+
container.removeAttribute(DATA_POSITIONING_ESCAPED);
|
|
16
|
+
if ((_middlewareData_hide = middlewareData.hide) === null || _middlewareData_hide === void 0 ? void 0 : _middlewareData_hide.escaped) {
|
|
17
|
+
container.setAttribute(DATA_POSITIONING_ESCAPED, '');
|
|
18
|
+
}
|
|
19
|
+
container.removeAttribute(DATA_POSITIONING_HIDDEN);
|
|
20
|
+
if ((_middlewareData_hide1 = middlewareData.hide) === null || _middlewareData_hide1 === void 0 ? void 0 : _middlewareData_hide1.referenceHidden) {
|
|
21
|
+
container.setAttribute(DATA_POSITIONING_HIDDEN, '');
|
|
22
|
+
}
|
|
23
|
+
// Round so that the coordinates land on device pixels.
|
|
24
|
+
// This prevents blurriness in cases where the browser doesn't apply pixel snapping, such as when other effects like
|
|
25
|
+
// `backdrop-filter: blur()` are applied to the container, and the browser is zoomed in.
|
|
26
|
+
// See https://github.com/microsoft/fluentui/issues/26764 for more info.
|
|
27
|
+
const devicePixelRatio = ((_container_ownerDocument_defaultView = container.ownerDocument.defaultView) === null || _container_ownerDocument_defaultView === void 0 ? void 0 : _container_ownerDocument_defaultView.devicePixelRatio) || 1;
|
|
28
|
+
const x = Math.round(coordinates.x * devicePixelRatio) / devicePixelRatio;
|
|
29
|
+
const y = Math.round(coordinates.y * devicePixelRatio) / devicePixelRatio;
|
|
30
|
+
Object.assign(container.style, {
|
|
31
|
+
position: strategy
|
|
32
|
+
});
|
|
33
|
+
if (useTransform) {
|
|
34
|
+
Object.assign(container.style, {
|
|
35
|
+
transform: lowPPI ? `translate(${x}px, ${y}px)` : `translate3d(${x}px, ${y}px, 0)`
|
|
36
|
+
});
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
Object.assign(container.style, {
|
|
40
|
+
left: `${x}px`,
|
|
41
|
+
top: `${y}px`
|
|
42
|
+
});
|
|
43
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/writeContainerupdates.ts"],"sourcesContent":["import type { Placement, MiddlewareData, Strategy, Coords } from '@floating-ui/dom';\nimport {\n DATA_POSITIONING_ESCAPED,\n DATA_POSITIONING_HIDDEN,\n DATA_POSITIONING_INTERSECTING,\n DATA_POSITIONING_PLACEMENT,\n} from '../constants';\n\n/**\n * Writes all container element position updates after the position is computed\n */\nexport function writeContainerUpdates(options: {\n container: HTMLElement | null;\n placement: Placement;\n middlewareData: MiddlewareData;\n /**\n * Layer acceleration can disable subpixel rendering which causes slightly\n * blurry text on low PPI displays, so we want to use 2D transforms\n * instead\n */\n lowPPI: boolean;\n strategy: Strategy;\n coordinates: Coords;\n useTransform?: boolean;\n}): void {\n const { container, placement, middlewareData, strategy, lowPPI, coordinates, useTransform = true } = options;\n if (!container) {\n return;\n }\n container.setAttribute(DATA_POSITIONING_PLACEMENT, placement);\n container.removeAttribute(DATA_POSITIONING_INTERSECTING);\n if (middlewareData.intersectionObserver.intersecting) {\n container.setAttribute(DATA_POSITIONING_INTERSECTING, '');\n }\n\n container.removeAttribute(DATA_POSITIONING_ESCAPED);\n if (middlewareData.hide?.escaped) {\n container.setAttribute(DATA_POSITIONING_ESCAPED, '');\n }\n\n container.removeAttribute(DATA_POSITIONING_HIDDEN);\n if (middlewareData.hide?.referenceHidden) {\n container.setAttribute(DATA_POSITIONING_HIDDEN, '');\n }\n\n // Round so that the coordinates land on device pixels.\n // This prevents blurriness in cases where the browser doesn't apply pixel snapping, such as when other effects like\n // `backdrop-filter: blur()` are applied to the container, and the browser is zoomed in.\n // See https://github.com/microsoft/fluentui/issues/26764 for more info.\n const devicePixelRatio = container.ownerDocument.defaultView?.devicePixelRatio || 1;\n const x = Math.round(coordinates.x * devicePixelRatio) / devicePixelRatio;\n const y = Math.round(coordinates.y * devicePixelRatio) / devicePixelRatio;\n\n Object.assign(container.style, {\n position: strategy,\n });\n\n if (useTransform) {\n Object.assign(container.style, {\n transform: lowPPI ? `translate(${x}px, ${y}px)` : `translate3d(${x}px, ${y}px, 0)`,\n });\n return;\n }\n\n Object.assign(container.style, {\n left: `${x}px`,\n top: `${y}px`,\n });\n}\n"],"names":["DATA_POSITIONING_ESCAPED","DATA_POSITIONING_HIDDEN","DATA_POSITIONING_INTERSECTING","DATA_POSITIONING_PLACEMENT","writeContainerUpdates","options","middlewareData","container","placement","strategy","lowPPI","coordinates","useTransform","setAttribute","removeAttribute","intersectionObserver","intersecting","hide","escaped","referenceHidden","devicePixelRatio","ownerDocument","defaultView","x","Math","round","y","Object","assign","style","position","transform","left","top"],"mappings":"AACA,SACEA,wBAAwB,EACxBC,uBAAuB,EACvBC,6BAA6B,EAC7BC,0BAA0B,QACrB,kBAAe;AAEtB;;CAEC,GACD,OAAO,SAASC,sBAAsBC,OAarC;QAYKC,sBAKAA,uBAQqBC;IAxBzB,MAAM,EAAEA,SAAS,EAAEC,SAAS,EAAEF,cAAc,EAAEG,QAAQ,EAAEC,MAAM,EAAEC,WAAW,EAAEC,eAAe,IAAI,EAAE,GAAGP;IACrG,IAAI,CAACE,WAAW;QACd;IACF;IACAA,UAAUM,YAAY,CAACV,4BAA4BK;IACnDD,UAAUO,eAAe,CAACZ;IAC1B,IAAII,eAAeS,oBAAoB,CAACC,YAAY,EAAE;QACpDT,UAAUM,YAAY,CAACX,+BAA+B;IACxD;IAEAK,UAAUO,eAAe,CAACd;IAC1B,KAAIM,uBAAAA,eAAeW,IAAI,cAAnBX,2CAAAA,qBAAqBY,OAAO,EAAE;QAChCX,UAAUM,YAAY,CAACb,0BAA0B;IACnD;IAEAO,UAAUO,eAAe,CAACb;IAC1B,KAAIK,wBAAAA,eAAeW,IAAI,cAAnBX,4CAAAA,sBAAqBa,eAAe,EAAE;QACxCZ,UAAUM,YAAY,CAACZ,yBAAyB;IAClD;IAEA,uDAAuD;IACvD,oHAAoH;IACpH,wFAAwF;IACxF,wEAAwE;IACxE,MAAMmB,mBAAmBb,EAAAA,uCAAAA,UAAUc,aAAa,CAACC,WAAW,cAAnCf,2DAAAA,qCAAqCa,gBAAgB,KAAI;IAClF,MAAMG,IAAIC,KAAKC,KAAK,CAACd,YAAYY,CAAC,GAAGH,oBAAoBA;IACzD,MAAMM,IAAIF,KAAKC,KAAK,CAACd,YAAYe,CAAC,GAAGN,oBAAoBA;IAEzDO,OAAOC,MAAM,CAACrB,UAAUsB,KAAK,EAAE;QAC7BC,UAAUrB;IACZ;IAEA,IAAIG,cAAc;QAChBe,OAAOC,MAAM,CAACrB,UAAUsB,KAAK,EAAE;YAC7BE,WAAWrB,SAAS,CAAC,UAAU,EAAEa,EAAE,IAAI,EAAEG,EAAE,GAAG,CAAC,GAAG,CAAC,YAAY,EAAEH,EAAE,IAAI,EAAEG,EAAE,MAAM,CAAC;QACpF;QACA;IACF;IAEAC,OAAOC,MAAM,CAACrB,UAAUsB,KAAK,EAAE;QAC7BG,MAAM,GAAGT,EAAE,EAAE,CAAC;QACdU,KAAK,GAAGP,EAAE,EAAE,CAAC;IACf;AACF"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/* stylelint-disable fluentui/use-logical-properties -- Arrow rotation and Popper placement coordinates are physical in RTL, like createArrowStyles' @noflip values. */
|
|
2
|
+
.arrow {
|
|
3
|
+
box-sizing: border-box;
|
|
4
|
+
position: absolute;
|
|
5
|
+
z-index: -1;
|
|
6
|
+
background-color: inherit;
|
|
7
|
+
background-clip: content-box;
|
|
8
|
+
border-bottom-left-radius: var(--borderRadiusSmall);
|
|
9
|
+
transform: rotate(var(--fui-positioning-arrow-angle));
|
|
10
|
+
height: var(--fui-positioning-arrow-height);
|
|
11
|
+
width: var(--fui-positioning-arrow-height);
|
|
12
|
+
|
|
13
|
+
&::before {
|
|
14
|
+
content: '';
|
|
15
|
+
display: block;
|
|
16
|
+
background-color: inherit;
|
|
17
|
+
margin: calc(-1 * var(--fui-positioning-arrow-border-width, var(--strokeWidthThin)));
|
|
18
|
+
width: 100%;
|
|
19
|
+
height: 100%;
|
|
20
|
+
border: var(--fui-positioning-arrow-border-width, var(--strokeWidthThin))
|
|
21
|
+
var(--fui-positioning-arrow-border-style, solid)
|
|
22
|
+
var(--fui-positioning-arrow-border-color, var(--colorTransparentStroke));
|
|
23
|
+
border-bottom-left-radius: var(--borderRadiusSmall);
|
|
24
|
+
clip-path: polygon(0% 0%, 100% 100%, 0% 100%);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
:global([data-popper-placement^='top']) .arrow {
|
|
29
|
+
bottom: var(--fui-positioning-arrow-offset);
|
|
30
|
+
--fui-positioning-arrow-angle: -45deg;
|
|
31
|
+
}
|
|
32
|
+
:global([data-popper-placement^='right']) .arrow {
|
|
33
|
+
left: var(--fui-positioning-arrow-offset);
|
|
34
|
+
--fui-positioning-arrow-angle: 45deg;
|
|
35
|
+
}
|
|
36
|
+
:global([data-popper-placement^='bottom']) .arrow {
|
|
37
|
+
top: var(--fui-positioning-arrow-offset);
|
|
38
|
+
--fui-positioning-arrow-angle: 135deg;
|
|
39
|
+
}
|
|
40
|
+
:global([data-popper-placement^='left']) .arrow {
|
|
41
|
+
right: var(--fui-positioning-arrow-offset);
|
|
42
|
+
--fui-positioning-arrow-angle: 225deg;
|
|
43
|
+
}
|
|
@@ -27,5 +27,6 @@ const DEFAULT_CONFIGURATION = ({ options })=>{
|
|
|
27
27
|
const PositioningConfigurationContext = /*#__PURE__*/ _react.createContext(undefined);
|
|
28
28
|
const PositioningConfigurationProvider = PositioningConfigurationContext.Provider;
|
|
29
29
|
const usePositioningConfiguration = ()=>{
|
|
30
|
-
|
|
30
|
+
var _React_useContext;
|
|
31
|
+
return (_React_useContext = _react.useContext(PositioningConfigurationContext)) !== null && _React_useContext !== void 0 ? _React_useContext : DEFAULT_CONFIGURATION;
|
|
31
32
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/PositioningConfigurationContext.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport type { PositioningConfigurationFn } from './types';\n\n// ---\n\nconst DEFAULT_CONFIGURATION: PositioningConfigurationFn = ({ options }) => {\n return options;\n};\n\n// ---\n\nconst PositioningConfigurationContext = React.createContext<PositioningConfigurationFn | undefined>(undefined);\n\n/**\n * A context provider for the positioning configuration.\n *\n * Accepts a function that takes the positioning options and returns them modified.\n */\nexport const PositioningConfigurationProvider = PositioningConfigurationContext.Provider;\n\nexport const usePositioningConfiguration = (): PositioningConfigurationFn => {\n return React.useContext(PositioningConfigurationContext)
|
|
1
|
+
{"version":3,"sources":["../src/PositioningConfigurationContext.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport type { PositioningConfigurationFn } from './types';\n\n// ---\n\nconst DEFAULT_CONFIGURATION: PositioningConfigurationFn = ({ options }) => {\n return options;\n};\n\n// ---\n\nconst PositioningConfigurationContext = React.createContext<PositioningConfigurationFn | undefined>(undefined);\n\n/**\n * A context provider for the positioning configuration.\n *\n * Accepts a function that takes the positioning options and returns them modified.\n */\nexport const PositioningConfigurationProvider = PositioningConfigurationContext.Provider;\n\nexport const usePositioningConfiguration = (): PositioningConfigurationFn => {\n return React.useContext(PositioningConfigurationContext) ?? DEFAULT_CONFIGURATION;\n};\n"],"names":["React","DEFAULT_CONFIGURATION","options","PositioningConfigurationContext","createContext","undefined","PositioningConfigurationProvider","Provider","usePositioningConfiguration","useContext"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;iEAEuB,QAAQ;AAG/B,MAAM;AAEN,MAAMC,wBAAoD,CAAC,EAAEC,OAAO,EAAE;IACpE,OAAOA;AACT;AAEA,MAAM;AAEN,MAAMC,gDAAkCH,OAAMI,aAAa,CAAyCC;AAO7F,MAAMC,mCAAmCH,gCAAgCI,QAAQ,CAAC;AAElF,MAAMC,8BAA8B;QAClCR;IAAP,OAAA,CAAOA,oBAAAA,OAAMS,UAAU,CAACN,gCAAAA,MAAAA,QAAjBH,sBAAAA,KAAAA,IAAAA,oBAAqDC;AAC9D,EAAE"}
|