@fluentui/react-positioning 9.3.1 → 9.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. package/CHANGELOG.json +24 -1
  2. package/CHANGELOG.md +11 -2
  3. package/lib/constants.js.map +1 -1
  4. package/lib/createArrowStyles.js.map +1 -1
  5. package/lib/createPositionManager.js.map +1 -1
  6. package/lib/createVirtualElementFromClick.js.map +1 -1
  7. package/lib/index.js.map +1 -1
  8. package/lib/middleware/coverTarget.js.map +1 -1
  9. package/lib/middleware/flip.js.map +1 -1
  10. package/lib/middleware/index.js.map +1 -1
  11. package/lib/middleware/intersecting.js.map +1 -1
  12. package/lib/middleware/maxSize.js.map +1 -1
  13. package/lib/middleware/offset.js.map +1 -1
  14. package/lib/middleware/shift.js.map +1 -1
  15. package/lib/types.js.map +1 -1
  16. package/lib/usePositioning.js.map +1 -1
  17. package/lib/usePositioningMouseTarget.js.map +1 -1
  18. package/lib/utils/debounce.js.map +1 -1
  19. package/lib/utils/fromFloatingUIPlacement.js.map +1 -1
  20. package/lib/utils/getBoundary.js.map +1 -1
  21. package/lib/utils/getFloatingUIOffset.js.map +1 -1
  22. package/lib/utils/getReactFiberFromNode.js.map +1 -1
  23. package/lib/utils/getScrollParent.js.map +1 -1
  24. package/lib/utils/hasAutoFocusFilter.js.map +1 -1
  25. package/lib/utils/index.js.map +1 -1
  26. package/lib/utils/mergeArrowOffset.js.map +1 -1
  27. package/lib/utils/parseFloatingUIPlacement.js.map +1 -1
  28. package/lib/utils/resolvePositioningShorthand.js.map +1 -1
  29. package/lib/utils/toFloatingUIPlacement.js.map +1 -1
  30. package/lib/utils/toggleScrollListener.js.map +1 -1
  31. package/lib/utils/useCallbackRef.js.map +1 -1
  32. package/lib/utils/writeArrowUpdates.js.map +1 -1
  33. package/lib/utils/writeContainerupdates.js.map +1 -1
  34. package/lib-amd/constants.js +10 -0
  35. package/lib-amd/constants.js.map +1 -0
  36. package/lib-amd/createArrowStyles.js +62 -0
  37. package/lib-amd/createArrowStyles.js.map +1 -0
  38. package/lib-amd/createPositionManager.js +85 -0
  39. package/lib-amd/createPositionManager.js.map +1 -0
  40. package/lib-amd/createVirtualElementFromClick.js +32 -0
  41. package/lib-amd/createVirtualElementFromClick.js.map +1 -0
  42. package/lib-amd/index.js +13 -0
  43. package/lib-amd/index.js.map +1 -0
  44. package/lib-amd/middleware/coverTarget.js +32 -0
  45. package/lib-amd/middleware/coverTarget.js.map +1 -0
  46. package/lib-amd/middleware/flip.js +11 -0
  47. package/lib-amd/middleware/flip.js.map +1 -0
  48. package/lib-amd/middleware/index.js +11 -0
  49. package/lib-amd/middleware/index.js.map +1 -0
  50. package/lib-amd/middleware/intersecting.js +33 -0
  51. package/lib-amd/middleware/intersecting.js.map +1 -0
  52. package/lib-amd/middleware/maxSize.js +43 -0
  53. package/lib-amd/middleware/maxSize.js.map +1 -0
  54. package/lib-amd/middleware/offset.js +14 -0
  55. package/lib-amd/middleware/offset.js.map +1 -0
  56. package/lib-amd/middleware/shift.js +17 -0
  57. package/lib-amd/middleware/shift.js.map +1 -0
  58. package/lib-amd/types.js +5 -0
  59. package/lib-amd/types.js.map +1 -0
  60. package/lib-amd/usePositioning.js +152 -0
  61. package/lib-amd/usePositioning.js.map +1 -0
  62. package/lib-amd/usePositioningMouseTarget.js +39 -0
  63. package/lib-amd/usePositioningMouseTarget.js.map +1 -0
  64. package/lib-amd/utils/debounce.js +27 -0
  65. package/lib-amd/utils/debounce.js.map +1 -0
  66. package/lib-amd/utils/fromFloatingUIPlacement.js +37 -0
  67. package/lib-amd/utils/fromFloatingUIPlacement.js.map +1 -0
  68. package/lib-amd/utils/getBoundary.js +26 -0
  69. package/lib-amd/utils/getBoundary.js.map +1 -0
  70. package/lib-amd/utils/getFloatingUIOffset.js +25 -0
  71. package/lib-amd/utils/getFloatingUIOffset.js.map +1 -0
  72. package/lib-amd/utils/getReactFiberFromNode.js +48 -0
  73. package/lib-amd/utils/getReactFiberFromNode.js.map +1 -0
  74. package/lib-amd/utils/getScrollParent.js +64 -0
  75. package/lib-amd/utils/getScrollParent.js.map +1 -0
  76. package/lib-amd/utils/hasAutoFocusFilter.js +31 -0
  77. package/lib-amd/utils/hasAutoFocusFilter.js.map +1 -0
  78. package/lib-amd/utils/index.js +19 -0
  79. package/lib-amd/utils/index.js.map +1 -0
  80. package/lib-amd/utils/mergeArrowOffset.js +38 -0
  81. package/lib-amd/utils/mergeArrowOffset.js.map +1 -0
  82. package/lib-amd/utils/parseFloatingUIPlacement.js +20 -0
  83. package/lib-amd/utils/parseFloatingUIPlacement.js.map +1 -0
  84. package/lib-amd/utils/resolvePositioningShorthand.js +31 -0
  85. package/lib-amd/utils/resolvePositioningShorthand.js.map +1 -0
  86. package/lib-amd/utils/toFloatingUIPlacement.js +40 -0
  87. package/lib-amd/utils/toFloatingUIPlacement.js.map +1 -0
  88. package/lib-amd/utils/toggleScrollListener.js +26 -0
  89. package/lib-amd/utils/toggleScrollListener.js.map +1 -0
  90. package/lib-amd/utils/useCallbackRef.js +55 -0
  91. package/lib-amd/utils/useCallbackRef.js.map +1 -0
  92. package/lib-amd/utils/writeArrowUpdates.js +21 -0
  93. package/lib-amd/utils/writeArrowUpdates.js.map +1 -0
  94. package/lib-amd/utils/writeContainerupdates.js +34 -0
  95. package/lib-amd/utils/writeContainerupdates.js.map +1 -0
  96. package/lib-commonjs/constants.js.map +1 -1
  97. package/lib-commonjs/createArrowStyles.js.map +1 -1
  98. package/lib-commonjs/createPositionManager.js.map +1 -1
  99. package/lib-commonjs/createVirtualElementFromClick.js.map +1 -1
  100. package/lib-commonjs/index.js.map +1 -1
  101. package/lib-commonjs/middleware/coverTarget.js.map +1 -1
  102. package/lib-commonjs/middleware/flip.js.map +1 -1
  103. package/lib-commonjs/middleware/index.js.map +1 -1
  104. package/lib-commonjs/middleware/intersecting.js.map +1 -1
  105. package/lib-commonjs/middleware/maxSize.js.map +1 -1
  106. package/lib-commonjs/middleware/offset.js.map +1 -1
  107. package/lib-commonjs/middleware/shift.js.map +1 -1
  108. package/lib-commonjs/usePositioning.js.map +1 -1
  109. package/lib-commonjs/usePositioningMouseTarget.js.map +1 -1
  110. package/lib-commonjs/utils/debounce.js.map +1 -1
  111. package/lib-commonjs/utils/fromFloatingUIPlacement.js.map +1 -1
  112. package/lib-commonjs/utils/getBoundary.js.map +1 -1
  113. package/lib-commonjs/utils/getFloatingUIOffset.js.map +1 -1
  114. package/lib-commonjs/utils/getReactFiberFromNode.js.map +1 -1
  115. package/lib-commonjs/utils/getScrollParent.js.map +1 -1
  116. package/lib-commonjs/utils/hasAutoFocusFilter.js.map +1 -1
  117. package/lib-commonjs/utils/index.js.map +1 -1
  118. package/lib-commonjs/utils/mergeArrowOffset.js.map +1 -1
  119. package/lib-commonjs/utils/parseFloatingUIPlacement.js.map +1 -1
  120. package/lib-commonjs/utils/resolvePositioningShorthand.js.map +1 -1
  121. package/lib-commonjs/utils/toFloatingUIPlacement.js.map +1 -1
  122. package/lib-commonjs/utils/toggleScrollListener.js.map +1 -1
  123. package/lib-commonjs/utils/useCallbackRef.js.map +1 -1
  124. package/lib-commonjs/utils/writeArrowUpdates.js.map +1 -1
  125. package/lib-commonjs/utils/writeContainerupdates.js.map +1 -1
  126. package/package.json +4 -5
package/CHANGELOG.json CHANGED
@@ -2,7 +2,30 @@
2
2
  "name": "@fluentui/react-positioning",
3
3
  "entries": [
4
4
  {
5
- "date": "Fri, 11 Nov 2022 14:53:19 GMT",
5
+ "date": "Thu, 17 Nov 2022 23:02:41 GMT",
6
+ "tag": "@fluentui/react-positioning_v9.3.2",
7
+ "version": "9.3.2",
8
+ "comments": {
9
+ "none": [
10
+ {
11
+ "author": "martinhochel@microsoft.com",
12
+ "package": "@fluentui/react-positioning",
13
+ "commit": "ea768501802d65d63ddc63fff3816fb6b5008ae4",
14
+ "comment": "chore: update package scaffold"
15
+ }
16
+ ],
17
+ "patch": [
18
+ {
19
+ "author": "beachball",
20
+ "package": "@fluentui/react-positioning",
21
+ "comment": "Bump @fluentui/react-utilities to v9.2.2",
22
+ "commit": "94e156be5d3b5790d82dccf08c32672733fb9335"
23
+ }
24
+ ]
25
+ }
26
+ },
27
+ {
28
+ "date": "Fri, 11 Nov 2022 14:57:32 GMT",
6
29
  "tag": "@fluentui/react-positioning_v9.3.1",
7
30
  "version": "9.3.1",
8
31
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,21 @@
1
1
  # Change Log - @fluentui/react-positioning
2
2
 
3
- This log was last generated on Fri, 11 Nov 2022 14:53:19 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 17 Nov 2022 23:02:41 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.3.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-positioning_v9.3.2)
8
+
9
+ Thu, 17 Nov 2022 23:02:41 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-positioning_v9.3.1..@fluentui/react-positioning_v9.3.2)
11
+
12
+ ### Patches
13
+
14
+ - Bump @fluentui/react-utilities to v9.2.2 ([PR #25683](https://github.com/microsoft/fluentui/pull/25683) by beachball)
15
+
7
16
  ## [9.3.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-positioning_v9.3.1)
8
17
 
9
- Fri, 11 Nov 2022 14:53:19 GMT
18
+ Fri, 11 Nov 2022 14:57:32 GMT
10
19
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-positioning_v9.3.0..@fluentui/react-positioning_v9.3.1)
11
20
 
12
21
  ### Patches
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"../src/","sources":["constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,6BAA6B,GAAG,6BAA6B,CAAC;AAC3E,MAAM,CAAC,MAAM,wBAAwB,GAAG,qBAAqB,CAAC;AAC9D,MAAM,CAAC,MAAM,uBAAuB,GAAG,8BAA8B,CAAC;AACtE,MAAM,CAAC,MAAM,0BAA0B,GAAG,uBAAuB,CAAC","sourcesContent":["export const DATA_POSITIONING_INTERSECTING = 'data-popper-is-intersecting';\nexport const DATA_POSITIONING_ESCAPED = 'data-popper-escaped';\nexport const DATA_POSITIONING_HIDDEN = 'data-popper-reference-hidden';\nexport const DATA_POSITIONING_PLACEMENT = 'data-popper-placement';\n"]}
1
+ {"version":3,"file":"constants.js","sourceRoot":"../src/","sources":["packages/react-components/react-positioning/src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,6BAA6B,GAAG,6BAA6B,CAAC;AAC3E,MAAM,CAAC,MAAM,wBAAwB,GAAG,qBAAqB,CAAC;AAC9D,MAAM,CAAC,MAAM,uBAAuB,GAAG,8BAA8B,CAAC;AACtE,MAAM,CAAC,MAAM,0BAA0B,GAAG,uBAAuB,CAAC","sourcesContent":["export const DATA_POSITIONING_INTERSECTING = 'data-popper-is-intersecting';\nexport const DATA_POSITIONING_ESCAPED = 'data-popper-escaped';\nexport const DATA_POSITIONING_HIDDEN = 'data-popper-reference-hidden';\nexport const DATA_POSITIONING_PLACEMENT = 'data-popper-placement';\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["createArrowStyles.ts"],"names":[],"mappings":"AAAA,SAAS,UAAT,QAA2B,gBAA3B;AACA,SAAS,MAAT,QAAuB,uBAAvB;AAsCA;;;;;;;;;;;;;;;;;;;;;;AAsBG;;AACH,OAAM,SAAU,iBAAV,CAA4B,OAA5B,EAA6D;EACjE,MAAM;IACJ,WADI;IAEJ,WAAW,GAAG,KAFV;IAGJ,WAAW,GAAG,OAHV;IAIJ,WAAW,GAAG,MAAM,CAAC;EAJjB,IAKF,OALJ;EAOA,OAAO;IACL,QAAQ,EAAE,UADL;IAEL,eAAe,EAAE,SAFZ;IAGL,UAAU,EAAE,QAHP;IAIL,MAAM,EAAE,CAAC,CAJJ;IAML,IAAI,WAAW,IAAI,uBAAuB,CAAC,WAAD,CAA1C,CANK;IAQL,YAAY;MACV,OAAO,EAAE,IADC;MAEV,UAAU,EAAE,SAFF;MAGV,QAAQ,EAAE,UAHA;MAIV,SAAS,EAAE,YAJD;MAKV,KAAK,EAAE,SALG;MAMV,MAAM,EAAE,SANE;MAOV,eAAe,EAAE,SAPP;MAQV,GAAG,UAAU,CAAC,WAAX,CACD,GAAG,WAAW,gBADb,EAED,GAAG,WAAW,gBAFb,EAGD,GAAG,WAAW,gBAHb,CARO;MAaV,GAAG,UAAU,CAAC,YAAX,CAAwB,WAAxB,EAAqC,WAArC,EAAkD,WAAlD,CAbO;MAcV,uBAAuB,EAAE,MAAM,CAAC,iBAdtB;MAeV,SAAS,EAAE;IAfD,CARP;IA0BL;IACA,2CAA2C;MACzC,MAAM,EAAE,IAAI,WAAW,EADkB;MAEzC,WAAW;IAF8B,CA3BtC;IA+BL,6CAA6C;MAC3C,IAAI,EAAE,IAAI,WAAW,gBADsB;MAE3C,WAAW;IAFgC,CA/BxC;IAmCL,8CAA8C;MAC5C,GAAG,EAAE,IAAI,WAAW,EADwB;MAE5C,WAAW;IAFiC,CAnCzC;IAuCL,4CAA4C;MAC1C,KAAK,EAAE,IAAI,WAAW,gBADoB;MAE1C,WAAW;IAF+B;EAvCvC,CAAP;AA4CD;AAED;;;;;;AAMG;;AACH,OAAM,SAAU,uBAAV,CAAkC,WAAlC,EAAqD;EACzD;EACA;EACA,MAAM,UAAU,GAAG,GAAG,QAAQ,WAAW,IAAzC;EACA,OAAO;IAAE,KAAK,EAAE,UAAT;IAAqB,MAAM,EAAE;EAA7B,CAAP;AACD","sourcesContent":["import { shorthands } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport type { GriffelStyle } from '@griffel/react';\n\n/**\n * @internal\n * Options parameter for the createArrowStyles function\n */\nexport type CreateArrowStylesOptions = {\n /**\n * The height of the arrow from the base to the tip, in px. The base width of the arrow is always twice its height.\n *\n * This can be undefined to leave out the arrow size styles. You must then add styles created by\n * createArrowHeightStyles to set the arrow's size correctly. This can be useful if the arrow can be different sizes.\n */\n arrowHeight: number | undefined;\n\n /**\n * The borderWidth of the arrow. Should be the same borderWidth as the parent element.\n *\n * @defaultvalue 1px\n */\n borderWidth?: GriffelStyle['borderBottomWidth'];\n\n /**\n * The borderStyle for the arrow. Should be the same borderStyle as the parent element.\n *\n * @defaultvalue solid\n */\n borderStyle?: GriffelStyle['borderBottomStyle'];\n\n /**\n * The borderColor of the arrow. Should be the same borderColor as the parent element.\n *\n * @defaultvalue tokens.colorTransparentStroke\n */\n borderColor?: GriffelStyle['borderBottomColor'];\n};\n\n/**\n * @internal\n * Helper that creates a makeStyles rule for an arrow element.\n * For runtime arrow size toggling simply create extra classnames to apply to the arrow element\n *\n * ```ts\n * makeStyles({\n * arrowWithSize: createArrowStyles({ arrowHeight: 6 }),\n *\n * arrowWithoutSize: createArrowStyles({ arrowHeight: undefined }),\n * mediumArrow: createArrowHeightStyles(4),\n * smallArrow: createArrowHeightStyles(2),\n * })\n * ...\n *\n * state.arrowWithSize.className = styles.arrowWithSize;\n * state.arrowWithoutSize.className = mergeClasses(\n * styles.arrowWithoutSize,\n * state.smallArrow && styles.smallArrow,\n * state.mediumArrow && styles.mediumArrow,\n * )\n * ```\n */\nexport function createArrowStyles(options: CreateArrowStylesOptions): GriffelStyle {\n const {\n arrowHeight,\n borderWidth = '1px',\n borderStyle = 'solid',\n borderColor = tokens.colorTransparentStroke,\n } = options;\n\n return {\n position: 'absolute',\n backgroundColor: 'inherit',\n visibility: 'hidden',\n zIndex: -1,\n\n ...(arrowHeight && createArrowHeightStyles(arrowHeight)),\n\n '::before': {\n content: '\"\"',\n visibility: 'visible',\n position: 'absolute',\n boxSizing: 'border-box',\n width: 'inherit',\n height: 'inherit',\n backgroundColor: 'inherit',\n ...shorthands.borderRight(\n `${borderWidth} /* @noflip */`,\n `${borderStyle} /* @noflip */`,\n `${borderColor} /* @noflip */`,\n ),\n ...shorthands.borderBottom(borderWidth, borderStyle, borderColor),\n borderBottomRightRadius: tokens.borderRadiusSmall,\n transform: 'rotate(var(--angle)) translate(0, 50%) rotate(45deg)',\n },\n\n // Popper sets data-popper-placement on the root element, which is used to align the arrow\n ':global([data-popper-placement^=\"top\"])': {\n bottom: `-${borderWidth}`,\n '--angle': '0',\n },\n ':global([data-popper-placement^=\"right\"])': {\n left: `-${borderWidth} /* @noflip */`,\n '--angle': '90deg',\n },\n ':global([data-popper-placement^=\"bottom\"])': {\n top: `-${borderWidth}`,\n '--angle': '180deg',\n },\n ':global([data-popper-placement^=\"left\"])': {\n right: `-${borderWidth} /* @noflip */`,\n '--angle': '270deg',\n },\n };\n}\n\n/**\n * @internal\n * Creates CSS styles to size the arrow created by createArrowStyles to the given height.\n *\n * Use this when you need to create classes for several different arrow sizes. If you only need a\n * constant arrow size, you can pass the `arrowHeight` param to createArrowStyles instead.\n */\nexport function createArrowHeightStyles(arrowHeight: number) {\n // The arrow is a square rotated 45 degrees to have its bottom and right edges form a right triangle.\n // Multiply the triangle's height by sqrt(2) to get length of its edges.\n const edgeLength = `${1.414 * arrowHeight}px`;\n return { width: edgeLength, height: edgeLength };\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["packages/react-components/react-positioning/src/createArrowStyles.ts"],"names":[],"mappings":"AAAA,SAAS,UAAT,QAA2B,gBAA3B;AACA,SAAS,MAAT,QAAuB,uBAAvB;AAsCA;;;;;;;;;;;;;;;;;;;;;;AAsBG;;AACH,OAAM,SAAU,iBAAV,CAA4B,OAA5B,EAA6D;EACjE,MAAM;IACJ,WADI;IAEJ,WAAW,GAAG,KAFV;IAGJ,WAAW,GAAG,OAHV;IAIJ,WAAW,GAAG,MAAM,CAAC;EAJjB,IAKF,OALJ;EAOA,OAAO;IACL,QAAQ,EAAE,UADL;IAEL,eAAe,EAAE,SAFZ;IAGL,UAAU,EAAE,QAHP;IAIL,MAAM,EAAE,CAAC,CAJJ;IAML,IAAI,WAAW,IAAI,uBAAuB,CAAC,WAAD,CAA1C,CANK;IAQL,YAAY;MACV,OAAO,EAAE,IADC;MAEV,UAAU,EAAE,SAFF;MAGV,QAAQ,EAAE,UAHA;MAIV,SAAS,EAAE,YAJD;MAKV,KAAK,EAAE,SALG;MAMV,MAAM,EAAE,SANE;MAOV,eAAe,EAAE,SAPP;MAQV,GAAG,UAAU,CAAC,WAAX,CACD,GAAG,WAAW,gBADb,EAED,GAAG,WAAW,gBAFb,EAGD,GAAG,WAAW,gBAHb,CARO;MAaV,GAAG,UAAU,CAAC,YAAX,CAAwB,WAAxB,EAAqC,WAArC,EAAkD,WAAlD,CAbO;MAcV,uBAAuB,EAAE,MAAM,CAAC,iBAdtB;MAeV,SAAS,EAAE;IAfD,CARP;IA0BL;IACA,2CAA2C;MACzC,MAAM,EAAE,IAAI,WAAW,EADkB;MAEzC,WAAW;IAF8B,CA3BtC;IA+BL,6CAA6C;MAC3C,IAAI,EAAE,IAAI,WAAW,gBADsB;MAE3C,WAAW;IAFgC,CA/BxC;IAmCL,8CAA8C;MAC5C,GAAG,EAAE,IAAI,WAAW,EADwB;MAE5C,WAAW;IAFiC,CAnCzC;IAuCL,4CAA4C;MAC1C,KAAK,EAAE,IAAI,WAAW,gBADoB;MAE1C,WAAW;IAF+B;EAvCvC,CAAP;AA4CD;AAED;;;;;;AAMG;;AACH,OAAM,SAAU,uBAAV,CAAkC,WAAlC,EAAqD;EACzD;EACA;EACA,MAAM,UAAU,GAAG,GAAG,QAAQ,WAAW,IAAzC;EACA,OAAO;IAAE,KAAK,EAAE,UAAT;IAAqB,MAAM,EAAE;EAA7B,CAAP;AACD","sourcesContent":["import { shorthands } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport type { GriffelStyle } from '@griffel/react';\n\n/**\n * @internal\n * Options parameter for the createArrowStyles function\n */\nexport type CreateArrowStylesOptions = {\n /**\n * The height of the arrow from the base to the tip, in px. The base width of the arrow is always twice its height.\n *\n * This can be undefined to leave out the arrow size styles. You must then add styles created by\n * createArrowHeightStyles to set the arrow's size correctly. This can be useful if the arrow can be different sizes.\n */\n arrowHeight: number | undefined;\n\n /**\n * The borderWidth of the arrow. Should be the same borderWidth as the parent element.\n *\n * @defaultvalue 1px\n */\n borderWidth?: GriffelStyle['borderBottomWidth'];\n\n /**\n * The borderStyle for the arrow. Should be the same borderStyle as the parent element.\n *\n * @defaultvalue solid\n */\n borderStyle?: GriffelStyle['borderBottomStyle'];\n\n /**\n * The borderColor of the arrow. Should be the same borderColor as the parent element.\n *\n * @defaultvalue tokens.colorTransparentStroke\n */\n borderColor?: GriffelStyle['borderBottomColor'];\n};\n\n/**\n * @internal\n * Helper that creates a makeStyles rule for an arrow element.\n * For runtime arrow size toggling simply create extra classnames to apply to the arrow element\n *\n * ```ts\n * makeStyles({\n * arrowWithSize: createArrowStyles({ arrowHeight: 6 }),\n *\n * arrowWithoutSize: createArrowStyles({ arrowHeight: undefined }),\n * mediumArrow: createArrowHeightStyles(4),\n * smallArrow: createArrowHeightStyles(2),\n * })\n * ...\n *\n * state.arrowWithSize.className = styles.arrowWithSize;\n * state.arrowWithoutSize.className = mergeClasses(\n * styles.arrowWithoutSize,\n * state.smallArrow && styles.smallArrow,\n * state.mediumArrow && styles.mediumArrow,\n * )\n * ```\n */\nexport function createArrowStyles(options: CreateArrowStylesOptions): GriffelStyle {\n const {\n arrowHeight,\n borderWidth = '1px',\n borderStyle = 'solid',\n borderColor = tokens.colorTransparentStroke,\n } = options;\n\n return {\n position: 'absolute',\n backgroundColor: 'inherit',\n visibility: 'hidden',\n zIndex: -1,\n\n ...(arrowHeight && createArrowHeightStyles(arrowHeight)),\n\n '::before': {\n content: '\"\"',\n visibility: 'visible',\n position: 'absolute',\n boxSizing: 'border-box',\n width: 'inherit',\n height: 'inherit',\n backgroundColor: 'inherit',\n ...shorthands.borderRight(\n `${borderWidth} /* @noflip */`,\n `${borderStyle} /* @noflip */`,\n `${borderColor} /* @noflip */`,\n ),\n ...shorthands.borderBottom(borderWidth, borderStyle, borderColor),\n borderBottomRightRadius: tokens.borderRadiusSmall,\n transform: 'rotate(var(--angle)) translate(0, 50%) rotate(45deg)',\n },\n\n // Popper sets data-popper-placement on the root element, which is used to align the arrow\n ':global([data-popper-placement^=\"top\"])': {\n bottom: `-${borderWidth}`,\n '--angle': '0',\n },\n ':global([data-popper-placement^=\"right\"])': {\n left: `-${borderWidth} /* @noflip */`,\n '--angle': '90deg',\n },\n ':global([data-popper-placement^=\"bottom\"])': {\n top: `-${borderWidth}`,\n '--angle': '180deg',\n },\n ':global([data-popper-placement^=\"left\"])': {\n right: `-${borderWidth} /* @noflip */`,\n '--angle': '270deg',\n },\n };\n}\n\n/**\n * @internal\n * Creates CSS styles to size the arrow created by createArrowStyles to the given height.\n *\n * Use this when you need to create classes for several different arrow sizes. If you only need a\n * constant arrow size, you can pass the `arrowHeight` param to createArrowStyles instead.\n */\nexport function createArrowHeightStyles(arrowHeight: number) {\n // The arrow is a square rotated 45 degrees to have its bottom and right edges form a right triangle.\n // Multiply the triangle's height by sqrt(2) to get length of its edges.\n const edgeLength = `${1.414 * arrowHeight}px`;\n return { width: edgeLength, height: edgeLength };\n}\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["createPositionManager.ts"],"names":[],"mappings":"AAAA,SAAS,eAAT,QAAgC,kBAAhC;AAGA,SAAS,QAAT,EAAmB,iBAAnB,EAAsC,qBAAtC,EAA6D,eAA7D,QAAoF,SAApF;AA8BA;;;AAGG;;AACH,OAAM,SAAU,qBAAV,CAAgC,OAAhC,EAA+D;EACnE,MAAM;IAAE,SAAF;IAAa,MAAb;IAAqB,KAArB;IAA4B,QAA5B;IAAsC,UAAtC;IAAkD;EAAlD,IAAgE,OAAtE;;EACA,IAAI,CAAC,MAAD,IAAW,CAAC,SAAhB,EAA2B;IACzB,OAAO;MACL,cAAc,EAAE,MAAM,SADjB;MAEL,OAAO,EAAE,MAAM;IAFV,CAAP;EAID;;EAED,IAAI,aAAa,GAAG,IAApB;EACA,MAAM,aAAa,GAAqB,IAAI,GAAJ,EAAxC;EACA,MAAM,YAAY,GAAG,SAAS,CAAC,aAAV,CAAwB,WAA7C,CAXmE,CAan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;MACA;MACA;MACA;MACA,IAAI,OAAO,CAAC,GAAR,CAAY,QAAZ,KAAyB,aAA7B,EAA4C;QAC1C;QACA,OAAO,CAAC,KAAR,CAAc,gDAAd,EAAgE,GAAhE;MACD;IACF,CAxBH;EAyBD,CAxCD;;EA0CA,MAAM,cAAc,GAAG,QAAQ,CAAC,MAAM,WAAW,EAAlB,CAA/B;;EAEA,MAAM,OAAO,GAAG,MAAK;IACnB,IAAI,YAAJ,EAAkB;MAChB,YAAY,CAAC,mBAAb,CAAiC,QAAjC,EAA2C,cAA3C;MACA,YAAY,CAAC,mBAAb,CAAiC,QAAjC,EAA2C,cAA3C;IACD;;IAED,aAAa,CAAC,OAAd,CAAsB,YAAY,IAAG;MACnC,YAAY,CAAC,mBAAb,CAAiC,QAAjC,EAA2C,cAA3C;IACD,CAFD;EAGD,CATD;;EAWA,IAAI,YAAJ,EAAkB;IAChB,YAAY,CAAC,gBAAb,CAA8B,QAA9B,EAAwC,cAAxC;IACA,YAAY,CAAC,gBAAb,CAA8B,QAA9B,EAAwC,cAAxC;EACD,CA3EkE,CA6EnE;;;EACA,cAAc;EAEd,OAAO;IACL,cADK;IAEL;EAFK,CAAP;AAID","sourcesContent":["import { computePosition } from '@floating-ui/dom';\nimport type { Middleware, Placement, Strategy } from '@floating-ui/dom';\nimport type { PositionManager, TargetElement } from './types';\nimport { debounce, writeArrowUpdates, writeContainerUpdates, getScrollParent } from './utils';\n\ninterface PositionManagerOptions {\n /**\n * The positioned element\n */\n container: HTMLElement;\n /**\n * Element that the container will be anchored to\n */\n target: TargetElement;\n /**\n * Arrow that points from the container to the target\n */\n arrow: HTMLElement | null;\n /**\n * The value of the css `position` property\n * @default absolute\n */\n strategy: Strategy;\n /**\n * [Floating UI middleware](https://floating-ui.com/docs/middleware)\n */\n middleware: Middleware[];\n /**\n * [Floating UI placement](https://floating-ui.com/docs/computePosition#placement)\n */\n placement?: Placement;\n}\n\n/**\n * @internal\n * @returns manager that handles positioning out of the react lifecycle\n */\nexport function createPositionManager(options: PositionManagerOptions): PositionManager {\n const { container, target, arrow, strategy, middleware, placement } = options;\n if (!target || !container) {\n return {\n updatePosition: () => undefined,\n dispose: () => undefined,\n };\n }\n\n let isFirstUpdate = true;\n const scrollParents: Set<HTMLElement> = new Set<HTMLElement>();\n const targetWindow = container.ownerDocument.defaultView;\n\n // When the container is first resolved, set position `fixed` to avoid scroll jumps.\n // Without this scroll jumps can occur when the element is rendered initially and receives focus\n Object.assign(container.style, { position: 'fixed', left: 0, top: 0, margin: 0 });\n\n const forceUpdate = () => {\n if (isFirstUpdate) {\n scrollParents.add(getScrollParent(container));\n if (target instanceof HTMLElement) {\n scrollParents.add(getScrollParent(target));\n }\n\n scrollParents.forEach(scrollParent => {\n scrollParent.addEventListener('scroll', updatePosition);\n });\n\n isFirstUpdate = false;\n }\n\n Object.assign(container.style, { position: strategy });\n computePosition(target, container, { placement, middleware, strategy })\n .then(({ x, y, middlewareData, placement: computedPlacement }) => {\n writeArrowUpdates({ arrow, middlewareData });\n writeContainerUpdates({\n container,\n middlewareData,\n placement: computedPlacement,\n coordinates: { x, y },\n lowPPI: (targetWindow?.devicePixelRatio || 1) <= 1,\n strategy,\n });\n })\n .catch(err => {\n // https://github.com/floating-ui/floating-ui/issues/1845\n // FIXME for node > 14\n // node 15 introduces promise rejection which means that any components\n // tests need to be `it('', async () => {})` otherwise there can be race conditions with\n // JSDOM being torn down before this promise is resolved so globals like `window` and `document` don't exist\n // Unless all tests that ever use `usePositioning` are turned into async tests, any logging during testing\n // will actually be counter productive\n if (process.env.NODE_ENV === 'development') {\n // eslint-disable-next-line no-console\n console.error('[usePositioning]: Failed to calculate position', err);\n }\n });\n };\n\n const updatePosition = debounce(() => forceUpdate());\n\n const dispose = () => {\n if (targetWindow) {\n targetWindow.removeEventListener('scroll', updatePosition);\n targetWindow.removeEventListener('resize', updatePosition);\n }\n\n scrollParents.forEach(scrollParent => {\n scrollParent.removeEventListener('scroll', updatePosition);\n });\n };\n\n if (targetWindow) {\n targetWindow.addEventListener('scroll', updatePosition);\n targetWindow.addEventListener('resize', updatePosition);\n }\n\n // Update the position on initialization\n updatePosition();\n\n return {\n updatePosition,\n dispose,\n };\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["packages/react-components/react-positioning/src/createPositionManager.ts"],"names":[],"mappings":"AAAA,SAAS,eAAT,QAAgC,kBAAhC;AAGA,SAAS,QAAT,EAAmB,iBAAnB,EAAsC,qBAAtC,EAA6D,eAA7D,QAAoF,SAApF;AA8BA;;;AAGG;;AACH,OAAM,SAAU,qBAAV,CAAgC,OAAhC,EAA+D;EACnE,MAAM;IAAE,SAAF;IAAa,MAAb;IAAqB,KAArB;IAA4B,QAA5B;IAAsC,UAAtC;IAAkD;EAAlD,IAAgE,OAAtE;;EACA,IAAI,CAAC,MAAD,IAAW,CAAC,SAAhB,EAA2B;IACzB,OAAO;MACL,cAAc,EAAE,MAAM,SADjB;MAEL,OAAO,EAAE,MAAM;IAFV,CAAP;EAID;;EAED,IAAI,aAAa,GAAG,IAApB;EACA,MAAM,aAAa,GAAqB,IAAI,GAAJ,EAAxC;EACA,MAAM,YAAY,GAAG,SAAS,CAAC,aAAV,CAAwB,WAA7C,CAXmE,CAanE;EACA;;EACA,MAAM,CAAC,MAAP,CAAc,SAAS,CAAC,KAAxB,EAA+B;IAAE,QAAQ,EAAE,OAAZ;IAAqB,IAAI,EAAE,CAA3B;IAA8B,GAAG,EAAE,CAAnC;IAAsC,MAAM,EAAE;EAA9C,CAA/B;;EAEA,MAAM,WAAW,GAAG,MAAK;IACvB,IAAI,aAAJ,EAAmB;MACjB,aAAa,CAAC,GAAd,CAAkB,eAAe,CAAC,SAAD,CAAjC;;MACA,IAAI,MAAM,YAAY,WAAtB,EAAmC;QACjC,aAAa,CAAC,GAAd,CAAkB,eAAe,CAAC,MAAD,CAAjC;MACD;;MAED,aAAa,CAAC,OAAd,CAAsB,YAAY,IAAG;QACnC,YAAY,CAAC,gBAAb,CAA8B,QAA9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,CAAiC,QAAjC,EAA2C,cAA3C;IACD,CAFD;EAGD,CATD;;EAWA,IAAI,YAAJ,EAAkB;IAChB,YAAY,CAAC,gBAAb,CAA8B,QAA9B,EAAwC,cAAxC;IACA,YAAY,CAAC,gBAAb,CAA8B,QAA9B,EAAwC,cAAxC;EACD,CA3EkE,CA6EnE;;;EACA,cAAc;EAEd,OAAO;IACL,cADK;IAEL;EAFK,CAAP;AAID","sourcesContent":["import { computePosition } from '@floating-ui/dom';\nimport type { Middleware, Placement, Strategy } from '@floating-ui/dom';\nimport type { PositionManager, TargetElement } from './types';\nimport { debounce, writeArrowUpdates, writeContainerUpdates, getScrollParent } from './utils';\n\ninterface PositionManagerOptions {\n /**\n * The positioned element\n */\n container: HTMLElement;\n /**\n * Element that the container will be anchored to\n */\n target: TargetElement;\n /**\n * Arrow that points from the container to the target\n */\n arrow: HTMLElement | null;\n /**\n * The value of the css `position` property\n * @default absolute\n */\n strategy: Strategy;\n /**\n * [Floating UI middleware](https://floating-ui.com/docs/middleware)\n */\n middleware: Middleware[];\n /**\n * [Floating UI placement](https://floating-ui.com/docs/computePosition#placement)\n */\n placement?: Placement;\n}\n\n/**\n * @internal\n * @returns manager that handles positioning out of the react lifecycle\n */\nexport function createPositionManager(options: PositionManagerOptions): PositionManager {\n const { container, target, arrow, strategy, middleware, placement } = options;\n if (!target || !container) {\n return {\n updatePosition: () => undefined,\n dispose: () => undefined,\n };\n }\n\n let isFirstUpdate = true;\n const scrollParents: Set<HTMLElement> = new Set<HTMLElement>();\n const targetWindow = container.ownerDocument.defaultView;\n\n // When the container is first resolved, set position `fixed` to avoid scroll jumps.\n // Without this scroll jumps can occur when the element is rendered initially and receives focus\n Object.assign(container.style, { position: 'fixed', left: 0, top: 0, margin: 0 });\n\n const forceUpdate = () => {\n if (isFirstUpdate) {\n scrollParents.add(getScrollParent(container));\n if (target instanceof HTMLElement) {\n scrollParents.add(getScrollParent(target));\n }\n\n scrollParents.forEach(scrollParent => {\n scrollParent.addEventListener('scroll', updatePosition);\n });\n\n isFirstUpdate = false;\n }\n\n Object.assign(container.style, { position: strategy });\n computePosition(target, container, { placement, middleware, strategy })\n .then(({ x, y, middlewareData, placement: computedPlacement }) => {\n writeArrowUpdates({ arrow, middlewareData });\n writeContainerUpdates({\n container,\n middlewareData,\n placement: computedPlacement,\n coordinates: { x, y },\n lowPPI: (targetWindow?.devicePixelRatio || 1) <= 1,\n strategy,\n });\n })\n .catch(err => {\n // https://github.com/floating-ui/floating-ui/issues/1845\n // FIXME for node > 14\n // node 15 introduces promise rejection which means that any components\n // tests need to be `it('', async () => {})` otherwise there can be race conditions with\n // JSDOM being torn down before this promise is resolved so globals like `window` and `document` don't exist\n // Unless all tests that ever use `usePositioning` are turned into async tests, any logging during testing\n // will actually be counter productive\n if (process.env.NODE_ENV === 'development') {\n // eslint-disable-next-line no-console\n console.error('[usePositioning]: Failed to calculate position', err);\n }\n });\n };\n\n const updatePosition = debounce(() => forceUpdate());\n\n const dispose = () => {\n if (targetWindow) {\n targetWindow.removeEventListener('scroll', updatePosition);\n targetWindow.removeEventListener('resize', updatePosition);\n }\n\n scrollParents.forEach(scrollParent => {\n scrollParent.removeEventListener('scroll', updatePosition);\n });\n };\n\n if (targetWindow) {\n targetWindow.addEventListener('scroll', updatePosition);\n targetWindow.addEventListener('resize', updatePosition);\n }\n\n // Update the position on initialization\n updatePosition();\n\n return {\n updatePosition,\n dispose,\n };\n}\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["createVirtualElementFromClick.ts"],"names":[],"mappings":"AAEA;;;AAGG;AACH,OAAM,SAAU,6BAAV,CAAwC,WAAxC,EAA+D;EACnE,MAAM,IAAI,GAAG,WAAW,CAAC,OAAzB;EACA,MAAM,GAAG,GAAG,WAAW,CAAC,OAAxB;EACA,MAAM,KAAK,GAAG,IAAI,GAAG,CAArB;EACA,MAAM,MAAM,GAAG,GAAG,GAAG,CAArB;;EAEA,SAAS,qBAAT,GAA8B;IAC5B,OAAO;MACL,IADK;MAEL,GAFK;MAGL,KAHK;MAIL,MAJK;MAKL,CAAC,EAAE,IALE;MAML,CAAC,EAAE,GANE;MAOL,MAAM,EAAE,CAPH;MAQL,KAAK,EAAE;IARF,CAAP;EAUD;;EAED,OAAO;IACL;EADK,CAAP;AAGD","sourcesContent":["import type { PositioningVirtualElement } from './types';\n\n/**\n * Creates a virtual element based on the position of a click event\n * Can be used as a target for popper in scenarios such as context menus\n */\nexport function createVirtualElementFromClick(nativeEvent: MouseEvent): PositioningVirtualElement {\n const left = nativeEvent.clientX;\n const top = nativeEvent.clientY;\n const right = left + 1;\n const bottom = top + 1;\n\n function getBoundingClientRect() {\n return {\n left,\n top,\n right,\n bottom,\n x: left,\n y: top,\n height: 1,\n width: 1,\n };\n }\n\n return {\n getBoundingClientRect,\n };\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["packages/react-components/react-positioning/src/createVirtualElementFromClick.ts"],"names":[],"mappings":"AAEA;;;AAGG;AACH,OAAM,SAAU,6BAAV,CAAwC,WAAxC,EAA+D;EACnE,MAAM,IAAI,GAAG,WAAW,CAAC,OAAzB;EACA,MAAM,GAAG,GAAG,WAAW,CAAC,OAAxB;EACA,MAAM,KAAK,GAAG,IAAI,GAAG,CAArB;EACA,MAAM,MAAM,GAAG,GAAG,GAAG,CAArB;;EAEA,SAAS,qBAAT,GAA8B;IAC5B,OAAO;MACL,IADK;MAEL,GAFK;MAGL,KAHK;MAIL,MAJK;MAKL,CAAC,EAAE,IALE;MAML,CAAC,EAAE,GANE;MAOL,MAAM,EAAE,CAPH;MAQL,KAAK,EAAE;IARF,CAAP;EAUD;;EAED,OAAO;IACL;EADK,CAAP;AAGD","sourcesContent":["import type { PositioningVirtualElement } from './types';\n\n/**\n * Creates a virtual element based on the position of a click event\n * Can be used as a target for popper in scenarios such as context menus\n */\nexport function createVirtualElementFromClick(nativeEvent: MouseEvent): PositioningVirtualElement {\n const left = nativeEvent.clientX;\n const top = nativeEvent.clientY;\n const right = left + 1;\n const bottom = top + 1;\n\n function getBoundingClientRect() {\n return {\n left,\n top,\n right,\n bottom,\n x: left,\n y: top,\n height: 1,\n width: 1,\n };\n }\n\n return {\n getBoundingClientRect,\n };\n}\n"],"sourceRoot":"../src/"}
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAEjF,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,2BAA2B,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC","sourcesContent":["export { createVirtualElementFromClick } from './createVirtualElementFromClick';\nexport { createArrowHeightStyles, createArrowStyles } from './createArrowStyles';\nexport type { CreateArrowStylesOptions } from './createArrowStyles';\nexport { usePositioning } from './usePositioning';\nexport { usePositioningMouseTarget } from './usePositioningMouseTarget';\nexport { resolvePositioningShorthand, mergeArrowOffset } from './utils/index';\nexport type {\n Alignment,\n AutoSize,\n Boundary,\n Offset,\n OffsetFunction,\n OffsetFunctionParam,\n OffsetObject,\n OffsetShorthand,\n Position,\n PositioningImperativeRef,\n PositioningProps,\n PositioningShorthand,\n PositioningShorthandValue,\n PositioningVirtualElement,\n SetVirtualMouseTarget,\n} from './types';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["packages/react-components/react-positioning/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAEjF,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,2BAA2B,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC","sourcesContent":["export { createVirtualElementFromClick } from './createVirtualElementFromClick';\nexport { createArrowHeightStyles, createArrowStyles } from './createArrowStyles';\nexport type { CreateArrowStylesOptions } from './createArrowStyles';\nexport { usePositioning } from './usePositioning';\nexport { usePositioningMouseTarget } from './usePositioningMouseTarget';\nexport { resolvePositioningShorthand, mergeArrowOffset } from './utils/index';\nexport type {\n Alignment,\n AutoSize,\n Boundary,\n Offset,\n OffsetFunction,\n OffsetFunctionParam,\n OffsetObject,\n OffsetShorthand,\n Position,\n PositioningImperativeRef,\n PositioningProps,\n PositioningShorthand,\n PositioningShorthandValue,\n PositioningVirtualElement,\n SetVirtualMouseTarget,\n} from './types';\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["middleware/coverTarget.ts"],"names":[],"mappings":"AACA,SAAS,wBAAT,QAAyC,gBAAzC;AAEA,OAAM,SAAU,WAAV,GAAqB;EACzB,OAAO;IACL,IAAI,EAAE,aADD;IAEL,EAAE,EAAE,mBAAmB,IAAG;MACxB,MAAM;QAAE,SAAF;QAAa,KAAb;QAAoB,CAApB;QAAuB;MAAvB,IAA6B,mBAAnC;MACA,MAAM,aAAa,GAAG,wBAAwB,CAAC,SAAD,CAAxB,CAAoC,IAA1D;MACA,MAAM,SAAS,GAAG;QAAE,CAAF;QAAK;MAAL,CAAlB;;MAEA,QAAQ,aAAR;QACE,KAAK,QAAL;UACE,SAAS,CAAC,CAAV,IAAe,KAAK,CAAC,SAAN,CAAgB,MAA/B;UACA;;QACF,KAAK,KAAL;UACE,SAAS,CAAC,CAAV,IAAe,KAAK,CAAC,SAAN,CAAgB,MAA/B;UACA;;QACF,KAAK,MAAL;UACE,SAAS,CAAC,CAAV,IAAe,KAAK,CAAC,SAAN,CAAgB,KAA/B;UACA;;QACF,KAAK,OAAL;UACE,SAAS,CAAC,CAAV,IAAe,KAAK,CAAC,SAAN,CAAgB,KAA/B;UACA;MAZJ;;MAeA,OAAO,SAAP;IACD;EAvBI,CAAP;AAyBD","sourcesContent":["import type { Middleware } from '@floating-ui/dom';\nimport { parseFloatingUIPlacement } from '../utils/index';\n\nexport function coverTarget(): Middleware {\n return {\n name: 'coverTarget',\n fn: middlewareArguments => {\n const { placement, rects, x, y } = middlewareArguments;\n const basePlacement = parseFloatingUIPlacement(placement).side;\n const newCoords = { x, y };\n\n switch (basePlacement) {\n case 'bottom':\n newCoords.y -= rects.reference.height;\n break;\n case 'top':\n newCoords.y += rects.reference.height;\n break;\n case 'left':\n newCoords.x += rects.reference.width;\n break;\n case 'right':\n newCoords.x -= rects.reference.width;\n break;\n }\n\n return newCoords;\n },\n };\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["packages/react-components/react-positioning/src/middleware/coverTarget.ts"],"names":[],"mappings":"AACA,SAAS,wBAAT,QAAyC,gBAAzC;AAEA,OAAM,SAAU,WAAV,GAAqB;EACzB,OAAO;IACL,IAAI,EAAE,aADD;IAEL,EAAE,EAAE,mBAAmB,IAAG;MACxB,MAAM;QAAE,SAAF;QAAa,KAAb;QAAoB,CAApB;QAAuB;MAAvB,IAA6B,mBAAnC;MACA,MAAM,aAAa,GAAG,wBAAwB,CAAC,SAAD,CAAxB,CAAoC,IAA1D;MACA,MAAM,SAAS,GAAG;QAAE,CAAF;QAAK;MAAL,CAAlB;;MAEA,QAAQ,aAAR;QACE,KAAK,QAAL;UACE,SAAS,CAAC,CAAV,IAAe,KAAK,CAAC,SAAN,CAAgB,MAA/B;UACA;;QACF,KAAK,KAAL;UACE,SAAS,CAAC,CAAV,IAAe,KAAK,CAAC,SAAN,CAAgB,MAA/B;UACA;;QACF,KAAK,MAAL;UACE,SAAS,CAAC,CAAV,IAAe,KAAK,CAAC,SAAN,CAAgB,KAA/B;UACA;;QACF,KAAK,OAAL;UACE,SAAS,CAAC,CAAV,IAAe,KAAK,CAAC,SAAN,CAAgB,KAA/B;UACA;MAZJ;;MAeA,OAAO,SAAP;IACD;EAvBI,CAAP;AAyBD","sourcesContent":["import type { Middleware } from '@floating-ui/dom';\nimport { parseFloatingUIPlacement } from '../utils/index';\n\nexport function coverTarget(): Middleware {\n return {\n name: 'coverTarget',\n fn: middlewareArguments => {\n const { placement, rects, x, y } = middlewareArguments;\n const basePlacement = parseFloatingUIPlacement(placement).side;\n const newCoords = { x, y };\n\n switch (basePlacement) {\n case 'bottom':\n newCoords.y -= rects.reference.height;\n break;\n case 'top':\n newCoords.y += rects.reference.height;\n break;\n case 'left':\n newCoords.x += rects.reference.width;\n break;\n case 'right':\n newCoords.x -= rects.reference.width;\n break;\n }\n\n return newCoords;\n },\n };\n}\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["middleware/flip.ts"],"names":[],"mappings":"AAAA,SAAS,IAAI,IAAI,QAAjB,QAAiC,kBAAjC;AAEA,SAAS,WAAT,QAA4B,gBAA5B;AAOA,OAAM,SAAU,IAAV,CAAe,OAAf,EAA6C;EACjD,MAAM;IAAE,oBAAF;IAAwB,YAAxB;IAAsC;EAAtC,IAAoD,OAA1D;EAEA,OAAO,QAAQ,CAAC,EACd,IAAI,oBAAoB,IAAI;MAAE,QAAQ,EAAE;IAAZ,CAA5B,CADc;IAEd,IAAI,YAAY,IAAI;MAAE,WAAW,EAAE,IAAf;MAAqB,QAAQ,EAAE,WAAW,CAAC,SAAD,EAAY,YAAZ;IAA1C,CAApB,CAFc;IAGd,gBAAgB,EAAE;EAHJ,CAAD,CAAf;AAKD","sourcesContent":["import { flip as baseFlip } from '@floating-ui/dom';\nimport type { PositioningOptions } from '../types';\nimport { getBoundary } from '../utils/index';\n\nexport interface FlipMiddlewareOptions extends Pick<PositioningOptions, 'flipBoundary'> {\n hasScrollableElement?: boolean;\n container: HTMLElement | null;\n}\n\nexport function flip(options: FlipMiddlewareOptions) {\n const { hasScrollableElement, flipBoundary, container } = options;\n\n return baseFlip({\n ...(hasScrollableElement && { boundary: 'clippingAncestors' }),\n ...(flipBoundary && { altBoundary: true, boundary: getBoundary(container, flipBoundary) }),\n fallbackStrategy: 'bestFit',\n });\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["packages/react-components/react-positioning/src/middleware/flip.ts"],"names":[],"mappings":"AAAA,SAAS,IAAI,IAAI,QAAjB,QAAiC,kBAAjC;AAEA,SAAS,WAAT,QAA4B,gBAA5B;AAOA,OAAM,SAAU,IAAV,CAAe,OAAf,EAA6C;EACjD,MAAM;IAAE,oBAAF;IAAwB,YAAxB;IAAsC;EAAtC,IAAoD,OAA1D;EAEA,OAAO,QAAQ,CAAC,EACd,IAAI,oBAAoB,IAAI;MAAE,QAAQ,EAAE;IAAZ,CAA5B,CADc;IAEd,IAAI,YAAY,IAAI;MAAE,WAAW,EAAE,IAAf;MAAqB,QAAQ,EAAE,WAAW,CAAC,SAAD,EAAY,YAAZ;IAA1C,CAApB,CAFc;IAGd,gBAAgB,EAAE;EAHJ,CAAD,CAAf;AAKD","sourcesContent":["import { flip as baseFlip } from '@floating-ui/dom';\nimport type { PositioningOptions } from '../types';\nimport { getBoundary } from '../utils/index';\n\nexport interface FlipMiddlewareOptions extends Pick<PositioningOptions, 'flipBoundary'> {\n hasScrollableElement?: boolean;\n container: HTMLElement | null;\n}\n\nexport function flip(options: FlipMiddlewareOptions) {\n const { hasScrollableElement, flipBoundary, container } = options;\n\n return baseFlip({\n ...(hasScrollableElement && { boundary: 'clippingAncestors' }),\n ...(flipBoundary && { altBoundary: true, boundary: getBoundary(container, flipBoundary) }),\n fallbackStrategy: 'bestFit',\n });\n}\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["middleware/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC","sourcesContent":["export * from './coverTarget';\nexport * from './flip';\nexport * from './intersecting';\nexport * from './maxSize';\nexport * from './offset';\nexport * from './shift';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["packages/react-components/react-positioning/src/middleware/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC","sourcesContent":["export * from './coverTarget';\nexport * from './flip';\nexport * from './intersecting';\nexport * from './maxSize';\nexport * from './offset';\nexport * from './shift';\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["middleware/intersecting.ts"],"names":[],"mappings":"AACA,SAAS,cAAT,QAA+B,kBAA/B;AAEA,OAAM,SAAU,YAAV,GAAsB;EAC1B,OAAO;IACL,IAAI,EAAE,sBADD;IAEL,EAAE,EAAE,MAAM,mBAAN,IAA4B;MAC9B,MAAM,YAAY,GAAG,mBAAmB,CAAC,KAApB,CAA0B,QAA/C;MACA,MAAM,WAAW,GAAG,MAAM,cAAc,CAAC,mBAAD,EAAsB;QAAE,WAAW,EAAE;MAAf,CAAtB,CAAxC;MAEA,MAAM,iBAAiB,GAAG,WAAW,CAAC,GAAZ,GAAkB,YAAY,CAAC,MAA/B,IAAyC,WAAW,CAAC,GAAZ,GAAkB,CAArF;MACA,MAAM,oBAAoB,GAAG,WAAW,CAAC,MAAZ,GAAqB,YAAY,CAAC,MAAlC,IAA4C,WAAW,CAAC,MAAZ,GAAqB,CAA9F;MAEA,MAAM,cAAc,GAAG,iBAAiB,IAAI,oBAA5C;MAEA,OAAO;QACL,IAAI,EAAE;UACJ,YAAY,EAAE;QADV;MADD,CAAP;IAKD;EAhBI,CAAP;AAkBD","sourcesContent":["import type { Middleware } from '@floating-ui/dom';\nimport { detectOverflow } from '@floating-ui/dom';\n\nexport function intersecting(): Middleware {\n return {\n name: 'intersectionObserver',\n fn: async middlewareArguments => {\n const floatingRect = middlewareArguments.rects.floating;\n const altOverflow = await detectOverflow(middlewareArguments, { altBoundary: true });\n\n const isIntersectingTop = altOverflow.top < floatingRect.height && altOverflow.top > 0;\n const isIntersectingBottom = altOverflow.bottom < floatingRect.height && altOverflow.bottom > 0;\n\n const isIntersecting = isIntersectingTop || isIntersectingBottom;\n\n return {\n data: {\n intersecting: isIntersecting,\n },\n };\n },\n };\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["packages/react-components/react-positioning/src/middleware/intersecting.ts"],"names":[],"mappings":"AACA,SAAS,cAAT,QAA+B,kBAA/B;AAEA,OAAM,SAAU,YAAV,GAAsB;EAC1B,OAAO;IACL,IAAI,EAAE,sBADD;IAEL,EAAE,EAAE,MAAM,mBAAN,IAA4B;MAC9B,MAAM,YAAY,GAAG,mBAAmB,CAAC,KAApB,CAA0B,QAA/C;MACA,MAAM,WAAW,GAAG,MAAM,cAAc,CAAC,mBAAD,EAAsB;QAAE,WAAW,EAAE;MAAf,CAAtB,CAAxC;MAEA,MAAM,iBAAiB,GAAG,WAAW,CAAC,GAAZ,GAAkB,YAAY,CAAC,MAA/B,IAAyC,WAAW,CAAC,GAAZ,GAAkB,CAArF;MACA,MAAM,oBAAoB,GAAG,WAAW,CAAC,MAAZ,GAAqB,YAAY,CAAC,MAAlC,IAA4C,WAAW,CAAC,MAAZ,GAAqB,CAA9F;MAEA,MAAM,cAAc,GAAG,iBAAiB,IAAI,oBAA5C;MAEA,OAAO;QACL,IAAI,EAAE;UACJ,YAAY,EAAE;QADV;MADD,CAAP;IAKD;EAhBI,CAAP;AAkBD","sourcesContent":["import type { Middleware } from '@floating-ui/dom';\nimport { detectOverflow } from '@floating-ui/dom';\n\nexport function intersecting(): Middleware {\n return {\n name: 'intersectionObserver',\n fn: async middlewareArguments => {\n const floatingRect = middlewareArguments.rects.floating;\n const altOverflow = await detectOverflow(middlewareArguments, { altBoundary: true });\n\n const isIntersectingTop = altOverflow.top < floatingRect.height && altOverflow.top > 0;\n const isIntersectingBottom = altOverflow.bottom < floatingRect.height && altOverflow.bottom > 0;\n\n const isIntersecting = isIntersectingTop || isIntersectingBottom;\n\n return {\n data: {\n intersecting: isIntersecting,\n },\n };\n },\n };\n}\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["middleware/maxSize.ts"],"names":[],"mappings":"AAAA,SAAS,cAAT,QAA+B,kBAA/B;AAGA,SAAS,wBAAT,QAAyC,gBAAzC;AAEA,OAAM,SAAU,OAAV,CAAkB,QAAlB,EAA0D;EAC9D,OAAO;IACL,IAAI,EAAE,SADD;IAEL,EAAE,EAAE,MAAM,mBAAN,IAA4B;MAC9B,MAAM;QAAE,SAAF;QAAa,KAAb;QAAoB,QAApB;QAA8B;MAA9B,IAAiD,mBAAvD;MACA,MAAM,aAAa,GAAG,wBAAwB,CAAC,SAAD,CAAxB,CAAoC,IAA1D;MAEA,MAAM,QAAQ,GAAG,MAAM,cAAc,CAAC,mBAAD,CAArC;MACA,MAAM;QAAE,CAAF;QAAK;MAAL,IAAW,cAAc,CAAC,KAAf,IAAwB;QAAE,CAAC,EAAE,CAAL;QAAQ,CAAC,EAAE;MAAX,CAAzC;MACA,MAAM;QAAE,KAAF;QAAS;MAAT,IAAoB,KAAK,CAAC,QAAhC;MAEA,MAAM,SAAS,GAAS,aAAa,KAAK,MAAlB,GAA2B,MAA3B,GAAoC,OAA5D;MACA,MAAM,UAAU,GAAS,aAAa,KAAK,KAAlB,GAA0B,KAA1B,GAAkC,QAA3D;MAEA,MAAM,aAAa,GACjB,QAAQ,KAAK,QAAb,IACA,QAAQ,KAAK,cADb,IAEC,QAAQ,CAAC,SAAD,CAAR,GAAsB,CAAtB,KAA4B,QAAQ,KAAK,IAAb,IAAqB,QAAQ,KAAK,OAA9D,CAHH;MAIA,MAAM,cAAc,GAClB,QAAQ,KAAK,QAAb,IACA,QAAQ,KAAK,eADb,IAEC,QAAQ,CAAC,UAAD,CAAR,GAAuB,CAAvB,KAA6B,QAAQ,KAAK,IAAb,IAAqB,QAAQ,KAAK,QAA/D,CAHH;;MAKA,IAAI,aAAJ,EAAmB;QACjB,QAAQ,CAAC,QAAT,CAAkB,KAAlB,CAAwB,QAAxB,GAAmC,GAAG,KAAK,GAAG,QAAQ,CAAC,SAAD,CAAhB,GAA8B,CAAC,IAArE;MACD;;MACD,IAAI,cAAJ,EAAoB;QAClB,QAAQ,CAAC,QAAT,CAAkB,KAAlB,CAAwB,SAAxB,GAAoC,GAAG,MAAM,GAAG,QAAQ,CAAC,UAAD,CAAjB,GAAgC,CAAC,IAAxE;MACD;;MAED,OAAO,EAAP;IACD;EA9BI,CAAP;AAgCD","sourcesContent":["import { detectOverflow } from '@floating-ui/dom';\nimport type { Middleware, Side } from '@floating-ui/dom';\nimport type { PositioningOptions } from '../types';\nimport { parseFloatingUIPlacement } from '../utils/index';\n\nexport function maxSize(autoSize: PositioningOptions['autoSize']): Middleware {\n return {\n name: 'maxSize',\n fn: async middlewareArguments => {\n const { placement, rects, elements, middlewareData } = middlewareArguments;\n const basePlacement = parseFloatingUIPlacement(placement).side;\n\n const overflow = await detectOverflow(middlewareArguments);\n const { x, y } = middlewareData.shift || { x: 0, y: 0 };\n const { width, height } = rects.floating;\n\n const widthProp: Side = basePlacement === 'left' ? 'left' : 'right';\n const heightProp: Side = basePlacement === 'top' ? 'top' : 'bottom';\n\n const applyMaxWidth =\n autoSize === 'always' ||\n autoSize === 'width-always' ||\n (overflow[widthProp] > 0 && (autoSize === true || autoSize === 'width'));\n const applyMaxHeight =\n autoSize === 'always' ||\n autoSize === 'height-always' ||\n (overflow[heightProp] > 0 && (autoSize === true || autoSize === 'height'));\n\n if (applyMaxWidth) {\n elements.floating.style.maxWidth = `${width - overflow[widthProp] - x}px`;\n }\n if (applyMaxHeight) {\n elements.floating.style.maxHeight = `${height - overflow[heightProp] - y}px`;\n }\n\n return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AwB,QAAxB,GAAmC,GAAG,KAAK,GAAG,QAAQ,CAAC,SAAD,CAAhB,GAA8B,CAAC,IAArE;MACD;;MACD,IAAI,cAAJ,EAAoB;QAClB,QAAQ,CAAC,QAAT,CAAkB,KAAlB,CAAwB,SAAxB,GAAoC,GAAG,MAAM,GAAG,QAAQ,CAAC,UAAD,CAAjB,GAAgC,CAAC,IAAxE;MACD;;MAED,OAAO,EAAP;IACD;EA9BI,CAAP;AAgCD","sourcesContent":["import { detectOverflow } from '@floating-ui/dom';\nimport type { Middleware, Side } from '@floating-ui/dom';\nimport type { PositioningOptions } from '../types';\nimport { parseFloatingUIPlacement } from '../utils/index';\n\nexport function maxSize(autoSize: PositioningOptions['autoSize']): Middleware {\n return {\n name: 'maxSize',\n fn: async middlewareArguments => {\n const { placement, rects, elements, middlewareData } = middlewareArguments;\n const basePlacement = parseFloatingUIPlacement(placement).side;\n\n const overflow = await detectOverflow(middlewareArguments);\n const { x, y } = middlewareData.shift || { x: 0, y: 0 };\n const { width, height } = rects.floating;\n\n const widthProp: Side = basePlacement === 'left' ? 'left' : 'right';\n const heightProp: Side = basePlacement === 'top' ? 'top' : 'bottom';\n\n const applyMaxWidth =\n autoSize === 'always' ||\n autoSize === 'width-always' ||\n (overflow[widthProp] > 0 && (autoSize === true || autoSize === 'width'));\n const applyMaxHeight =\n autoSize === 'always' ||\n autoSize === 'height-always' ||\n (overflow[heightProp] > 0 && (autoSize === true || autoSize === 'height'));\n\n if (applyMaxWidth) {\n elements.floating.style.maxWidth = `${width - overflow[widthProp] - x}px`;\n }\n if (applyMaxHeight) {\n elements.floating.style.maxHeight = `${height - overflow[heightProp] - y}px`;\n }\n\n return {};\n },\n };\n}\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["middleware/offset.ts"],"names":[],"mappings":"AAAA,SAAS,MAAM,IAAI,UAAnB,QAAqC,kBAArC;AAEA,SAAS,mBAAT,QAAoC,8BAApC;AAEA;;AAEG;;AACH,OAAM,SAAU,MAAV,CAAiB,WAAjB,EAA0D;EAC9D,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,WAAD,CAA5C;EACA,OAAO,UAAU,CAAC,gBAAD,CAAjB;AACD","sourcesContent":["import { offset as baseOffset } from '@floating-ui/dom';\nimport type { PositioningOptions } from '../types';\nimport { getFloatingUIOffset } from '../utils/getFloatingUIOffset';\n\n/**\n * Wraps floating UI offset middleware to to transform offset value\n */\nexport function offset(offsetValue: PositioningOptions['offset']) {\n const floatingUIOffset = getFloatingUIOffset(offsetValue);\n return baseOffset(floatingUIOffset);\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["packages/react-components/react-positioning/src/middleware/offset.ts"],"names":[],"mappings":"AAAA,SAAS,MAAM,IAAI,UAAnB,QAAqC,kBAArC;AAEA,SAAS,mBAAT,QAAoC,8BAApC;AAEA;;AAEG;;AACH,OAAM,SAAU,MAAV,CAAiB,WAAjB,EAA0D;EAC9D,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,WAAD,CAA5C;EACA,OAAO,UAAU,CAAC,gBAAD,CAAjB;AACD","sourcesContent":["import { offset as baseOffset } from '@floating-ui/dom';\nimport type { PositioningOptions } from '../types';\nimport { getFloatingUIOffset } from '../utils/getFloatingUIOffset';\n\n/**\n * Wraps floating UI offset middleware to to transform offset value\n */\nexport function offset(offsetValue: PositioningOptions['offset']) {\n const floatingUIOffset = getFloatingUIOffset(offsetValue);\n return baseOffset(floatingUIOffset);\n}\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["middleware/shift.ts"],"names":[],"mappings":"AAAA,SAAS,KAAK,IAAI,SAAlB,EAA6B,UAA7B,QAA+C,kBAA/C;AAEA,SAAS,WAAT,QAA4B,gBAA5B;AAQA;;AAEG;;AACH,OAAM,SAAU,KAAV,CAAgB,OAAhB,EAA+C;EACnD,MAAM;IAAE,oBAAF;IAAwB,aAAxB;IAAuC,gBAAvC;IAAyD;EAAzD,IAAuE,OAA7E;EAEA,OAAO,SAAS,CAAC,EACf,IAAI,oBAAoB,IAAI;MAAE,QAAQ,EAAE;IAAZ,CAA5B,CADe;IAEf,IAAI,aAAa,IAAI;MACnB,SAAS,EAAE,aAAa,KAAK,KADV;MAEnB,OAAO,EAAE,UAAU,CAAC;QAAE,SAAS,EAAE,aAAa,KAAK,KAA/B;QAAsC,QAAQ,EAAE;MAAhD,CAAD;IAFA,CAArB,CAFe;IAMf,IAAI,gBAAgB,IAAI;MAAE,WAAW,EAAE,IAAf;MAAqB,QAAQ,EAAE,WAAW,CAAC,SAAD,EAAY,gBAAZ;IAA1C,CAAxB;EANe,CAAD,CAAhB;AAQD","sourcesContent":["import { shift as baseShift, limitShift } from '@floating-ui/dom';\nimport type { PositioningOptions } from '../types';\nimport { getBoundary } from '../utils/index';\n\nexport interface ShiftMiddlewareOptions extends Pick<PositioningOptions, 'overflowBoundary'> {\n hasScrollableElement?: boolean;\n disableTether?: PositioningOptions['unstable_disableTether'];\n container: HTMLElement | null;\n}\n\n/**\n * Wraps the floating UI shift middleware for easier usage of our options\n */\nexport function shift(options: ShiftMiddlewareOptions) {\n const { hasScrollableElement, disableTether, overflowBoundary, container } = options;\n\n return baseShift({\n ...(hasScrollableElement && { boundary: 'clippingAncestors' }),\n ...(disableTether && {\n crossAxis: disableTether === 'all',\n limiter: limitShift({ crossAxis: disableTether !== 'all', mainAxis: false }),\n }),\n ...(overflowBoundary && { altBoundary: true, boundary: getBoundary(container, overflowBoundary) }),\n });\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["packages/react-components/react-positioning/src/middleware/shift.ts"],"names":[],"mappings":"AAAA,SAAS,KAAK,IAAI,SAAlB,EAA6B,UAA7B,QAA+C,kBAA/C;AAEA,SAAS,WAAT,QAA4B,gBAA5B;AAQA;;AAEG;;AACH,OAAM,SAAU,KAAV,CAAgB,OAAhB,EAA+C;EACnD,MAAM;IAAE,oBAAF;IAAwB,aAAxB;IAAuC,gBAAvC;IAAyD;EAAzD,IAAuE,OAA7E;EAEA,OAAO,SAAS,CAAC,EACf,IAAI,oBAAoB,IAAI;MAAE,QAAQ,EAAE;IAAZ,CAA5B,CADe;IAEf,IAAI,aAAa,IAAI;MACnB,SAAS,EAAE,aAAa,KAAK,KADV;MAEnB,OAAO,EAAE,UAAU,CAAC;QAAE,SAAS,EAAE,aAAa,KAAK,KAA/B;QAAsC,QAAQ,EAAE;MAAhD,CAAD;IAFA,CAArB,CAFe;IAMf,IAAI,gBAAgB,IAAI;MAAE,WAAW,EAAE,IAAf;MAAqB,QAAQ,EAAE,WAAW,CAAC,SAAD,EAAY,gBAAZ;IAA1C,CAAxB;EANe,CAAD,CAAhB;AAQD","sourcesContent":["import { shift as baseShift, limitShift } from '@floating-ui/dom';\nimport type { PositioningOptions } from '../types';\nimport { getBoundary } from '../utils/index';\n\nexport interface ShiftMiddlewareOptions extends Pick<PositioningOptions, 'overflowBoundary'> {\n hasScrollableElement?: boolean;\n disableTether?: PositioningOptions['unstable_disableTether'];\n container: HTMLElement | null;\n}\n\n/**\n * Wraps the floating UI shift middleware for easier usage of our options\n */\nexport function shift(options: ShiftMiddlewareOptions) {\n const { hasScrollableElement, disableTether, overflowBoundary, container } = options;\n\n return baseShift({\n ...(hasScrollableElement && { boundary: 'clippingAncestors' }),\n ...(disableTether && {\n crossAxis: disableTether === 'all',\n limiter: limitShift({ crossAxis: disableTether !== 'all', mainAxis: false }),\n }),\n ...(overflowBoundary && { altBoundary: true, boundary: getBoundary(container, overflowBoundary) }),\n });\n}\n"],"sourceRoot":"../src/"}
package/lib/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"../src/","sources":["types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\n\ntype Rect = {\n width: number;\n height: number;\n x: number;\n y: number;\n};\n\nexport type OffsetFunctionParam = {\n positionedRect: Rect;\n targetRect: Rect;\n position: Position;\n alignment?: Alignment;\n};\n\nexport type TargetElement = HTMLElement | PositioningVirtualElement;\n\n/**\n * @internal\n */\nexport interface UsePositioningOptions extends PositioningProps {\n /**\n * If false, does not position anything\n */\n enabled?: boolean;\n}\n\n/**\n * @internal\n */\nexport interface PositionManager {\n updatePosition: () => void;\n dispose: () => void;\n}\n\nexport interface UsePositioningReturn {\n // React refs are supposed to be contravariant\n // (allows a more general type to be passed rather than a more specific one)\n // However, Typescript currently can't infer that fact for refs\n // See https://github.com/microsoft/TypeScript/issues/30748 for more information\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n targetRef: React.MutableRefObject<any>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n containerRef: React.MutableRefObject<any>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n arrowRef: React.MutableRefObject<any>;\n}\n\nexport type OffsetObject = { crossAxis?: number; mainAxis: number };\n\nexport type OffsetShorthand = number;\n\nexport type OffsetFunction = (param: OffsetFunctionParam) => OffsetObject | OffsetShorthand;\n\nexport type Offset = OffsetFunction | OffsetObject | OffsetShorthand;\n\nexport type Position = 'above' | 'below' | 'before' | 'after';\nexport type Alignment = 'top' | 'bottom' | 'start' | 'end' | 'center';\n\nexport type AutoSize = 'height' | 'height-always' | 'width' | 'width-always' | 'always' | boolean;\n\nexport type Boundary = HTMLElement | Array<HTMLElement> | 'clippingParents' | 'scrollParent' | 'window';\n\nexport type PositioningImperativeRef = {\n /**\n * Updates the position imperatively.\n * Useful when the position of the target changes from other factors than scrolling of window resize.\n */\n updatePosition: () => void;\n\n /**\n * Sets the target and updates positioning imperatively.\n * Useful for avoiding double renders with the target option.\n */\n setTarget: (target: TargetElement) => void;\n};\n\nexport type PositioningVirtualElement = {\n getBoundingClientRect: () => {\n x: number;\n y: number;\n top: number;\n left: number;\n bottom: number;\n right: number;\n width: number;\n height: number;\n };\n contextElement?: Element;\n};\n\nexport type SetVirtualMouseTarget = (event: React.MouseEvent | MouseEvent | undefined | null) => void;\n\nexport interface PositioningOptions {\n /** Alignment for the component. Only has an effect if used with the @see position option */\n align?: Alignment;\n\n /** The element which will define the boundaries of the positioned element for the flip behavior. */\n flipBoundary?: Boundary | null;\n\n /** The element which will define the boundaries of the positioned element for the overflow behavior. */\n overflowBoundary?: Boundary | null;\n\n /**\n * Position for the component. Position has higher priority than align. If position is vertical ('above' | 'below')\n * and align is also vertical ('top' | 'bottom') or if both position and align are horizontal ('before' | 'after'\n * and 'start' | 'end' respectively),\n * then provided value for 'align' will be ignored and 'center' will be used instead.\n */\n position?: Position;\n\n /**\n * Enables the position element to be positioned with 'fixed' (default value is position: 'absolute')\n * @default false\n */\n positionFixed?: boolean;\n\n /**\n * Lets you displace a positioned element from its reference element.\n * This can be useful if you need to apply some margin between them or if you need to fine tune the\n * position according to some custom logic.\n */\n offset?: Offset;\n\n /**\n * Defines padding between the corner of the popup element and the arrow.\n * Use to prevent the arrow from overlapping a rounded corner, for example.\n */\n arrowPadding?: number;\n\n /**\n * Applies max-height and max-width on the positioned element to fit it within the available space in viewport.\n * true enables this for both width and height when overflow happens.\n * 'always' applies `max-height`/`max-width` regardless of overflow.\n * 'height' applies `max-height` when overflow happens, and 'width' for `max-width`\n * `height-always` applies `max-height` regardless of overflow, and 'width-always' for always applying `max-width`\n */\n autoSize?: AutoSize;\n\n /**\n * Modifies position and alignment to cover the target\n */\n coverTarget?: boolean;\n\n /**\n * Disables automatic repositioning of the component; it will always be placed according to the values of `align` and\n * `position` props, regardless of the size of the component, the reference element or the viewport.\n */\n pinned?: boolean;\n\n /**\n * When the reference element or the viewport is outside viewport allows a positioned element to be fully in viewport.\n * \"all\" enables this behavior for all axis.\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n unstable_disableTether?: boolean | 'all';\n}\n\nexport interface PositioningProps\n // \"positionFixed\" & \"unstable_disableTether\" are not exported as public API (yet)\n extends Omit<PositioningOptions, 'positionFixed' | 'unstable_disableTether'> {\n /** An imperative handle to Popper methods. */\n positioningRef?: React.Ref<PositioningImperativeRef>;\n\n /**\n * Manual override for the target element. Useful for scenarios where a component accepts user prop to override target\n */\n target?: TargetElement | null;\n}\n\nexport type PositioningShorthandValue =\n | 'above'\n | 'above-start'\n | 'above-end'\n | 'below'\n | 'below-start'\n | 'below-end'\n | 'before'\n | 'before-top'\n | 'before-bottom'\n | 'after'\n | 'after-top'\n | 'after-bottom';\n\nexport type PositioningShorthand = PositioningProps | PositioningShorthandValue;\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"../src/","sources":["packages/react-components/react-positioning/src/types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\n\ntype Rect = {\n width: number;\n height: number;\n x: number;\n y: number;\n};\n\nexport type OffsetFunctionParam = {\n positionedRect: Rect;\n targetRect: Rect;\n position: Position;\n alignment?: Alignment;\n};\n\nexport type TargetElement = HTMLElement | PositioningVirtualElement;\n\n/**\n * @internal\n */\nexport interface UsePositioningOptions extends PositioningProps {\n /**\n * If false, does not position anything\n */\n enabled?: boolean;\n}\n\n/**\n * @internal\n */\nexport interface PositionManager {\n updatePosition: () => void;\n dispose: () => void;\n}\n\nexport interface UsePositioningReturn {\n // React refs are supposed to be contravariant\n // (allows a more general type to be passed rather than a more specific one)\n // However, Typescript currently can't infer that fact for refs\n // See https://github.com/microsoft/TypeScript/issues/30748 for more information\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n targetRef: React.MutableRefObject<any>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n containerRef: React.MutableRefObject<any>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n arrowRef: React.MutableRefObject<any>;\n}\n\nexport type OffsetObject = { crossAxis?: number; mainAxis: number };\n\nexport type OffsetShorthand = number;\n\nexport type OffsetFunction = (param: OffsetFunctionParam) => OffsetObject | OffsetShorthand;\n\nexport type Offset = OffsetFunction | OffsetObject | OffsetShorthand;\n\nexport type Position = 'above' | 'below' | 'before' | 'after';\nexport type Alignment = 'top' | 'bottom' | 'start' | 'end' | 'center';\n\nexport type AutoSize = 'height' | 'height-always' | 'width' | 'width-always' | 'always' | boolean;\n\nexport type Boundary = HTMLElement | Array<HTMLElement> | 'clippingParents' | 'scrollParent' | 'window';\n\nexport type PositioningImperativeRef = {\n /**\n * Updates the position imperatively.\n * Useful when the position of the target changes from other factors than scrolling of window resize.\n */\n updatePosition: () => void;\n\n /**\n * Sets the target and updates positioning imperatively.\n * Useful for avoiding double renders with the target option.\n */\n setTarget: (target: TargetElement) => void;\n};\n\nexport type PositioningVirtualElement = {\n getBoundingClientRect: () => {\n x: number;\n y: number;\n top: number;\n left: number;\n bottom: number;\n right: number;\n width: number;\n height: number;\n };\n contextElement?: Element;\n};\n\nexport type SetVirtualMouseTarget = (event: React.MouseEvent | MouseEvent | undefined | null) => void;\n\nexport interface PositioningOptions {\n /** Alignment for the component. Only has an effect if used with the @see position option */\n align?: Alignment;\n\n /** The element which will define the boundaries of the positioned element for the flip behavior. */\n flipBoundary?: Boundary | null;\n\n /** The element which will define the boundaries of the positioned element for the overflow behavior. */\n overflowBoundary?: Boundary | null;\n\n /**\n * Position for the component. Position has higher priority than align. If position is vertical ('above' | 'below')\n * and align is also vertical ('top' | 'bottom') or if both position and align are horizontal ('before' | 'after'\n * and 'start' | 'end' respectively),\n * then provided value for 'align' will be ignored and 'center' will be used instead.\n */\n position?: Position;\n\n /**\n * Enables the position element to be positioned with 'fixed' (default value is position: 'absolute')\n * @default false\n */\n positionFixed?: boolean;\n\n /**\n * Lets you displace a positioned element from its reference element.\n * This can be useful if you need to apply some margin between them or if you need to fine tune the\n * position according to some custom logic.\n */\n offset?: Offset;\n\n /**\n * Defines padding between the corner of the popup element and the arrow.\n * Use to prevent the arrow from overlapping a rounded corner, for example.\n */\n arrowPadding?: number;\n\n /**\n * Applies max-height and max-width on the positioned element to fit it within the available space in viewport.\n * true enables this for both width and height when overflow happens.\n * 'always' applies `max-height`/`max-width` regardless of overflow.\n * 'height' applies `max-height` when overflow happens, and 'width' for `max-width`\n * `height-always` applies `max-height` regardless of overflow, and 'width-always' for always applying `max-width`\n */\n autoSize?: AutoSize;\n\n /**\n * Modifies position and alignment to cover the target\n */\n coverTarget?: boolean;\n\n /**\n * Disables automatic repositioning of the component; it will always be placed according to the values of `align` and\n * `position` props, regardless of the size of the component, the reference element or the viewport.\n */\n pinned?: boolean;\n\n /**\n * When the reference element or the viewport is outside viewport allows a positioned element to be fully in viewport.\n * \"all\" enables this behavior for all axis.\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n unstable_disableTether?: boolean | 'all';\n}\n\nexport interface PositioningProps\n // \"positionFixed\" & \"unstable_disableTether\" are not exported as public API (yet)\n extends Omit<PositioningOptions, 'positionFixed' | 'unstable_disableTether'> {\n /** An imperative handle to Popper methods. */\n positioningRef?: React.Ref<PositioningImperativeRef>;\n\n /**\n * Manual override for the target element. Useful for scenarios where a component accepts user prop to override target\n */\n target?: TargetElement | null;\n}\n\nexport type PositioningShorthandValue =\n | 'above'\n | 'above-start'\n | 'above-end'\n | 'below'\n | 'below-start'\n | 'below-end'\n | 'before'\n | 'before-top'\n | 'before-bottom'\n | 'after'\n | 'after-top'\n | 'after-bottom';\n\nexport type PositioningShorthand = PositioningProps | PositioningShorthandValue;\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["usePositioning.ts"],"names":[],"mappings":"AAAA,SAAS,IAAI,IAAI,cAAjB,EAAiC,KAAK,IAAI,eAA1C,QAAiE,kBAAjE;AAEA,SAAS,kBAAkB,IAAI,SAA/B,QAAgD,iCAAhD;AACA,SAAS,SAAT,EAAoB,yBAApB,QAAqD,2BAArD;AACA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AAQA,SAAS,cAAT,EAAyB,qBAAzB,EAAgD,kBAAhD,EAAoE,eAApE,QAA2F,SAA3F;AACA,SACE,KAAK,IAAI,eADX,EAEE,IAAI,IAAI,cAFV,EAGE,WAAW,IAAI,qBAHjB,EAIE,OAAO,IAAI,iBAJb,EAKE,MAAM,IAAI,gBALZ,EAME,YAAY,IAAI,sBANlB,QAOO,cAPP;AAQA,SAAS,qBA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OAAO,EAAE,KAAX;MAAkB,OAAO,EAAE;IAA3B,CAAD,CAPP,EAQjB,cAAc,CAAC;MAAE,QAAQ,EAAE;IAAZ,CAAD,CARG,EASjB,cAAc,CAAC;MAAE,QAAQ,EAAE;IAAZ,CAAD,CATG,EAUjB,MAViB,CAUV,OAVU,CAAnB;IAYA,OAAO;MACL,SADK;MAEL,UAFK;MAGL;IAHK,CAAP;EAKD,CAtBI,EAuBL,CACE,KADF,EAEE,YAFF,EAGE,QAHF,EAIE,WAJF,EAKE,aALF,EAME,YANF,EAOE,KAPF,EAQE,MARF,EASE,gBATF,EAUE,MAVF,EAWE,QAXF,EAYE,QAZF,CAvBK,CAAP;AAsCD","sourcesContent":["import { hide as hideMiddleware, arrow as arrowMiddleware } from '@floating-ui/dom';\nimport type { Middleware, Strategy } from '@floating-ui/dom';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { canUseDOM, useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\nimport * as React from 'react';\nimport type {\n PositioningOptions,\n PositioningProps,\n PositionManager,\n TargetElement,\n UsePositioningReturn,\n} from './types';\nimport { useCallbackRef, toFloatingUIPlacement, hasAutofocusFilter, hasScrollParent } from './utils';\nimport {\n shift as shiftMiddleware,\n flip as flipMiddleware,\n coverTarget as coverTargetMiddleware,\n maxSize as maxSizeMiddleware,\n offset as offsetMiddleware,\n intersecting as intersectingMiddleware,\n} from './middleware';\nimport { createPositionManager } from './createPositionManager';\n\n/**\n * @internal\n */\nexport function usePositioning(options: UsePositioningOptions): UsePositioningReturn {\n const managerRef = React.useRef<PositionManager | null>(null);\n const targetRef = React.useRef<TargetElement | null>(null);\n const overrideTargetRef = React.useRef<TargetElement | null>(null);\n const containerRef = React.useRef<HTMLElement | null>(null);\n const arrowRef = React.useRef<HTMLElement | null>(null);\n\n const { enabled = true } = options;\n const resolvePositioningOptions = usePositioningOptions(options);\n const updatePositionManager = React.useCallback(() => {\n if (managerRef.current) {\n managerRef.current.dispose();\n }\n managerRef.current = null;\n\n const target = overrideTargetRef.current ?? targetRef.current;\n\n if (enabled && canUseDOM() && target && containerRef.current) {\n managerRef.current = createPositionManager({\n container: containerRef.current,\n target,\n arrow: arrowRef.current,\n ...resolvePositioningOptions(containerRef.current, arrowRef.current),\n });\n }\n }, [enabled, resolvePositioningOptions]);\n\n const setOverrideTarget = React.useCallback(\n (target: TargetElement | null) => {\n overrideTargetRef.current = target;\n updatePositionManager();\n },\n [updatePositionManager],\n );\n\n React.useImperativeHandle(\n options.positioningRef,\n () => ({\n updatePosition: () => managerRef.current?.updatePosition(),\n setTarget: (target: TargetElement) => {\n if (options.target && process.env.NODE_ENV !== 'production') {\n const err = new Error();\n // eslint-disable-next-line no-console\n console.warn('Imperative setTarget should not be used at the same time as target option');\n // eslint-disable-next-line no-console\n console.warn(err.stack);\n }\n\n setOverrideTarget(target);\n },\n }),\n [options.target, setOverrideTarget],\n );\n\n useIsomorphicLayoutEffect(() => {\n setOverrideTarget(options.target ?? null);\n }, [options.target, setOverrideTarget]);\n\n useIsomorphicLayoutEffect(() => {\n updatePositionManager();\n }, [updatePositionManager]);\n\n if (process.env.NODE_ENV !== 'production') {\n // This checked should run only in development mode\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useEffect(() => {\n if (containerRef.current) {\n const contentNode = containerRef.current;\n const treeWalker = contentNode.ownerDocument?.createTreeWalker(contentNode, NodeFilter.SHOW_ELEMENT, {\n acceptNode: hasAutofocusFilter,\n });\n\n while (treeWalker.nextNode()) {\n const node = treeWalker.currentNode;\n // eslint-disable-next-line no-console\n console.warn('<Popper>:', node);\n // eslint-disable-next-line no-console\n console.warn(\n [\n '<Popper>: ^ this node contains \"autoFocus\" prop on a React element. This can break the initial',\n 'positioning of an element and cause a window jump effect. This issue occurs because React polyfills',\n '\"autoFocus\" behavior to solve inconsistencies between different browsers:',\n 'https://github.com/facebook/react/issues/11851#issuecomment-351787078',\n '\\n',\n 'However, \".focus()\" in this case occurs before any other React effects will be executed',\n '(React.useEffect(), componentDidMount(), etc.) and we can not prevent this behavior. If you really',\n 'want to use \"autoFocus\" please add \"position: fixed\" to styles of the element that is wrapped by',\n '\"Popper\".',\n `In general, it's not recommended to use \"autoFocus\" as it may break accessibility aspects:`,\n 'https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-autofocus.md',\n '\\n',\n 'We suggest to use the \"trapFocus\" prop on Fluent components or a catch \"ref\" and then use',\n '\"ref.current.focus\" in React.useEffect():',\n 'https://reactjs.org/docs/refs-and-the-dom.html#adding-a-ref-to-a-dom-element',\n ].join(' '),\n );\n }\n }\n // We run this check once, no need to add deps here\n // TODO: Should be rework to handle options.enabled and contentRef updates\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n }\n\n const setTarget = useCallbackRef<TargetElement>(null, target => {\n if (targetRef.current !== target) {\n targetRef.current = target;\n updatePositionManager();\n }\n });\n\n const setContainer = useCallbackRef<HTMLElement | null>(null, container => {\n if (containerRef.current !== container) {\n containerRef.current = container;\n updatePositionManager();\n }\n });\n\n const setArrow = useCallbackRef<HTMLElement | null>(null, arrow => {\n if (arrowRef.current !== arrow) {\n arrowRef.current = arrow;\n updatePositionManager();\n }\n });\n\n // Let users use callback refs so they feel like 'normal' DOM refs\n return { targetRef: setTarget, containerRef: setContainer, arrowRef: setArrow };\n}\n\ninterface UsePositioningOptions extends PositioningProps {\n /**\n * If false, does not position anything\n */\n enabled?: boolean;\n}\n\nfunction usePositioningOptions(options: PositioningOptions) {\n const {\n align,\n arrowPadding,\n autoSize,\n coverTarget,\n flipBoundary,\n offset,\n overflowBoundary,\n pinned,\n position,\n unstable_disableTether: disableTether,\n positionFixed,\n } = options;\n\n const { dir } = useFluent();\n const isRtl = dir === 'rtl';\n const strategy: Strategy = positionFixed ? 'fixed' : 'absolute';\n\n return React.useCallback(\n (container: HTMLElement | null, arrow: HTMLElement | null) => {\n const hasScrollableElement = hasScrollParent(container);\n\n const placement = toFloatingUIPlacement(align, position, isRtl);\n const middleware = [\n offset && offsetMiddleware(offset),\n coverTarget && coverTargetMiddleware(),\n !pinned && flipMiddleware({ container, flipBoundary, hasScrollableElement }),\n shiftMiddleware({ container, hasScrollableElement, overflowBoundary, disableTether }),\n autoSize && maxSizeMiddleware(autoSize),\n intersectingMiddleware(),\n arrow && arrowMiddleware({ element: arrow, padding: arrowPadding }),\n hideMiddleware({ strategy: 'referenceHidden' }),\n hideMiddleware({ strategy: 'escaped' }),\n ].filter(Boolean) as Middleware[];\n\n return {\n placement,\n middleware,\n strategy,\n };\n },\n [\n align,\n arrowPadding,\n autoSize,\n coverTarget,\n disableTether,\n flipBoundary,\n isRtl,\n offset,\n overflowBoundary,\n pinned,\n position,\n strategy,\n ],\n );\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["packages/react-components/react-positioning/src/usePositioning.ts"],"names":[],"mappings":"AAAA,SAAS,IAAI,IAAI,cAAjB,EAAiC,KAAK,IAAI,eAA1C,QAAiE,kBAAjE;AAEA,SAAS,kBAAkB,IAAI,SAA/B,QAAgD,iCAAhD;AACA,SAAS,SAAT,EAAoB,yBAApB,QAAqD,2BAArD;AACA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AAQA,SAAS,cAAT,EAAyB,qBAAzB,EAAgD,kBAAhD,EAAoE,eAApE,QAA2F,SAA3F;AACA,SACE,KAAK,IAAI,eADX,EAEE,IAAI,IAAI,cAFV,EAGE,WAAW,IAAI,qBAHjB,EAIE,OAAO,IAAI,iBAJb,EAKE,MAAM,IAAI,gBALZ,EAME,YAAY,IAAI,sBANlB,QAOO,cAPP;AAQA,SAAS,qBAAT,QAAsC,yBAAtC;AAEA;;AAEG;;AACH,OAAM,SAAU,cAAV,CAAyB,OAAzB,EAAuD;EAC3D,MAAM,UAAU,GAAG,KAAK,CAAC,MAAN,CAAqC,IAArC,CAAnB;EACA,MAAM,SAAS,GAAG,KAAK,CAAC,MAAN,CAAmC,IAAnC,CAAlB;EACA,MAAM,iBAAiB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MAEL,UAFK;MAGL;IAHK,CAAP;EAKD,CAtBI,EAuBL,CACE,KADF,EAEE,YAFF,EAGE,QAHF,EAIE,WAJF,EAKE,aALF,EAME,YANF,EAOE,KAPF,EAQE,MARF,EASE,gBATF,EAUE,MAVF,EAWE,QAXF,EAYE,QAZF,CAvBK,CAAP;AAsCD","sourcesContent":["import { hide as hideMiddleware, arrow as arrowMiddleware } from '@floating-ui/dom';\nimport type { Middleware, Strategy } from '@floating-ui/dom';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { canUseDOM, useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\nimport * as React from 'react';\nimport type {\n PositioningOptions,\n PositioningProps,\n PositionManager,\n TargetElement,\n UsePositioningReturn,\n} from './types';\nimport { useCallbackRef, toFloatingUIPlacement, hasAutofocusFilter, hasScrollParent } from './utils';\nimport {\n shift as shiftMiddleware,\n flip as flipMiddleware,\n coverTarget as coverTargetMiddleware,\n maxSize as maxSizeMiddleware,\n offset as offsetMiddleware,\n intersecting as intersectingMiddleware,\n} from './middleware';\nimport { createPositionManager } from './createPositionManager';\n\n/**\n * @internal\n */\nexport function usePositioning(options: UsePositioningOptions): UsePositioningReturn {\n const managerRef = React.useRef<PositionManager | null>(null);\n const targetRef = React.useRef<TargetElement | null>(null);\n const overrideTargetRef = React.useRef<TargetElement | null>(null);\n const containerRef = React.useRef<HTMLElement | null>(null);\n const arrowRef = React.useRef<HTMLElement | null>(null);\n\n const { enabled = true } = options;\n const resolvePositioningOptions = usePositioningOptions(options);\n const updatePositionManager = React.useCallback(() => {\n if (managerRef.current) {\n managerRef.current.dispose();\n }\n managerRef.current = null;\n\n const target = overrideTargetRef.current ?? targetRef.current;\n\n if (enabled && canUseDOM() && target && containerRef.current) {\n managerRef.current = createPositionManager({\n container: containerRef.current,\n target,\n arrow: arrowRef.current,\n ...resolvePositioningOptions(containerRef.current, arrowRef.current),\n });\n }\n }, [enabled, resolvePositioningOptions]);\n\n const setOverrideTarget = React.useCallback(\n (target: TargetElement | null) => {\n overrideTargetRef.current = target;\n updatePositionManager();\n },\n [updatePositionManager],\n );\n\n React.useImperativeHandle(\n options.positioningRef,\n () => ({\n updatePosition: () => managerRef.current?.updatePosition(),\n setTarget: (target: TargetElement) => {\n if (options.target && process.env.NODE_ENV !== 'production') {\n const err = new Error();\n // eslint-disable-next-line no-console\n console.warn('Imperative setTarget should not be used at the same time as target option');\n // eslint-disable-next-line no-console\n console.warn(err.stack);\n }\n\n setOverrideTarget(target);\n },\n }),\n [options.target, setOverrideTarget],\n );\n\n useIsomorphicLayoutEffect(() => {\n setOverrideTarget(options.target ?? null);\n }, [options.target, setOverrideTarget]);\n\n useIsomorphicLayoutEffect(() => {\n updatePositionManager();\n }, [updatePositionManager]);\n\n if (process.env.NODE_ENV !== 'production') {\n // This checked should run only in development mode\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useEffect(() => {\n if (containerRef.current) {\n const contentNode = containerRef.current;\n const treeWalker = contentNode.ownerDocument?.createTreeWalker(contentNode, NodeFilter.SHOW_ELEMENT, {\n acceptNode: hasAutofocusFilter,\n });\n\n while (treeWalker.nextNode()) {\n const node = treeWalker.currentNode;\n // eslint-disable-next-line no-console\n console.warn('<Popper>:', node);\n // eslint-disable-next-line no-console\n console.warn(\n [\n '<Popper>: ^ this node contains \"autoFocus\" prop on a React element. This can break the initial',\n 'positioning of an element and cause a window jump effect. This issue occurs because React polyfills',\n '\"autoFocus\" behavior to solve inconsistencies between different browsers:',\n 'https://github.com/facebook/react/issues/11851#issuecomment-351787078',\n '\\n',\n 'However, \".focus()\" in this case occurs before any other React effects will be executed',\n '(React.useEffect(), componentDidMount(), etc.) and we can not prevent this behavior. If you really',\n 'want to use \"autoFocus\" please add \"position: fixed\" to styles of the element that is wrapped by',\n '\"Popper\".',\n `In general, it's not recommended to use \"autoFocus\" as it may break accessibility aspects:`,\n 'https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-autofocus.md',\n '\\n',\n 'We suggest to use the \"trapFocus\" prop on Fluent components or a catch \"ref\" and then use',\n '\"ref.current.focus\" in React.useEffect():',\n 'https://reactjs.org/docs/refs-and-the-dom.html#adding-a-ref-to-a-dom-element',\n ].join(' '),\n );\n }\n }\n // We run this check once, no need to add deps here\n // TODO: Should be rework to handle options.enabled and contentRef updates\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n }\n\n const setTarget = useCallbackRef<TargetElement>(null, target => {\n if (targetRef.current !== target) {\n targetRef.current = target;\n updatePositionManager();\n }\n });\n\n const setContainer = useCallbackRef<HTMLElement | null>(null, container => {\n if (containerRef.current !== container) {\n containerRef.current = container;\n updatePositionManager();\n }\n });\n\n const setArrow = useCallbackRef<HTMLElement | null>(null, arrow => {\n if (arrowRef.current !== arrow) {\n arrowRef.current = arrow;\n updatePositionManager();\n }\n });\n\n // Let users use callback refs so they feel like 'normal' DOM refs\n return { targetRef: setTarget, containerRef: setContainer, arrowRef: setArrow };\n}\n\ninterface UsePositioningOptions extends PositioningProps {\n /**\n * If false, does not position anything\n */\n enabled?: boolean;\n}\n\nfunction usePositioningOptions(options: PositioningOptions) {\n const {\n align,\n arrowPadding,\n autoSize,\n coverTarget,\n flipBoundary,\n offset,\n overflowBoundary,\n pinned,\n position,\n unstable_disableTether: disableTether,\n positionFixed,\n } = options;\n\n const { dir } = useFluent();\n const isRtl = dir === 'rtl';\n const strategy: Strategy = positionFixed ? 'fixed' : 'absolute';\n\n return React.useCallback(\n (container: HTMLElement | null, arrow: HTMLElement | null) => {\n const hasScrollableElement = hasScrollParent(container);\n\n const placement = toFloatingUIPlacement(align, position, isRtl);\n const middleware = [\n offset && offsetMiddleware(offset),\n coverTarget && coverTargetMiddleware(),\n !pinned && flipMiddleware({ container, flipBoundary, hasScrollableElement }),\n shiftMiddleware({ container, hasScrollableElement, overflowBoundary, disableTether }),\n autoSize && maxSizeMiddleware(autoSize),\n intersectingMiddleware(),\n arrow && arrowMiddleware({ element: arrow, padding: arrowPadding }),\n hideMiddleware({ strategy: 'referenceHidden' }),\n hideMiddleware({ strategy: 'escaped' }),\n ].filter(Boolean) as Middleware[];\n\n return {\n placement,\n middleware,\n strategy,\n };\n },\n [\n align,\n arrowPadding,\n autoSize,\n coverTarget,\n disableTether,\n flipBoundary,\n isRtl,\n offset,\n overflowBoundary,\n pinned,\n position,\n strategy,\n ],\n );\n}\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["usePositioningMouseTarget.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,6BAAT,QAA8C,iCAA9C;AAGA;;;;;;;;AAQG;;AACH,OAAO,MAAM,yBAAyB,GACpC,YADuC,IAErC;EACF,MAAM,CAAC,cAAD,EAAiB,iBAAjB,IAAsC,KAAK,CAAC,QAAN,CAAsD,YAAtD,CAA5C;;EAEA,MAAM,qBAAqB,GAA0B,KAAK,IAAG;IAC3D,IAAI,KAAK,KAAK,SAAV,IAAuB,KAAK,KAAK,IAArC,EAA2C;MACzC,iBAAiB,CAAC,SAAD,CAAjB;MACA;IACD;;IAED,IAAI,UAAJ;;IACA,IAAI,EAAE,KAAK,YAAY,UAAnB,CAAJ,EAAoC;MAClC,UAAU,GAAG,KAAK,CAAC,WAAnB;IACD,CAFD,MAEO;MACL,UAAU,GAAG,KAAb;IACD;;IAED,IAAI,EAAE,UAAU,YAAY,UAAxB,KAAuC,OAAO,CAAC,GAAR,CAAY,QAAZ,KAAyB,YAApE,EAAkF;MAChF;MACA,OAAO,CAAC,KAAR,CAAc,+DAAd;IACD;;IAED,MAAM,aAAa,GAAG,6BAA6B,CAAC,UAAD,CAAnD;IACA,iBAAiB,CAAC,aAAD,CAAjB;EACD,CApBD;;EAsBA,OAAO,CAAC,cAAD,EAAiB,qBAAjB,CAAP;AACD,CA5BM","sourcesContent":["import * as React from 'react';\nimport { createVirtualElementFromClick } from './createVirtualElementFromClick';\nimport { PositioningVirtualElement, SetVirtualMouseTarget } from './types';\n\n/**\n * @internal\n * A state hook that manages a popper virtual element from mouseevents.\n * Useful for scenarios where a component needs to be positioned by mouse click (e.g. contextmenu)\n * React synthetic events are not persisted by this hook\n *\n * @param initialState - initializes a user provided state similare to useState\n * @returns state and dispatcher for a Popper virtual element that uses native/synthetic mouse events\n */\nexport const usePositioningMouseTarget = (\n initialState?: PositioningVirtualElement | (() => PositioningVirtualElement),\n) => {\n const [virtualElement, setVirtualElement] = React.useState<PositioningVirtualElement | undefined>(initialState);\n\n const setVirtualMouseTarget: SetVirtualMouseTarget = event => {\n if (event === undefined || event === null) {\n setVirtualElement(undefined);\n return;\n }\n\n let mouseevent: MouseEvent;\n if (!(event instanceof MouseEvent)) {\n mouseevent = event.nativeEvent;\n } else {\n mouseevent = event;\n }\n\n if (!(mouseevent instanceof MouseEvent) && process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.error('usePositioningMouseTarget should only be used with MouseEvent');\n }\n\n const contextTarget = createVirtualElementFromClick(mouseevent);\n setVirtualElement(contextTarget);\n };\n\n return [virtualElement, setVirtualMouseTarget] as const;\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["packages/react-components/react-positioning/src/usePositioningMouseTarget.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,6BAAT,QAA8C,iCAA9C;AAGA;;;;;;;;AAQG;;AACH,OAAO,MAAM,yBAAyB,GACpC,YADuC,IAErC;EACF,MAAM,CAAC,cAAD,EAAiB,iBAAjB,IAAsC,KAAK,CAAC,QAAN,CAAsD,YAAtD,CAA5C;;EAEA,MAAM,qBAAqB,GAA0B,KAAK,IAAG;IAC3D,IAAI,KAAK,KAAK,SAAV,IAAuB,KAAK,KAAK,IAArC,EAA2C;MACzC,iBAAiB,CAAC,SAAD,CAAjB;MACA;IACD;;IAED,IAAI,UAAJ;;IACA,IAAI,EAAE,KAAK,YAAY,UAAnB,CAAJ,EAAoC;MAClC,UAAU,GAAG,KAAK,CAAC,WAAnB;IACD,CAFD,MAEO;MACL,UAAU,GAAG,KAAb;IACD;;IAED,IAAI,EAAE,UAAU,YAAY,UAAxB,KAAuC,OAAO,CAAC,GAAR,CAAY,QAAZ,KAAyB,YAApE,EAAkF;MAChF;MACA,OAAO,CAAC,KAAR,CAAc,+DAAd;IACD;;IAED,MAAM,aAAa,GAAG,6BAA6B,CAAC,UAAD,CAAnD;IACA,iBAAiB,CAAC,aAAD,CAAjB;EACD,CApBD;;EAsBA,OAAO,CAAC,cAAD,EAAiB,qBAAjB,CAAP;AACD,CA5BM","sourcesContent":["import * as React from 'react';\nimport { createVirtualElementFromClick } from './createVirtualElementFromClick';\nimport { PositioningVirtualElement, SetVirtualMouseTarget } from './types';\n\n/**\n * @internal\n * A state hook that manages a popper virtual element from mouseevents.\n * Useful for scenarios where a component needs to be positioned by mouse click (e.g. contextmenu)\n * React synthetic events are not persisted by this hook\n *\n * @param initialState - initializes a user provided state similare to useState\n * @returns state and dispatcher for a Popper virtual element that uses native/synthetic mouse events\n */\nexport const usePositioningMouseTarget = (\n initialState?: PositioningVirtualElement | (() => PositioningVirtualElement),\n) => {\n const [virtualElement, setVirtualElement] = React.useState<PositioningVirtualElement | undefined>(initialState);\n\n const setVirtualMouseTarget: SetVirtualMouseTarget = event => {\n if (event === undefined || event === null) {\n setVirtualElement(undefined);\n return;\n }\n\n let mouseevent: MouseEvent;\n if (!(event instanceof MouseEvent)) {\n mouseevent = event.nativeEvent;\n } else {\n mouseevent = event;\n }\n\n if (!(mouseevent instanceof MouseEvent) && process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.error('usePositioningMouseTarget should only be used with MouseEvent');\n }\n\n const contextTarget = createVirtualElementFromClick(mouseevent);\n setVirtualElement(contextTarget);\n };\n\n return [virtualElement, setVirtualMouseTarget] as const;\n};\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["utils/debounce.ts"],"names":[],"mappings":"AAAA;;;;;AAKG;AACH,OAAM,SAAU,QAAV,CAAsB,EAAtB,EAAkC;EACtC,IAAI,OAAJ;EACA,OAAO,MAAK;IACV,IAAI,CAAC,OAAL,EAAc;MACZ,OAAO,GAAG,IAAI,OAAJ,CAAe,OAAO,IAAG;QACjC,OAAO,CAAC,OAAR,GAAkB,IAAlB,CAAuB,MAAK;UAC1B,OAAO,GAAG,SAAV;UACA,OAAO,CAAC,EAAE,EAAH,CAAP;QACD,CAHD;MAID,CALS,CAAV;IAMD;;IAED,OAAO,OAAP;EACD,CAXD;AAYD","sourcesContent":["/**\n * Promise microtask debouncer used by Popper.js v2\n * This is no longer exported in Floating UI (Popper.js v3)\n * https://github.com/floating-ui/floating-ui/blob/v2.x/src/utils/debounce.js\n * @param fn function that will be debounced\n */\nexport function debounce<T>(fn: Function): () => Promise<T> {\n let pending: Promise<T> | undefined;\n return () => {\n if (!pending) {\n pending = new Promise<T>(resolve => {\n Promise.resolve().then(() => {\n pending = undefined;\n resolve(fn());\n });\n });\n }\n\n return pending;\n };\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["packages/react-components/react-positioning/src/utils/debounce.ts"],"names":[],"mappings":"AAAA;;;;;AAKG;AACH,OAAM,SAAU,QAAV,CAAsB,EAAtB,EAAkC;EACtC,IAAI,OAAJ;EACA,OAAO,MAAK;IACV,IAAI,CAAC,OAAL,EAAc;MACZ,OAAO,GAAG,IAAI,OAAJ,CAAe,OAAO,IAAG;QACjC,OAAO,CAAC,OAAR,GAAkB,IAAlB,CAAuB,MAAK;UAC1B,OAAO,GAAG,SAAV;UACA,OAAO,CAAC,EAAE,EAAH,CAAP;QACD,CAHD;MAID,CALS,CAAV;IAMD;;IAED,OAAO,OAAP;EACD,CAXD;AAYD","sourcesContent":["/**\n * Promise microtask debouncer used by Popper.js v2\n * This is no longer exported in Floating UI (Popper.js v3)\n * https://github.com/floating-ui/floating-ui/blob/v2.x/src/utils/debounce.js\n * @param fn function that will be debounced\n */\nexport function debounce<T>(fn: Function): () => Promise<T> {\n let pending: Promise<T> | undefined;\n return () => {\n if (!pending) {\n pending = new Promise<T>(resolve => {\n Promise.resolve().then(() => {\n pending = undefined;\n resolve(fn());\n });\n });\n }\n\n return pending;\n };\n}\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["utils/fromFloatingUIPlacement.ts"],"names":[],"mappings":"AAEA,SAAS,wBAAT,QAAyC,4BAAzC;;AAEA,MAAM,cAAc,GAAG,OAA+B;EACpD,GAAG,EAAE,OAD+C;EAEpD,MAAM,EAAE,OAF4C;EAGpD,KAAK,EAAE,OAH6C;EAIpD,IAAI,EAAE;AAJ8C,CAA/B,CAAvB,C,CAOA;AACA;;;AACA,MAAM,eAAe,GAAI,QAAD,IAA+D;EACrF,IAAI,QAAQ,KAAK,OAAb,IAAwB,QAAQ,KAAK,OAAzC,EAAkD;IAChD,OAAO;MACL,KAAK,EAAE,OADF;MAEL,GAAG,EAAE;IAFA,CAAP;EAID;;EAED,OAAO;IACL,KAAK,EAAE,KADF;IAEL,GAAG,EAAE;EAFA,CAAP;AAID,CAZD;AAcA;;;AAGG;;;AACH,OAAO,MAAM,uBAAuB,GAAI,SAAD,IAAwE;EAC7G,MAAM;IAAE,IAAF;IAAQ,SAAS,EAAE;EAAnB,IAA2C,wBAAwB,CAAC,SAAD,CAAzE;EACA,MAAM,QAAQ,GAAG,cAAc,GAAG,IAAH,CAA/B;EACA,MAAM,SAAS,GAAG,mBAAmB,IAAI,eAAe,CAAC,QAAD,CAAf,CAA0B,mBAA1B,CAAzC;EAEA,OAAO;IAAE,QAAF;IAAY;EAAZ,CAAP;AACD,CANM","sourcesContent":["import type { Side, Alignment as FloatingUIAlignment, Placement } from '@floating-ui/dom';\nimport type { Alignment, Position } from '../types';\nimport { parseFloatingUIPlacement } from './parseFloatingUIPlacement';\n\nconst getPositionMap = (): Record<Side, Position> => ({\n top: 'above',\n bottom: 'below',\n right: 'after',\n left: 'before',\n});\n\n// Floating UI automatically flips alignment\n// https://github.com/floating-ui/floating-ui/issues/1563\nconst getAlignmentMap = (position: Position): Record<FloatingUIAlignment, Alignment> => {\n if (position === 'above' || position === 'below') {\n return {\n start: 'start',\n end: 'end',\n };\n }\n\n return {\n start: 'top',\n end: 'bottom',\n };\n};\n\n/**\n * Maps Floating UI placement to positioning values\n * @see positioningHelper.test.ts for expected placement values\n */\nexport const fromFloatingUIPlacement = (placement: Placement): { position: Position; alignment?: Alignment } => {\n const { side, alignment: floatingUIAlignment } = parseFloatingUIPlacement(placement);\n const position = getPositionMap()[side];\n const alignment = floatingUIAlignment && getAlignmentMap(position)[floatingUIAlignment];\n\n return { position, alignment };\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["packages/react-components/react-positioning/src/utils/fromFloatingUIPlacement.ts"],"names":[],"mappings":"AAEA,SAAS,wBAAT,QAAyC,4BAAzC;;AAEA,MAAM,cAAc,GAAG,OAA+B;EACpD,GAAG,EAAE,OAD+C;EAEpD,MAAM,EAAE,OAF4C;EAGpD,KAAK,EAAE,OAH6C;EAIpD,IAAI,EAAE;AAJ8C,CAA/B,CAAvB,C,CAOA;AACA;;;AACA,MAAM,eAAe,GAAI,QAAD,IAA+D;EACrF,IAAI,QAAQ,KAAK,OAAb,IAAwB,QAAQ,KAAK,OAAzC,EAAkD;IAChD,OAAO;MACL,KAAK,EAAE,OADF;MAEL,GAAG,EAAE;IAFA,CAAP;EAID;;EAED,OAAO;IACL,KAAK,EAAE,KADF;IAEL,GAAG,EAAE;EAFA,CAAP;AAID,CAZD;AAcA;;;AAGG;;;AACH,OAAO,MAAM,uBAAuB,GAAI,SAAD,IAAwE;EAC7G,MAAM;IAAE,IAAF;IAAQ,SAAS,EAAE;EAAnB,IAA2C,wBAAwB,CAAC,SAAD,CAAzE;EACA,MAAM,QAAQ,GAAG,cAAc,GAAG,IAAH,CAA/B;EACA,MAAM,SAAS,GAAG,mBAAmB,IAAI,eAAe,CAAC,QAAD,CAAf,CAA0B,mBAA1B,CAAzC;EAEA,OAAO;IAAE,QAAF;IAAY;EAAZ,CAAP;AACD,CANM","sourcesContent":["import type { Side, Alignment as FloatingUIAlignment, Placement } from '@floating-ui/dom';\nimport type { Alignment, Position } from '../types';\nimport { parseFloatingUIPlacement } from './parseFloatingUIPlacement';\n\nconst getPositionMap = (): Record<Side, Position> => ({\n top: 'above',\n bottom: 'below',\n right: 'after',\n left: 'before',\n});\n\n// Floating UI automatically flips alignment\n// https://github.com/floating-ui/floating-ui/issues/1563\nconst getAlignmentMap = (position: Position): Record<FloatingUIAlignment, Alignment> => {\n if (position === 'above' || position === 'below') {\n return {\n start: 'start',\n end: 'end',\n };\n }\n\n return {\n start: 'top',\n end: 'bottom',\n };\n};\n\n/**\n * Maps Floating UI placement to positioning values\n * @see positioningHelper.test.ts for expected placement values\n */\nexport const fromFloatingUIPlacement = (placement: Placement): { position: Position; alignment?: Alignment } => {\n const { side, alignment: floatingUIAlignment } = parseFloatingUIPlacement(placement);\n const position = getPositionMap()[side];\n const alignment = floatingUIAlignment && getAlignmentMap(position)[floatingUIAlignment];\n\n return { position, alignment };\n};\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["utils/getBoundary.ts"],"names":[],"mappings":"AAEA,SAAS,eAAT,QAAgC,mBAAhC;AAGA;;AAEG;;AACH,OAAM,SAAU,WAAV,CAAsB,OAAtB,EAAmD,QAAnD,EAAsE;EAC1E,IAAI,QAAQ,KAAK,QAAjB,EAA2B;IACzB,OAAO,OAAO,KAAA,IAAP,IAAA,OAAO,KAAA,KAAA,CAAP,GAAO,KAAA,CAAP,GAAA,OAAO,CAAE,aAAT,CAAwB,eAA/B;EACD;;EAED,IAAI,QAAQ,KAAK,iBAAjB,EAAoC;IAClC,OAAO,mBAAP;EACD;;EAED,IAAI,QAAQ,KAAK,cAAjB,EAAiC;IAC/B,IAAI,cAAc,GAA4B,eAAe,CAAC,OAAD,CAA7D;;IAEA,IAAI,cAAc,CAAC,QAAf,KAA4B,MAAhC,EAAwC;MACtC,cAAc,GAAG,OAAO,KAAA,IAAP,IAAA,OAAO,KAAA,KAAA,CAAP,GAAO,KAAA,CAAP,GAAA,OAAO,CAAE,aAAT,CAAwB,eAAzC;IACD;;IAED,OAAO,cAAP;EACD;;EAED,OAAO,QAAP;AACD","sourcesContent":["import type { Boundary as FloatingUIBoundary } from '@floating-ui/dom';\n\nimport { getScrollParent } from './getScrollParent';\nimport type { Boundary } 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(element: HTMLElement | null, boundary?: Boundary): 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"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["packages/react-components/react-positioning/src/utils/getBoundary.ts"],"names":[],"mappings":"AAEA,SAAS,eAAT,QAAgC,mBAAhC;AAGA;;AAEG;;AACH,OAAM,SAAU,WAAV,CAAsB,OAAtB,EAAmD,QAAnD,EAAsE;EAC1E,IAAI,QAAQ,KAAK,QAAjB,EAA2B;IACzB,OAAO,OAAO,KAAA,IAAP,IAAA,OAAO,KAAA,KAAA,CAAP,GAAO,KAAA,CAAP,GAAA,OAAO,CAAE,aAAT,CAAwB,eAA/B;EACD;;EAED,IAAI,QAAQ,KAAK,iBAAjB,EAAoC;IAClC,OAAO,mBAAP;EACD;;EAED,IAAI,QAAQ,KAAK,cAAjB,EAAiC;IAC/B,IAAI,cAAc,GAA4B,eAAe,CAAC,OAAD,CAA7D;;IAEA,IAAI,cAAc,CAAC,QAAf,KAA4B,MAAhC,EAAwC;MACtC,cAAc,GAAG,OAAO,KAAA,IAAP,IAAA,OAAO,KAAA,KAAA,CAAP,GAAO,KAAA,CAAP,GAAA,OAAO,CAAE,aAAT,CAAwB,eAAzC;IACD;;IAED,OAAO,cAAP;EACD;;EAED,OAAO,QAAP;AACD","sourcesContent":["import type { Boundary as FloatingUIBoundary } from '@floating-ui/dom';\n\nimport { getScrollParent } from './getScrollParent';\nimport type { Boundary } 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(element: HTMLElement | null, boundary?: Boundary): 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"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["utils/getFloatingUIOffset.ts"],"names":[],"mappings":"AAEA,SAAS,uBAAT,QAAwC,2BAAxC;AAgCA;;;;AAIG;;AACH,OAAM,SAAU,mBAAV,CACJ,SADI,EACyB;EAE7B,IAAI,CAAC,SAAL,EAAgB;IACd,OAAO,SAAP;EACD;;EAED,IAAI,OAAO,SAAP,KAAqB,QAArB,IAAiC,OAAO,SAAP,KAAqB,QAA1D,EAAoE;IAClE,OAAO,SAAP;EACD;;EAED,OAAO,CAAC;IAAE,KAAK,EAAE;MAAE,QAAF;MAAY;IAAZ,CAAT;IAAkC;EAAlC,CAAD,KAAkD;IACvD,MAAM;MAAE,QAAF;MAAY;IAAZ,IAA0B,uBAAuB,CAAC,SAAD,CAAvD;IACA,OAAO,SAAS,CAAC;MAAE,cAAc,EAAE,QAAlB;MAA4B,UAAU,EAAE,SAAxC;MAAmD,QAAnD;MAA6D;IAA7D,CAAD,CAAhB;EACD,CAHD;AAID","sourcesContent":["import type { Offset } from '../types';\nimport type { MiddlewareArguments } from '@floating-ui/dom';\nimport { fromFloatingUIPlacement } from './fromFloatingUIPlacement';\n/**\n * Type taken from Floating UI since they are not exported\n */\nexport type FloatingUIOffsetValue =\n | number\n | {\n /**\n * The axis that runs along the side of the floating element.\n * @default 0\n */\n mainAxis?: number;\n /**\n * The axis that runs along the alignment of the floating element.\n * @default 0\n */\n crossAxis?: number;\n /**\n * When set to a number, overrides the `crossAxis` value for aligned\n * (non-centered/base) placements and works logically. A positive number\n * will move the floating element in the direction of the opposite edge\n * to the one that is aligned, while a negative number the reverse.\n * @default null\n */\n alignmentAxis?: number | null;\n };\n\n/**\n * Type taken from Floating UI since they are not exported\n */\nexport type FloatingUIOffsetFunction = (args: MiddlewareArguments) => FloatingUIOffsetValue;\n\n/**\n * Shim to transform offset values from this library to Floating UI\n * @param rawOffset Offset from this library\n * @returns An offset value compatible with Floating UI\n */\nexport function getFloatingUIOffset(\n rawOffset: Offset | undefined,\n): FloatingUIOffsetValue | FloatingUIOffsetFunction | undefined {\n if (!rawOffset) {\n return rawOffset;\n }\n\n if (typeof rawOffset === 'number' || typeof rawOffset === 'object') {\n return rawOffset;\n }\n\n return ({ rects: { floating, reference }, placement }) => {\n const { position, alignment } = fromFloatingUIPlacement(placement);\n return rawOffset({ positionedRect: floating, targetRect: reference, position, alignment });\n };\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["packages/react-components/react-positioning/src/utils/getFloatingUIOffset.ts"],"names":[],"mappings":"AAEA,SAAS,uBAAT,QAAwC,2BAAxC;AAgCA;;;;AAIG;;AACH,OAAM,SAAU,mBAAV,CACJ,SADI,EACyB;EAE7B,IAAI,CAAC,SAAL,EAAgB;IACd,OAAO,SAAP;EACD;;EAED,IAAI,OAAO,SAAP,KAAqB,QAArB,IAAiC,OAAO,SAAP,KAAqB,QAA1D,EAAoE;IAClE,OAAO,SAAP;EACD;;EAED,OAAO,CAAC;IAAE,KAAK,EAAE;MAAE,QAAF;MAAY;IAAZ,CAAT;IAAkC;EAAlC,CAAD,KAAkD;IACvD,MAAM;MAAE,QAAF;MAAY;IAAZ,IAA0B,uBAAuB,CAAC,SAAD,CAAvD;IACA,OAAO,SAAS,CAAC;MAAE,cAAc,EAAE,QAAlB;MAA4B,UAAU,EAAE,SAAxC;MAAmD,QAAnD;MAA6D;IAA7D,CAAD,CAAhB;EACD,CAHD;AAID","sourcesContent":["import type { Offset } from '../types';\nimport type { MiddlewareArguments } from '@floating-ui/dom';\nimport { fromFloatingUIPlacement } from './fromFloatingUIPlacement';\n/**\n * Type taken from Floating UI since they are not exported\n */\nexport type FloatingUIOffsetValue =\n | number\n | {\n /**\n * The axis that runs along the side of the floating element.\n * @default 0\n */\n mainAxis?: number;\n /**\n * The axis that runs along the alignment of the floating element.\n * @default 0\n */\n crossAxis?: number;\n /**\n * When set to a number, overrides the `crossAxis` value for aligned\n * (non-centered/base) placements and works logically. A positive number\n * will move the floating element in the direction of the opposite edge\n * to the one that is aligned, while a negative number the reverse.\n * @default null\n */\n alignmentAxis?: number | null;\n };\n\n/**\n * Type taken from Floating UI since they are not exported\n */\nexport type FloatingUIOffsetFunction = (args: MiddlewareArguments) => FloatingUIOffsetValue;\n\n/**\n * Shim to transform offset values from this library to Floating UI\n * @param rawOffset Offset from this library\n * @returns An offset value compatible with Floating UI\n */\nexport function getFloatingUIOffset(\n rawOffset: Offset | undefined,\n): FloatingUIOffsetValue | FloatingUIOffsetFunction | undefined {\n if (!rawOffset) {\n return rawOffset;\n }\n\n if (typeof rawOffset === 'number' || typeof rawOffset === 'object') {\n return rawOffset;\n }\n\n return ({ rects: { floating, reference }, placement }) => {\n const { position, alignment } = fromFloatingUIPlacement(placement);\n return rawOffset({ positionedRect: floating, targetRect: reference, position, alignment });\n };\n}\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["utils/getReactFiberFromNode.ts"],"names":[],"mappings":"AAuEA,IAAK,OAAL;;AA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,CAAA,GAAA,eAAA;EACA,OAAA,CAAA,OAAA,CAAA,0BAAA,CAAA,GAAA,EAAA,CAAA,GAAA,0BAAA;EACA,OAAA,CAAA,OAAA,CAAA,oBAAA,CAAA,GAAA,EAAA,CAAA,GAAA,oBAAA;EACA,OAAA,CAAA,OAAA,CAAA,uBAAA,CAAA,GAAA,EAAA,CAAA,GAAA,uBAAA;EACA,OAAA,CAAA,OAAA,CAAA,sBAAA,CAAA,GAAA,EAAA,CAAA,GAAA,sBAAA;EACA,OAAA,CAAA,OAAA,CAAA,gBAAA,CAAA,GAAA,EAAA,CAAA,GAAA,gBAAA;AACD,CAvBD,EAAK,OAAO,KAAP,OAAO,GAAA,EAAA,CAAZ;;AAsLA,OAAM,SAAU,qBAAV,CAAgC,GAAhC,EAAqD;EACzD,IAAI,CAAC,GAAL,EAAU;IACR,OAAO,IAAP;EACD;;EAED,KAAK,MAAM,CAAX,IAAgB,GAAhB,EAAqB;IACnB;IACA;IACA;IACA,IAAI,CAAC,CAAC,OAAF,CAAU,0BAAV,MAA0C,CAA1C,IAA+C,CAAC,CAAC,OAAF,CAAU,eAAV,MAA+B,CAAlF,EAAqF;MACnF;MACA;MACA,OAAO,GAAG,CAAC,CAAD,CAAV;IACD;EACF;;EAED,MAAM,IAAI,KAAJ,CAAU,yDAAV,CAAN;AACD","sourcesContent":["import * as React from 'react';\n\n// ========================================================\n// react/packages/shared/ReactTypes.js\n// ========================================================\n\ntype ReactEventResponder<E, C> = {\n $$typeof: Symbol | number;\n displayName: string;\n targetEventTypes: null | string[];\n rootEventTypes: null | string[];\n getInitialState: null | ((props: Object) => Object);\n onEvent: null | ((event: E, context: C, props: Object, state: Object) => void);\n onRootEvent: null | ((event: E, context: C, props: Object, state: Object) => void);\n onMount: null | ((context: C, props: Object, state: Object) => void);\n onUnmount: null | ((context: C, props: Object, state: Object) => void);\n};\n\ntype ReactEventResponderInstance<E, C> = {\n fiber: Object;\n props: Object;\n responder: ReactEventResponder<E, C>;\n rootEventTypes: null | Set<string>;\n state: Object;\n};\n\n// ========================================================\n// react/packages/react-reconciler/src/ReactFiberHooks.js\n// ========================================================\n\nexport type HookType =\n | 'useState'\n | 'useReducer'\n | 'useContext'\n | 'useRef'\n | 'useEffect'\n | 'useLayoutEffect'\n | 'useCallback'\n | 'useMemo'\n | 'useImperativeHandle'\n | 'useDebugValue'\n | 'useResponder';\n\ntype ReactProviderType<T> = {\n $$typeof: Symbol | number;\n _context: ReactContext<T>;\n};\n\ntype ReactContext<T> = {\n $$typeof: Symbol | number;\n Consumer: ReactContext<T>;\n Provider: ReactProviderType<T>;\n\n _calculateChangedBits: ((a: T, b: T) => number) | null;\n\n _currentValue: T;\n _currentValue2: T;\n _threadCount: number;\n\n // DEV only\n _currentRenderer?: Object | null;\n _currentRenderer2?: Object | null;\n};\n\ntype ContextDependency<T> = {\n context: ReactContext<T>;\n observedBits: number;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n next: ContextDependency<any> | null;\n};\n\nenum WorkTag {\n FunctionComponent = 0,\n ClassComponent = 1,\n IndeterminateComponent = 2, // Before we know whether it is function or class\n HostRoot = 3, // Root of a host tree. Could be nested inside another node.\n HostPortal = 4, // A subtree. Could be an entry point to a different renderer.\n HostComponent = 5,\n HostText = 6,\n Fragment = 7,\n Mode = 8,\n ContextConsumer = 9,\n ContextProvider = 10,\n ForwardRef = 11,\n Profiler = 12,\n SuspenseComponent = 13,\n MemoComponent = 14,\n SimpleMemoComponent = 15,\n LazyComponent = 16,\n IncompleteClassComponent = 17,\n DehydratedFragment = 18,\n SuspenseListComponent = 19,\n FundamentalComponent = 20,\n ScopeComponent = 21,\n}\n\ntype Source = {\n fileName: string;\n lineNumber: number;\n};\n\ntype ExpirationTime = number;\n\ntype Dependencies = {\n expirationTime: ExpirationTime;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n firstContext: ContextDependency<any> | null;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n responders: Map<ReactEventResponder<any, any>, ReactEventResponderInstance<any, any>> | null;\n};\n\n// ========================================================\n// react/packages/react-reconciler/src/ReactFiber.js\n// ========================================================\n\n// A Fiber is work on a Component that needs to be done or was done. There can\n// be more than one per component.\n\nexport type Fiber = {\n // These first fields are conceptually members of an Instance. This used to\n // be split into a separate type and intersected with the other Fiber fields,\n // but until Flow fixes its intersection bugs, we've merged them into a\n // single type.\n\n // An Instance is shared between all versions of a component. We can easily\n // break this out into a separate object to avoid copying so much to the\n // alternate versions of the tree. We put this on a single object for now to\n // minimize the number of objects created during the initial render.\n\n // Tag identifying the type of fiber.\n tag: WorkTag;\n\n // Unique identifier of this child.\n key: null | string;\n\n // The value of element.type which is used to preserve the identity during\n // reconciliation of this child.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n elementType: any;\n\n // The resolved function/class/ associated with this fiber.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n type: any;\n\n // The local state associated with this fiber.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n stateNode: any;\n\n // Conceptual aliases\n // parent : Instance -> return The parent happens to be the same as the\n // return fiber since we've merged the fiber and instance.\n\n // Remaining fields belong to Fiber\n\n // The Fiber to return to after finishing processing this one.\n // This is effectively the parent, but there can be multiple parents (two)\n // so this is only the parent of the thing we're currently processing.\n // It is conceptually the same as the return address of a stack frame.\n return: Fiber | null;\n\n // Singly Linked List Tree Structure.\n child: Fiber | null;\n sibling: Fiber | null;\n index: number;\n\n // The ref last used to attach this node.\n // I'll avoid adding an owner field for prod and model that as functions.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ref: React.Ref<any>;\n\n // Input is the data coming into process this fiber. Arguments. Props.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n pendingProps: any; // This type will be more specific once we overload the tag.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n memoizedProps: any; // The props used to create the output.\n\n // A queue of state updates and callbacks.\n // updateQueue: UpdateQueue<any> | null,\n\n // The state used to create the output\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n memoizedState: any;\n\n // Dependencies (contexts, events) for this fiber, if it has any\n dependencies: Dependencies | null;\n\n // // Bitfield that describes properties about the fiber and its subtree. E.g.\n // // the ConcurrentMode flag indicates whether the subtree should be async-by-\n // // default. When a fiber is created, it inherits the mode of its\n // // parent. Additional flags can be set at creation time, but after that the\n // // value should remain unchanged throughout the fiber's lifetime, particularly\n // // before its child fibers are created.\n // mode: TypeOfMode\n //\n // // Effect\n // effectTag: SideEffectTag\n\n // Singly linked list fast path to the next fiber with side-effects.\n nextEffect: Fiber | null;\n\n // The first and last fiber with side-effect within this subtree. This allows\n // us to reuse a slice of the linked list when we reuse the work done within\n // this fiber.\n firstEffect: Fiber | null;\n lastEffect: Fiber | null;\n\n // Represents a time in the future by which this work should be completed.\n // Does not include work found in its subtree.\n expirationTime: ExpirationTime;\n\n // This is used to quickly determine if a subtree has no pending changes.\n childExpirationTime: ExpirationTime;\n\n // This is a pooled version of a Fiber. Every fiber that gets updated will\n // eventually have a pair. There are cases when we can clean up pairs to save\n // memory if we need to.\n alternate: Fiber | null;\n\n // Time spent rendering this Fiber and its descendants for the current update.\n // This tells us how well the tree makes use of sCU for memoization.\n // It is reset to 0 each time we render and only updated when we don't bailout.\n // This field is only set when the enableProfilerTimer flag is enabled.\n actualDuration?: number;\n\n // If the Fiber is currently active in the \"render\" phase,\n // This marks the time at which the work began.\n // This field is only set when the enableProfilerTimer flag is enabled.\n actualStartTime?: number;\n\n // Duration of the most recent render time for this Fiber.\n // This value is not updated when we bailout for memoization purposes.\n // This field is only set when the enableProfilerTimer flag is enabled.\n selfBaseDuration?: number;\n\n // Sum of base times for all descendants of this Fiber.\n // This value bubbles up during the \"complete\" phase.\n // This field is only set when the enableProfilerTimer flag is enabled.\n treeBaseDuration?: number;\n\n // Conceptual aliases\n // workInProgress : Fiber -> alternate The alternate used for reuse happens\n // to be the same as work in progress.\n // __DEV__ only\n _debugID?: number;\n _debugSource?: Source | null;\n _debugOwner?: Fiber | null;\n _debugIsCurrentlyTiming?: boolean;\n _debugNeedsRemount?: boolean;\n\n // Used to verify that the order of hooks does not change between renders.\n _debugHookTypes?: HookType[] | null;\n};\n\nexport function getReactFiberFromNode(elm: Node | undefined): Fiber | null {\n if (!elm) {\n return null;\n }\n\n for (const k in elm) {\n // React 16 uses \"__reactInternalInstance$\" prefix\n // React 17 uses \"__reactFiber$\" prefix\n // https://github.com/facebook/react/pull/18377\n if (k.indexOf('__reactInternalInstance$') === 0 || k.indexOf('__reactFiber$') === 0) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return elm[k];\n }\n }\n\n throw new Error('getReactFiber(): Failed to find a React Fiber on a node');\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["packages/react-components/react-positioning/src/utils/getReactFiberFromNode.ts"],"names":[],"mappings":"AAuEA,IAAK,OAAL;;AAAA,CAAA,UAAK,OAAL,EAAY;EACV,OAAA,CAAA,OAAA,CAAA,mBAAA,CAAA,GAAA,CAAA,CAAA,GAAA,mBAAA;EACA,OAAA,CAAA,OAAA,CAAA,gBAAA,CAAA,GAAA,CAAA,CAAA,GAAA,gBAAA;EACA,OAAA,CAAA,OAAA,CAAA,wBAAA,CAAA,GAAA,CAAA,CAAA,GAAA,wBAAA;EACA,OAAA,CAAA,OAAA,CAAA,UAAA,CAAA,GAAA,CAAA,CAAA,GAAA,UAAA;EACA,OAAA,CAAA,OAAA,CAAA,YAAA,CAAA,GAAA,CAAA,CAAA,GAAA,YAAA;EACA,OAAA,CAAA,OAAA,CAAA,eAAA,CAAA,GAAA,CAAA,CAAA,GAAA,eAAA;EACA,OAAA,CAAA,OAAA,CAAA,UAAA,CAAA,GAAA,CAAA,CAAA,GAAA,UAAA;EACA,OAAA,CAAA,OAAA,CAAA,UAAA,CAAA,GAAA,CAAA,CAAA,GAAA,UAAA;EACA,OAAA,CAAA,OAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAA;EACA,OAAA,CAAA,OAA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AV,MAA+B,CAAlF,EAAqF;MACnF;MACA;MACA,OAAO,GAAG,CAAC,CAAD,CAAV;IACD;EACF;;EAED,MAAM,IAAI,KAAJ,CAAU,yDAAV,CAAN;AACD","sourcesContent":["import * as React from 'react';\n\n// ========================================================\n// react/packages/shared/ReactTypes.js\n// ========================================================\n\ntype ReactEventResponder<E, C> = {\n $$typeof: Symbol | number;\n displayName: string;\n targetEventTypes: null | string[];\n rootEventTypes: null | string[];\n getInitialState: null | ((props: Object) => Object);\n onEvent: null | ((event: E, context: C, props: Object, state: Object) => void);\n onRootEvent: null | ((event: E, context: C, props: Object, state: Object) => void);\n onMount: null | ((context: C, props: Object, state: Object) => void);\n onUnmount: null | ((context: C, props: Object, state: Object) => void);\n};\n\ntype ReactEventResponderInstance<E, C> = {\n fiber: Object;\n props: Object;\n responder: ReactEventResponder<E, C>;\n rootEventTypes: null | Set<string>;\n state: Object;\n};\n\n// ========================================================\n// react/packages/react-reconciler/src/ReactFiberHooks.js\n// ========================================================\n\nexport type HookType =\n | 'useState'\n | 'useReducer'\n | 'useContext'\n | 'useRef'\n | 'useEffect'\n | 'useLayoutEffect'\n | 'useCallback'\n | 'useMemo'\n | 'useImperativeHandle'\n | 'useDebugValue'\n | 'useResponder';\n\ntype ReactProviderType<T> = {\n $$typeof: Symbol | number;\n _context: ReactContext<T>;\n};\n\ntype ReactContext<T> = {\n $$typeof: Symbol | number;\n Consumer: ReactContext<T>;\n Provider: ReactProviderType<T>;\n\n _calculateChangedBits: ((a: T, b: T) => number) | null;\n\n _currentValue: T;\n _currentValue2: T;\n _threadCount: number;\n\n // DEV only\n _currentRenderer?: Object | null;\n _currentRenderer2?: Object | null;\n};\n\ntype ContextDependency<T> = {\n context: ReactContext<T>;\n observedBits: number;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n next: ContextDependency<any> | null;\n};\n\nenum WorkTag {\n FunctionComponent = 0,\n ClassComponent = 1,\n IndeterminateComponent = 2, // Before we know whether it is function or class\n HostRoot = 3, // Root of a host tree. Could be nested inside another node.\n HostPortal = 4, // A subtree. Could be an entry point to a different renderer.\n HostComponent = 5,\n HostText = 6,\n Fragment = 7,\n Mode = 8,\n ContextConsumer = 9,\n ContextProvider = 10,\n ForwardRef = 11,\n Profiler = 12,\n SuspenseComponent = 13,\n MemoComponent = 14,\n SimpleMemoComponent = 15,\n LazyComponent = 16,\n IncompleteClassComponent = 17,\n DehydratedFragment = 18,\n SuspenseListComponent = 19,\n FundamentalComponent = 20,\n ScopeComponent = 21,\n}\n\ntype Source = {\n fileName: string;\n lineNumber: number;\n};\n\ntype ExpirationTime = number;\n\ntype Dependencies = {\n expirationTime: ExpirationTime;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n firstContext: ContextDependency<any> | null;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n responders: Map<ReactEventResponder<any, any>, ReactEventResponderInstance<any, any>> | null;\n};\n\n// ========================================================\n// react/packages/react-reconciler/src/ReactFiber.js\n// ========================================================\n\n// A Fiber is work on a Component that needs to be done or was done. There can\n// be more than one per component.\n\nexport type Fiber = {\n // These first fields are conceptually members of an Instance. This used to\n // be split into a separate type and intersected with the other Fiber fields,\n // but until Flow fixes its intersection bugs, we've merged them into a\n // single type.\n\n // An Instance is shared between all versions of a component. We can easily\n // break this out into a separate object to avoid copying so much to the\n // alternate versions of the tree. We put this on a single object for now to\n // minimize the number of objects created during the initial render.\n\n // Tag identifying the type of fiber.\n tag: WorkTag;\n\n // Unique identifier of this child.\n key: null | string;\n\n // The value of element.type which is used to preserve the identity during\n // reconciliation of this child.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n elementType: any;\n\n // The resolved function/class/ associated with this fiber.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n type: any;\n\n // The local state associated with this fiber.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n stateNode: any;\n\n // Conceptual aliases\n // parent : Instance -> return The parent happens to be the same as the\n // return fiber since we've merged the fiber and instance.\n\n // Remaining fields belong to Fiber\n\n // The Fiber to return to after finishing processing this one.\n // This is effectively the parent, but there can be multiple parents (two)\n // so this is only the parent of the thing we're currently processing.\n // It is conceptually the same as the return address of a stack frame.\n return: Fiber | null;\n\n // Singly Linked List Tree Structure.\n child: Fiber | null;\n sibling: Fiber | null;\n index: number;\n\n // The ref last used to attach this node.\n // I'll avoid adding an owner field for prod and model that as functions.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ref: React.Ref<any>;\n\n // Input is the data coming into process this fiber. Arguments. Props.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n pendingProps: any; // This type will be more specific once we overload the tag.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n memoizedProps: any; // The props used to create the output.\n\n // A queue of state updates and callbacks.\n // updateQueue: UpdateQueue<any> | null,\n\n // The state used to create the output\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n memoizedState: any;\n\n // Dependencies (contexts, events) for this fiber, if it has any\n dependencies: Dependencies | null;\n\n // // Bitfield that describes properties about the fiber and its subtree. E.g.\n // // the ConcurrentMode flag indicates whether the subtree should be async-by-\n // // default. When a fiber is created, it inherits the mode of its\n // // parent. Additional flags can be set at creation time, but after that the\n // // value should remain unchanged throughout the fiber's lifetime, particularly\n // // before its child fibers are created.\n // mode: TypeOfMode\n //\n // // Effect\n // effectTag: SideEffectTag\n\n // Singly linked list fast path to the next fiber with side-effects.\n nextEffect: Fiber | null;\n\n // The first and last fiber with side-effect within this subtree. This allows\n // us to reuse a slice of the linked list when we reuse the work done within\n // this fiber.\n firstEffect: Fiber | null;\n lastEffect: Fiber | null;\n\n // Represents a time in the future by which this work should be completed.\n // Does not include work found in its subtree.\n expirationTime: ExpirationTime;\n\n // This is used to quickly determine if a subtree has no pending changes.\n childExpirationTime: ExpirationTime;\n\n // This is a pooled version of a Fiber. Every fiber that gets updated will\n // eventually have a pair. There are cases when we can clean up pairs to save\n // memory if we need to.\n alternate: Fiber | null;\n\n // Time spent rendering this Fiber and its descendants for the current update.\n // This tells us how well the tree makes use of sCU for memoization.\n // It is reset to 0 each time we render and only updated when we don't bailout.\n // This field is only set when the enableProfilerTimer flag is enabled.\n actualDuration?: number;\n\n // If the Fiber is currently active in the \"render\" phase,\n // This marks the time at which the work began.\n // This field is only set when the enableProfilerTimer flag is enabled.\n actualStartTime?: number;\n\n // Duration of the most recent render time for this Fiber.\n // This value is not updated when we bailout for memoization purposes.\n // This field is only set when the enableProfilerTimer flag is enabled.\n selfBaseDuration?: number;\n\n // Sum of base times for all descendants of this Fiber.\n // This value bubbles up during the \"complete\" phase.\n // This field is only set when the enableProfilerTimer flag is enabled.\n treeBaseDuration?: number;\n\n // Conceptual aliases\n // workInProgress : Fiber -> alternate The alternate used for reuse happens\n // to be the same as work in progress.\n // __DEV__ only\n _debugID?: number;\n _debugSource?: Source | null;\n _debugOwner?: Fiber | null;\n _debugIsCurrentlyTiming?: boolean;\n _debugNeedsRemount?: boolean;\n\n // Used to verify that the order of hooks does not change between renders.\n _debugHookTypes?: HookType[] | null;\n};\n\nexport function getReactFiberFromNode(elm: Node | undefined): Fiber | null {\n if (!elm) {\n return null;\n }\n\n for (const k in elm) {\n // React 16 uses \"__reactInternalInstance$\" prefix\n // React 17 uses \"__reactFiber$\" prefix\n // https://github.com/facebook/react/pull/18377\n if (k.indexOf('__reactInternalInstance$') === 0 || k.indexOf('__reactFiber$') === 0) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return elm[k];\n }\n }\n\n throw new Error('getReactFiber(): Failed to find a React Fiber on a node');\n}\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["utils/getScrollParent.ts"],"names":[],"mappings":"AAAA;;;;AAIG;AACH,OAAO,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,I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C,GAAiC,KAAA,CAAjC,GAAiC,EAAA,CAAE,IAAxC,CAAtB,GAAqE,KAA/F;AACD,CAHM","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,"sources":["packages/react-components/react-positioning/src/utils/getScrollParent.ts"],"names":[],"mappings":"AAAA;;;;AAIG;AACH,OAAO,MAAM,aAAa,GAAI,IAAD,IAAmC;EAC9D,IAAI,IAAI,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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","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 +1 @@
1
- {"version":3,"sources":["utils/hasAutoFocusFilter.ts"],"names":[],"mappings":"AAAA;AACA;AACA;AAEA,SAAS,qBAAT,QAAsC,yBAAtC;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,qBAAqB,CAAC,IAAD,CAArB,MAA2B,IAA3B,IAA2B,EAAA,KAAA,KAAA,CAA3B,GAA2B,KAAA,CAA3B,GAA2B,EAAA,CAAE,YAAF,CAAe,SAA3C,CAAR;EACD;;EAED,OAAO,KAAP;AACD;;AAED,OAAM,SAAU,kBAAV,CAA6B,IAA7B,EAAuC;EAC3C,OAAO,gBAAgB,CAAC,IAAD,CAAhB,GAAyB,UAAU,CAAC,aAApC,GAAoD,UAAU,CAAC,WAAtE;AACD","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,"sources":["packages/react-components/react-positioning/src/utils/hasAutoFocusFilter.ts"],"names":[],"mappings":"AAAA;AACA;AACA;AAEA,SAAS,qBAAT,QAAsC,yBAAtC;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,qBAAqB,CAAC,IAAD,CAArB,MAA2B,IAA3B,IAA2B,EAAA,KAAA,KAAA,CAA3B,GAA2B,KAAA,CAA3B,GAA2B,EAAA,CAAE,YAAF,CAAe,SAA3C,CAAR;EACD;;EAED,OAAO,KAAP;AACD;;AAED,OAAM,SAAU,kBAAV,CAA6B,IAA7B,EAAuC;EAC3C,OAAO,gBAAgB,CAAC,IAAD,CAAhB,GAAyB,UAAU,CAAC,aAApC,GAAoD,UAAU,CAAC,WAAtE;AACD","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 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,eAAe,CAAC;AAC9B,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC","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"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["packages/react-components/react-positioning/src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,eAAe,CAAC;AAC9B,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC","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"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["utils/mergeArrowOffset.ts"],"names":[],"mappings":"AAEA;;;;;;;;AAQG;AACH,OAAM,SAAU,gBAAV,CAA2B,UAA3B,EAAkE,WAAlE,EAAqF;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;;AAED,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,"sources":["packages/react-components/react-positioning/src/utils/mergeArrowOffset.ts"],"names":[],"mappings":"AAEA;;;;;;;;AAQG;AACH,OAAM,SAAU,gBAAV,CAA2B,UAA3B,EAAkE,WAAlE,EAAqF;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;;AAED,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 +1 @@
1
- {"version":3,"sources":["utils/parseFloatingUIPlacement.ts"],"names":[],"mappings":"AAEA;;;;;AAKG;AACH,OAAM,SAAU,wBAAV,CAAmC,SAAnC,EAAuD;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","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,"sources":["packages/react-components/react-positioning/src/utils/parseFloatingUIPlacement.ts"],"names":[],"mappings":"AAEA;;;;;AAKG;AACH,OAAM,SAAU,wBAAV,CAAmC,SAAnC,EAAuD;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","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 +1 @@
1
- {"version":3,"sources":["utils/resolvePositioningShor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orthandValue, 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,"sources":["packages/react-components/react-positioning/src/utils/resolvePositioningShorthand.ts"],"names":[],"mappings":"AAEA;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,OAAM,SAAU,2BAAV,CACJ,SADI,EAC8C;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","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 +1 @@
1
- {"version":3,"sources":["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;;;AACH,OAAO,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","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,"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;;;AACH,OAAO,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","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 +1 @@
1
- {"version":3,"sources":["utils/toggleScrollListener.ts"],"names":[],"mappings":"AACA,SAAS,eAAT,QAAgC,mBAAhC;AAEA;;;;;AAKG;;AACH,OAAM,SAAU,oBAAV,CACJ,IADI,EAEJ,IAFI,EAGJ,OAHI,EAGkB;EAEtB,IAAI,IAAI,KAAK,IAAb,EAAmB;IACjB;EACD;;EAED,IAAI,IAAI,YAAY,WAApB,EAAiC;IAC/B,MAAM,gBAAgB,GAAG,eAAe,CAAC,IAAD,CAAxC;IACA,gBAAgB,CAAC,mBAAjB,CAAqC,QAArC,EAA+C,OAA/C;EACD;;EACD,IAAI,IAAI,YAAY,WAApB,EAAiC;IAC/B,MAAM,YAAY,GAAG,eAAe,CAAC,IAAD,CAApC;IACA,YAAY,CAAC,gBAAb,CAA8B,QAA9B,EAAwC,OAAxC;EACD;AACF","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,"sources":["packages/react-components/react-positioning/src/utils/toggleScrollListener.ts"],"names":[],"mappings":"AACA,SAAS,eAAT,QAAgC,mBAAhC;AAEA;;;;;AAKG;;AACH,OAAM,SAAU,oBAAV,CACJ,IADI,EAEJ,IAFI,EAGJ,OAHI,EAGkB;EAEtB,IAAI,IAAI,KAAK,IAAb,EAAmB;IACjB;EACD;;EAED,IAAI,IAAI,YAAY,WAApB,EAAiC;IAC/B,MAAM,gBAAgB,GAAG,eAAe,CAAC,IAAD,CAAxC;IACA,gBAAgB,CAAC,mBAAjB,CAAqC,QAArC,EAA+C,OAA/C;EACD;;EACD,IAAI,IAAI,YAAY,WAApB,EAAiC;IAC/B,MAAM,YAAY,GAAG,eAAe,CAAC,IAAD,CAApC;IACA,YAAY,CAAC,gBAAb,CAA8B,QAA9B,EAAwC,OAAxC;EACD;AACF","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/"}