@fluentui/react-positioning 9.5.14 → 9.6.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +30 -1
- package/CHANGELOG.md +16 -2
- package/dist/index.d.ts +6 -1
- package/lib/constants.js +0 -1
- package/lib/constants.js.map +1 -1
- package/lib/createArrowStyles.js +47 -55
- package/lib/createArrowStyles.js.map +1 -1
- package/lib/createPositionManager.js +95 -108
- package/lib/createPositionManager.js.map +1 -1
- package/lib/createVirtualElementFromClick.js +18 -19
- package/lib/createVirtualElementFromClick.js.map +1 -1
- package/lib/index.js +0 -1
- package/lib/index.js.map +1 -1
- package/lib/middleware/coverTarget.js +26 -32
- package/lib/middleware/coverTarget.js.map +1 -1
- package/lib/middleware/flip.js +22 -32
- package/lib/middleware/flip.js.map +1 -1
- package/lib/middleware/index.js +0 -1
- package/lib/middleware/index.js.map +1 -1
- package/lib/middleware/intersecting.js +16 -17
- package/lib/middleware/intersecting.js.map +1 -1
- package/lib/middleware/maxSize.js +25 -34
- package/lib/middleware/maxSize.js.map +1 -1
- package/lib/middleware/offset.js +3 -5
- package/lib/middleware/offset.js.map +1 -1
- package/lib/middleware/shift.js +21 -30
- package/lib/middleware/shift.js.map +1 -1
- package/lib/types.js +0 -1
- package/lib/types.js.map +1 -1
- package/lib/usePositioning.js +188 -154
- package/lib/usePositioning.js.map +1 -1
- package/lib/usePositioningMouseTarget.js +24 -23
- package/lib/usePositioningMouseTarget.js.map +1 -1
- package/lib/utils/debounce.js +13 -14
- package/lib/utils/debounce.js.map +1 -1
- package/lib/utils/fromFloatingUIPlacement.js +23 -28
- package/lib/utils/fromFloatingUIPlacement.js.map +1 -1
- package/lib/utils/getBoundary.js +14 -16
- package/lib/utils/getBoundary.js.map +1 -1
- package/lib/utils/getFloatingUIOffset.js +16 -27
- package/lib/utils/getFloatingUIOffset.js.map +1 -1
- package/lib/utils/getReactFiberFromNode.js +36 -37
- package/lib/utils/getReactFiberFromNode.js.map +1 -1
- package/lib/utils/getScrollParent.js +35 -42
- package/lib/utils/getScrollParent.js.map +1 -1
- package/lib/utils/hasAutoFocusFilter.js +9 -11
- package/lib/utils/hasAutoFocusFilter.js.map +1 -1
- package/lib/utils/index.js +0 -1
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/mergeArrowOffset.js +24 -25
- package/lib/utils/mergeArrowOffset.js.map +1 -1
- package/lib/utils/parseFloatingUIPlacement.js +6 -7
- package/lib/utils/parseFloatingUIPlacement.js.map +1 -1
- package/lib/utils/resolvePositioningShorthand.js +55 -56
- package/lib/utils/resolvePositioningShorthand.js.map +1 -1
- package/lib/utils/toFloatingUIPadding.js +16 -21
- package/lib/utils/toFloatingUIPadding.js.map +1 -1
- package/lib/utils/toFloatingUIPlacement.js +25 -27
- package/lib/utils/toFloatingUIPlacement.js.map +1 -1
- package/lib/utils/toggleScrollListener.js +12 -14
- package/lib/utils/toggleScrollListener.js.map +1 -1
- package/lib/utils/useCallbackRef.js +30 -32
- package/lib/utils/useCallbackRef.js.map +1 -1
- package/lib/utils/writeArrowUpdates.js +10 -17
- package/lib/utils/writeArrowUpdates.js.map +1 -1
- package/lib/utils/writeContainerupdates.js +39 -39
- package/lib/utils/writeContainerupdates.js.map +1 -1
- package/lib-commonjs/constants.js +1 -3
- package/lib-commonjs/constants.js.map +1 -1
- package/lib-commonjs/createArrowStyles.js +1 -3
- package/lib-commonjs/createArrowStyles.js.map +1 -1
- package/lib-commonjs/createPositionManager.js +4 -5
- package/lib-commonjs/createPositionManager.js.map +1 -1
- package/lib-commonjs/createVirtualElementFromClick.js +1 -3
- package/lib-commonjs/createVirtualElementFromClick.js.map +1 -1
- package/lib-commonjs/index.js +0 -3
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/middleware/coverTarget.js +1 -3
- package/lib-commonjs/middleware/coverTarget.js.map +1 -1
- package/lib-commonjs/middleware/flip.js +1 -3
- package/lib-commonjs/middleware/flip.js.map +1 -1
- package/lib-commonjs/middleware/index.js +0 -3
- package/lib-commonjs/middleware/index.js.map +1 -1
- package/lib-commonjs/middleware/intersecting.js +1 -3
- package/lib-commonjs/middleware/intersecting.js.map +1 -1
- package/lib-commonjs/middleware/maxSize.js +1 -3
- package/lib-commonjs/middleware/maxSize.js.map +1 -1
- package/lib-commonjs/middleware/offset.js +1 -3
- package/lib-commonjs/middleware/offset.js.map +1 -1
- package/lib-commonjs/middleware/shift.js +1 -3
- package/lib-commonjs/middleware/shift.js.map +1 -1
- package/lib-commonjs/types.js +0 -3
- package/lib-commonjs/types.js.map +1 -1
- package/lib-commonjs/usePositioning.js +6 -6
- package/lib-commonjs/usePositioning.js.map +1 -1
- package/lib-commonjs/usePositioningMouseTarget.js +1 -3
- package/lib-commonjs/usePositioningMouseTarget.js.map +1 -1
- package/lib-commonjs/utils/debounce.js +1 -3
- package/lib-commonjs/utils/debounce.js.map +1 -1
- package/lib-commonjs/utils/fromFloatingUIPlacement.js +1 -3
- package/lib-commonjs/utils/fromFloatingUIPlacement.js.map +1 -1
- package/lib-commonjs/utils/getBoundary.js +1 -3
- package/lib-commonjs/utils/getBoundary.js.map +1 -1
- package/lib-commonjs/utils/getFloatingUIOffset.js +1 -3
- package/lib-commonjs/utils/getFloatingUIOffset.js.map +1 -1
- package/lib-commonjs/utils/getReactFiberFromNode.js +1 -3
- package/lib-commonjs/utils/getReactFiberFromNode.js.map +1 -1
- package/lib-commonjs/utils/getScrollParent.js +1 -3
- package/lib-commonjs/utils/getScrollParent.js.map +1 -1
- package/lib-commonjs/utils/hasAutoFocusFilter.js +1 -3
- package/lib-commonjs/utils/hasAutoFocusFilter.js.map +1 -1
- package/lib-commonjs/utils/index.js +0 -3
- package/lib-commonjs/utils/index.js.map +1 -1
- package/lib-commonjs/utils/mergeArrowOffset.js +1 -3
- package/lib-commonjs/utils/mergeArrowOffset.js.map +1 -1
- package/lib-commonjs/utils/parseFloatingUIPlacement.js +1 -3
- package/lib-commonjs/utils/parseFloatingUIPlacement.js.map +1 -1
- package/lib-commonjs/utils/resolvePositioningShorthand.js +1 -3
- package/lib-commonjs/utils/resolvePositioningShorthand.js.map +1 -1
- package/lib-commonjs/utils/toFloatingUIPadding.js +1 -3
- package/lib-commonjs/utils/toFloatingUIPadding.js.map +1 -1
- package/lib-commonjs/utils/toFloatingUIPlacement.js +1 -3
- package/lib-commonjs/utils/toFloatingUIPlacement.js.map +1 -1
- package/lib-commonjs/utils/toggleScrollListener.js +1 -3
- package/lib-commonjs/utils/toggleScrollListener.js.map +1 -1
- package/lib-commonjs/utils/useCallbackRef.js +1 -3
- package/lib-commonjs/utils/useCallbackRef.js.map +1 -1
- package/lib-commonjs/utils/writeArrowUpdates.js +1 -3
- package/lib-commonjs/utils/writeArrowUpdates.js.map +1 -1
- package/lib-commonjs/utils/writeContainerupdates.js +12 -5
- package/lib-commonjs/utils/writeContainerupdates.js.map +1 -1
- package/package.json +3 -3
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["getScrollParent.js"],"sourcesContent":["/**\n * Returns the parent node or the host of the node argument.\n * @param node - DOM node.\n * @returns - parent DOM node.\n */ export const getParentNode = (node)=>{\n if (node.nodeName === 'HTML') {\n return node;\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return node.parentNode || node.host;\n};\n/**\n * Returns CSS styles of the given node.\n * @param node - DOM node.\n * @returns - CSS styles.\n */ const getStyleComputedProperty = (node)=>{\n var _node_ownerDocument;\n if (node.nodeType !== 1) {\n return {};\n }\n const window = (_node_ownerDocument = node.ownerDocument) === null || _node_ownerDocument === void 0 ? void 0 : _node_ownerDocument.defaultView;\n return window.getComputedStyle(node, null);\n};\n/**\n * Returns the first scrollable parent of the given element.\n * @param node - DOM node.\n * @returns - the first scrollable parent.\n */ export const getScrollParent = (node)=>{\n // Return body, `getScroll` will take care to get the correct `scrollTop` from it\n const parentNode = node && getParentNode(node);\n // eslint-disable-next-line\n if (!parentNode) return document.body;\n switch(parentNode.nodeName){\n case 'HTML':\n case 'BODY':\n return parentNode.ownerDocument.body;\n case '#document':\n return parentNode.body;\n }\n // If any of the overflow props is defined for the node then we return it as the parent\n const { overflow , overflowX , overflowY } = getStyleComputedProperty(parentNode);\n if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {\n return parentNode;\n }\n return getScrollParent(parentNode);\n};\nexport const hasScrollParent = (node)=>{\n var _scrollParentElement_ownerDocument;\n const scrollParentElement = getScrollParent(node);\n return scrollParentElement ? scrollParentElement !== ((_scrollParentElement_ownerDocument = scrollParentElement.ownerDocument) === null || _scrollParentElement_ownerDocument === void 0 ? void 0 : _scrollParentElement_ownerDocument.body) : false;\n};\n"],"names":["getParentNode","getScrollParent","hasScrollParent","node","nodeName","parentNode","host","getStyleComputedProperty","_node_ownerDocument","nodeType","window","ownerDocument","defaultView","getComputedStyle","document","body","overflow","overflowX","overflowY","test","_scrollParentElement_ownerDocument","scrollParentElement"],"mappings":"AAAA;;;;CAIC;;;;;;;;;;;IAAgBA,aAAa,MAAbA;IAuBAC,eAAe,MAAfA;IAmBJC,eAAe,MAAfA;;AA1CF,MAAMF,gBAAgB,CAACG,OAAO;IACrC,IAAIA,KAAKC,QAAQ,KAAK,QAAQ;QAC1B,OAAOD;IACX,CAAC;IACD,8DAA8D;IAC9D,OAAOA,KAAKE,UAAU,IAAIF,KAAKG,IAAI;AACvC;AACA;;;;CAIC,GAAG,MAAMC,2BAA2B,CAACJ,OAAO;IACzC,IAAIK;IACJ,IAAIL,KAAKM,QAAQ,KAAK,GAAG;QACrB,OAAO,CAAC;IACZ,CAAC;IACD,MAAMC,SAAS,AAACF,CAAAA,sBAAsBL,KAAKQ,aAAa,AAAD,MAAO,IAAI,IAAIH,wBAAwB,KAAK,IAAI,KAAK,IAAIA,oBAAoBI,WAAW;IAC/I,OAAOF,OAAOG,gBAAgB,CAACV,MAAM,IAAI;AAC7C;AAKW,MAAMF,kBAAkB,CAACE,OAAO;IACvC,iFAAiF;IACjF,MAAME,aAAaF,QAAQH,cAAcG;IACzC,2BAA2B;IAC3B,IAAI,CAACE,YAAY,OAAOS,SAASC,IAAI;IACrC,OAAOV,WAAWD,QAAQ;QACtB,KAAK;QACL,KAAK;YACD,OAAOC,WAAWM,aAAa,CAACI,IAAI;QACxC,KAAK;YACD,OAAOV,WAAWU,IAAI;IAC9B;IACA,uFAAuF;IACvF,MAAM,EAAEC,SAAQ,EAAGC,UAAS,EAAGC,UAAS,EAAG,GAAGX,yBAAyBF;IACvE,IAAI,wBAAwBc,IAAI,CAACH,WAAWE,YAAYD,YAAY;QAChE,OAAOZ;IACX,CAAC;IACD,OAAOJ,gBAAgBI;AAC3B;AACO,MAAMH,kBAAkB,CAACC,OAAO;IACnC,IAAIiB;IACJ,MAAMC,sBAAsBpB,gBAAgBE;IAC5C,OAAOkB,sBAAsBA,wBAAyB,CAAA,AAACD,CAAAA,qCAAqCC,oBAAoBV,aAAa,AAAD,MAAO,IAAI,IAAIS,uCAAuC,KAAK,IAAI,KAAK,IAAIA,mCAAmCL,IAAI,AAAD,IAAK,KAAK;AACxP"}
|
@@ -26,6 +26,4 @@ const _getReactFiberFromNode = require("./getReactFiberFromNode");
|
|
26
26
|
}
|
27
27
|
function hasAutofocusFilter(node) {
|
28
28
|
return hasAutofocusProp(node) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
29
|
-
}
|
30
|
-
|
31
|
-
//# sourceMappingURL=hasAutoFocusFilter.js.map
|
29
|
+
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["hasAutoFocusFilter.js"],"sourcesContent":["//\n// Dev utils to detect if nodes have \"autoFocus\" props.\n//\nimport { getReactFiberFromNode } from './getReactFiberFromNode';\n/**\n * Detects if a passed HTML node has \"autoFocus\" prop on a React's fiber. Is needed as React handles autofocus behavior\n * in React DOM and will not pass \"autoFocus\" to an actual HTML.\n *\n * @param node\n */ function hasAutofocusProp(node) {\n // https://github.com/facebook/react/blob/848bb2426e44606e0a55dfe44c7b3ece33772485/packages/react-dom/src/client/ReactDOMHostConfig.js#L157-L166\n const isAutoFocusableElement = node.nodeName === 'BUTTON' || node.nodeName === 'INPUT' || node.nodeName === 'SELECT' || node.nodeName === 'TEXTAREA';\n if (isAutoFocusableElement) {\n var _getReactFiberFromNode;\n return !!((_getReactFiberFromNode = getReactFiberFromNode(node)) === null || _getReactFiberFromNode === void 0 ? void 0 : _getReactFiberFromNode.pendingProps.autoFocus);\n }\n return false;\n}\nexport function hasAutofocusFilter(node) {\n return hasAutofocusProp(node) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;\n}\n"],"names":["hasAutofocusFilter","hasAutofocusProp","node","isAutoFocusableElement","nodeName","_getReactFiberFromNode","getReactFiberFromNode","pendingProps","autoFocus","NodeFilter","FILTER_ACCEPT","FILTER_SKIP"],"mappings":"AAAA,EAAE;AACF,uDAAuD;AACvD,EAAE;;;;;+BAgBcA;;aAAAA;;uCAfsB;AACtC;;;;;CAKC,GAAG,SAASC,iBAAiBC,IAAI,EAAE;IAChC,gJAAgJ;IAChJ,MAAMC,yBAAyBD,KAAKE,QAAQ,KAAK,YAAYF,KAAKE,QAAQ,KAAK,WAAWF,KAAKE,QAAQ,KAAK,YAAYF,KAAKE,QAAQ,KAAK;IAC1I,IAAID,wBAAwB;QACxB,IAAIE;QACJ,OAAO,CAAC,CAAE,CAAA,AAACA,CAAAA,0BAAyBC,IAAAA,4CAAqB,EAACJ,KAAI,MAAO,IAAI,IAAIG,4BAA2B,KAAK,IAAI,KAAK,IAAIA,wBAAuBE,YAAY,CAACC,SAAS,AAAD;IAC1K,CAAC;IACD,OAAO,KAAK;AAChB;AACO,SAASR,mBAAmBE,IAAI,EAAE;IACrC,OAAOD,iBAAiBC,QAAQO,WAAWC,aAAa,GAAGD,WAAWE,WAAW;AACrF"}
|
@@ -18,6 +18,3 @@ _exportStar(require("./toggleScrollListener"), exports);
|
|
18
18
|
_exportStar(require("./hasAutoFocusFilter"), exports);
|
19
19
|
_exportStar(require("./writeArrowUpdates"), exports);
|
20
20
|
_exportStar(require("./writeContainerupdates"), exports);
|
21
|
-
//# sourceMappingURL=index.js.map
|
22
|
-
|
23
|
-
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["index.js"],"sourcesContent":["export * from './parseFloatingUIPlacement';\nexport * from './getBoundary';\nexport * from './getReactFiberFromNode';\nexport * from './getScrollParent';\nexport * from './mergeArrowOffset';\nexport * from './toFloatingUIPadding';\nexport * from './toFloatingUIPlacement';\nexport * from './fromFloatingUIPlacement';\nexport * from './resolvePositioningShorthand';\nexport * from './useCallbackRef';\nexport * from './debounce';\nexport * from './toggleScrollListener';\nexport * from './hasAutoFocusFilter';\nexport * from './writeArrowUpdates';\nexport * from './writeContainerupdates';\n"],"names":[],"mappings":";;;;;oBAAc;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA"}
|
@@ -42,6 +42,4 @@ const addArrowOffset = (offset, arrowHeight)=>{
|
|
42
42
|
...offset,
|
43
43
|
mainAxis: ((_offset_mainAxis = offset.mainAxis) !== null && _offset_mainAxis !== void 0 ? _offset_mainAxis : 0) + arrowHeight
|
44
44
|
};
|
45
|
-
};
|
46
|
-
|
47
|
-
//# sourceMappingURL=mergeArrowOffset.js.map
|
45
|
+
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["mergeArrowOffset.js"],"sourcesContent":["/**\n * Generally when adding an arrow to popper, it's necessary to offset the position of the popper by the\n * height of the arrow. A simple utility to merge a provided offset with an arrow height to return the final offset\n *\n * @internal\n * @param userOffset - The offset provided by the user\n * @param arrowHeight - The height of the arrow in px\n * @returns User offset augmented with arrow height\n */ export function mergeArrowOffset(userOffset, arrowHeight) {\n if (typeof userOffset === 'number') {\n return addArrowOffset(userOffset, arrowHeight);\n }\n if (typeof userOffset === 'object' && userOffset !== null) {\n return addArrowOffset(userOffset, arrowHeight);\n }\n if (typeof userOffset === 'function') {\n return (offsetParams)=>{\n const offset = userOffset(offsetParams);\n return addArrowOffset(offset, arrowHeight);\n };\n }\n return {\n mainAxis: arrowHeight\n };\n}\nconst addArrowOffset = (offset, arrowHeight)=>{\n if (typeof offset === 'number') {\n return {\n mainAxis: offset + arrowHeight\n };\n }\n var _offset_mainAxis;\n return {\n ...offset,\n mainAxis: ((_offset_mainAxis = offset.mainAxis) !== null && _offset_mainAxis !== void 0 ? _offset_mainAxis : 0) + arrowHeight\n };\n};\n"],"names":["mergeArrowOffset","userOffset","arrowHeight","addArrowOffset","offsetParams","offset","mainAxis","_offset_mainAxis"],"mappings":"AAAA;;;;;;;;CAQC;;;;+BAAmBA;;aAAAA;;AAAT,SAASA,iBAAiBC,UAAU,EAAEC,WAAW,EAAE;IAC1D,IAAI,OAAOD,eAAe,UAAU;QAChC,OAAOE,eAAeF,YAAYC;IACtC,CAAC;IACD,IAAI,OAAOD,eAAe,YAAYA,eAAe,IAAI,EAAE;QACvD,OAAOE,eAAeF,YAAYC;IACtC,CAAC;IACD,IAAI,OAAOD,eAAe,YAAY;QAClC,OAAO,CAACG,eAAe;YACnB,MAAMC,SAASJ,WAAWG;YAC1B,OAAOD,eAAeE,QAAQH;QAClC;IACJ,CAAC;IACD,OAAO;QACHI,UAAUJ;IACd;AACJ;AACA,MAAMC,iBAAiB,CAACE,QAAQH,cAAc;IAC1C,IAAI,OAAOG,WAAW,UAAU;QAC5B,OAAO;YACHC,UAAUD,SAASH;QACvB;IACJ,CAAC;IACD,IAAIK;IACJ,OAAO;QACH,GAAGF,MAAM;QACTC,UAAU,AAAC,CAAA,AAACC,CAAAA,mBAAmBF,OAAOC,QAAQ,AAAD,MAAO,IAAI,IAAIC,qBAAqB,KAAK,IAAIA,mBAAmB,CAAC,AAAD,IAAKL;IACtH;AACJ"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["parseFloatingUIPlacement.js"],"sourcesContent":["/**\n * Parses Floating UI placement and returns the different components\n * @param placement - the floating ui placement (i.e. bottom-start)\n *\n * @returns side and alignment components of the placement\n */ export function parseFloatingUIPlacement(placement) {\n const tokens = placement.split('-');\n return {\n side: tokens[0],\n alignment: tokens[1]\n };\n}\n"],"names":["parseFloatingUIPlacement","placement","tokens","split","side","alignment"],"mappings":"AAAA;;;;;CAKC;;;;+BAAmBA;;aAAAA;;AAAT,SAASA,yBAAyBC,SAAS,EAAE;IACpD,MAAMC,SAASD,UAAUE,KAAK,CAAC;IAC/B,OAAO;QACHC,MAAMF,MAAM,CAAC,EAAE;QACfG,WAAWH,MAAM,CAAC,EAAE;IACxB;AACJ"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["resolvePositioningShorthand.js"],"sourcesContent":["// Look up table for shorthand to avoid parsing strings\nconst shorthandLookup = {\n above: {\n position: 'above',\n align: 'center'\n },\n 'above-start': {\n position: 'above',\n align: 'start'\n },\n 'above-end': {\n position: 'above',\n align: 'end'\n },\n below: {\n position: 'below',\n align: 'center'\n },\n 'below-start': {\n position: 'below',\n align: 'start'\n },\n 'below-end': {\n position: 'below',\n align: 'end'\n },\n before: {\n position: 'before',\n align: 'center'\n },\n 'before-top': {\n position: 'before',\n align: 'top'\n },\n 'before-bottom': {\n position: 'before',\n align: 'bottom'\n },\n after: {\n position: 'after',\n align: 'center'\n },\n 'after-top': {\n position: 'after',\n align: 'top'\n },\n 'after-bottom': {\n position: 'after',\n align: 'bottom'\n }\n};\nexport function resolvePositioningShorthand(shorthand) {\n if (shorthand === undefined || shorthand === null) {\n return {};\n }\n if (typeof shorthand === 'string') {\n return shorthandLookup[shorthand];\n }\n return shorthand;\n}\n"],"names":["resolvePositioningShorthand","shorthandLookup","above","position","align","below","before","after","shorthand","undefined"],"mappings":"AAAA,uDAAuD;;;;;+BAmDvCA;;aAAAA;;AAlDhB,MAAMC,kBAAkB;IACpBC,OAAO;QACHC,UAAU;QACVC,OAAO;IACX;IACA,eAAe;QACXD,UAAU;QACVC,OAAO;IACX;IACA,aAAa;QACTD,UAAU;QACVC,OAAO;IACX;IACAC,OAAO;QACHF,UAAU;QACVC,OAAO;IACX;IACA,eAAe;QACXD,UAAU;QACVC,OAAO;IACX;IACA,aAAa;QACTD,UAAU;QACVC,OAAO;IACX;IACAE,QAAQ;QACJH,UAAU;QACVC,OAAO;IACX;IACA,cAAc;QACVD,UAAU;QACVC,OAAO;IACX;IACA,iBAAiB;QACbD,UAAU;QACVC,OAAO;IACX;IACAG,OAAO;QACHJ,UAAU;QACVC,OAAO;IACX;IACA,aAAa;QACTD,UAAU;QACVC,OAAO;IACX;IACA,gBAAgB;QACZD,UAAU;QACVC,OAAO;IACX;AACJ;AACO,SAASJ,4BAA4BQ,SAAS,EAAE;IACnD,IAAIA,cAAcC,aAAaD,cAAc,IAAI,EAAE;QAC/C,OAAO,CAAC;IACZ,CAAC;IACD,IAAI,OAAOA,cAAc,UAAU;QAC/B,OAAOP,eAAe,CAACO,UAAU;IACrC,CAAC;IACD,OAAOA;AACX"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["toFloatingUIPadding.js"],"sourcesContent":["export function toFloatingUIPadding(padding, isRtl) {\n if (typeof padding === 'number') {\n return padding;\n }\n const { start , end , ...verticalPadding } = padding;\n const paddingObject = verticalPadding;\n const left = isRtl ? 'end' : 'start';\n const right = isRtl ? 'start' : 'end';\n // assign properties explicitly since undefined values are actually handled by floating UI\n // TODO create floating UI issue\n if (padding[left]) {\n paddingObject.left = padding[left];\n }\n if (padding[right]) {\n paddingObject.right = padding[right];\n }\n return paddingObject;\n}\n"],"names":["toFloatingUIPadding","padding","isRtl","start","end","verticalPadding","paddingObject","left","right"],"mappings":";;;;+BAAgBA;;aAAAA;;AAAT,SAASA,oBAAoBC,OAAO,EAAEC,KAAK,EAAE;IAChD,IAAI,OAAOD,YAAY,UAAU;QAC7B,OAAOA;IACX,CAAC;IACD,MAAM,EAAEE,MAAK,EAAGC,IAAG,EAAG,GAAGC,iBAAiB,GAAGJ;IAC7C,MAAMK,gBAAgBD;IACtB,MAAME,OAAOL,QAAQ,QAAQ,OAAO;IACpC,MAAMM,QAAQN,QAAQ,UAAU,KAAK;IACrC,0FAA0F;IAC1F,gCAAgC;IAChC,IAAID,OAAO,CAACM,KAAK,EAAE;QACfD,cAAcC,IAAI,GAAGN,OAAO,CAACM,KAAK;IACtC,CAAC;IACD,IAAIN,OAAO,CAACO,MAAM,EAAE;QAChBF,cAAcE,KAAK,GAAGP,OAAO,CAACO,MAAM;IACxC,CAAC;IACD,OAAOF;AACX"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["toFloatingUIPlacement.js"],"sourcesContent":["const getPositionMap = (rtl)=>({\n above: 'top',\n below: 'bottom',\n before: rtl ? 'right' : 'left',\n after: rtl ? 'left' : 'right'\n });\n// Floating UI automatically flips alignment\n// https://github.com/floating-ui/floating-ui/issues/1563\nconst getAlignmentMap = ()=>({\n start: 'start',\n end: 'end',\n top: 'start',\n bottom: 'end',\n center: undefined\n });\nconst shouldAlignToCenter = (p, a)=>{\n const positionedVertically = p === 'above' || p === 'below';\n const alignedVertically = a === 'top' || a === 'bottom';\n return positionedVertically && alignedVertically || !positionedVertically && !alignedVertically;\n};\n/**\n * Maps internal positioning values to Floating UI placement\n * @see positioningHelper.test.ts for expected placement values\n */ export const toFloatingUIPlacement = (align, position, rtl)=>{\n const alignment = shouldAlignToCenter(position, align) ? 'center' : align;\n const computedPosition = position && getPositionMap(rtl)[position];\n const computedAlignment = alignment && getAlignmentMap()[alignment];\n if (computedPosition && computedAlignment) {\n return `${computedPosition}-${computedAlignment}`;\n }\n return computedPosition;\n};\n"],"names":["toFloatingUIPlacement","getPositionMap","rtl","above","below","before","after","getAlignmentMap","start","end","top","bottom","center","undefined","shouldAlignToCenter","p","a","positionedVertically","alignedVertically","align","position","alignment","computedPosition","computedAlignment"],"mappings":";;;;+BAuBiBA;;aAAAA;;AAvBjB,MAAMC,iBAAiB,CAACC,MAAO,CAAA;QACvBC,OAAO;QACPC,OAAO;QACPC,QAAQH,MAAM,UAAU,MAAM;QAC9BI,OAAOJ,MAAM,SAAS,OAAO;IACjC,CAAA;AACJ,4CAA4C;AAC5C,yDAAyD;AACzD,MAAMK,kBAAkB,IAAK,CAAA;QACrBC,OAAO;QACPC,KAAK;QACLC,KAAK;QACLC,QAAQ;QACRC,QAAQC;IACZ,CAAA;AACJ,MAAMC,sBAAsB,CAACC,GAAGC,IAAI;IAChC,MAAMC,uBAAuBF,MAAM,WAAWA,MAAM;IACpD,MAAMG,oBAAoBF,MAAM,SAASA,MAAM;IAC/C,OAAOC,wBAAwBC,qBAAqB,CAACD,wBAAwB,CAACC;AAClF;AAIW,MAAMlB,wBAAwB,CAACmB,OAAOC,UAAUlB,MAAM;IAC7D,MAAMmB,YAAYP,oBAAoBM,UAAUD,SAAS,WAAWA,KAAK;IACzE,MAAMG,mBAAmBF,YAAYnB,eAAeC,IAAI,CAACkB,SAAS;IAClE,MAAMG,oBAAoBF,aAAad,iBAAiB,CAACc,UAAU;IACnE,IAAIC,oBAAoBC,mBAAmB;QACvC,OAAO,CAAC,EAAED,iBAAiB,CAAC,EAAEC,kBAAkB,CAAC;IACrD,CAAC;IACD,OAAOD;AACX"}
|
@@ -20,6 +20,4 @@ function toggleScrollListener(next, prev, handler) {
|
|
20
20
|
const scrollParent = (0, _getScrollParent.getScrollParent)(next);
|
21
21
|
scrollParent.addEventListener('scroll', handler);
|
22
22
|
}
|
23
|
-
}
|
24
|
-
|
25
|
-
//# sourceMappingURL=toggleScrollListener.js.map
|
23
|
+
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["toggleScrollListener.js"],"sourcesContent":["import { isHTMLElement } from '@fluentui/react-utilities';\nimport { getScrollParent } from './getScrollParent';\n/**\n * Toggles event listeners for scroll parent.\n * Cleans up the event listeners for the previous element and adds them for the new scroll parent.\n * @param next Next element\n * @param prev Previous element\n */ export function toggleScrollListener(next, prev, handler) {\n if (next === prev) {\n return;\n }\n if (isHTMLElement(prev)) {\n const prevScrollParent = getScrollParent(prev);\n prevScrollParent.removeEventListener('scroll', handler);\n }\n if (isHTMLElement(next)) {\n const scrollParent = getScrollParent(next);\n scrollParent.addEventListener('scroll', handler);\n }\n}\n"],"names":["toggleScrollListener","next","prev","handler","isHTMLElement","prevScrollParent","getScrollParent","removeEventListener","scrollParent","addEventListener"],"mappings":";;;;+BAOoBA;;aAAAA;;gCAPU;iCACE;AAMrB,SAASA,qBAAqBC,IAAI,EAAEC,IAAI,EAAEC,OAAO,EAAE;IAC1D,IAAIF,SAASC,MAAM;QACf;IACJ,CAAC;IACD,IAAIE,IAAAA,6BAAa,EAACF,OAAO;QACrB,MAAMG,mBAAmBC,IAAAA,gCAAe,EAACJ;QACzCG,iBAAiBE,mBAAmB,CAAC,UAAUJ;IACnD,CAAC;IACD,IAAIC,IAAAA,6BAAa,EAACH,OAAO;QACrB,MAAMO,eAAeF,IAAAA,gCAAe,EAACL;QACrCO,aAAaC,gBAAgB,CAAC,UAAUN;IAC5C,CAAC;AACL"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["useCallbackRef.js"],"sourcesContent":["import * as React from 'react';\nimport { useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\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 */ export function useCallbackRef(initialValue, callback, skipInitialResolve) {\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 if (last !== value) {\n ref.value = value;\n if (skipInitialResolve && isFirst.current) {\n return;\n }\n ref.callback(value, last);\n }\n }\n }\n }));\n useIsomorphicLayoutEffect(()=>{\n isFirst.current = false;\n }, []);\n // update callback\n ref.callback = callback;\n return ref.facade;\n}\n"],"names":["useCallbackRef","initialValue","callback","skipInitialResolve","isFirst","React","useRef","ref","useState","value","facade","current","last","useIsomorphicLayoutEffect"],"mappings":";;;;+BAkBoBA;;aAAAA;;;6DAlBG;gCACmB;AAiB/B,SAASA,eAAeC,YAAY,EAAEC,QAAQ,EAAEC,kBAAkB,EAAE;IAC3E,MAAMC,UAAUC,OAAMC,MAAM,CAAC,IAAI;IACjC,MAAM,CAACC,IAAI,GAAGF,OAAMG,QAAQ,CAAC,IAAK,CAAA;YAC1B,QAAQ;YACRC,OAAOR;YACP,gBAAgB;YAChBC;YACA,8BAA8B;YAC9BQ,QAAQ;gBACJ,IAAIC,WAAW;oBACX,OAAOJ,IAAIE,KAAK;gBACpB;gBACA,IAAIE,SAASF,MAAM;oBACf,MAAMG,OAAOL,IAAIE,KAAK;oBACtB,IAAIG,SAASH,OAAO;wBAChBF,IAAIE,KAAK,GAAGA;wBACZ,IAAIN,sBAAsBC,QAAQO,OAAO,EAAE;4BACvC;wBACJ,CAAC;wBACDJ,IAAIL,QAAQ,CAACO,OAAOG;oBACxB,CAAC;gBACL;YACJ;QACJ,CAAA;IACJC,IAAAA,yCAAyB,EAAC,IAAI;QAC1BT,QAAQO,OAAO,GAAG,KAAK;IAC3B,GAAG,EAAE;IACL,kBAAkB;IAClBJ,IAAIL,QAAQ,GAAGA;IACf,OAAOK,IAAIG,MAAM;AACrB"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["writeArrowUpdates.js"],"sourcesContent":["/**\n * Writes all DOM element updates after position is computed\n */ export function writeArrowUpdates(options) {\n const { arrow , middlewareData } = options;\n if (!middlewareData.arrow || !arrow) {\n return;\n }\n const { x: arrowX , y: arrowY } = middlewareData.arrow;\n Object.assign(arrow.style, {\n left: `${arrowX}px`,\n top: `${arrowY}px`\n });\n}\n"],"names":["writeArrowUpdates","options","arrow","middlewareData","x","arrowX","y","arrowY","Object","assign","style","left","top"],"mappings":"AAAA;;CAEC;;;;+BAAmBA;;aAAAA;;AAAT,SAASA,kBAAkBC,OAAO,EAAE;IAC3C,MAAM,EAAEC,MAAK,EAAGC,eAAc,EAAG,GAAGF;IACpC,IAAI,CAACE,eAAeD,KAAK,IAAI,CAACA,OAAO;QACjC;IACJ,CAAC;IACD,MAAM,EAAEE,GAAGC,OAAM,EAAGC,GAAGC,OAAM,EAAG,GAAGJ,eAAeD,KAAK;IACvDM,OAAOC,MAAM,CAACP,MAAMQ,KAAK,EAAE;QACvBC,MAAM,CAAC,EAAEN,OAAO,EAAE,CAAC;QACnBO,KAAK,CAAC,EAAEL,OAAO,EAAE,CAAC;IACtB;AACJ"}
|
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "writeContainerUpdates", {
|
|
9
9
|
const _constants = require("../constants");
|
10
10
|
function writeContainerUpdates(options) {
|
11
11
|
var _middlewareData_hide, _middlewareData_hide1, _container_ownerDocument_defaultView;
|
12
|
-
const { container , placement , middlewareData , strategy , lowPPI , coordinates } = options;
|
12
|
+
const { container , placement , middlewareData , strategy , lowPPI , coordinates , useTransform =true } = options;
|
13
13
|
if (!container) {
|
14
14
|
return;
|
15
15
|
}
|
@@ -34,9 +34,16 @@ function writeContainerUpdates(options) {
|
|
34
34
|
const x = Math.round(coordinates.x * devicePixelRatio) / devicePixelRatio;
|
35
35
|
const y = Math.round(coordinates.y * devicePixelRatio) / devicePixelRatio;
|
36
36
|
Object.assign(container.style, {
|
37
|
-
transform: lowPPI ? `translate(${x}px, ${y}px)` : `translate3d(${x}px, ${y}px, 0)`,
|
38
37
|
position: strategy
|
39
38
|
});
|
40
|
-
|
41
|
-
|
42
|
-
|
39
|
+
if (useTransform) {
|
40
|
+
Object.assign(container.style, {
|
41
|
+
transform: lowPPI ? `translate(${x}px, ${y}px)` : `translate3d(${x}px, ${y}px, 0)`
|
42
|
+
});
|
43
|
+
return;
|
44
|
+
}
|
45
|
+
Object.assign(container.style, {
|
46
|
+
left: `${x}px`,
|
47
|
+
top: `${y}px`
|
48
|
+
});
|
49
|
+
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["writeContainerupdates.js"],"sourcesContent":["import { DATA_POSITIONING_ESCAPED, DATA_POSITIONING_HIDDEN, DATA_POSITIONING_INTERSECTING, DATA_POSITIONING_PLACEMENT } from '../constants';\n/**\n * Writes all container element position updates after the position is computed\n */ export function writeContainerUpdates(options) {\n var _middlewareData_hide, _middlewareData_hide1, _container_ownerDocument_defaultView;\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 container.removeAttribute(DATA_POSITIONING_ESCAPED);\n if ((_middlewareData_hide = middlewareData.hide) === null || _middlewareData_hide === void 0 ? void 0 : _middlewareData_hide.escaped) {\n container.setAttribute(DATA_POSITIONING_ESCAPED, '');\n }\n container.removeAttribute(DATA_POSITIONING_HIDDEN);\n if ((_middlewareData_hide1 = middlewareData.hide) === null || _middlewareData_hide1 === void 0 ? void 0 : _middlewareData_hide1.referenceHidden) {\n container.setAttribute(DATA_POSITIONING_HIDDEN, '');\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 = container.ownerDocument.defaultView) === null || _container_ownerDocument_defaultView === void 0 ? void 0 : _container_ownerDocument_defaultView.devicePixelRatio) || 1;\n const x = Math.round(coordinates.x * devicePixelRatio) / devicePixelRatio;\n const y = Math.round(coordinates.y * devicePixelRatio) / devicePixelRatio;\n Object.assign(container.style, {\n position: strategy\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 Object.assign(container.style, {\n left: `${x}px`,\n top: `${y}px`\n });\n}\n"],"names":["writeContainerUpdates","options","_middlewareData_hide","_middlewareData_hide1","_container_ownerDocument_defaultView","container","placement","middlewareData","strategy","lowPPI","coordinates","useTransform","setAttribute","DATA_POSITIONING_PLACEMENT","removeAttribute","DATA_POSITIONING_INTERSECTING","intersectionObserver","intersecting","DATA_POSITIONING_ESCAPED","hide","escaped","DATA_POSITIONING_HIDDEN","referenceHidden","devicePixelRatio","ownerDocument","defaultView","x","Math","round","y","Object","assign","style","position","transform","left","top"],"mappings":";;;;+BAGoBA;;aAAAA;;2BAHyG;AAGlH,SAASA,sBAAsBC,OAAO,EAAE;IAC/C,IAAIC,sBAAsBC,uBAAuBC;IACjD,MAAM,EAAEC,UAAS,EAAGC,UAAS,EAAGC,eAAc,EAAGC,SAAQ,EAAGC,OAAM,EAAGC,YAAW,EAAGC,cAAc,IAAI,CAAA,EAAG,GAAGV;IAC3G,IAAI,CAACI,WAAW;QACZ;IACJ,CAAC;IACDA,UAAUO,YAAY,CAACC,qCAA0B,EAAEP;IACnDD,UAAUS,eAAe,CAACC,wCAA6B;IACvD,IAAIR,eAAeS,oBAAoB,CAACC,YAAY,EAAE;QAClDZ,UAAUO,YAAY,CAACG,wCAA6B,EAAE;IAC1D,CAAC;IACDV,UAAUS,eAAe,CAACI,mCAAwB;IAClD,IAAI,AAAChB,CAAAA,uBAAuBK,eAAeY,IAAI,AAAD,MAAO,IAAI,IAAIjB,yBAAyB,KAAK,IAAI,KAAK,IAAIA,qBAAqBkB,OAAO,EAAE;QAClIf,UAAUO,YAAY,CAACM,mCAAwB,EAAE;IACrD,CAAC;IACDb,UAAUS,eAAe,CAACO,kCAAuB;IACjD,IAAI,AAAClB,CAAAA,wBAAwBI,eAAeY,IAAI,AAAD,MAAO,IAAI,IAAIhB,0BAA0B,KAAK,IAAI,KAAK,IAAIA,sBAAsBmB,eAAe,EAAE;QAC7IjB,UAAUO,YAAY,CAACS,kCAAuB,EAAE;IACpD,CAAC;IACD,uDAAuD;IACvD,oHAAoH;IACpH,wFAAwF;IACxF,wEAAwE;IACxE,MAAME,mBAAmB,AAAC,CAAA,AAACnB,CAAAA,uCAAuCC,UAAUmB,aAAa,CAACC,WAAW,AAAD,MAAO,IAAI,IAAIrB,yCAAyC,KAAK,IAAI,KAAK,IAAIA,qCAAqCmB,gBAAgB,AAAD,KAAM;IACxO,MAAMG,IAAIC,KAAKC,KAAK,CAAClB,YAAYgB,CAAC,GAAGH,oBAAoBA;IACzD,MAAMM,IAAIF,KAAKC,KAAK,CAAClB,YAAYmB,CAAC,GAAGN,oBAAoBA;IACzDO,OAAOC,MAAM,CAAC1B,UAAU2B,KAAK,EAAE;QAC3BC,UAAUzB;IACd;IACA,IAAIG,cAAc;QACdmB,OAAOC,MAAM,CAAC1B,UAAU2B,KAAK,EAAE;YAC3BE,WAAWzB,SAAS,CAAC,UAAU,EAAEiB,EAAE,IAAI,EAAEG,EAAE,GAAG,CAAC,GAAG,CAAC,YAAY,EAAEH,EAAE,IAAI,EAAEG,EAAE,MAAM,CAAC;QACtF;QACA;IACJ,CAAC;IACDC,OAAOC,MAAM,CAAC1B,UAAU2B,KAAK,EAAE;QAC3BG,MAAM,CAAC,EAAET,EAAE,EAAE,CAAC;QACdU,KAAK,CAAC,EAAEP,EAAE,EAAE,CAAC;IACjB;AACJ"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fluentui/react-positioning",
|
3
|
-
"version": "9.
|
3
|
+
"version": "9.6.0",
|
4
4
|
"description": "A react wrapper around Popper.js for Fluent UI",
|
5
5
|
"main": "lib-commonjs/index.js",
|
6
6
|
"module": "lib/index.js",
|
@@ -32,8 +32,8 @@
|
|
32
32
|
"@floating-ui/dom": "^1.2.0",
|
33
33
|
"@fluentui/react-shared-contexts": "^9.5.0",
|
34
34
|
"@fluentui/react-theme": "^9.1.8",
|
35
|
-
"@fluentui/react-utilities": "^9.9.
|
36
|
-
"@griffel/react": "^1.5.
|
35
|
+
"@fluentui/react-utilities": "^9.9.2",
|
36
|
+
"@griffel/react": "^1.5.7",
|
37
37
|
"@swc/helpers": "^0.4.14"
|
38
38
|
},
|
39
39
|
"peerDependencies": {
|