@fluentui/react-positioning 9.75.1-experimental.css-modules.20261103-d6c85ee2a9.0 → 9.75.1-experimental.positioning-engine.20261103-19efe125d1.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.
Files changed (111) hide show
  1. package/CHANGELOG.md +7 -7
  2. package/README.md +130 -7
  3. package/lib/PositioningConfigurationContext.js +1 -2
  4. package/lib/PositioningConfigurationContext.js.map +1 -1
  5. package/lib/createPositionManager.js +74 -82
  6. package/lib/createPositionManager.js.map +1 -1
  7. package/lib/engine/computePosition.js +258 -0
  8. package/lib/engine/computePosition.js.map +1 -0
  9. package/lib/engine/index.js +260 -0
  10. package/lib/engine/index.js.map +1 -0
  11. package/lib/engine/platform.js +209 -0
  12. package/lib/engine/platform.js.map +1 -0
  13. package/lib/middleware/flip.js +1 -1
  14. package/lib/middleware/flip.js.map +1 -1
  15. package/lib/middleware/intersecting.js +1 -1
  16. package/lib/middleware/intersecting.js.map +1 -1
  17. package/lib/middleware/maxSize.js +1 -1
  18. package/lib/middleware/maxSize.js.map +1 -1
  19. package/lib/middleware/offset.js +1 -1
  20. package/lib/middleware/offset.js.map +1 -1
  21. package/lib/middleware/shift.js +1 -1
  22. package/lib/middleware/shift.js.map +1 -1
  23. package/lib/usePositioning.js +38 -48
  24. package/lib/usePositioning.js.map +1 -1
  25. package/lib/usePositioning.raster.js +45 -0
  26. package/lib/usePositioning.raster.js.map +1 -0
  27. package/lib/usePositioningOptions.js +25 -117
  28. package/lib/usePositioningOptions.js.map +1 -1
  29. package/lib/utils/createResizeObserver.js +2 -2
  30. package/lib/utils/createResizeObserver.js.map +1 -1
  31. package/lib/utils/debounce.js +6 -13
  32. package/lib/utils/debounce.js.map +1 -1
  33. package/lib/utils/fromFloatingUIPlacement.js +10 -29
  34. package/lib/utils/fromFloatingUIPlacement.js.map +1 -1
  35. package/lib/utils/getBoundary.js +8 -17
  36. package/lib/utils/getBoundary.js.map +1 -1
  37. package/lib/utils/index.js +0 -2
  38. package/lib/utils/index.js.map +1 -1
  39. package/lib/utils/listScrollParents.js +12 -20
  40. package/lib/utils/listScrollParents.js.map +1 -1
  41. package/lib/utils/normalizeAutoSize.js +15 -22
  42. package/lib/utils/normalizeAutoSize.js.map +1 -1
  43. package/lib/utils/toFloatingUIPlacement.js +9 -26
  44. package/lib/utils/toFloatingUIPlacement.js.map +1 -1
  45. package/lib/utils/useCallbackRef.js +1 -10
  46. package/lib/utils/useCallbackRef.js.map +1 -1
  47. package/lib-commonjs/PositioningConfigurationContext.cjs +1 -2
  48. package/lib-commonjs/PositioningConfigurationContext.cjs.map +1 -1
  49. package/lib-commonjs/createPositionManager.cjs +72 -80
  50. package/lib-commonjs/createPositionManager.cjs.map +1 -1
  51. package/lib-commonjs/engine/computePosition.cjs +265 -0
  52. package/lib-commonjs/engine/computePosition.cjs.map +1 -0
  53. package/lib-commonjs/engine/index.cjs +290 -0
  54. package/lib-commonjs/engine/index.cjs.map +1 -0
  55. package/lib-commonjs/engine/platform.cjs +264 -0
  56. package/lib-commonjs/engine/platform.cjs.map +1 -0
  57. package/lib-commonjs/middleware/flip.cjs +6 -6
  58. package/lib-commonjs/middleware/flip.cjs.map +1 -1
  59. package/lib-commonjs/middleware/intersecting.cjs +2 -2
  60. package/lib-commonjs/middleware/intersecting.cjs.map +1 -1
  61. package/lib-commonjs/middleware/maxSize.cjs +4 -4
  62. package/lib-commonjs/middleware/maxSize.cjs.map +1 -1
  63. package/lib-commonjs/middleware/offset.cjs +2 -2
  64. package/lib-commonjs/middleware/offset.cjs.map +1 -1
  65. package/lib-commonjs/middleware/shift.cjs +7 -7
  66. package/lib-commonjs/middleware/shift.cjs.map +1 -1
  67. package/lib-commonjs/usePositioning.cjs +37 -46
  68. package/lib-commonjs/usePositioning.cjs.map +1 -1
  69. package/lib-commonjs/usePositioning.raster.cjs +49 -0
  70. package/lib-commonjs/usePositioning.raster.cjs.map +1 -0
  71. package/lib-commonjs/usePositioningOptions.cjs +24 -112
  72. package/lib-commonjs/usePositioningOptions.cjs.map +1 -1
  73. package/lib-commonjs/utils/createResizeObserver.cjs +2 -2
  74. package/lib-commonjs/utils/createResizeObserver.cjs.map +1 -1
  75. package/lib-commonjs/utils/debounce.cjs +6 -13
  76. package/lib-commonjs/utils/debounce.cjs.map +1 -1
  77. package/lib-commonjs/utils/fromFloatingUIPlacement.cjs +21 -32
  78. package/lib-commonjs/utils/fromFloatingUIPlacement.cjs.map +1 -1
  79. package/lib-commonjs/utils/getBoundary.cjs +8 -17
  80. package/lib-commonjs/utils/getBoundary.cjs.map +1 -1
  81. package/lib-commonjs/utils/index.cjs +0 -8
  82. package/lib-commonjs/utils/index.cjs.map +1 -1
  83. package/lib-commonjs/utils/listScrollParents.cjs +12 -20
  84. package/lib-commonjs/utils/listScrollParents.cjs.map +1 -1
  85. package/lib-commonjs/utils/normalizeAutoSize.cjs +26 -25
  86. package/lib-commonjs/utils/normalizeAutoSize.cjs.map +1 -1
  87. package/lib-commonjs/utils/toFloatingUIPlacement.cjs +13 -27
  88. package/lib-commonjs/utils/toFloatingUIPlacement.cjs.map +1 -1
  89. package/lib-commonjs/utils/useCallbackRef.cjs +1 -9
  90. package/lib-commonjs/utils/useCallbackRef.cjs.map +1 -1
  91. package/package.json +5 -9
  92. package/lib/Arrow.module.css +0 -45
  93. package/lib/hooks/useSafeZoneArea/SafeZoneArea.module.css +0 -28
  94. package/lib/hooks/useSafeZoneArea/SafeZoneArea.styles.css.js +0 -9
  95. package/lib/hooks/useSafeZoneArea/SafeZoneArea.styles.css.js.map +0 -1
  96. package/lib/hooks/useSafeZoneArea/SafeZoneArea.styles.raw.css.js +0 -9
  97. package/lib/hooks/useSafeZoneArea/SafeZoneArea.styles.raw.css.js.map +0 -1
  98. package/lib/utils/writeArrowUpdates.js +0 -13
  99. package/lib/utils/writeArrowUpdates.js.map +0 -1
  100. package/lib/utils/writeContainerupdates.js +0 -43
  101. package/lib/utils/writeContainerupdates.js.map +0 -1
  102. package/lib-commonjs/Arrow.module.css +0 -45
  103. package/lib-commonjs/hooks/useSafeZoneArea/SafeZoneArea.module.css +0 -28
  104. package/lib-commonjs/hooks/useSafeZoneArea/SafeZoneArea.styles.css.cjs +0 -20
  105. package/lib-commonjs/hooks/useSafeZoneArea/SafeZoneArea.styles.css.cjs.map +0 -1
  106. package/lib-commonjs/hooks/useSafeZoneArea/SafeZoneArea.styles.raw.css.cjs +0 -20
  107. package/lib-commonjs/hooks/useSafeZoneArea/SafeZoneArea.styles.raw.css.cjs.map +0 -1
  108. package/lib-commonjs/utils/writeArrowUpdates.cjs +0 -23
  109. package/lib-commonjs/utils/writeArrowUpdates.cjs.map +0 -1
  110. package/lib-commonjs/utils/writeContainerupdates.cjs +0 -51
  111. package/lib-commonjs/utils/writeContainerupdates.cjs.map +0 -1
@@ -1 +1 @@
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":";;;;+BAQgBC;;;;;;iCANgB,uBAAoB;AAM7C,qBACLC,OAA2B,EAC3BC,QAA8B;IAE9B,IAAIA,aAAa,UAAU;QACzB,OAAOD,YAAAA,QAAAA,YAAAA,KAAAA,IAAAA,KAAAA,IAAAA,QAASE,aAAa,CAAEC,eAAe;IAChD;IAEA,IAAIF,aAAa,mBAAmB;QAClC,OAAO;IACT;IAEA,IAAIA,aAAa,gBAAgB;QAC/B,IAAIG,qBAA0CN,gCAAAA,EAAgBE;QAE9D,IAAII,eAAeC,QAAQ,KAAK,QAAQ;YACtCD,iBAAiBJ,YAAAA,QAAAA,YAAAA,KAAAA,IAAAA,KAAAA,IAAAA,QAASE,aAAa,CAAEC,eAAe;QAC1D;QAEA,OAAOC;IACT;IAEA,OAAOH;AACT"}
1
+ {"version":3,"sources":["../../src/utils/getBoundary.ts"],"sourcesContent":["import type { Boundary as FloatingUIBoundary } from '@floating-ui/dom';\n\nimport { getRoot } from '../engine/platform';\nimport { listScrollParents } from './listScrollParents';\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 const getBoundary = (\n element: HTMLElement | null,\n boundary?: PositioningBoundary,\n): FloatingUIBoundary | undefined => {\n const root = element ? getRoot(element) : undefined;\n // The closest scroll parent, the root when it's the body\n const scrollParent = boundary === 'scrollParent' && element && listScrollParents(element)[0];\n\n return boundary === 'clippingParents'\n ? 'clippingAncestors'\n : boundary === 'window' || boundary === 'scrollParent'\n ? (scrollParent && scrollParent.nodeName !== 'BODY' && scrollParent) || root\n : boundary;\n};\n"],"names":["getRoot","listScrollParents","getBoundary","element","boundary","root","undefined","scrollParent","nodeName"],"mappings":";;;;+BASaE;;;;;;0BAPW,wBAAqB;mCACX,yBAAsB;AAMjD,oBAAoB,CACzBC,SACAC;IAEA,MAAMC,OAAOF,cAAUH,iBAAAA,EAAQG,WAAWG;IAC1C,yDAAyD;IACzD,MAAMC,eAAeH,aAAa,kBAAkBD,eAAWF,oCAAAA,EAAkBE,QAAQ,CAAC,EAAE;IAE5F,OAAOC,aAAa,oBAChB,sBACAA,aAAa,YAAYA,aAAa,iBACrCG,gBAAgBA,aAAaC,QAAQ,KAAK,UAAUD,gBAAiBF,OACtED;AACN,EAAE"}
@@ -56,12 +56,6 @@ _export(exports, {
56
56
  },
57
57
  get useCallbackRef () {
58
58
  return _useCallbackRef.useCallbackRef;
59
- },
60
- get writeArrowUpdates () {
61
- return _writeArrowUpdates.writeArrowUpdates;
62
- },
63
- get writeContainerUpdates () {
64
- return _writeContainerupdates.writeContainerUpdates;
65
59
  }
66
60
  });
67
61
  const _parseFloatingUIPlacement = require("./parseFloatingUIPlacement.cjs");
@@ -77,6 +71,4 @@ const _useCallbackRef = require("./useCallbackRef.cjs");
77
71
  const _debounce = require("./debounce.cjs");
78
72
  const _toggleScrollListener = require("./toggleScrollListener.cjs");
79
73
  const _hasAutoFocusFilter = require("./hasAutoFocusFilter.cjs");
80
- const _writeArrowUpdates = require("./writeArrowUpdates.cjs");
81
- const _writeContainerupdates = require("./writeContainerupdates.cjs");
82
74
  const _normalizeAutoSize = require("./normalizeAutoSize.cjs");
@@ -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 { 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":";;;;;;;;;;;QAWSY;iCAAQ;;QAHRH;+DAAuB;;;eAPvBR,wBAAW;;;eAGXE,8BAAa;;;eADbD,4CAAqB;;;eACNE,gCAAe;;;eAS9BU,sCAAkB;;;eATcT,gCAAe;;;eAC/CC,kCAAgB;;;eAWhBW,oCAAiB;;;eAhBjBjB,kDAAwB;;;eASxBU,wDAA2B;;QAH3BH;uDAAmB;;;eACnBC,4CAAqB;;;eAKrBK,0CAAoB;;;eAFpBF,8BAAc;;;eAIdI,oCAAiB;;;eACjBC,4CAAqB;;;0CAfW,gCAA6B;6BAC1C,mBAAgB;uCAEN,6BAA0B;iCACA,uBAAoB;kCACnD,wBAAqB;qCAClB,2BAAwB;uCACtB,6BAA0B;yCACxB,+BAA4B;6CACxB,mCAAgC;gCAC7C,sBAAmB;0BACzB,gBAAa;sCACD,4BAAyB;oCAC3B,0BAAuB;mCACxB,yBAAsB;uCAClB,6BAA0B;mCAC9B,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 { normalizeAutoSize } from './normalizeAutoSize';\n"],"names":["parseFloatingUIPlacement","getBoundary","getReactFiberFromNode","getParentNode","getScrollParent","hasScrollParent","mergeArrowOffset","toFloatingUIPadding","toFloatingUIPlacement","fromFloatingUIPlacement","resolvePositioningShorthand","useCallbackRef","debounce","toggleScrollListener","hasAutofocusFilter","normalizeAutoSize"],"mappings":";;;;;;;;;;;;eAWSY,kBAAQ;;QAHRH;+DAAuB;;;eAPvBR,wBAAW;;;eAGXE,8BAAa;;;eADbD,4CAAqB;;;eACNE,gCAAe;;;eAS9BU,sCAAkB;;;eATcT,gCAAe;;;eAC/CC,kCAAgB;;;eAShBS,oCAAiB;;;eAdjBf,kDAAwB;;;eASxBU,wDAA2B;;;eAH3BH,wCAAmB;;;eACnBC,4CAAqB;;;eAKrBK,0CAAoB;;QAFpBF;6CAAc;;;0CAVkB,gCAA6B;6BAC1C,mBAAgB;uCAEN,6BAA0B;iCACA,uBAAoB;kCACnD,wBAAqB;qCAClB,2BAAwB;uCACtB,6BAA0B;yCACxB,+BAA4B;6CACxB,mCAAgC;gCAC7C,sBAAmB;0BACzB,gBAAa;sCACD,4BAAyB;oCAC3B,0BAAuB;mCACxB,yBAAsB"}
@@ -8,25 +8,17 @@ Object.defineProperty(exports, "listScrollParents", {
8
8
  return listScrollParents;
9
9
  }
10
10
  });
11
- const _getScrollParent = require("./getScrollParent.cjs");
12
- function listScrollParents(node) {
11
+ const _platform = require("../engine/platform.cjs");
12
+ const listScrollParents = (node)=>{
13
+ const body = node.ownerDocument.body;
13
14
  const scrollParents = [];
14
- let cur = node;
15
- while(cur){
16
- const scrollParent = (0, _getScrollParent.getScrollParent)(cur);
17
- if (node.ownerDocument.body === scrollParent) {
18
- scrollParents.push(scrollParent);
19
- break;
15
+ (0, _platform.findAncestor)(node, (parent, { overflow, overflowX, overflowY })=>{
16
+ if (parent !== body && /auto|scroll|overlay/.test(overflow + overflowY + overflowX)) {
17
+ scrollParents.push(parent);
20
18
  }
21
- if (scrollParent.nodeName === 'BODY' && scrollParent !== node.ownerDocument.body) {
22
- if (process.env.NODE_ENV !== 'production') {
23
- // eslint-disable-next-line no-console
24
- 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 ');
25
- }
26
- break;
27
- }
28
- scrollParents.push(scrollParent);
29
- cur = scrollParent;
30
- }
31
- return scrollParents;
32
- }
19
+ });
20
+ return [
21
+ ...scrollParents,
22
+ body
23
+ ];
24
+ };
@@ -1 +1 @@
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":";;;;+BAEgBC;;;;;;iCAFgB,uBAAoB;AAE7C,2BAA2BC,IAAiB;IACjD,MAAMC,gBAA+B,EAAE;IAEvC,IAAIC,MAA0BF;IAC9B,MAAOE,IAAK;QACV,MAAMC,mBAAeL,gCAAAA,EAAgBI;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"}
1
+ {"version":3,"sources":["../../src/utils/listScrollParents.ts"],"sourcesContent":["import { findAncestor } from '../engine/platform';\n\n/** Lists the scroll parents of the node, the closest first, up to and including the body of its document */\nexport const listScrollParents = (node: HTMLElement): HTMLElement[] => {\n const body = node.ownerDocument.body;\n const scrollParents: HTMLElement[] = [];\n\n findAncestor(node, (parent, { overflow, overflowX, overflowY }) => {\n if (parent !== body && /auto|scroll|overlay/.test(overflow + overflowY + overflowX)) {\n scrollParents.push(parent as HTMLElement);\n }\n });\n\n return [...scrollParents, body];\n};\n"],"names":["findAncestor","listScrollParents","node","body","ownerDocument","scrollParents","parent","overflow","overflowX","overflowY","test","push"],"mappings":";;;;+BAGaC;;;;;;0BAHgB,wBAAqB;AAG3C,0BAA0B,CAACC;IAChC,MAAMC,OAAOD,KAAKE,aAAa,CAACD,IAAI;IACpC,MAAME,gBAA+B,EAAE;QAEvCL,sBAAAA,EAAaE,MAAM,CAACI,QAAQ,EAAEC,QAAQ,EAAEC,SAAS,EAAEC,SAAS,EAAE;QAC5D,IAAIH,WAAWH,QAAQ,sBAAsBO,IAAI,CAACH,WAAWE,YAAYD,YAAY;YACnFH,cAAcM,IAAI,CAACL;QACrB;IACF;IAEA,OAAO;WAAID;QAAeF;KAAK;AACjC,EAAE"}
@@ -6,33 +6,34 @@
6
6
  Object.defineProperty(exports, "__esModule", {
7
7
  value: true
8
8
  });
9
- Object.defineProperty(exports, "normalizeAutoSize", {
10
- enumerable: true,
11
- get: function() {
9
+ function _export(target, all) {
10
+ for(var name in all)Object.defineProperty(target, name, {
11
+ enumerable: true,
12
+ get: Object.getOwnPropertyDescriptor(all, name).get
13
+ });
14
+ }
15
+ _export(exports, {
16
+ get getAutoSizeDimensions () {
17
+ return getAutoSizeDimensions;
18
+ },
19
+ get normalizeAutoSize () {
12
20
  return normalizeAutoSize;
13
21
  }
14
22
  });
15
23
  const normalizeAutoSize = (autoSize)=>{
16
- switch(autoSize){
17
- case 'always':
18
- case true:
19
- return {
20
- applyMaxWidth: true,
21
- applyMaxHeight: true
22
- };
23
- case 'width-always':
24
- case 'width':
25
- return {
26
- applyMaxWidth: true,
27
- applyMaxHeight: false
28
- };
29
- case 'height-always':
30
- case 'height':
31
- return {
32
- applyMaxWidth: false,
33
- applyMaxHeight: true
34
- };
35
- default:
36
- return false;
37
- }
24
+ const dimensions = getAutoSizeDimensions(autoSize);
25
+ return dimensions.length ? {
26
+ applyMaxWidth: dimensions.includes('width'),
27
+ applyMaxHeight: dimensions.includes('height')
28
+ } : false;
29
+ };
30
+ const getAutoSizeDimensions = (autoSize)=>{
31
+ // 'width-always' and 'height-always' are obsolete aliases of 'width' and 'height'
32
+ const dimension = /^(width|height)(-always)?$/.exec(String(autoSize));
33
+ return autoSize === true || autoSize === 'always' ? [
34
+ 'width',
35
+ 'height'
36
+ ] : dimension ? [
37
+ dimension[1]
38
+ ] : [];
38
39
  };
@@ -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 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;;;;;;;;;;AAAO,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
+ {"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 const dimensions = getAutoSizeDimensions(autoSize);\n return dimensions.length\n ? {\n applyMaxWidth: dimensions.includes('width'),\n applyMaxHeight: dimensions.includes('height'),\n }\n : false;\n};\n\nexport const getAutoSizeDimensions = (autoSize?: PositioningOptions['autoSize']): ('width' | 'height')[] => {\n // 'width-always' and 'height-always' are obsolete aliases of 'width' and 'height'\n const dimension = /^(width|height)(-always)?$/.exec(String(autoSize));\n return autoSize === true || autoSize === 'always' ? ['width', 'height'] : dimension ? [dimension[1] as 'width'] : [];\n};\n"],"names":["normalizeAutoSize","autoSize","dimensions","getAutoSizeDimensions","length","applyMaxWidth","includes","applyMaxHeight","dimension","exec","String"],"mappings":"AAEA;;;;CAIC,GACD;;;;;;;;;;;;eAUaG;;;;;;AAVN,MAAMH,oBAAoB,CAACC;IAChC,MAAMC,aAAaC,sBAAsBF;IACzC,OAAOC,WAAWE,MAAM,GACpB;QACEC,eAAeH,WAAWI,QAAQ,CAAC;QACnCC,gBAAgBL,WAAWI,QAAQ,CAAC;IACtC,IACA;AACN,EAAE;AAEK,8BAA8B,CAACL;IACpC,kFAAkF;IAClF,MAAMO,YAAY,6BAA6BC,IAAI,CAACC,OAAOT;IAC3D,OAAOA,aAAa,QAAQA,aAAa,WAAW;QAAC;QAAS;KAAS,GAAGO,YAAY;QAACA,SAAS,CAAC,EAAE;KAAY,GAAG,EAAE;AACtH,EAAE"}
@@ -1,4 +1,7 @@
1
- "use strict";
1
+ /**
2
+ * Maps internal positioning values to Floating UI placement
3
+ * @see positioningHelper.test.ts for expected placement values
4
+ */ "use strict";
2
5
  Object.defineProperty(exports, "__esModule", {
3
6
  value: true
4
7
  });
@@ -8,32 +11,15 @@ Object.defineProperty(exports, "toFloatingUIPlacement", {
8
11
  return toFloatingUIPlacement;
9
12
  }
10
13
  });
11
- const getPositionMap = (rtl)=>({
12
- above: 'top',
13
- below: 'bottom',
14
- before: rtl ? 'right' : 'left',
15
- after: rtl ? 'left' : 'right'
16
- });
17
- // Floating UI automatically flips alignment
18
- // https://github.com/floating-ui/floating-ui/issues/1563
19
- const getAlignmentMap = ()=>({
20
- start: 'start',
21
- end: 'end',
22
- top: 'start',
23
- bottom: 'end',
24
- center: undefined
25
- });
26
- const shouldAlignToCenter = (p, a)=>{
27
- const positionedVertically = p === 'above' || p === 'below';
28
- const alignedVertically = a === 'top' || a === 'bottom';
29
- return positionedVertically && alignedVertically || !positionedVertically && !alignedVertically;
30
- };
31
14
  const toFloatingUIPlacement = (align, position, rtl)=>{
32
- const alignment = shouldAlignToCenter(position, align) ? 'center' : align;
33
- const computedPosition = position && getPositionMap(rtl)[position];
34
- const computedAlignment = alignment && getAlignmentMap()[alignment];
35
- if (computedPosition && computedAlignment) {
36
- return `${computedPosition}-${computedAlignment}`;
15
+ if (!position) {
16
+ return undefined;
17
+ }
18
+ const block = position === 'above' || position === 'below';
19
+ const side = block ? position === 'above' ? 'top' : 'bottom' : position === 'before' !== !!rtl ? 'left' : 'right';
20
+ const alignedVertically = align === 'top' || align === 'bottom';
21
+ if (!align || align === 'center' || block === alignedVertically) {
22
+ return side;
37
23
  }
38
- return computedPosition;
24
+ return `${side}-${align === 'start' || align === 'top' ? 'start' : 'end'}`;
39
25
  };
@@ -1 +1 @@
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":";;;;;;;eAkCakB;;;AA5Bb,MAAMlB,iBAAiB,CAACC,MAAwD,CAAA;QAC9EC,OAAO;QACPC,OAAO;QACPC,QAAQH,MAAM,UAAU;QACxBI,OAAOJ,MAAM,SAAS;KACxB,CAAA;AAEA,4CAA4C;AAC5C,yDAAyD;AACzD,MAAMK,kBAAkB,IAAsD,CAAA;QAC5EC,OAAO;QACPC,KAAK;QACLC,KAAK;QACLC,QAAQ;QACRC,QAAQC;KACV,CAAA;AAEA,MAAMC,sBAAsB,CAACC,GAAcC;IACzC,MAAMC,uBAAuBF,MAAM,WAAWA,MAAM;IACpD,MAAMG,oBAAoBF,MAAM,SAASA,MAAM;IAE/C,OAAQC,wBAAwBC,qBAAuB,CAACD,wBAAwB,CAACC;AACnF;AAMO,8BAA8B,CAACE,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
+ {"version":3,"sources":["../../src/utils/toFloatingUIPlacement.ts"],"sourcesContent":["import type { Placement, Side } from '@floating-ui/dom';\nimport type { Alignment, Position } from '../types';\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 if (!position) {\n return undefined;\n }\n const block = position === 'above' || position === 'below';\n const side: Side = block\n ? position === 'above'\n ? 'top'\n : 'bottom'\n : (position === 'before') !== !!rtl\n ? 'left'\n : 'right';\n const alignedVertically = align === 'top' || align === 'bottom';\n if (!align || align === 'center' || block === alignedVertically) {\n return side;\n }\n return `${side}-${align === 'start' || align === 'top' ? 'start' : 'end'}`;\n};\n"],"names":["toFloatingUIPlacement","align","position","rtl","undefined","block","side","alignedVertically"],"mappings":"AAGA;;;CAGC,GACD;;;;;;;;;;AAAO,MAAMA,wBAAwB,CAACC,OAAmBC,UAAqBC;IAC5E,IAAI,CAACD,UAAU;QACb,OAAOE;IACT;IACA,MAAMC,QAAQH,aAAa,WAAWA,aAAa;IACnD,MAAMI,OAAaD,QACfH,aAAa,UACX,QACA,WACDA,aAAa,aAAc,CAAC,CAACC,MAC9B,SACA;IACJ,MAAMI,oBAAoBN,UAAU,SAASA,UAAU;IACvD,IAAI,CAACA,SAASA,UAAU,YAAYI,UAAUE,mBAAmB;QAC/D,OAAOD;IACT;IACA,OAAO,GAAGA,KAAK,CAAC,EAAEL,UAAU,WAAWA,UAAU,QAAQ,UAAU,OAAO;AAC5E,EAAE"}
@@ -11,9 +11,7 @@ Object.defineProperty(exports, "useCallbackRef", {
11
11
  });
12
12
  const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
13
13
  const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
14
- const _reactutilities = require("@fluentui/react-utilities");
15
- function useCallbackRef(initialValue, callback, skipInitialResolve) {
16
- const isFirst = _react.useRef(true);
14
+ function useCallbackRef(initialValue, callback) {
17
15
  const [ref] = _react.useState(()=>({
18
16
  // value
19
17
  value: initialValue,
@@ -28,17 +26,11 @@ function useCallbackRef(initialValue, callback, skipInitialResolve) {
28
26
  const last = ref.value;
29
27
  if (last !== value) {
30
28
  ref.value = value;
31
- if (skipInitialResolve && isFirst.current) {
32
- return;
33
- }
34
29
  ref.callback(value, last);
35
30
  }
36
31
  }
37
32
  }
38
33
  }));
39
- (0, _reactutilities.useIsomorphicLayoutEffect)(()=>{
40
- isFirst.current = false;
41
- }, []);
42
34
  // update callback
43
35
  ref.callback = callback;
44
36
  return ref.facade;
@@ -1 +1 @@
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;;;;;+BAsBgBE;;;;;;;iEApBO,QAAQ;gCACW,4BAA4B;AAmB/D,wBACLC,YAAsB,EACtBC,QAA2D,EAC3DC,kBAA4B;IAG5B,MAAMC,UAAUN,OAAMO,MAAM,CAAC;IAC7B,MAAM,CAACC,IAAI,GAAGR,OAAMS,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;SACF,CAAA;QAEAZ,yCAAAA,EAA0B;QACxBK,QAAQM,OAAO,GAAG;IACpB,GAAG,EAAE;IAEL,kBAAkB;IAClBJ,IAAIJ,QAAQ,GAAGA;IAEf,OAAOI,IAAIG,MAAM;AACnB"}
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;;;;;+BAoBgBC;;;;;;;iEAlBO,QAAQ;AAkBxB,wBACLC,YAAsB,EACtBC,QAA2D;IAG3D,MAAM,CAACC,IAAI,GAAGJ,OAAMK,QAAQ,CAAC,IAAO,CAAA;YAClC,QAAQ;YACRC,OAAOJ;YACP,gBAAgB;YAChBC;YACA,8BAA8B;YAC9BI,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;wBACZF,IAAID,QAAQ,CAACG,OAAOG;oBACtB;gBACF;YACF;SACF,CAAA;IAEA,kBAAkB;IAClBL,IAAID,QAAQ,GAAGA;IAEf,OAAOC,IAAIG,MAAM;AACnB"}
package/package.json CHANGED
@@ -1,13 +1,11 @@
1
1
  {
2
2
  "name": "@fluentui/react-positioning",
3
- "version": "9.75.1-experimental.css-modules.20261103-d6c85ee2a9.0",
3
+ "version": "9.75.1-experimental.positioning-engine.20261103-19efe125d1.0",
4
4
  "description": "A react wrapper around Popper.js for Fluent UI",
5
5
  "main": "lib-commonjs/index.cjs",
6
6
  "module": "lib/index.js",
7
7
  "typings": "./dist/index.d.ts",
8
- "sideEffects": [
9
- "**/*.css"
10
- ],
8
+ "sideEffects": false,
11
9
  "repository": {
12
10
  "type": "git",
13
11
  "url": "https://github.com/microsoft/fluentui"
@@ -16,12 +14,11 @@
16
14
  "dependencies": {
17
15
  "@floating-ui/devtools": "^0.2.3",
18
16
  "@floating-ui/dom": "^1.6.12",
19
- "@fluentui/react-shared-contexts": "9.75.1-experimental.css-modules.20261103-d6c85ee2a9.0",
20
- "@fluentui/react-theme": "9.75.1-experimental.css-modules.20261103-d6c85ee2a9.0",
21
- "@fluentui/react-utilities": "9.75.1-experimental.css-modules.20261103-d6c85ee2a9.0",
17
+ "@fluentui/react-shared-contexts": "9.75.1-experimental.positioning-engine.20261103-19efe125d1.0",
18
+ "@fluentui/react-theme": "9.75.1-experimental.positioning-engine.20261103-19efe125d1.0",
19
+ "@fluentui/react-utilities": "9.75.1-experimental.positioning-engine.20261103-19efe125d1.0",
22
20
  "@griffel/react": "^1.5.32",
23
21
  "@swc/helpers": "^0.5.1",
24
- "clsx": "^2.1.1",
25
22
  "use-sync-external-store": "^1.4.0"
26
23
  },
27
24
  "peerDependencies": {
@@ -45,7 +42,6 @@
45
42
  "default": "./lib-commonjs/index.cjs"
46
43
  }
47
44
  },
48
- "./arrow.module.css": "./lib/Arrow.module.css",
49
45
  "./package.json": "./package.json"
50
46
  },
51
47
  "files": [
@@ -1,45 +0,0 @@
1
- @layer fluent {
2
- .arrow {
3
- box-sizing: border-box;
4
- position: absolute;
5
- z-index: -1;
6
- background-color: inherit;
7
- background-clip: content-box;
8
- /* The rotated arrow and placement coordinates are intentionally physical in RTL. */
9
- border-bottom-left-radius: var(--borderRadiusSmall);
10
- transform: rotate(var(--fui-positioning-arrow-angle));
11
- height: var(--fui-positioning-arrow-height);
12
- width: var(--fui-positioning-arrow-height);
13
-
14
- &::before {
15
- content: '';
16
- display: block;
17
- background-color: inherit;
18
- margin: calc(-1 * var(--fui-positioning-arrow-border-width, var(--strokeWidthThin)));
19
- width: 100%;
20
- height: 100%;
21
- border: var(--fui-positioning-arrow-border-width, var(--strokeWidthThin))
22
- var(--fui-positioning-arrow-border-style, solid)
23
- var(--fui-positioning-arrow-border-color, var(--colorTransparentStroke));
24
- border-bottom-left-radius: var(--borderRadiusSmall);
25
- clip-path: polygon(0% 0%, 100% 100%, 0% 100%);
26
- }
27
- }
28
-
29
- :global([data-popper-placement^='top']) .arrow {
30
- bottom: var(--fui-positioning-arrow-offset);
31
- --fui-positioning-arrow-angle: -45deg;
32
- }
33
- :global([data-popper-placement^='right']) .arrow {
34
- left: var(--fui-positioning-arrow-offset);
35
- --fui-positioning-arrow-angle: 45deg;
36
- }
37
- :global([data-popper-placement^='bottom']) .arrow {
38
- top: var(--fui-positioning-arrow-offset);
39
- --fui-positioning-arrow-angle: 135deg;
40
- }
41
- :global([data-popper-placement^='left']) .arrow {
42
- right: var(--fui-positioning-arrow-offset);
43
- --fui-positioning-arrow-angle: 225deg;
44
- }
45
- }
@@ -1,28 +0,0 @@
1
- @layer fluent {
2
- .wrapper {
3
- display: none;
4
- height: 0;
5
- width: 0;
6
- pointer-events: none;
7
- }
8
- .wrapperActive {
9
- display: block;
10
- }
11
- .svg {
12
- fill: transparent;
13
- pointer-events: none;
14
- position: fixed;
15
- top: 0;
16
- inset-inline-start: 0;
17
- }
18
- .safeZone {
19
- pointer-events: auto;
20
- }
21
- .safeZoneDebug {
22
- cursor: crosshair;
23
- fill: color-mix(in srgb, var(--colorPaletteGreenBackground3) 20%, transparent);
24
- }
25
- .rectDebug {
26
- fill: color-mix(in srgb, var(--colorPaletteRedBackground3) 20%, transparent);
27
- }
28
- }
@@ -1,9 +0,0 @@
1
- import styles from "./SafeZoneArea.module.css";
2
- export const useStyles = ()=>({
3
- wrapper: styles.wrapper,
4
- wrapperActive: styles.wrapperActive,
5
- svg: styles.svg,
6
- safeZone: styles.safeZone,
7
- safeZoneDebug: styles.safeZoneDebug,
8
- rectDebug: styles.rectDebug
9
- });
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/hooks/useSafeZoneArea/SafeZoneArea.styles.css.ts"],"sourcesContent":["import styles from './SafeZoneArea.module.css';\n\nexport const useStyles = (): Record<\n 'wrapper' | 'wrapperActive' | 'svg' | 'safeZone' | 'safeZoneDebug' | 'rectDebug',\n string\n> => ({\n wrapper: styles.wrapper,\n wrapperActive: styles.wrapperActive,\n svg: styles.svg,\n safeZone: styles.safeZone,\n safeZoneDebug: styles.safeZoneDebug,\n rectDebug: styles.rectDebug,\n});\n"],"names":["styles","useStyles","wrapper","wrapperActive","svg","safeZone","safeZoneDebug","rectDebug"],"mappings":"AAAA,OAAOA,YAAY,4BAA4B;AAE/C,OAAO,MAAMC,YAAY,IAGnB,CAAA;QACJC,SAASF,OAAOE,OAAO;QACvBC,eAAeH,OAAOG,aAAa;QACnCC,KAAKJ,OAAOI,GAAG;QACfC,UAAUL,OAAOK,QAAQ;QACzBC,eAAeN,OAAOM,aAAa;QACnCC,WAAWP,OAAOO,SAAS;IAC7B,CAAA,EAAG"}
@@ -1,9 +0,0 @@
1
- import styles from "./SafeZoneArea.module.css";
2
- export const useStyles = ()=>({
3
- wrapper: styles.wrapper,
4
- wrapperActive: styles.wrapperActive,
5
- svg: styles.svg,
6
- safeZone: styles.safeZone,
7
- safeZoneDebug: styles.safeZoneDebug,
8
- rectDebug: styles.rectDebug
9
- });
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/hooks/useSafeZoneArea/SafeZoneArea.styles.css.ts"],"sourcesContent":["import styles from './SafeZoneArea.module.css';\n\nexport const useStyles = (): Record<\n 'wrapper' | 'wrapperActive' | 'svg' | 'safeZone' | 'safeZoneDebug' | 'rectDebug',\n string\n> => ({\n wrapper: styles.wrapper,\n wrapperActive: styles.wrapperActive,\n svg: styles.svg,\n safeZone: styles.safeZone,\n safeZoneDebug: styles.safeZoneDebug,\n rectDebug: styles.rectDebug,\n});\n"],"names":["styles","useStyles","wrapper","wrapperActive","svg","safeZone","safeZoneDebug","rectDebug"],"mappings":"AAAA,OAAOA,YAAY,4BAA4B;AAE/C,OAAO,MAAMC,YAAY,IAGnB,CAAA;QACJC,SAASF,OAAOE,OAAO;QACvBC,eAAeH,OAAOG,aAAa;QACnCC,KAAKJ,OAAOI,GAAG;QACfC,UAAUL,OAAOK,QAAQ;QACzBC,eAAeN,OAAOM,aAAa;QACnCC,WAAWP,OAAOO,SAAS;IAC7B,CAAA,EAAG"}
@@ -1,13 +0,0 @@
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
- }
@@ -1 +0,0 @@
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"}
@@ -1,43 +0,0 @@
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
- }
@@ -1 +0,0 @@
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"}
@@ -1,45 +0,0 @@
1
- @layer fluent {
2
- .arrow {
3
- box-sizing: border-box;
4
- position: absolute;
5
- z-index: -1;
6
- background-color: inherit;
7
- background-clip: content-box;
8
- /* The rotated arrow and placement coordinates are intentionally physical in RTL. */
9
- border-bottom-left-radius: var(--borderRadiusSmall);
10
- transform: rotate(var(--fui-positioning-arrow-angle));
11
- height: var(--fui-positioning-arrow-height);
12
- width: var(--fui-positioning-arrow-height);
13
-
14
- &::before {
15
- content: '';
16
- display: block;
17
- background-color: inherit;
18
- margin: calc(-1 * var(--fui-positioning-arrow-border-width, var(--strokeWidthThin)));
19
- width: 100%;
20
- height: 100%;
21
- border: var(--fui-positioning-arrow-border-width, var(--strokeWidthThin))
22
- var(--fui-positioning-arrow-border-style, solid)
23
- var(--fui-positioning-arrow-border-color, var(--colorTransparentStroke));
24
- border-bottom-left-radius: var(--borderRadiusSmall);
25
- clip-path: polygon(0% 0%, 100% 100%, 0% 100%);
26
- }
27
- }
28
-
29
- :global([data-popper-placement^='top']) .arrow {
30
- bottom: var(--fui-positioning-arrow-offset);
31
- --fui-positioning-arrow-angle: -45deg;
32
- }
33
- :global([data-popper-placement^='right']) .arrow {
34
- left: var(--fui-positioning-arrow-offset);
35
- --fui-positioning-arrow-angle: 45deg;
36
- }
37
- :global([data-popper-placement^='bottom']) .arrow {
38
- top: var(--fui-positioning-arrow-offset);
39
- --fui-positioning-arrow-angle: 135deg;
40
- }
41
- :global([data-popper-placement^='left']) .arrow {
42
- right: var(--fui-positioning-arrow-offset);
43
- --fui-positioning-arrow-angle: 225deg;
44
- }
45
- }
@@ -1,28 +0,0 @@
1
- @layer fluent {
2
- .wrapper {
3
- display: none;
4
- height: 0;
5
- width: 0;
6
- pointer-events: none;
7
- }
8
- .wrapperActive {
9
- display: block;
10
- }
11
- .svg {
12
- fill: transparent;
13
- pointer-events: none;
14
- position: fixed;
15
- top: 0;
16
- inset-inline-start: 0;
17
- }
18
- .safeZone {
19
- pointer-events: auto;
20
- }
21
- .safeZoneDebug {
22
- cursor: crosshair;
23
- fill: color-mix(in srgb, var(--colorPaletteGreenBackground3) 20%, transparent);
24
- }
25
- .rectDebug {
26
- fill: color-mix(in srgb, var(--colorPaletteRedBackground3) 20%, transparent);
27
- }
28
- }
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "useStyles", {
6
- enumerable: true,
7
- get: function() {
8
- return useStyles;
9
- }
10
- });
11
- const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
12
- const _SafeZoneAreamodulecss = /*#__PURE__*/ _interop_require_default._(require("./SafeZoneArea.module.css"));
13
- const useStyles = ()=>({
14
- wrapper: _SafeZoneAreamodulecss.default.wrapper,
15
- wrapperActive: _SafeZoneAreamodulecss.default.wrapperActive,
16
- svg: _SafeZoneAreamodulecss.default.svg,
17
- safeZone: _SafeZoneAreamodulecss.default.safeZone,
18
- safeZoneDebug: _SafeZoneAreamodulecss.default.safeZoneDebug,
19
- rectDebug: _SafeZoneAreamodulecss.default.rectDebug
20
- });
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/hooks/useSafeZoneArea/SafeZoneArea.styles.css.ts"],"sourcesContent":["import styles from './SafeZoneArea.module.css';\n\nexport const useStyles = (): Record<\n 'wrapper' | 'wrapperActive' | 'svg' | 'safeZone' | 'safeZoneDebug' | 'rectDebug',\n string\n> => ({\n wrapper: styles.wrapper,\n wrapperActive: styles.wrapperActive,\n svg: styles.svg,\n safeZone: styles.safeZone,\n safeZoneDebug: styles.safeZoneDebug,\n rectDebug: styles.rectDebug,\n});\n"],"names":["styles","useStyles","wrapper","wrapperActive","svg","safeZone","safeZoneDebug","rectDebug"],"mappings":";;;;+BAEaC;;;;;;;gFAFM,4BAA4B;AAExC,kBAAkB,IAGnB,CAAA;QACJC,SAASF,8BAAAA,CAAOE,OAAO;QACvBC,eAAeH,8BAAAA,CAAOG,aAAa;QACnCC,KAAKJ,8BAAAA,CAAOI,GAAG;QACfC,UAAUL,8BAAAA,CAAOK,QAAQ;QACzBC,eAAeN,8BAAAA,CAAOM,aAAa;QACnCC,WAAWP,8BAAAA,CAAOO,SAAS;KAC7B,CAAA,EAAG"}