@fluentui/react-positioning 9.3.4 → 9.3.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. package/CHANGELOG.json +69 -1
  2. package/CHANGELOG.md +24 -2
  3. package/lib/createArrowStyles.js +0 -2
  4. package/lib/createArrowStyles.js.map +1 -1
  5. package/lib/createPositionManager.js +8 -17
  6. package/lib/createPositionManager.js.map +1 -1
  7. package/lib/createVirtualElementFromClick.js +0 -2
  8. package/lib/createVirtualElementFromClick.js.map +1 -1
  9. package/lib/middleware/coverTarget.js +0 -5
  10. package/lib/middleware/coverTarget.js.map +1 -1
  11. package/lib/middleware/flip.js +2 -1
  12. package/lib/middleware/flip.js.map +1 -1
  13. package/lib/middleware/intersecting.js.map +1 -1
  14. package/lib/middleware/maxSize.js +31 -38
  15. package/lib/middleware/maxSize.js.map +1 -1
  16. package/lib/middleware/offset.js +0 -1
  17. package/lib/middleware/offset.js.map +1 -1
  18. package/lib/middleware/shift.js +2 -2
  19. package/lib/middleware/shift.js.map +1 -1
  20. package/lib/usePositioning.js +16 -25
  21. package/lib/usePositioning.js.map +1 -1
  22. package/lib/usePositioningMouseTarget.js +0 -7
  23. package/lib/usePositioningMouseTarget.js.map +1 -1
  24. package/lib/utils/debounce.js +0 -1
  25. package/lib/utils/debounce.js.map +1 -1
  26. package/lib/utils/fromFloatingUIPlacement.js +2 -7
  27. package/lib/utils/fromFloatingUIPlacement.js.map +1 -1
  28. package/lib/utils/getBoundary.js +0 -6
  29. package/lib/utils/getBoundary.js.map +1 -1
  30. package/lib/utils/getFloatingUIOffset.js +0 -3
  31. package/lib/utils/getFloatingUIOffset.js.map +1 -1
  32. package/lib/utils/getReactFiberFromNode.js +0 -4
  33. package/lib/utils/getReactFiberFromNode.js.map +1 -1
  34. package/lib/utils/getScrollParent.js +6 -18
  35. package/lib/utils/getScrollParent.js.map +1 -1
  36. package/lib/utils/hasAutoFocusFilter.js +2 -7
  37. package/lib/utils/hasAutoFocusFilter.js.map +1 -1
  38. package/lib/utils/mergeArrowOffset.js +2 -7
  39. package/lib/utils/mergeArrowOffset.js.map +1 -1
  40. package/lib/utils/parseFloatingUIPlacement.js.map +1 -1
  41. package/lib/utils/resolvePositioningShorthand.js +0 -2
  42. package/lib/utils/resolvePositioningShorthand.js.map +1 -1
  43. package/lib/utils/toFloatingUIPlacement.js +2 -8
  44. package/lib/utils/toFloatingUIPlacement.js.map +1 -1
  45. package/lib/utils/toggleScrollListener.js +0 -3
  46. package/lib/utils/toggleScrollListener.js.map +1 -1
  47. package/lib/utils/useCallbackRef.js +2 -8
  48. package/lib/utils/useCallbackRef.js.map +1 -1
  49. package/lib/utils/writeArrowUpdates.js +0 -2
  50. package/lib/utils/writeArrowUpdates.js.map +1 -1
  51. package/lib/utils/writeContainerupdates.js +0 -10
  52. package/lib/utils/writeContainerupdates.js.map +1 -1
  53. package/lib-amd/createPositionManager.js +3 -0
  54. package/lib-amd/createPositionManager.js.map +1 -1
  55. package/lib-amd/middleware/maxSize.js +24 -36
  56. package/lib-amd/middleware/maxSize.js.map +1 -1
  57. package/lib-amd/usePositioning.js +1 -1
  58. package/lib-amd/usePositioning.js.map +1 -1
  59. package/lib-commonjs/constants.js.map +1 -1
  60. package/lib-commonjs/createArrowStyles.js +0 -7
  61. package/lib-commonjs/createArrowStyles.js.map +1 -1
  62. package/lib-commonjs/createPositionManager.js +8 -21
  63. package/lib-commonjs/createPositionManager.js.map +1 -1
  64. package/lib-commonjs/createVirtualElementFromClick.js +0 -4
  65. package/lib-commonjs/createVirtualElementFromClick.js.map +1 -1
  66. package/lib-commonjs/index.js +0 -10
  67. package/lib-commonjs/index.js.map +1 -1
  68. package/lib-commonjs/middleware/coverTarget.js +0 -8
  69. package/lib-commonjs/middleware/coverTarget.js.map +1 -1
  70. package/lib-commonjs/middleware/flip.js +2 -5
  71. package/lib-commonjs/middleware/flip.js.map +1 -1
  72. package/lib-commonjs/middleware/index.js +0 -7
  73. package/lib-commonjs/middleware/index.js.map +1 -1
  74. package/lib-commonjs/middleware/intersecting.js +0 -3
  75. package/lib-commonjs/middleware/intersecting.js.map +1 -1
  76. package/lib-commonjs/middleware/maxSize.js +30 -41
  77. package/lib-commonjs/middleware/maxSize.js.map +1 -1
  78. package/lib-commonjs/middleware/offset.js +0 -5
  79. package/lib-commonjs/middleware/offset.js.map +1 -1
  80. package/lib-commonjs/middleware/shift.js +2 -6
  81. package/lib-commonjs/middleware/shift.js.map +1 -1
  82. package/lib-commonjs/types.js.map +1 -1
  83. package/lib-commonjs/usePositioning.js +16 -34
  84. package/lib-commonjs/usePositioning.js.map +1 -1
  85. package/lib-commonjs/usePositioningMouseTarget.js +0 -11
  86. package/lib-commonjs/usePositioningMouseTarget.js.map +1 -1
  87. package/lib-commonjs/utils/debounce.js +0 -3
  88. package/lib-commonjs/utils/debounce.js.map +1 -1
  89. package/lib-commonjs/utils/fromFloatingUIPlacement.js +2 -9
  90. package/lib-commonjs/utils/fromFloatingUIPlacement.js.map +1 -1
  91. package/lib-commonjs/utils/getBoundary.js +0 -9
  92. package/lib-commonjs/utils/getBoundary.js.map +1 -1
  93. package/lib-commonjs/utils/getFloatingUIOffset.js +0 -6
  94. package/lib-commonjs/utils/getFloatingUIOffset.js.map +1 -1
  95. package/lib-commonjs/utils/getReactFiberFromNode.js +0 -5
  96. package/lib-commonjs/utils/getReactFiberFromNode.js.map +1 -1
  97. package/lib-commonjs/utils/getScrollParent.js +6 -23
  98. package/lib-commonjs/utils/getScrollParent.js.map +1 -1
  99. package/lib-commonjs/utils/hasAutoFocusFilter.js +5 -12
  100. package/lib-commonjs/utils/hasAutoFocusFilter.js.map +1 -1
  101. package/lib-commonjs/utils/index.js +0 -15
  102. package/lib-commonjs/utils/index.js.map +1 -1
  103. package/lib-commonjs/utils/mergeArrowOffset.js +2 -9
  104. package/lib-commonjs/utils/mergeArrowOffset.js.map +1 -1
  105. package/lib-commonjs/utils/parseFloatingUIPlacement.js +0 -2
  106. package/lib-commonjs/utils/parseFloatingUIPlacement.js.map +1 -1
  107. package/lib-commonjs/utils/resolvePositioningShorthand.js +2 -6
  108. package/lib-commonjs/utils/resolvePositioningShorthand.js.map +1 -1
  109. package/lib-commonjs/utils/toFloatingUIPlacement.js +2 -10
  110. package/lib-commonjs/utils/toFloatingUIPlacement.js.map +1 -1
  111. package/lib-commonjs/utils/toggleScrollListener.js +0 -6
  112. package/lib-commonjs/utils/toggleScrollListener.js.map +1 -1
  113. package/lib-commonjs/utils/useCallbackRef.js +2 -12
  114. package/lib-commonjs/utils/useCallbackRef.js.map +1 -1
  115. package/lib-commonjs/utils/writeArrowUpdates.js +0 -4
  116. package/lib-commonjs/utils/writeArrowUpdates.js.map +1 -1
  117. package/lib-commonjs/utils/writeContainerupdates.js +0 -13
  118. package/lib-commonjs/utils/writeContainerupdates.js.map +1 -1
  119. package/package.json +6 -6
@@ -9,30 +9,24 @@ exports.hasScrollParent = exports.getScrollParent = exports.getParentNode = void
9
9
  * @param node - DOM node.
10
10
  * @returns - parent DOM node.
11
11
  */
12
-
13
12
  const getParentNode = node => {
14
13
  if (node.nodeName === 'HTML') {
15
14
  return node;
16
- } // eslint-disable-next-line @typescript-eslint/no-explicit-any
17
-
18
-
15
+ }
16
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
19
17
  return node.parentNode || node.host;
20
18
  };
21
-
22
19
  exports.getParentNode = getParentNode;
23
20
  /**
24
21
  * Returns CSS styles of the given node.
25
22
  * @param node - DOM node.
26
23
  * @returns - CSS styles.
27
24
  */
28
-
29
25
  const getStyleComputedProperty = node => {
30
26
  var _a;
31
-
32
27
  if (node.nodeType !== 1) {
33
28
  return {};
34
29
  }
35
-
36
30
  const window = (_a = node.ownerDocument) === null || _a === void 0 ? void 0 : _a.defaultView;
37
31
  return window.getComputedStyle(node, null);
38
32
  };
@@ -41,45 +35,34 @@ const getStyleComputedProperty = node => {
41
35
  * @param node - DOM node.
42
36
  * @returns - the first scrollable parent.
43
37
  */
44
-
45
-
46
38
  const getScrollParent = node => {
47
39
  // Return body, `getScroll` will take care to get the correct `scrollTop` from it
48
- const parentNode = node && exports.getParentNode(node); // eslint-disable-next-line
49
-
40
+ const parentNode = node && exports.getParentNode(node);
41
+ // eslint-disable-next-line
50
42
  if (!parentNode) return document.body;
51
-
52
43
  switch (parentNode.nodeName) {
53
44
  case 'HTML':
54
45
  case 'BODY':
55
46
  return parentNode.ownerDocument.body;
56
-
57
47
  case '#document':
58
48
  return parentNode.body;
59
- } // If any of the overflow props is defined for the node then we return it as the parent
60
-
61
-
49
+ }
50
+ // If any of the overflow props is defined for the node then we return it as the parent
62
51
  const {
63
52
  overflow,
64
53
  overflowX,
65
54
  overflowY
66
55
  } = getStyleComputedProperty(parentNode);
67
-
68
56
  if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
69
57
  return parentNode;
70
58
  }
71
-
72
59
  return exports.getScrollParent(parentNode);
73
60
  };
74
-
75
61
  exports.getScrollParent = getScrollParent;
76
-
77
62
  const hasScrollParent = node => {
78
63
  var _a;
79
-
80
64
  const scrollParentElement = exports.getScrollParent(node);
81
65
  return scrollParentElement ? scrollParentElement !== ((_a = scrollParentElement.ownerDocument) === null || _a === void 0 ? void 0 : _a.body) : false;
82
66
  };
83
-
84
67
  exports.hasScrollParent = hasScrollParent;
85
68
  //# sourceMappingURL=getScrollParent.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-positioning/src/utils/getScrollParent.ts"],"names":[],"mappings":";;;;;;AAAA;;;;AAIG;;AACI,MAAM,aAAa,GAAI,IAAD,IAAmC;EAC9D,IAAI,IAAI,CAAC,QAAL,KAAkB,MAAtB,EAA8B;IAC5B,OAAO,IAAP;EACD,CAH6D,CAI9D;;;EACA,OAAO,IAAI,CAAC,UAAL,IAAoB,IAAY,CAAC,IAAxC;AACD,CANM;;AAAM,OAAA,CAAA,aAAA,GAAa,aAAb;AAQb;;;;AAIG;;AACH,MAAM,wBAAwB,GAAI,IAAD,IAAoD;;;EACnF,IAAI,IAAI,CAAC,QAAL,KAAkB,CAAtB,EAAyB;IACvB,OAAO,EAAP;EACD;;EAED,MAAM,MAAM,GAAG,CAAA,EAAA,GAAA,IAAI,CAAC,aAAL,MAAkB,IAAlB,IAAkB,EAAA,KAAA,KAAA,CAAlB,GAAkB,KAAA,CAAlB,GAAkB,EAAA,CAAE,WAAnC;EACA,OAAO,MAAO,CAAC,gBAAR,CAAyB,IAAzB,EAA+B,IAA/B,CAAP;AACD,CAPD;AASA;;;;AAIG;;;AACI,MAAM,eAAe,GAAI,IAAD,IAAqD;EAClF;EACA,MAAM,UAAU,GAAG,IAAI,IAAI,OAAA,CAAA,aAAA,CAAc,IAAd,CAA3B,CAFkF,CAGlF;;EACA,IAAI,CAAC,UAAL,EAAiB,OAAO,QAAQ,CAAC,IAAhB;;EAEjB,QAAQ,UAAU,CAAC,QAAnB;IACE,KAAK,MAAL;IACA,KAAK,MAAL;MACE,OAAO,UAAU,CAAC,aAAX,CAA0B,IAAjC;;IACF,KAAK,WAAL;MACE,OAAS,UAAmC,CAAC,IAA7C;EALJ,CANkF,CAclF;;;EACA,MAAM;IAAE,QAAF;IAAY,SAAZ;IAAuB;EAAvB,IAAqC,wBAAwB,CAAC,UAAD,CAAnE;;EACA,IAAI,wBAAwB,IAAxB,CAA6B,QAAS,GAAG,SAAZ,GAAyB,SAAtD,CAAJ,EAAsE;IACpE,OAAO,UAAP;EACD;;EAED,OAAO,OAAA,CAAA,eAAA,CAAgB,UAAhB,CAAP;AACD,CArBM;;AAAM,OAAA,CAAA,eAAA,GAAe,eAAf;;AAuBN,MAAM,eAAe,GAAI,IAAD,IAAiD;;;EAC9E,MAAM,mBAAmB,GAAgB,OAAA,CAAA,eAAA,CAAgB,IAAhB,CAAzC;EACA,OAAO,mBAAmB,GAAG,mBAAmB,MAAK,CAAA,EAAA,GAAA,mBAAmB,CAAC,aAApB,MAAiC,IAAjC,IAAiC,EAAA,KAAA,KAAA,CAAjC,GAAiC,KAAA,CAAjC,GAAiC,EAAA,CAAE,IAAxC,CAAtB,GAAqE,KAA/F;AACD,CAHM;;AAAM,OAAA,CAAA,eAAA,GAAe,eAAf","sourcesContent":["/**\n * Returns the parent node or the host of the node argument.\n * @param node - DOM node.\n * @returns - parent DOM node.\n */\nexport const getParentNode = (node: HTMLElement): HTMLElement => {\n if (node.nodeName === 'HTML') {\n return node;\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return node.parentNode || (node as any).host;\n};\n\n/**\n * Returns CSS styles of the given node.\n * @param node - DOM node.\n * @returns - CSS styles.\n */\nconst getStyleComputedProperty = (node: HTMLElement): Partial<CSSStyleDeclaration> => {\n if (node.nodeType !== 1) {\n return {};\n }\n\n const window = node.ownerDocument?.defaultView;\n return window!.getComputedStyle(node, null);\n};\n\n/**\n * Returns the first scrollable parent of the given element.\n * @param node - DOM node.\n * @returns - the first scrollable parent.\n */\nexport const getScrollParent = (node: Document | HTMLElement | null): HTMLElement => {\n // Return body, `getScroll` will take care to get the correct `scrollTop` from it\n const parentNode = node && getParentNode(node as HTMLElement);\n // eslint-disable-next-line\n if (!parentNode) return document.body;\n\n switch (parentNode.nodeName) {\n case 'HTML':\n case 'BODY':\n return parentNode.ownerDocument!.body;\n case '#document':\n return ((parentNode as unknown) as Document).body;\n }\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\n return getScrollParent(parentNode);\n};\n\nexport const hasScrollParent = (node: Document | HTMLElement | null): boolean => {\n const scrollParentElement: HTMLElement = getScrollParent(node);\n return scrollParentElement ? scrollParentElement !== scrollParentElement.ownerDocument?.body : false;\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":";;;;;;AAAA;;;;;AAKO,MAAMA,aAAa,GAAIC,IAAiB,IAAiB;EAC9D,IAAIA,IAAI,CAACC,QAAQ,KAAK,MAAM,EAAE;IAC5B,OAAOD,IAAI;;EAEb;EACA,OAAOA,IAAI,CAACE,UAAU,IAAKF,IAAY,CAACG,IAAI;AAC9C,CAAC;AANYC,qBAAa;AAQ1B;;;;;AAKA,MAAMC,wBAAwB,GAAIL,IAAiB,IAAkC;;EACnF,IAAIA,IAAI,CAACM,QAAQ,KAAK,CAAC,EAAE;IACvB,OAAO,EAAE;;EAGX,MAAMC,MAAM,GAAG,UAAI,CAACC,aAAa,0CAAEC,WAAW;EAC9C,OAAOF,MAAO,CAACG,gBAAgB,CAACV,IAAI,EAAE,IAAI,CAAC;AAC7C,CAAC;AAED;;;;;AAKO,MAAMW,eAAe,GAAIX,IAAmC,IAAiB;EAClF;EACA,MAAME,UAAU,GAAGF,IAAI,IAAII,qBAAa,CAACJ,IAAmB,CAAC;EAC7D;EACA,IAAI,CAACE,UAAU,EAAE,OAAOU,QAAQ,CAACC,IAAI;EAErC,QAAQX,UAAU,CAACD,QAAQ;IACzB,KAAK,MAAM;IACX,KAAK,MAAM;MACT,OAAOC,UAAU,CAACM,aAAc,CAACK,IAAI;IACvC,KAAK,WAAW;MACd,OAASX,UAAmC,CAACW,IAAI;EAAC;EAGtD;EACA,MAAM;IAAEC,QAAQ;IAAEC,SAAS;IAAEC;EAAS,CAAE,GAAGX,wBAAwB,CAACH,UAAU,CAAC;EAC/E,IAAI,uBAAuB,CAACe,IAAI,CAACH,QAAS,GAAGE,SAAU,GAAGD,SAAS,CAAC,EAAE;IACpE,OAAOb,UAAU;;EAGnB,OAAOE,uBAAe,CAACF,UAAU,CAAC;AACpC,CAAC;AArBYE,uBAAe;AAuBrB,MAAMc,eAAe,GAAIlB,IAAmC,IAAa;;EAC9E,MAAMmB,mBAAmB,GAAgBf,uBAAe,CAACJ,IAAI,CAAC;EAC9D,OAAOmB,mBAAmB,GAAGA,mBAAmB,MAAK,yBAAmB,CAACX,aAAa,0CAAEK,IAAI,IAAG,KAAK;AACtG,CAAC;AAHYT,uBAAe","names":["getParentNode","node","nodeName","parentNode","host","exports","getStyleComputedProperty","nodeType","window","ownerDocument","defaultView","getComputedStyle","getScrollParent","document","body","overflow","overflowX","overflowY","test","hasScrollParent","scrollParentElement"],"sourceRoot":"../src/","sources":["packages/react-components/react-positioning/src/utils/getScrollParent.ts"],"sourcesContent":["/**\n * Returns the parent node or the host of the node argument.\n * @param node - DOM node.\n * @returns - parent DOM node.\n */\nexport const getParentNode = (node: HTMLElement): HTMLElement => {\n if (node.nodeName === 'HTML') {\n return node;\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return node.parentNode || (node as any).host;\n};\n\n/**\n * Returns CSS styles of the given node.\n * @param node - DOM node.\n * @returns - CSS styles.\n */\nconst getStyleComputedProperty = (node: HTMLElement): Partial<CSSStyleDeclaration> => {\n if (node.nodeType !== 1) {\n return {};\n }\n\n const window = node.ownerDocument?.defaultView;\n return window!.getComputedStyle(node, null);\n};\n\n/**\n * Returns the first scrollable parent of the given element.\n * @param node - DOM node.\n * @returns - the first scrollable parent.\n */\nexport const getScrollParent = (node: Document | HTMLElement | null): HTMLElement => {\n // Return body, `getScroll` will take care to get the correct `scrollTop` from it\n const parentNode = node && getParentNode(node as HTMLElement);\n // eslint-disable-next-line\n if (!parentNode) return document.body;\n\n switch (parentNode.nodeName) {\n case 'HTML':\n case 'BODY':\n return parentNode.ownerDocument!.body;\n case '#document':\n return ((parentNode as unknown) as Document).body;\n }\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\n return getScrollParent(parentNode);\n};\n\nexport const hasScrollParent = (node: Document | HTMLElement | null): boolean => {\n const scrollParentElement: HTMLElement = getScrollParent(node);\n return scrollParentElement ? scrollParentElement !== scrollParentElement.ownerDocument?.body : false;\n};\n"]}
@@ -1,12 +1,12 @@
1
- "use strict"; //
1
+ "use strict";
2
+
3
+ //
2
4
  // Dev utils to detect if nodes have "autoFocus" props.
3
5
  //
4
-
5
6
  Object.defineProperty(exports, "__esModule", {
6
7
  value: true
7
8
  });
8
9
  exports.hasAutofocusFilter = void 0;
9
-
10
10
  const getReactFiberFromNode_1 = /*#__PURE__*/require("./getReactFiberFromNode");
11
11
  /**
12
12
  * Detects if a passed HTML node has "autoFocus" prop on a React's fiber. Is needed as React handles autofocus behavior
@@ -14,24 +14,17 @@ const getReactFiberFromNode_1 = /*#__PURE__*/require("./getReactFiberFromNode");
14
14
  *
15
15
  * @param node
16
16
  */
17
-
18
-
19
17
  function hasAutofocusProp(node) {
20
- var _a; // https://github.com/facebook/react/blob/848bb2426e44606e0a55dfe44c7b3ece33772485/packages/react-dom/src/client/ReactDOMHostConfig.js#L157-L166
21
-
22
-
18
+ var _a;
19
+ // https://github.com/facebook/react/blob/848bb2426e44606e0a55dfe44c7b3ece33772485/packages/react-dom/src/client/ReactDOMHostConfig.js#L157-L166
23
20
  const isAutoFocusableElement = node.nodeName === 'BUTTON' || node.nodeName === 'INPUT' || node.nodeName === 'SELECT' || node.nodeName === 'TEXTAREA';
24
-
25
21
  if (isAutoFocusableElement) {
26
22
  return !!((_a = getReactFiberFromNode_1.getReactFiberFromNode(node)) === null || _a === void 0 ? void 0 : _a.pendingProps.autoFocus);
27
23
  }
28
-
29
24
  return false;
30
25
  }
31
-
32
26
  function hasAutofocusFilter(node) {
33
27
  return hasAutofocusProp(node) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
34
28
  }
35
-
36
29
  exports.hasAutofocusFilter = hasAutofocusFilter;
37
30
  //# sourceMappingURL=hasAutoFocusFilter.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-positioning/src/utils/hasAutoFocusFilter.ts"],"names":[],"mappings":"cAAA;AACA;AACA;;;;;;;AAEA,MAAA,uBAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;AAEA;;;;;AAKG;;;AACH,SAAS,gBAAT,CAA0B,IAA1B,EAAoC;SAAA,CAClC;;;EACA,MAAM,sBAAsB,GAC1B,IAAI,CAAC,QAAL,KAAkB,QAAlB,IACA,IAAI,CAAC,QAAL,KAAkB,OADlB,IAEA,IAAI,CAAC,QAAL,KAAkB,QAFlB,IAGA,IAAI,CAAC,QAAL,KAAkB,UAJpB;;EAMA,IAAI,sBAAJ,EAA4B;IAC1B,OAAO,CAAC,EAAC,CAAA,EAAA,GAAA,uBAAA,CAAA,qBAAA,CAAsB,IAAtB,CAAA,MAA2B,IAA3B,IAA2B,EAAA,KAAA,KAAA,CAA3B,GAA2B,KAAA,CAA3B,GAA2B,EAAA,CAAE,YAAF,CAAe,SAA3C,CAAR;EACD;;EAED,OAAO,KAAP;AACD;;AAED,SAAgB,kBAAhB,CAAmC,IAAnC,EAA6C;EAC3C,OAAO,gBAAgB,CAAC,IAAD,CAAhB,GAAyB,UAAU,CAAC,aAApC,GAAoD,UAAU,CAAC,WAAtE;AACD;;AAFD,OAAA,CAAA,kBAAA,GAAA,kBAAA","sourcesContent":["//\n// Dev utils to detect if nodes have \"autoFocus\" props.\n//\n\nimport { getReactFiberFromNode } from './getReactFiberFromNode';\n\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 */\nfunction hasAutofocusProp(node: Node): boolean {\n // https://github.com/facebook/react/blob/848bb2426e44606e0a55dfe44c7b3ece33772485/packages/react-dom/src/client/ReactDOMHostConfig.js#L157-L166\n const isAutoFocusableElement =\n node.nodeName === 'BUTTON' ||\n node.nodeName === 'INPUT' ||\n node.nodeName === 'SELECT' ||\n node.nodeName === 'TEXTAREA';\n\n if (isAutoFocusableElement) {\n return !!getReactFiberFromNode(node)?.pendingProps.autoFocus;\n }\n\n return false;\n}\n\nexport function hasAutofocusFilter(node: Node) {\n return hasAutofocusProp(node) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":";;AAAA;AACA;AACA;;;;;AAEA;AAEA;;;;;;AAMA,SAASA,gBAAgB,CAACC,IAAU;;EAClC;EACA,MAAMC,sBAAsB,GAC1BD,IAAI,CAACE,QAAQ,KAAK,QAAQ,IAC1BF,IAAI,CAACE,QAAQ,KAAK,OAAO,IACzBF,IAAI,CAACE,QAAQ,KAAK,QAAQ,IAC1BF,IAAI,CAACE,QAAQ,KAAK,UAAU;EAE9B,IAAID,sBAAsB,EAAE;IAC1B,OAAO,CAAC,EAAC,mDAAqB,CAACD,IAAI,CAAC,0CAAEG,YAAY,CAACC,SAAS;;EAG9D,OAAO,KAAK;AACd;AAEA,SAAgBC,kBAAkB,CAACL,IAAU;EAC3C,OAAOD,gBAAgB,CAACC,IAAI,CAAC,GAAGM,UAAU,CAACC,aAAa,GAAGD,UAAU,CAACE,WAAW;AACnF;AAFAC","names":["hasAutofocusProp","node","isAutoFocusableElement","nodeName","pendingProps","autoFocus","hasAutofocusFilter","NodeFilter","FILTER_ACCEPT","FILTER_SKIP","exports"],"sourceRoot":"../src/","sources":["packages/react-components/react-positioning/src/utils/hasAutoFocusFilter.ts"],"sourcesContent":["//\n// Dev utils to detect if nodes have \"autoFocus\" props.\n//\n\nimport { getReactFiberFromNode } from './getReactFiberFromNode';\n\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 */\nfunction hasAutofocusProp(node: Node): boolean {\n // https://github.com/facebook/react/blob/848bb2426e44606e0a55dfe44c7b3ece33772485/packages/react-dom/src/client/ReactDOMHostConfig.js#L157-L166\n const isAutoFocusableElement =\n node.nodeName === 'BUTTON' ||\n node.nodeName === 'INPUT' ||\n node.nodeName === 'SELECT' ||\n node.nodeName === 'TEXTAREA';\n\n if (isAutoFocusableElement) {\n return !!getReactFiberFromNode(node)?.pendingProps.autoFocus;\n }\n\n return false;\n}\n\nexport function hasAutofocusFilter(node: Node) {\n return hasAutofocusProp(node) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;\n}\n"]}
@@ -3,34 +3,19 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
-
7
6
  const tslib_1 = /*#__PURE__*/require("tslib");
8
-
9
7
  tslib_1.__exportStar(require("./parseFloatingUIPlacement"), exports);
10
-
11
8
  tslib_1.__exportStar(require("./getBoundary"), exports);
12
-
13
9
  tslib_1.__exportStar(require("./getReactFiberFromNode"), exports);
14
-
15
10
  tslib_1.__exportStar(require("./getScrollParent"), exports);
16
-
17
11
  tslib_1.__exportStar(require("./mergeArrowOffset"), exports);
18
-
19
12
  tslib_1.__exportStar(require("./toFloatingUIPlacement"), exports);
20
-
21
13
  tslib_1.__exportStar(require("./fromFloatingUIPlacement"), exports);
22
-
23
14
  tslib_1.__exportStar(require("./resolvePositioningShorthand"), exports);
24
-
25
15
  tslib_1.__exportStar(require("./useCallbackRef"), exports);
26
-
27
16
  tslib_1.__exportStar(require("./debounce"), exports);
28
-
29
17
  tslib_1.__exportStar(require("./toggleScrollListener"), exports);
30
-
31
18
  tslib_1.__exportStar(require("./hasAutoFocusFilter"), exports);
32
-
33
19
  tslib_1.__exportStar(require("./writeArrowUpdates"), exports);
34
-
35
20
  tslib_1.__exportStar(require("./writeContainerupdates"), exports);
36
21
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-positioning/src/utils/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,4BAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,eAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,yBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,mBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,oBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,yBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,2BAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,+BAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,kBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,YAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,wBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,sBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,qBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,yBAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './parseFloatingUIPlacement';\nexport * from './getBoundary';\nexport * from './getReactFiberFromNode';\nexport * from './getScrollParent';\nexport * from './mergeArrowOffset';\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"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":";;;;;;AAAAA;AACAA;AACAA;AACAA;AACAA;AACAA;AACAA;AACAA;AACAA;AACAA;AACAA;AACAA;AACAA;AACAA","names":["tslib_1"],"sourceRoot":"../src/","sources":["packages/react-components/react-positioning/src/utils/index.ts"],"sourcesContent":["export * from './parseFloatingUIPlacement';\nexport * from './getBoundary';\nexport * from './getReactFiberFromNode';\nexport * from './getScrollParent';\nexport * from './mergeArrowOffset';\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"]}
@@ -13,40 +13,33 @@ exports.mergeArrowOffset = void 0;
13
13
  * @param arrowHeight - The height of the arrow in px
14
14
  * @returns User offset augmented with arrow height
15
15
  */
16
-
17
16
  function mergeArrowOffset(userOffset, arrowHeight) {
18
17
  if (typeof userOffset === 'number') {
19
18
  return addArrowOffset(userOffset, arrowHeight);
20
19
  }
21
-
22
20
  if (typeof userOffset === 'object' && userOffset !== null) {
23
21
  return addArrowOffset(userOffset, arrowHeight);
24
22
  }
25
-
26
23
  if (typeof userOffset === 'function') {
27
24
  return offsetParams => {
28
25
  const offset = userOffset(offsetParams);
29
26
  return addArrowOffset(offset, arrowHeight);
30
27
  };
31
28
  }
32
-
33
29
  return {
34
30
  mainAxis: arrowHeight
35
31
  };
36
32
  }
37
-
38
33
  exports.mergeArrowOffset = mergeArrowOffset;
39
-
40
34
  const addArrowOffset = (offset, arrowHeight) => {
41
35
  var _a;
42
-
43
36
  if (typeof offset === 'number') {
44
37
  return {
45
38
  mainAxis: offset + arrowHeight
46
39
  };
47
40
  }
48
-
49
- return { ...offset,
41
+ return {
42
+ ...offset,
50
43
  mainAxis: ((_a = offset.mainAxis) !== null && _a !== void 0 ? _a : 0) + arrowHeight
51
44
  };
52
45
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-positioning/src/utils/mergeArrowOffset.ts"],"names":[],"mappings":";;;;;;AAEA;;;;;;;;AAQG;;AACH,SAAgB,gBAAhB,CAAiC,UAAjC,EAAwE,WAAxE,EAA2F;EACzF,IAAI,OAAO,UAAP,KAAsB,QAA1B,EAAoC;IAClC,OAAO,cAAc,CAAC,UAAD,EAAa,WAAb,CAArB;EACD;;EAED,IAAI,OAAO,UAAP,KAAsB,QAAtB,IAAkC,UAAU,KAAK,IAArD,EAA2D;IACzD,OAAO,cAAc,CAAC,UAAD,EAAa,WAAb,CAArB;EACD;;EAED,IAAI,OAAO,UAAP,KAAsB,UAA1B,EAAsC;IACpC,OAAO,YAAY,IAAG;MACpB,MAAM,MAAM,GAAG,UAAU,CAAC,YAAD,CAAzB;MACA,OAAO,cAAc,CAAC,MAAD,EAAS,WAAT,CAArB;IACD,CAHD;EAID;;EAED,OAAO;IAAE,QAAQ,EAAE;EAAZ,CAAP;AACD;;AAjBD,OAAA,CAAA,gBAAA,GAAA,gBAAA;;AAmBA,MAAM,cAAc,GAAG,CAAC,MAAD,EAAgC,WAAhC,KAAqE;;;EAC1F,IAAI,OAAO,MAAP,KAAkB,QAAtB,EAAgC;IAC9B,OAAO;MAAE,QAAQ,EAAE,MAAM,GAAG;IAArB,CAAP;EACD;;EAED,OAAO,EAAE,GAAG,MAAL;IAAa,QAAQ,EAAE,CAAC,CAAA,EAAA,GAAA,MAAM,CAAC,QAAP,MAAe,IAAf,IAAe,EAAA,KAAA,KAAA,CAAf,GAAe,EAAf,GAAmB,CAApB,IAAyB;EAAhD,CAAP;AACD,CAND","sourcesContent":["import type { Offset, OffsetObject } from '../types';\n\n/**\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 */\nexport function mergeArrowOffset(userOffset: Offset | undefined | null, arrowHeight: number): Offset {\n if (typeof userOffset === 'number') {\n return addArrowOffset(userOffset, arrowHeight);\n }\n\n if (typeof userOffset === 'object' && userOffset !== null) {\n return addArrowOffset(userOffset, arrowHeight);\n }\n\n if (typeof userOffset === 'function') {\n return offsetParams => {\n const offset = userOffset(offsetParams);\n return addArrowOffset(offset, arrowHeight);\n };\n }\n\n return { mainAxis: arrowHeight };\n}\n\nconst addArrowOffset = (offset: OffsetObject | number, arrowHeight: number): OffsetObject => {\n if (typeof offset === 'number') {\n return { mainAxis: offset + arrowHeight };\n }\n\n return { ...offset, mainAxis: (offset.mainAxis ?? 0) + arrowHeight };\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":";;;;;;AAEA;;;;;;;;;AASA,SAAgBA,gBAAgB,CAACC,UAAqC,EAAEC,WAAmB;EACzF,IAAI,OAAOD,UAAU,KAAK,QAAQ,EAAE;IAClC,OAAOE,cAAc,CAACF,UAAU,EAAEC,WAAW,CAAC;;EAGhD,IAAI,OAAOD,UAAU,KAAK,QAAQ,IAAIA,UAAU,KAAK,IAAI,EAAE;IACzD,OAAOE,cAAc,CAACF,UAAU,EAAEC,WAAW,CAAC;;EAGhD,IAAI,OAAOD,UAAU,KAAK,UAAU,EAAE;IACpC,OAAOG,YAAY,IAAG;MACpB,MAAMC,MAAM,GAAGJ,UAAU,CAACG,YAAY,CAAC;MACvC,OAAOD,cAAc,CAACE,MAAM,EAAEH,WAAW,CAAC;IAC5C,CAAC;;EAGH,OAAO;IAAEI,QAAQ,EAAEJ;EAAW,CAAE;AAClC;AAjBAK;AAmBA,MAAMJ,cAAc,GAAG,CAACE,MAA6B,EAAEH,WAAmB,KAAkB;;EAC1F,IAAI,OAAOG,MAAM,KAAK,QAAQ,EAAE;IAC9B,OAAO;MAAEC,QAAQ,EAAED,MAAM,GAAGH;IAAW,CAAE;;EAG3C,OAAO;IAAE,GAAGG,MAAM;IAAEC,QAAQ,EAAE,CAAC,YAAM,CAACA,QAAQ,mCAAI,CAAC,IAAIJ;EAAW,CAAE;AACtE,CAAC","names":["mergeArrowOffset","userOffset","arrowHeight","addArrowOffset","offsetParams","offset","mainAxis","exports"],"sourceRoot":"../src/","sources":["packages/react-components/react-positioning/src/utils/mergeArrowOffset.ts"],"sourcesContent":["import type { Offset, OffsetObject } from '../types';\n\n/**\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 */\nexport function mergeArrowOffset(userOffset: Offset | undefined | null, arrowHeight: number): Offset {\n if (typeof userOffset === 'number') {\n return addArrowOffset(userOffset, arrowHeight);\n }\n\n if (typeof userOffset === 'object' && userOffset !== null) {\n return addArrowOffset(userOffset, arrowHeight);\n }\n\n if (typeof userOffset === 'function') {\n return offsetParams => {\n const offset = userOffset(offsetParams);\n return addArrowOffset(offset, arrowHeight);\n };\n }\n\n return { mainAxis: arrowHeight };\n}\n\nconst addArrowOffset = (offset: OffsetObject | number, arrowHeight: number): OffsetObject => {\n if (typeof offset === 'number') {\n return { mainAxis: offset + arrowHeight };\n }\n\n return { ...offset, mainAxis: (offset.mainAxis ?? 0) + arrowHeight };\n};\n"]}
@@ -10,7 +10,6 @@ exports.parseFloatingUIPlacement = void 0;
10
10
  *
11
11
  * @returns side and alignment components of the placement
12
12
  */
13
-
14
13
  function parseFloatingUIPlacement(placement) {
15
14
  const tokens = placement.split('-');
16
15
  return {
@@ -18,6 +17,5 @@ function parseFloatingUIPlacement(placement) {
18
17
  alignment: tokens[1]
19
18
  };
20
19
  }
21
-
22
20
  exports.parseFloatingUIPlacement = parseFloatingUIPlacement;
23
21
  //# sourceMappingURL=parseFloatingUIPlacement.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-positioning/src/utils/parseFloatingUIPlacement.ts"],"names":[],"mappings":";;;;;;AAEA;;;;;AAKG;;AACH,SAAgB,wBAAhB,CAAyC,SAAzC,EAA6D;EAC3D,MAAM,MAAM,GAAG,SAAS,CAAC,KAAV,CAAgB,GAAhB,CAAf;EACA,OAAO;IACL,IAAI,EAAE,MAAM,CAAC,CAAD,CADP;IAEL,SAAS,EAAE,MAAM,CAAC,CAAD;EAFZ,CAAP;AAID;;AAND,OAAA,CAAA,wBAAA,GAAA,wBAAA","sourcesContent":["import type { Side, Placement, Alignment } from '@floating-ui/dom';\n\n/**\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 */\nexport function parseFloatingUIPlacement(placement: Placement): { side: Side; alignment: Alignment } {\n const tokens = placement.split('-');\n return {\n side: tokens[0] as Side,\n alignment: tokens[1] as Alignment,\n };\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":";;;;;;AAEA;;;;;;AAMA,SAAgBA,wBAAwB,CAACC,SAAoB;EAC3D,MAAMC,MAAM,GAAGD,SAAS,CAACE,KAAK,CAAC,GAAG,CAAC;EACnC,OAAO;IACLC,IAAI,EAAEF,MAAM,CAAC,CAAC,CAAS;IACvBG,SAAS,EAAEH,MAAM,CAAC,CAAC;GACpB;AACH;AANAI","names":["parseFloatingUIPlacement","placement","tokens","split","side","alignment","exports"],"sourceRoot":"../src/","sources":["packages/react-components/react-positioning/src/utils/parseFloatingUIPlacement.ts"],"sourcesContent":["import type { Side, Placement, Alignment } from '@floating-ui/dom';\n\n/**\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 */\nexport function parseFloatingUIPlacement(placement: Placement): { side: Side; alignment: Alignment } {\n const tokens = placement.split('-');\n return {\n side: tokens[0] as Side,\n alignment: tokens[1] as Alignment,\n };\n}\n"]}
@@ -3,8 +3,8 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.resolvePositioningShorthand = void 0; // Look up table for shorthand to avoid parsing strings
7
-
6
+ exports.resolvePositioningShorthand = void 0;
7
+ // Look up table for shorthand to avoid parsing strings
8
8
  const shorthandLookup = {
9
9
  above: {
10
10
  position: 'above',
@@ -55,18 +55,14 @@ const shorthandLookup = {
55
55
  align: 'bottom'
56
56
  }
57
57
  };
58
-
59
58
  function resolvePositioningShorthand(shorthand) {
60
59
  if (shorthand === undefined || shorthand === null) {
61
60
  return {};
62
61
  }
63
-
64
62
  if (typeof shorthand === 'string') {
65
63
  return shorthandLookup[shorthand];
66
64
  }
67
-
68
65
  return shorthand;
69
66
  }
70
-
71
67
  exports.resolvePositioningShorthand = resolvePositioningShorthand;
72
68
  //# sourceMappingURL=resolvePositioningShorthand.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-positioning/src/utils/resolvePositioningShorthand.ts"],"names":[],"mappings":";;;;;8CAEA;;AACA,MAAM,eAAe,GAAoF;EACvG,KAAK,EAAE;IAAE,QAAQ,EAAE,OAAZ;IAAqB,KAAK,EAAE;EAA5B,CADgG;EAEvG,eAAe;IAAE,QAAQ,EAAE,OAAZ;IAAqB,KAAK,EAAE;EAA5B,CAFwF;EAGvG,aAAa;IAAE,QAAQ,EAAE,OAAZ;IAAqB,KAAK,EAAE;EAA5B,CAH0F;EAIvG,KAAK,EAAE;IAAE,QAAQ,EAAE,OAAZ;IAAqB,KAAK,EAAE;EAA5B,CAJgG;EAKvG,eAAe;IAAE,QAAQ,EAAE,OAAZ;IAAqB,KAAK,EAAE;EAA5B,CALwF;EAMvG,aAAa;IAAE,QAAQ,EAAE,OAAZ;IAAqB,KAAK,EAAE;EAA5B,CAN0F;EAOvG,MAAM,EAAE;IAAE,QAAQ,EAAE,QAAZ;IAAsB,KAAK,EAAE;EAA7B,CAP+F;EAQvG,cAAc;IAAE,QAAQ,EAAE,QAAZ;IAAsB,KAAK,EAAE;EAA7B,CARyF;EASvG,iBAAiB;IAAE,QAAQ,EAAE,QAAZ;IAAsB,KAAK,EAAE;EAA7B,CATsF;EAUvG,KAAK,EAAE;IAAE,QAAQ,EAAE,OAAZ;IAAqB,KAAK,EAAE;EAA5B,CAVgG;EAWvG,aAAa;IAAE,QAAQ,EAAE,OAAZ;IAAqB,KAAK,EAAE;EAA5B,CAX0F;EAYvG,gBAAgB;IAAE,QAAQ,EAAE,OAAZ;IAAqB,KAAK,EAAE;EAA5B;AAZuF,CAAzG;;AAeA,SAAgB,2BAAhB,CACE,SADF,EACoD;EAElD,IAAI,SAAS,KAAK,SAAd,IAA2B,SAAS,KAAK,IAA7C,EAAmD;IACjD,OAAO,EAAP;EACD;;EAED,IAAI,OAAO,SAAP,KAAqB,QAAzB,EAAmC;IACjC,OAAO,eAAe,CAAC,SAAD,CAAtB;EACD;;EAED,OAAO,SAAP;AACD;;AAZD,OAAA,CAAA,2BAAA,GAAA,2BAAA","sourcesContent":["import type { PositioningShorthand, PositioningShorthandValue, PositioningProps } from '../types';\n\n// Look up table for shorthand to avoid parsing strings\nconst shorthandLookup: Record<PositioningShorthandValue, Pick<PositioningProps, 'position' | 'align'>> = {\n above: { position: 'above', align: 'center' },\n 'above-start': { position: 'above', align: 'start' },\n 'above-end': { position: 'above', align: 'end' },\n below: { position: 'below', align: 'center' },\n 'below-start': { position: 'below', align: 'start' },\n 'below-end': { position: 'below', align: 'end' },\n before: { position: 'before', align: 'center' },\n 'before-top': { position: 'before', align: 'top' },\n 'before-bottom': { position: 'before', align: 'bottom' },\n after: { position: 'after', align: 'center' },\n 'after-top': { position: 'after', align: 'top' },\n 'after-bottom': { position: 'after', align: 'bottom' },\n};\n\nexport function resolvePositioningShorthand(\n shorthand: PositioningShorthand | undefined | null,\n): Readonly<PositioningProps> {\n if (shorthand === undefined || shorthand === null) {\n return {};\n }\n\n if (typeof shorthand === 'string') {\n return shorthandLookup[shorthand];\n }\n\n return shorthand as Readonly<PositioningProps>;\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":";;;;;;AAEA;AACA,MAAMA,eAAe,GAAoF;EACvGC,KAAK,EAAE;IAAEC,QAAQ,EAAE,OAAO;IAAEC,KAAK,EAAE;EAAQ,CAAE;EAC7C,aAAa,EAAE;IAAED,QAAQ,EAAE,OAAO;IAAEC,KAAK,EAAE;EAAO,CAAE;EACpD,WAAW,EAAE;IAAED,QAAQ,EAAE,OAAO;IAAEC,KAAK,EAAE;EAAK,CAAE;EAChDC,KAAK,EAAE;IAAEF,QAAQ,EAAE,OAAO;IAAEC,KAAK,EAAE;EAAQ,CAAE;EAC7C,aAAa,EAAE;IAAED,QAAQ,EAAE,OAAO;IAAEC,KAAK,EAAE;EAAO,CAAE;EACpD,WAAW,EAAE;IAAED,QAAQ,EAAE,OAAO;IAAEC,KAAK,EAAE;EAAK,CAAE;EAChDE,MAAM,EAAE;IAAEH,QAAQ,EAAE,QAAQ;IAAEC,KAAK,EAAE;EAAQ,CAAE;EAC/C,YAAY,EAAE;IAAED,QAAQ,EAAE,QAAQ;IAAEC,KAAK,EAAE;EAAK,CAAE;EAClD,eAAe,EAAE;IAAED,QAAQ,EAAE,QAAQ;IAAEC,KAAK,EAAE;EAAQ,CAAE;EACxDG,KAAK,EAAE;IAAEJ,QAAQ,EAAE,OAAO;IAAEC,KAAK,EAAE;EAAQ,CAAE;EAC7C,WAAW,EAAE;IAAED,QAAQ,EAAE,OAAO;IAAEC,KAAK,EAAE;EAAK,CAAE;EAChD,cAAc,EAAE;IAAED,QAAQ,EAAE,OAAO;IAAEC,KAAK,EAAE;EAAQ;CACrD;AAED,SAAgBI,2BAA2B,CACzCC,SAAkD;EAElD,IAAIA,SAAS,KAAKC,SAAS,IAAID,SAAS,KAAK,IAAI,EAAE;IACjD,OAAO,EAAE;;EAGX,IAAI,OAAOA,SAAS,KAAK,QAAQ,EAAE;IACjC,OAAOR,eAAe,CAACQ,SAAS,CAAC;;EAGnC,OAAOA,SAAuC;AAChD;AAZAE","names":["shorthandLookup","above","position","align","below","before","after","resolvePositioningShorthand","shorthand","undefined","exports"],"sourceRoot":"../src/","sources":["packages/react-components/react-positioning/src/utils/resolvePositioningShorthand.ts"],"sourcesContent":["import type { PositioningShorthand, PositioningShorthandValue, PositioningProps } from '../types';\n\n// Look up table for shorthand to avoid parsing strings\nconst shorthandLookup: Record<PositioningShorthandValue, Pick<PositioningProps, 'position' | 'align'>> = {\n above: { position: 'above', align: 'center' },\n 'above-start': { position: 'above', align: 'start' },\n 'above-end': { position: 'above', align: 'end' },\n below: { position: 'below', align: 'center' },\n 'below-start': { position: 'below', align: 'start' },\n 'below-end': { position: 'below', align: 'end' },\n before: { position: 'before', align: 'center' },\n 'before-top': { position: 'before', align: 'top' },\n 'before-bottom': { position: 'before', align: 'bottom' },\n after: { position: 'after', align: 'center' },\n 'after-top': { position: 'after', align: 'top' },\n 'after-bottom': { position: 'after', align: 'bottom' },\n};\n\nexport function resolvePositioningShorthand(\n shorthand: PositioningShorthand | undefined | null,\n): Readonly<PositioningProps> {\n if (shorthand === undefined || shorthand === null) {\n return {};\n }\n\n if (typeof shorthand === 'string') {\n return shorthandLookup[shorthand];\n }\n\n return shorthand as Readonly<PositioningProps>;\n}\n"]}
@@ -4,16 +4,14 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.toFloatingUIPlacement = void 0;
7
-
8
7
  const getPositionMap = rtl => ({
9
8
  above: 'top',
10
9
  below: 'bottom',
11
10
  before: rtl ? 'right' : 'left',
12
11
  after: rtl ? 'left' : 'right'
13
- }); // Floating UI automatically flips alignment
12
+ });
13
+ // Floating UI automatically flips alignment
14
14
  // https://github.com/floating-ui/floating-ui/issues/1563
15
-
16
-
17
15
  const getAlignmentMap = () => ({
18
16
  start: 'start',
19
17
  end: 'end',
@@ -21,7 +19,6 @@ const getAlignmentMap = () => ({
21
19
  bottom: 'end',
22
20
  center: undefined
23
21
  });
24
-
25
22
  const shouldAlignToCenter = (p, a) => {
26
23
  const positionedVertically = p === 'above' || p === 'below';
27
24
  const alignedVertically = a === 'top' || a === 'bottom';
@@ -31,19 +28,14 @@ const shouldAlignToCenter = (p, a) => {
31
28
  * Maps internal positioning values to Floating UI placement
32
29
  * @see positioningHelper.test.ts for expected placement values
33
30
  */
34
-
35
-
36
31
  const toFloatingUIPlacement = (align, position, rtl) => {
37
32
  const alignment = shouldAlignToCenter(position, align) ? 'center' : align;
38
33
  const computedPosition = position && getPositionMap(rtl)[position];
39
34
  const computedAlignment = alignment && getAlignmentMap()[alignment];
40
-
41
35
  if (computedPosition && computedAlignment) {
42
36
  return `${computedPosition}-${computedAlignment}`;
43
37
  }
44
-
45
38
  return computedPosition;
46
39
  };
47
-
48
40
  exports.toFloatingUIPlacement = toFloatingUIPlacement;
49
41
  //# sourceMappingURL=toFloatingUIPlacement.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-positioning/src/utils/toFloatingUIPlacement.ts"],"names":[],"mappings":";;;;;;;AAMA,MAAM,cAAc,GAAI,GAAD,KAAyD;EAC9E,KAAK,EAAE,KADuE;EAE9E,KAAK,EAAE,QAFuE;EAG9E,MAAM,EAAE,GAAG,GAAG,OAAH,GAAa,MAHsD;EAI9E,KAAK,EAAE,GAAG,GAAG,MAAH,GAAY;AAJwD,CAAzD,CAAvB,C,CAOA;AACA;;;AACA,MAAM,eAAe,GAAG,OAAsD;EAC5E,KAAK,EAAE,OADqE;EAE5E,GAAG,EAAE,KAFuE;EAG5E,GAAG,EAAE,OAHuE;EAI5E,MAAM,EAAE,KAJoE;EAK5E,MAAM,EAAE;AALoE,CAAtD,CAAxB;;AAQA,MAAM,mBAAmB,GAAG,CAAC,CAAD,EAAe,CAAf,KAAyC;EACnE,MAAM,oBAAoB,GAAG,CAAC,KAAK,OAAN,IAAiB,CAAC,KAAK,OAApD;EACA,MAAM,iBAAiB,GAAG,CAAC,KAAK,KAAN,IAAe,CAAC,KAAK,QAA/C;EAEA,OAAQ,oBAAoB,IAAI,iBAAzB,IAAgD,CAAC,oBAAD,IAAyB,CAAC,iBAAjF;AACD,CALD;AAOA;;;AAGG;;;AACI,MAAM,qBAAqB,GAAG,CAAC,KAAD,EAAoB,QAApB,EAAyC,GAAzC,KAAiF;EACpH,MAAM,SAAS,GAAG,mBAAmB,CAAC,QAAD,EAAW,KAAX,CAAnB,GAAuC,QAAvC,GAAkD,KAApE;EAEA,MAAM,gBAAgB,GAAG,QAAQ,IAAI,cAAc,CAAC,GAAD,CAAd,CAAoB,QAApB,CAArC;EACA,MAAM,iBAAiB,GAAG,SAAS,IAAI,eAAe,GAAG,SAAH,CAAtD;;EAEA,IAAI,gBAAgB,IAAI,iBAAxB,EAA2C;IACzC,OAAO,GAAG,gBAAgB,IAAI,iBAAiB,EAA/C;EACD;;EAED,OAAO,gBAAP;AACD,CAXM;;AAAM,OAAA,CAAA,qBAAA,GAAqB,qBAArB","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"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":";;;;;;AAMA,MAAMA,cAAc,GAAIC,GAAa,KAA2C;EAC9EC,KAAK,EAAE,KAAK;EACZC,KAAK,EAAE,QAAQ;EACfC,MAAM,EAAEH,GAAG,GAAG,OAAO,GAAG,MAAM;EAC9BI,KAAK,EAAEJ,GAAG,GAAG,MAAM,GAAG;CACvB,CAAC;AAEF;AACA;AACA,MAAMK,eAAe,GAAG,OAAsD;EAC5EC,KAAK,EAAE,OAAO;EACdC,GAAG,EAAE,KAAK;EACVC,GAAG,EAAE,OAAO;EACZC,MAAM,EAAE,KAAK;EACbC,MAAM,EAAEC;CACT,CAAC;AAEF,MAAMC,mBAAmB,GAAG,CAACC,CAAY,EAAEC,CAAa,KAAa;EACnE,MAAMC,oBAAoB,GAAGF,CAAC,KAAK,OAAO,IAAIA,CAAC,KAAK,OAAO;EAC3D,MAAMG,iBAAiB,GAAGF,CAAC,KAAK,KAAK,IAAIA,CAAC,KAAK,QAAQ;EAEvD,OAAQC,oBAAoB,IAAIC,iBAAiB,IAAM,CAACD,oBAAoB,IAAI,CAACC,iBAAkB;AACrG,CAAC;AAED;;;;AAIO,MAAMC,qBAAqB,GAAG,CAACC,KAAiB,EAAEC,QAAmB,EAAEnB,GAAa,KAA2B;EACpH,MAAMoB,SAAS,GAAGR,mBAAmB,CAACO,QAAQ,EAAED,KAAK,CAAC,GAAG,QAAQ,GAAGA,KAAK;EAEzE,MAAMG,gBAAgB,GAAGF,QAAQ,IAAIpB,cAAc,CAACC,GAAG,CAAC,CAACmB,QAAQ,CAAC;EAClE,MAAMG,iBAAiB,GAAGF,SAAS,IAAIf,eAAe,EAAE,CAACe,SAAS,CAAC;EAEnE,IAAIC,gBAAgB,IAAIC,iBAAiB,EAAE;IACzC,OAAO,GAAGD,gBAAgB,IAAIC,iBAAiB,EAAe;;EAGhE,OAAOD,gBAAgB;AACzB,CAAC;AAXYE,6BAAqB","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","exports"],"sourceRoot":"../src/","sources":["packages/react-components/react-positioning/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"]}
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.toggleScrollListener = void 0;
7
-
8
7
  const getScrollParent_1 = /*#__PURE__*/require("./getScrollParent");
9
8
  /**
10
9
  * Toggles event listeners for scroll parent.
@@ -12,23 +11,18 @@ const getScrollParent_1 = /*#__PURE__*/require("./getScrollParent");
12
11
  * @param next Next element
13
12
  * @param prev Previous element
14
13
  */
15
-
16
-
17
14
  function toggleScrollListener(next, prev, handler) {
18
15
  if (next === prev) {
19
16
  return;
20
17
  }
21
-
22
18
  if (prev instanceof HTMLElement) {
23
19
  const prevScrollParent = getScrollParent_1.getScrollParent(prev);
24
20
  prevScrollParent.removeEventListener('scroll', handler);
25
21
  }
26
-
27
22
  if (next instanceof HTMLElement) {
28
23
  const scrollParent = getScrollParent_1.getScrollParent(next);
29
24
  scrollParent.addEventListener('scroll', handler);
30
25
  }
31
26
  }
32
-
33
27
  exports.toggleScrollListener = toggleScrollListener;
34
28
  //# sourceMappingURL=toggleScrollListener.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-positioning/src/utils/toggleScrollListener.ts"],"names":[],"mappings":";;;;;;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,mBAAA,CAAA;AAEA;;;;;AAKG;;;AACH,SAAgB,oBAAhB,CACE,IADF,EAEE,IAFF,EAGE,OAHF,EAGwB;EAEtB,IAAI,IAAI,KAAK,IAAb,EAAmB;IACjB;EACD;;EAED,IAAI,IAAI,YAAY,WAApB,EAAiC;IAC/B,MAAM,gBAAgB,GAAG,iBAAA,CAAA,eAAA,CAAgB,IAAhB,CAAzB;IACA,gBAAgB,CAAC,mBAAjB,CAAqC,QAArC,EAA+C,OAA/C;EACD;;EACD,IAAI,IAAI,YAAY,WAApB,EAAiC;IAC/B,MAAM,YAAY,GAAG,iBAAA,CAAA,eAAA,CAAgB,IAAhB,CAArB;IACA,YAAY,CAAC,gBAAb,CAA8B,QAA9B,EAAwC,OAAxC;EACD;AACF;;AAjBD,OAAA,CAAA,oBAAA,GAAA,oBAAA","sourcesContent":["import type { PositioningVirtualElement } from '../types';\nimport { getScrollParent } from './getScrollParent';\n\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 */\nexport function toggleScrollListener(\n next: HTMLElement | PositioningVirtualElement | null,\n prev: HTMLElement | PositioningVirtualElement | null,\n handler: EventListener,\n) {\n if (next === prev) {\n return;\n }\n\n if (prev instanceof HTMLElement) {\n const prevScrollParent = getScrollParent(prev);\n prevScrollParent.removeEventListener('scroll', handler);\n }\n if (next instanceof HTMLElement) {\n const scrollParent = getScrollParent(next);\n scrollParent.addEventListener('scroll', handler);\n }\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":";;;;;;AACA;AAEA;;;;;;AAMA,SAAgBA,oBAAoB,CAClCC,IAAoD,EACpDC,IAAoD,EACpDC,OAAsB;EAEtB,IAAIF,IAAI,KAAKC,IAAI,EAAE;IACjB;;EAGF,IAAIA,IAAI,YAAYE,WAAW,EAAE;IAC/B,MAAMC,gBAAgB,GAAGC,iCAAe,CAACJ,IAAI,CAAC;IAC9CG,gBAAgB,CAACE,mBAAmB,CAAC,QAAQ,EAAEJ,OAAO,CAAC;;EAEzD,IAAIF,IAAI,YAAYG,WAAW,EAAE;IAC/B,MAAMI,YAAY,GAAGF,iCAAe,CAACL,IAAI,CAAC;IAC1CO,YAAY,CAACC,gBAAgB,CAAC,QAAQ,EAAEN,OAAO,CAAC;;AAEpD;AAjBAO","names":["toggleScrollListener","next","prev","handler","HTMLElement","prevScrollParent","getScrollParent_1","removeEventListener","scrollParent","addEventListener","exports"],"sourceRoot":"../src/","sources":["packages/react-components/react-positioning/src/utils/toggleScrollListener.ts"],"sourcesContent":["import type { PositioningVirtualElement } from '../types';\nimport { getScrollParent } from './getScrollParent';\n\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 */\nexport function toggleScrollListener(\n next: HTMLElement | PositioningVirtualElement | null,\n prev: HTMLElement | PositioningVirtualElement | null,\n handler: EventListener,\n) {\n if (next === prev) {\n return;\n }\n\n if (prev instanceof HTMLElement) {\n const prevScrollParent = getScrollParent(prev);\n prevScrollParent.removeEventListener('scroll', handler);\n }\n if (next instanceof HTMLElement) {\n const scrollParent = getScrollParent(next);\n scrollParent.addEventListener('scroll', handler);\n }\n}\n"]}
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.useCallbackRef = void 0;
7
-
8
7
  const React = /*#__PURE__*/require("react");
9
-
10
8
  const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
11
9
  /**
12
10
  * Creates a MutableRef with ref change callback. Is useful as React.useRef() doesn't notify you when its content
@@ -25,8 +23,6 @@ const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
25
23
  * ref.current = 1;
26
24
  * // prints 0 -> 1
27
25
  */
28
-
29
-
30
26
  function useCallbackRef(initialValue, callback, skipInitialResolve) {
31
27
  const isFirst = React.useRef(true);
32
28
  const [ref] = React.useState(() => ({
@@ -39,30 +35,24 @@ function useCallbackRef(initialValue, callback, skipInitialResolve) {
39
35
  get current() {
40
36
  return ref.value;
41
37
  },
42
-
43
38
  set current(value) {
44
39
  const last = ref.value;
45
-
46
40
  if (last !== value) {
47
41
  ref.value = value;
48
-
49
42
  if (skipInitialResolve && isFirst.current) {
50
43
  return;
51
44
  }
52
-
53
45
  ref.callback(value, last);
54
46
  }
55
47
  }
56
-
57
48
  }
58
49
  }));
59
50
  react_utilities_1.useIsomorphicLayoutEffect(() => {
60
51
  isFirst.current = false;
61
- }, []); // update callback
62
-
52
+ }, []);
53
+ // update callback
63
54
  ref.callback = callback;
64
55
  return ref.facade;
65
56
  }
66
-
67
57
  exports.useCallbackRef = useCallbackRef;
68
58
  //# sourceMappingURL=useCallbackRef.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-positioning/src/utils/useCallbackRef.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;AAEA;;;;;;;;;;;;;;;;AAgBG;;;AACH,SAAgB,cAAhB,CACE,YADF,EAEE,QAFF,EAGE,kBAHF,EAG8B;EAE5B,MAAM,OAAO,GAAG,KAAK,CAAC,MAAN,CAAa,IAAb,CAAhB;EACA,MAAM,CAAC,GAAD,IAAQ,KAAK,CAAC,QAAN,CAAe,OAAO;IAClC;IACA,KAAK,EAAE,YAF2B;IAGlC;IACA,QAJkC;IAKlC;IACA,MAAM,EAAE;MACN,IAAI,OAAJ,GAAW;QACT,OAAO,GAAG,CAAC,KAAX;MACD,CAHK;;MAIN,IAAI,OAAJ,CAAY,KAAZ,EAAiB;QACf,MAAM,IAAI,GAAG,GAAG,CAAC,KAAjB;;QAEA,IAAI,IAAI,KAAK,KAAb,EAAoB;UAClB,GAAG,CAAC,KAAJ,GAAY,KAAZ;;UAEA,IAAI,kBAAkB,IAAI,OAAO,CAAC,OAAlC,EAA2C;YACzC;UACD;;UAED,GAAG,CAAC,QAAJ,CAAa,KAAb,EAAoB,IAApB;QACD;MACF;;IAhBK;EAN0B,CAAP,CAAf,CAAd;EA0BA,iBAAA,CAAA,yBAAA,CAA0B,MAAK;IAC7B,OAAO,CAAC,OAAR,GAAkB,KAAlB;EACD,CAFD,EAEG,EAFH,EA7B4B,CAiC5B;;EACA,GAAG,CAAC,QAAJ,GAAe,QAAf;EAEA,OAAO,GAAG,CAAC,MAAX;AACD;;AAxCD,OAAA,CAAA,cAAA,GAAA,cAAA","sourcesContent":["import * 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): 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"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":";;;;;;AAAA;AACA;AAEA;;;;;;;;;;;;;;;;;AAiBA,SAAgBA,cAAc,CAC5BC,YAAsB,EACtBC,QAA2D,EAC3DC,kBAA4B;EAE5B,MAAMC,OAAO,GAAGC,KAAK,CAACC,MAAM,CAAC,IAAI,CAAC;EAClC,MAAM,CAACC,GAAG,CAAC,GAAGF,KAAK,CAACG,QAAQ,CAAC,OAAO;IAClC;IACAC,KAAK,EAAER,YAAY;IACnB;IACAC,QAAQ;IACR;IACAQ,MAAM,EAAE;MACN,IAAIC,OAAO;QACT,OAAOJ,GAAG,CAACE,KAAK;MAClB,CAAC;MACD,IAAIE,OAAO,CAACF,KAAK;QACf,MAAMG,IAAI,GAAGL,GAAG,CAACE,KAAK;QAEtB,IAAIG,IAAI,KAAKH,KAAK,EAAE;UAClBF,GAAG,CAACE,KAAK,GAAGA,KAAK;UAEjB,IAAIN,kBAAkB,IAAIC,OAAO,CAACO,OAAO,EAAE;YACzC;;UAGFJ,GAAG,CAACL,QAAQ,CAACO,KAAK,EAAEG,IAAI,CAAC;;MAE7B;;GAEH,CAAC,CAAC;EAEHC,2CAAyB,CAAC,MAAK;IAC7BT,OAAO,CAACO,OAAO,GAAG,KAAK;EACzB,CAAC,EAAE,EAAE,CAAC;EAEN;EACAJ,GAAG,CAACL,QAAQ,GAAGA,QAAQ;EAEvB,OAAOK,GAAG,CAACG,MAAM;AACnB;AAxCAI","names":["useCallbackRef","initialValue","callback","skipInitialResolve","isFirst","React","useRef","ref","useState","value","facade","current","last","react_utilities_1","exports"],"sourceRoot":"../src/","sources":["packages/react-components/react-positioning/src/utils/useCallbackRef.ts"],"sourcesContent":["import * 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): 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"]}
@@ -7,17 +7,14 @@ exports.writeArrowUpdates = void 0;
7
7
  /**
8
8
  * Writes all DOM element updates after position is computed
9
9
  */
10
-
11
10
  function writeArrowUpdates(options) {
12
11
  const {
13
12
  arrow,
14
13
  middlewareData
15
14
  } = options;
16
-
17
15
  if (!middlewareData.arrow || !arrow) {
18
16
  return;
19
17
  }
20
-
21
18
  const {
22
19
  x: arrowX,
23
20
  y: arrowY
@@ -27,6 +24,5 @@ function writeArrowUpdates(options) {
27
24
  top: `${arrowY}px`
28
25
  });
29
26
  }
30
-
31
27
  exports.writeArrowUpdates = writeArrowUpdates;
32
28
  //# sourceMappingURL=writeArrowUpdates.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-positioning/src/utils/writeArrowUpdates.ts"],"names":[],"mappings":";;;;;;AAEA;;AAEG;;AACH,SAAgB,iBAAhB,CAAkC,OAAlC,EAAwG;EACtG,MAAM;IAAE,KAAF;IAAS;EAAT,IAA4B,OAAlC;;EACA,IAAI,CAAC,cAAc,CAAC,KAAhB,IAAyB,CAAC,KAA9B,EAAqC;IACnC;EACD;;EAED,MAAM;IAAE,CAAC,EAAE,MAAL;IAAa,CAAC,EAAE;EAAhB,IAA2B,cAAc,CAAC,KAAhD;EAEA,MAAM,CAAC,MAAP,CAAc,KAAK,CAAC,KAApB,EAA2B;IACzB,IAAI,EAAE,GAAG,MAAM,IADU;IAEzB,GAAG,EAAE,GAAG,MAAM;EAFW,CAA3B;AAID;;AAZD,OAAA,CAAA,iBAAA,GAAA,iBAAA","sourcesContent":["import { 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 }) {\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}px`,\n top: `${arrowY}px`,\n });\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":";;;;;;AAEA;;;AAGA,SAAgBA,iBAAiB,CAACC,OAAsE;EACtG,MAAM;IAAEC,KAAK;IAAEC;EAAc,CAAE,GAAGF,OAAO;EACzC,IAAI,CAACE,cAAc,CAACD,KAAK,IAAI,CAACA,KAAK,EAAE;IACnC;;EAGF,MAAM;IAAEE,CAAC,EAAEC,MAAM;IAAEC,CAAC,EAAEC;EAAM,CAAE,GAAGJ,cAAc,CAACD,KAAK;EAErDM,MAAM,CAACC,MAAM,CAACP,KAAK,CAACQ,KAAK,EAAE;IACzBC,IAAI,EAAE,GAAGN,MAAM,IAAI;IACnBO,GAAG,EAAE,GAAGL,MAAM;GACf,CAAC;AACJ;AAZAM","names":["writeArrowUpdates","options","arrow","middlewareData","x","arrowX","y","arrowY","Object","assign","style","left","top","exports"],"sourceRoot":"../src/","sources":["packages/react-components/react-positioning/src/utils/writeArrowUpdates.ts"],"sourcesContent":["import { 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 }) {\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}px`,\n top: `${arrowY}px`,\n });\n}\n"]}
@@ -4,16 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.writeContainerUpdates = void 0;
7
-
8
7
  const constants_1 = /*#__PURE__*/require("../constants");
9
8
  /**
10
9
  * Writes all container element position updates after the position is computed
11
10
  */
12
-
13
-
14
11
  function writeContainerUpdates(options) {
15
12
  var _a, _b;
16
-
17
13
  const {
18
14
  container,
19
15
  placement,
@@ -22,30 +18,22 @@ function writeContainerUpdates(options) {
22
18
  lowPPI,
23
19
  coordinates
24
20
  } = options;
25
-
26
21
  if (!container) {
27
22
  return;
28
23
  }
29
-
30
24
  container.setAttribute(constants_1.DATA_POSITIONING_PLACEMENT, placement);
31
25
  container.removeAttribute(constants_1.DATA_POSITIONING_INTERSECTING);
32
-
33
26
  if (middlewareData.intersectionObserver.intersecting) {
34
27
  container.setAttribute(constants_1.DATA_POSITIONING_INTERSECTING, '');
35
28
  }
36
-
37
29
  container.removeAttribute(constants_1.DATA_POSITIONING_ESCAPED);
38
-
39
30
  if ((_a = middlewareData.hide) === null || _a === void 0 ? void 0 : _a.escaped) {
40
31
  container.setAttribute(constants_1.DATA_POSITIONING_ESCAPED, '');
41
32
  }
42
-
43
33
  container.removeAttribute(constants_1.DATA_POSITIONING_HIDDEN);
44
-
45
34
  if ((_b = middlewareData.hide) === null || _b === void 0 ? void 0 : _b.referenceHidden) {
46
35
  container.setAttribute(constants_1.DATA_POSITIONING_HIDDEN, '');
47
36
  }
48
-
49
37
  const x = Math.round(coordinates.x);
50
38
  const y = Math.round(coordinates.y);
51
39
  Object.assign(container.style, {
@@ -53,6 +41,5 @@ function writeContainerUpdates(options) {
53
41
  position: strategy
54
42
  });
55
43
  }
56
-
57
44
  exports.writeContainerUpdates = writeContainerUpdates;
58
45
  //# sourceMappingURL=writeContainerupdates.js.map