@fluentui/react-positioning 9.0.0-rc.9 → 9.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. package/CHANGELOG.json +177 -1
  2. package/CHANGELOG.md +73 -2
  3. package/dist/index.d.ts +80 -48
  4. package/lib/createArrowStyles.js +3 -1
  5. package/lib/createArrowStyles.js.map +1 -1
  6. package/lib/createVirtualElementFromClick.js +2 -0
  7. package/lib/createVirtualElementFromClick.js.map +1 -1
  8. package/lib/index.js +2 -2
  9. package/lib/index.js.map +1 -1
  10. package/lib/isIntersectingModifier.js.map +1 -1
  11. package/lib/types.js.map +1 -1
  12. package/lib/{usePopper.js → usePositioning.js} +10 -8
  13. package/lib/usePositioning.js.map +1 -0
  14. package/lib/{usePopperMouseTarget.js → usePositioningMouseTarget.js} +4 -3
  15. package/lib/usePositioningMouseTarget.js.map +1 -0
  16. package/lib/utils/fromPopperPlacement.js +40 -0
  17. package/lib/utils/fromPopperPlacement.js.map +1 -0
  18. package/lib/utils/getBoundary.js +1 -1
  19. package/lib/utils/getBoundary.js.map +1 -1
  20. package/lib/utils/getPopperOffset.js +44 -0
  21. package/lib/utils/getPopperOffset.js.map +1 -0
  22. package/lib/utils/getReactFiberFromNode.js.map +1 -1
  23. package/lib/utils/getScrollParent.js.map +1 -1
  24. package/lib/utils/index.js +1 -1
  25. package/lib/utils/index.js.map +1 -1
  26. package/lib/utils/mergeArrowOffset.js +24 -22
  27. package/lib/utils/mergeArrowOffset.js.map +1 -1
  28. package/lib/utils/parsePopperPlacement.js +14 -0
  29. package/lib/utils/parsePopperPlacement.js.map +1 -0
  30. package/lib/utils/positioningHelper.js.map +1 -1
  31. package/lib/utils/resolvePositioningShorthand.js.map +1 -1
  32. package/lib/utils/useCallbackRef.js.map +1 -1
  33. package/lib-commonjs/createArrowStyles.js +3 -1
  34. package/lib-commonjs/createArrowStyles.js.map +1 -1
  35. package/lib-commonjs/createVirtualElementFromClick.js +2 -0
  36. package/lib-commonjs/createVirtualElementFromClick.js.map +1 -1
  37. package/lib-commonjs/index.js +7 -7
  38. package/lib-commonjs/index.js.map +1 -1
  39. package/lib-commonjs/isIntersectingModifier.js.map +1 -1
  40. package/lib-commonjs/{usePopper.js → usePositioning.js} +13 -10
  41. package/lib-commonjs/usePositioning.js.map +1 -0
  42. package/lib-commonjs/{usePopperMouseTarget.js → usePositioningMouseTarget.js} +6 -5
  43. package/lib-commonjs/usePositioningMouseTarget.js.map +1 -0
  44. package/lib-commonjs/utils/fromPopperPlacement.js +50 -0
  45. package/lib-commonjs/utils/fromPopperPlacement.js.map +1 -0
  46. package/lib-commonjs/utils/getBoundary.js +1 -1
  47. package/lib-commonjs/utils/getBoundary.js.map +1 -1
  48. package/lib-commonjs/utils/getPopperOffset.js +54 -0
  49. package/lib-commonjs/utils/getPopperOffset.js.map +1 -0
  50. package/lib-commonjs/utils/getReactFiberFromNode.js.map +1 -1
  51. package/lib-commonjs/utils/getScrollParent.js.map +1 -1
  52. package/lib-commonjs/utils/index.js +2 -2
  53. package/lib-commonjs/utils/index.js.map +1 -1
  54. package/lib-commonjs/utils/mergeArrowOffset.js +24 -22
  55. package/lib-commonjs/utils/mergeArrowOffset.js.map +1 -1
  56. package/lib-commonjs/utils/parsePopperPlacement.js +23 -0
  57. package/lib-commonjs/utils/parsePopperPlacement.js.map +1 -0
  58. package/lib-commonjs/utils/positioningHelper.js.map +1 -1
  59. package/lib-commonjs/utils/resolvePositioningShorthand.js.map +1 -1
  60. package/lib-commonjs/utils/useCallbackRef.js.map +1 -1
  61. package/package.json +6 -8
  62. package/lib/usePopper.js.map +0 -1
  63. package/lib/usePopperMouseTarget.js.map +0 -1
  64. package/lib/utils/getBasePlacement.js +0 -10
  65. package/lib/utils/getBasePlacement.js.map +0 -1
  66. package/lib-commonjs/usePopper.js.map +0 -1
  67. package/lib-commonjs/usePopperMouseTarget.js.map +0 -1
  68. package/lib-commonjs/utils/getBasePlacement.js +0 -19
  69. package/lib-commonjs/utils/getBasePlacement.js.map +0 -1
@@ -9,6 +9,7 @@ const react_1 = /*#__PURE__*/require("@griffel/react");
9
9
 
10
10
  const react_theme_1 = /*#__PURE__*/require("@fluentui/react-theme");
11
11
  /**
12
+ * @internal
12
13
  * Helper that creates a makeStyles rule for an arrow element.
13
14
  * For runtime arrow size toggling simply create extra classnames to apply to the arrow element
14
15
  *
@@ -45,7 +46,7 @@ function createArrowStyles(options) {
45
46
  visibility: 'hidden',
46
47
  zIndex: -1,
47
48
  ...(arrowHeight && createArrowHeightStyles(arrowHeight)),
48
- ':before': {
49
+ '::before': {
49
50
  content: '""',
50
51
  visibility: 'visible',
51
52
  position: 'absolute',
@@ -80,6 +81,7 @@ function createArrowStyles(options) {
80
81
 
81
82
  exports.createArrowStyles = createArrowStyles;
82
83
  /**
84
+ * @internal
83
85
  * Creates CSS styles to size the arrow created by createArrowStyles to the given height.
84
86
  *
85
87
  * Use this when you need to create classes for several different arrow sizes. If you only need a
@@ -1 +1 @@
1
- {"version":3,"sources":["createArrowStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,OAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AACA,MAAA,aAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;AAqCA;;;;;;;;;;;;;;;;;;;;;AAqBG;;;AACH,SAAgB,iBAAhB,CAAkC,OAAlC,EAAmE;AACjE,QAAM;AACJ,IAAA,WADI;AAEJ,IAAA,WAAW,GAAG,KAFV;AAGJ,IAAA,WAAW,GAAG,OAHV;AAIJ,IAAA,WAAW,GAAG,aAAA,CAAA,MAAA,CAAO;AAJjB,MAKF,OALJ;AAOA,SAAO;AACL,IAAA,QAAQ,EAAE,UADL;AAEL,IAAA,eAAe,EAAE,SAFZ;AAGL,IAAA,UAAU,EAAE,QAHP;AAIL,IAAA,MAAM,EAAE,CAAC,CAJJ;AAML,QAAI,WAAW,IAAI,uBAAuB,CAAC,WAAD,CAA1C,CANK;AAQL,eAAW;AACT,MAAA,OAAO,EAAE,IADA;AAET,MAAA,UAAU,EAAE,SAFH;AAGT,MAAA,QAAQ,EAAE,UAHD;AAIT,MAAA,SAAS,EAAE,YAJF;AAKT,MAAA,KAAK,EAAE,SALE;AAMT,MAAA,MAAM,EAAE,SANC;AAOT,MAAA,eAAe,EAAE,SAPR;AAQT,SAAG,OAAA,CAAA,UAAA,CAAW,WAAX,CACD,GAAG,WAAW,gBADb,EAED,GAAG,WAAW,gBAFb,EAGD,GAAG,WAAW,gBAHb,CARM;AAaT,SAAG,OAAA,CAAA,UAAA,CAAW,YAAX,CAAwB,WAAxB,EAAqC,WAArC,EAAkD,WAAlD,CAbM;AAcT,MAAA,uBAAuB,EAAE,aAAA,CAAA,MAAA,CAAO,iBAdvB;AAeT,MAAA,SAAS,EAAE;AAfF,KARN;AA0BL;AACA,+CAA2C;AACzC,MAAA,MAAM,EAAE,IAAI,WAAW,EADkB;AAEzC,iBAAW;AAF8B,KA3BtC;AA+BL,iDAA6C;AAC3C,MAAA,IAAI,EAAE,IAAI,WAAW,gBADsB;AAE3C,iBAAW;AAFgC,KA/BxC;AAmCL,kDAA8C;AAC5C,MAAA,GAAG,EAAE,IAAI,WAAW,EADwB;AAE5C,iBAAW;AAFiC,KAnCzC;AAuCL,gDAA4C;AAC1C,MAAA,KAAK,EAAE,IAAI,WAAW,gBADoB;AAE1C,iBAAW;AAF+B;AAvCvC,GAAP;AA4CD;;AApDD,OAAA,CAAA,iBAAA,GAAA,iBAAA;AAsDA;;;;;AAKG;;AACH,SAAgB,uBAAhB,CAAwC,WAAxC,EAA2D;AACzD;AACA;AACA,QAAM,UAAU,GAAG,GAAG,QAAQ,WAAW,IAAzC;AACA,SAAO;AAAE,IAAA,KAAK,EAAE,UAAT;AAAqB,IAAA,MAAM,EAAE;AAA7B,GAAP;AACD;;AALD,OAAA,CAAA,uBAAA,GAAA,uBAAA","sourcesContent":["import { shorthands } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport type { GriffelStyle } from '@griffel/react';\n\n/**\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 * 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 * 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":["createArrowStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,OAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AACA,MAAA,aAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;AAsCA;;;;;;;;;;;;;;;;;;;;;;AAsBG;;;AACH,SAAgB,iBAAhB,CAAkC,OAAlC,EAAmE;EACjE,MAAM;IACJ,WADI;IAEJ,WAAW,GAAG,KAFV;IAGJ,WAAW,GAAG,OAHV;IAIJ,WAAW,GAAG,aAAA,CAAA,MAAA,CAAO;EAJjB,IAKF,OALJ;EAOA,OAAO;IACL,QAAQ,EAAE,U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Content":["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/"}
@@ -21,6 +21,8 @@ function createVirtualElementFromClick(nativeEvent) {
21
21
  top,
22
22
  right,
23
23
  bottom,
24
+ x: left,
25
+ y: top,
24
26
  height: 1,
25
27
  width: 1
26
28
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["createVirtualElementFromClick.ts"],"names":[],"mappings":";;;;;;AAEA;;;AAGG;;AACH,SAAgB,6BAAhB,CAA8C,WAA9C,EAAqE;AACnE,QAAM,IAAI,GAAG,WAAW,CAAC,OAAzB;AACA,QAAM,GAAG,GAAG,WAAW,CAAC,OAAxB;AACA,QAAM,KAAK,GAAG,IAAI,GAAG,CAArB;AACA,QAAM,MAAM,GAAG,GAAG,GAAG,CAArB;;AAEA,WAAS,qBAAT,GAA8B;AAC5B,WAAO;AACL,MAAA,IADK;AAEL,MAAA,GAFK;AAGL,MAAA,KAHK;AAIL,MAAA,MAJK;AAML,MAAA,MAAM,EAAE,CANH;AAOL,MAAA,KAAK,EAAE;AAPF,KAAP;AASD;;AAED,SAAO;AACL,IAAA;AADK,GAAP;AAGD;;AArBD,OAAA,CAAA,6BAAA,GAAA,6BAAA","sourcesContent":["import type { PopperVirtualElement } 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): PopperVirtualElement {\n const left = nativeEvent.clientX;\n const top = nativeEvent.clientY;\n const right = left + 1;\n const bottom = top + 1;\n\n function getBoundingClientRect(): ClientRect {\n return {\n left,\n top,\n right,\n bottom,\n\n height: 1,\n width: 1,\n };\n }\n\n return {\n getBoundingClientRect,\n };\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["createVirtualElementFromClick.ts"],"names":[],"mappings":";;;;;;AAEA;;;AAGG;;AACH,SAAgB,6BAAhB,CAA8C,WAA9C,EAAqE;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;;AAtBD,OAAA,CAAA,6BAAA,GAAA,6BAAA","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/"}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.mergeArrowOffset = exports.resolvePositioningShorthand = exports.usePopperMouseTarget = exports.usePopper = exports.createArrowStyles = exports.createArrowHeightStyles = exports.createVirtualElementFromClick = void 0;
6
+ exports.mergeArrowOffset = exports.resolvePositioningShorthand = exports.usePositioningMouseTarget = exports.usePositioning = exports.createArrowStyles = exports.createArrowHeightStyles = exports.createVirtualElementFromClick = void 0;
7
7
 
8
8
  var createVirtualElementFromClick_1 = /*#__PURE__*/require("./createVirtualElementFromClick");
9
9
 
@@ -29,21 +29,21 @@ Object.defineProperty(exports, "createArrowStyles", {
29
29
  }
30
30
  });
31
31
 
32
- var usePopper_1 = /*#__PURE__*/require("./usePopper");
32
+ var usePositioning_1 = /*#__PURE__*/require("./usePositioning");
33
33
 
34
- Object.defineProperty(exports, "usePopper", {
34
+ Object.defineProperty(exports, "usePositioning", {
35
35
  enumerable: true,
36
36
  get: function () {
37
- return usePopper_1.usePopper;
37
+ return usePositioning_1.usePositioning;
38
38
  }
39
39
  });
40
40
 
41
- var usePopperMouseTarget_1 = /*#__PURE__*/require("./usePopperMouseTarget");
41
+ var usePositioningMouseTarget_1 = /*#__PURE__*/require("./usePositioningMouseTarget");
42
42
 
43
- Object.defineProperty(exports, "usePopperMouseTarget", {
43
+ Object.defineProperty(exports, "usePositioningMouseTarget", {
44
44
  enumerable: true,
45
45
  get: function () {
46
- return usePopperMouseTarget_1.usePopperMouseTarget;
46
+ return usePositioningMouseTarget_1.usePositioningMouseTarget;
47
47
  }
48
48
  });
49
49
 
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,+BAAA,gBAAA,OAAA,CAAA,iCAAA,CAAA;;AAAS,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,+BAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,+BAAA,CAAA,6BAAA;AAA6B;AAA7B,CAAA;;AACT,IAAA,mBAAA,gBAAA,OAAA,CAAA,qBAAA,CAAA;;AAAS,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,yBAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,mBAAA,CAAA,uBAAA;AAAuB;AAAvB,CAAA;AAAyB,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,mBAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,mBAAA,CAAA,iBAAA;AAAiB;AAAjB,CAAA;;AAElC,IAAA,WAAA,gBAAA,OAAA,CAAA,aAAA,CAAA;;AAAS,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,WAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,WAAA,CAAA,SAAA;AAAS;AAAT,CAAA;;AACT,IAAA,sBAAA,gBAAA,OAAA,CAAA,wBAAA,CAAA;;AAAS,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,sBAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,sBAAA,CAAA,oBAAA;AAAoB;AAApB,CAAA;;AACT,IAAA,OAAA,gBAAA,OAAA,CAAA,eAAA,CAAA;;AAAS,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,6BAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,OAAA,CAAA,2BAAA;AAA2B;AAA3B,CAAA;AAA6B,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,kBAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,OAAA,CAAA,gBAAA;AAAgB;AAAhB,CAAA","sourcesContent":["export { createVirtualElementFromClick } from './createVirtualElementFromClick';\nexport { createArrowHeightStyles, createArrowStyles } from './createArrowStyles';\nexport type { CreateArrowStylesOptions } from './createArrowStyles';\nexport { usePopper } from './usePopper';\nexport { usePopperMouseTarget } from './usePopperMouseTarget';\nexport { resolvePositioningShorthand, mergeArrowOffset } from './utils/index';\nexport type {\n Alignment,\n AutoSize,\n Boundary,\n Offset,\n OffsetFunction,\n OffsetFunctionParam,\n PopperOptions,\n PopperRefHandle,\n PopperVirtualElement,\n Position,\n PositioningProps,\n PositioningShorthand,\n PositioningShorthandValue,\n} from './types';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,+BAAA,gBAAA,OAAA,CAAA,iCAAA,CAAA;;AAAS,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,+BAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,+BAAA,CAAA,6BAAA;EAA6B;AAA7B,CAAA;;AACT,IAAA,mBAAA,gBAAA,OAAA,CAAA,qBAAA,CAAA;;AAAS,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,yBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,mBAAA,CAAA,uBAAA;EAAuB;AAAvB,CAAA;AAAyB,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,mBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,mBAAA,CAAA,iBAAA;EAAiB;AAAjB,CAAA;;AAElC,IAAA,gBAAA,gBAAA,OAAA,CAAA,kBAAA,CAAA;;AAAS,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,gBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,gBAAA,CAAA,cAAA;EAAc;AAAd,CAAA;;AACT,IAAA,2BAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;;AAAS,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,2BAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,2BAAA,CAAA,yBAAA;EAAyB;AAAzB,CAAA;;AACT,IAAA,OAAA,gBAAA,OAAA,CAAA,eAAA,CAAA;;AAAS,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,6BAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,OAAA,CAAA,2BAAA;EAA2B;AAA3B,CAAA;AAA6B,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,kBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,OAAA,CAAA,gBAAA;EAAgB;AAAhB,CAAA","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} from './types';\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["isIntersectingModifier.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,MAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AAEa,OAAA,CAAA,sBAAA,GAAiD;AAC5D,EAAA,IAAI,EAAE,0BADsD;AAE5D,EAAA,OAAO,EAAE,IAFmD;AAG5D,EAAA,KAAK,EAAE,MAHqD;AAI5D,EAAA,QAAQ,EAAE,CAAC,iBAAD,CAJkD;AAK5D,EAAA,EAAE,EAAE,CAAC;AAAE,IAAA,KAAF;AAAS,IAAA;AAAT,GAAD,KAAoB;AACtB,UAAM,UAAU,GAAG,KAAK,CAAC,KAAN,CAAY,MAA/B;AACA,UAAM,iBAAiB,GAAG,MAAA,CAAA,cAAA,CAAe,KAAf,EAAsB;AAAE,MAAA,WAAW,EAAE;AAAf,KAAtB,CAA1B;AAEA,UAAM,iBAAiB,GAAG,iBAAiB,CAAC,GAAlB,GAAwB,UAAU,CAAC,MAAnC,IAA6C,iBAAiB,CAAC,GAAlB,GAAwB,CAA/F;AACA,UAAM,oBAAoB,GAAG,iBAAiB,CAAC,MAAlB,GAA2B,UAAU,CAAC,MAAtC,IAAgD,iBAAiB,CAAC,MAAlB,GAA2B,CAAxG;AAEA,UAAM,cAAc,GAAG,iBAAiB,IAAI,oBAA5C;AAEA,IAAA,KAAK,CAAC,aAAN,CAAoB,IAApB,IAA4B;AAC1B,MAAA;AAD0B,KAA5B;AAGA,IAAA,KAAK,CAAC,UAAN,CAAiB,MAAjB,GAA0B,EACxB,GAAG,KAAK,CAAC,UAAN,CAAiB,MADI;AAExB,qCAA+B;AAFP,KAA1B;AAID;AArB2D,CAAjD","sourcesContent":["import { detectOverflow, Modifier } from '@popperjs/core';\n\nexport const isIntersectingModifier: IsIntersectingModifier = {\n name: 'is-intersecting-modifier',\n enabled: true,\n phase: 'main',\n requires: ['preventOverflow'],\n fn: ({ state, name }) => {\n const popperRect = state.rects.popper;\n const popperAltOverflow = detectOverflow(state, { altBoundary: true });\n\n const isIntersectingTop = popperAltOverflow.top < popperRect.height && popperAltOverflow.top > 0;\n const isIntersectingBottom = popperAltOverflow.bottom < popperRect.height && popperAltOverflow.bottom > 0;\n\n const isIntersecting = isIntersectingTop || isIntersectingBottom;\n\n state.modifiersData[name] = {\n isIntersecting,\n };\n state.attributes.popper = {\n ...state.attributes.popper,\n 'data-popper-is-intersecting': isIntersecting,\n };\n },\n};\n\ntype IsIntersectingModifier = Modifier<'is-intersecting-modifier', never>;\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["isIntersectingModifier.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,MAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AAEa,OAAA,CAAA,sBAAA,GAAiD;EAC5D,IAAI,EAAE,0BADsD;EAE5D,OAAO,EAAE,IAFmD;EAG5D,KAAK,EAAE,MAHqD;EAI5D,QAAQ,EAAE,CAAC,iBAAD,CAJkD;EAK5D,EAAE,EAAE,CAAC;IAAE,KAAF;IAAS;EAAT,CAAD,KAAoB;IACtB,MAAM,UAAU,GAAG,KAAK,CAAC,KAAN,CAAY,MAA/B;IACA,MAAM,iBAAiB,GAAG,MAAA,CAAA,cAAA,CAAe,KAAf,EAAsB;MAAE,WAAW,EAAE;IAAf,CAAtB,CAA1B;IAEA,MAAM,iBAAiB,GAAG,iBAAiB,CAAC,GAAlB,GAAwB,UAAU,CAAC,MAAnC,IAA6C,iBAAiB,CAAC,GAAlB,GAAwB,CAA/F;IACA,MAAM,oBAAoB,GAAG,iBAAiB,CAAC,MAAlB,GAA2B,UAAU,CAAC,MAAtC,IAAgD,iBAAiB,CAAC,MAAlB,GAA2B,CAAxG;IAEA,MAAM,cAAc,GAAG,iBAAiB,IAAI,oBAA5C;IAEA,KAAK,CAAC,aAAN,CAAoB,IAApB,IAA4B;MAC1B;IAD0B,CAA5B;IAGA,KAAK,CAAC,UAAN,CAAiB,MAAjB,GAA0B,EACxB,GAAG,KAAK,CAAC,UAAN,CAAiB,MADI;MAExB,+BAA+B;IAFP,CAA1B;EAID;AArB2D,CAAjD","sourcesContent":["import { detectOverflow, Modifier } from '@popperjs/core';\n\nexport const isIntersectingModifier: IsIntersectingModifier = {\n name: 'is-intersecting-modifier',\n enabled: true,\n phase: 'main',\n requires: ['preventOverflow'],\n fn: ({ state, name }) => {\n const popperRect = state.rects.popper;\n const popperAltOverflow = detectOverflow(state, { altBoundary: true });\n\n const isIntersectingTop = popperAltOverflow.top < popperRect.height && popperAltOverflow.top > 0;\n const isIntersectingBottom = popperAltOverflow.bottom < popperRect.height && popperAltOverflow.bottom > 0;\n\n const isIntersecting = isIntersectingTop || isIntersectingBottom;\n\n state.modifiersData[name] = {\n isIntersecting,\n };\n state.attributes.popper = {\n ...state.attributes.popper,\n 'data-popper-is-intersecting': isIntersecting,\n };\n },\n};\n\ntype IsIntersectingModifier = Modifier<'is-intersecting-modifier', never>;\n"],"sourceRoot":"../src/"}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.usePopper = void 0;
6
+ exports.usePositioning = void 0;
7
7
 
8
8
  const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
9
9
 
@@ -15,7 +15,9 @@ const React = /*#__PURE__*/require("react");
15
15
 
16
16
  const isIntersectingModifier_1 = /*#__PURE__*/require("./isIntersectingModifier");
17
17
 
18
- const index_1 = /*#__PURE__*/require("./utils/index"); //
18
+ const index_1 = /*#__PURE__*/require("./utils/index");
19
+
20
+ const getPopperOffset_1 = /*#__PURE__*/require("./utils/getPopperOffset"); //
19
21
  // Dev utils to detect if nodes have "autoFocus" props.
20
22
  //
21
23
 
@@ -65,13 +67,13 @@ function usePopperOptions(options, popperOriginalPositionRef) {
65
67
  // eslint-disable-next-line @typescript-eslint/naming-convention
66
68
  unstable_disableTether
67
69
  } = options;
68
- const isRtl = react_shared_contexts_1.useFluent().dir === 'rtl';
70
+ const isRtl = react_shared_contexts_1.useFluent_unstable().dir === 'rtl';
69
71
  const placement = index_1.getPlacement(align, position, isRtl);
70
72
  const strategy = positionFixed ? 'fixed' : 'absolute';
71
73
  const offsetModifier = React.useMemo(() => offset ? {
72
74
  name: 'offset',
73
75
  options: {
74
- offset: isRtl ? index_1.applyRtlToOffset(offset) : offset
76
+ offset: isRtl ? index_1.applyRtlToOffset(getPopperOffset_1.getPopperOffset(offset)) : getPopperOffset_1.getPopperOffset(offset)
75
77
  }
76
78
  } : null, [offset, isRtl]);
77
79
  return React.useCallback((target, container, arrow) => {
@@ -188,7 +190,7 @@ function usePopperOptions(options, popperOriginalPositionRef) {
188
190
  width,
189
191
  height
190
192
  } = state.rects.popper;
191
- const basePlacement = index_1.getBasePlacement(state.placement);
193
+ const basePlacement = index_1.parsePopperPlacement(state.placement).basePlacement;
192
194
  const widthProp = basePlacement === 'left' ? 'left' : 'right';
193
195
  const heightProp = basePlacement === 'top' ? 'top' : 'bottom';
194
196
  const applyMaxWidth = autoSize === 'always' || autoSize === 'width-always' || overflow[widthProp] > 0 && (autoSize === true || autoSize === 'width');
@@ -228,7 +230,7 @@ function usePopperOptions(options, popperOriginalPositionRef) {
228
230
  fn({
229
231
  state
230
232
  }) {
231
- const basePlacement = index_1.getBasePlacement(state.placement);
233
+ const basePlacement = index_1.parsePopperPlacement(state.placement).basePlacement;
232
234
 
233
235
  switch (basePlacement) {
234
236
  case 'bottom':
@@ -261,6 +263,7 @@ function usePopperOptions(options, popperOriginalPositionRef) {
261
263
  popperOriginalPositionRef]);
262
264
  }
263
265
  /**
266
+ * @internal
264
267
  * Exposes Popper positioning API via React hook. Contains few important differences between an official "react-popper"
265
268
  * package:
266
269
  * - style attributes are applied directly on DOM to avoid re-renders
@@ -270,7 +273,7 @@ function usePopperOptions(options, popperOriginalPositionRef) {
270
273
  */
271
274
 
272
275
 
273
- function usePopper(options = {}) {
276
+ function usePositioning(options = {}) {
274
277
  const {
275
278
  enabled = true
276
279
  } = options;
@@ -337,7 +340,7 @@ function usePopper(options = {}) {
337
340
  const arrowRef = index_1.useCallbackRef(null, handlePopperUpdate, true); // Stores external target from options.target or setTarget
338
341
 
339
342
  const overrideTargetRef = index_1.useCallbackRef(null, handlePopperUpdate, true);
340
- React.useImperativeHandle(options.popperRef, () => ({
343
+ React.useImperativeHandle(options.positioningRef, () => ({
341
344
  updatePosition: () => {
342
345
  var _a;
343
346
 
@@ -418,5 +421,5 @@ function usePopper(options = {}) {
418
421
  };
419
422
  }
420
423
 
421
- exports.usePopper = usePopper;
422
- //# sourceMappingURL=usePopper.js.map
424
+ exports.usePositioning = usePositioning;
425
+ //# sourceMappingURL=usePositioning.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["usePositioning.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,MAAA,uBAAA,gBAAA,OAAA,CAAA,iCAAA,CAAA;;AACA,MAAA,QAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AACA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AAEA,MAAA,wBAAA,gBAAA,OAAA,CAAA,0BAAA,CAAA;;AACA,MAAA,OAAA,gBAAA,OAAA,CAAA,eAAA,CAAA;;AAUA,MAAA,iBAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA,C,CAYA;AACA;AACA;;AAEA;;;AAGG;;;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,QA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ACA,MAAM,UAAU,GAAG,CAAA,EAAA,GAAA,WAAW,CAAC,aAAZ,MAAyB,IAAzB,IAAyB,EAAA,KAAA,KAAA,CAAzB,GAAyB,KAAA,CAAzB,GAAyB,EAAA,CAAE,gBAAF,CAAmB,WAAnB,EAAgC,UAAU,CAAC,YAA3C,EAAyD;UACnG,UAAU,EAAE;QADuF,CAAzD,CAA5C;;QAIA,OAAO,UAAU,KAAA,IAAV,IAAA,UAAU,KAAA,KAAA,CAAV,GAAU,KAAA,CAAV,GAAA,UAAU,CAAE,QAAZ,EAAP,EAA+B;UAC7B,MAAM,IAAI,GAAG,UAAU,CAAC,WAAxB,CAD6B,CAE7B;;UACA,OAAO,CAAC,IAAR,CAAa,WAAb,EAA0B,IAA1B,EAH6B,CAI7B;;UACA,OAAO,CAAC,IAAR,CACE,CACE,gGADF,EAEE,qGAFF,EAGE,2EAHF,EAIE,uEAJF,EAKE,IALF,EAME,yFANF,EAOE,oGAPF,EAQE,kGARF,EASE,WATF,EAUE,4FAVF,EAWE,6FAXF,EAYE,IAZF,EAaE,2FAbF,EAcE,2CAdF,EAeE,8EAfF,EAgBE,IAhBF,CAgBO,GAhBP,CADF;QAmBD;MACF,CAhCkB,CAiCnB;MACA;MACA;;IACD,CApCD,EAoCG,EApCH;EAqCD;;EAED,OAAO;IAAE,SAAF;IAAa,YAAb;IAA2B;EAA3B,CAAP;AACD;;AA5LD,OAAA,CAAA,cAAA,GAAA,cAAA","sourcesContent":["import { useEventCallback, useIsomorphicLayoutEffect, useFirstMount, canUseDOM } from '@fluentui/react-utilities';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport * as PopperJs from '@popperjs/core';\nimport * as React from 'react';\n\nimport { isIntersectingModifier } from './isIntersectingModifier';\nimport {\n getScrollParent,\n applyRtlToOffset,\n getPlacement,\n getReactFiberFromNode,\n getBoundary,\n useCallbackRef,\n parsePopperPlacement,\n} from './utils/index';\nimport type { PositioningVirtualElement, PositioningOptions, PositioningProps } from './types';\nimport { getPopperOffset } from './utils/getPopperOffset';\n\ntype PopperInstance = PopperJs.Instance & { isFirstRun?: boolean };\n\ninterface UsePopperOptions extends PositioningProps {\n /**\n * If false, delays Popper's creation.\n * @default true\n */\n enabled?: boolean;\n}\n\n//\n// Dev utils to detect if nodes have \"autoFocus\" props.\n//\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 */\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\nfunction hasAutofocusFilter(node: Node) {\n return hasAutofocusProp(node) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;\n}\n\n/**\n * Provides a callback to resolve Popper options, it's stable and should be used as a dependency to trigger updates\n * of Popper options.\n *\n * A callback is used there intentionally as some of Popper.js modifiers require DOM nodes (targer, container, arrow)\n * that can't be resolved properly during an initial rendering.\n */\nfunction usePopperOptions(options: PositioningOptions, popperOriginalPositionRef: React.MutableRefObject<string>) {\n const {\n align,\n arrowPadding,\n autoSize,\n coverTarget,\n flipBoundary,\n offset,\n overflowBoundary,\n pinned,\n position,\n positionFixed,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n unstable_disableTether,\n } = options;\n\n const isRtl = useFluent().dir === 'rtl';\n const placement = getPlacement(align, position, isRtl);\n const strategy = positionFixed ? 'fixed' : 'absolute';\n\n const offsetModifier = React.useMemo(\n () =>\n offset\n ? {\n name: 'offset',\n options: { offset: isRtl ? applyRtlToOffset(getPopperOffset(offset)) : getPopperOffset(offset) },\n }\n : null,\n [offset, isRtl],\n );\n\n return React.useCallback(\n (\n target: HTMLElement | PopperJs.VirtualElement | null,\n container: HTMLElement | null,\n arrow: HTMLElement | null,\n ): PopperJs.Options => {\n const scrollParentElement: HTMLElement = getScrollParent(container);\n const hasScrollableElement = scrollParentElement\n ? scrollParentElement !== scrollParentElement.ownerDocument?.body\n : false;\n\n const modifiers: PopperJs.Options['modifiers'] = [\n isIntersectingModifier,\n\n /**\n * We are setting the position to `fixed` in the first effect to prevent scroll jumps in case of the content\n * with managed focus. Modifier sets the position to `fixed` before all other modifier effects. Another part of\n * a patch modifies \".forceUpdate()\" directly after a Popper will be created.\n */\n {\n name: 'positionStyleFix',\n enabled: true,\n phase: 'afterWrite' as PopperJs.ModifierPhases,\n effect: ({ state, instance }: { state: PopperJs.State; instance: PopperInstance }) => {\n // \".isFirstRun\" is a part of our patch, on a first evaluation it will \"undefined\"\n // should be disabled for subsequent runs as it breaks positioning for them\n if (instance.isFirstRun !== false) {\n popperOriginalPositionRef.current = state.elements.popper.style.position;\n state.elements.popper.style.position = 'fixed';\n }\n\n return () => undefined;\n },\n requires: [],\n },\n\n { name: 'flip', options: { flipVariations: true } },\n\n /**\n * pinned disables the flip modifier by setting flip.enabled to false; this\n * disables automatic repositioning of the popper box; it will always be placed according to\n * the values of `align` and `position` props, regardless of the size of the component, the\n * reference element or the viewport.\n */\n pinned && { name: 'flip', enabled: false },\n\n /**\n * When the popper box is placed in the context of a scrollable element, we need to set\n * preventOverflow.escapeWithReference to true and flip.boundariesElement to 'scrollParent'\n * (default is 'viewport') so that the popper box will stick with the targetRef when we\n * scroll targetRef out of the viewport.\n */\n hasScrollableElement && { name: 'flip', options: { boundary: 'clippingParents' } },\n hasScrollableElement && { name: 'preventOverflow', options: { boundary: 'clippingParents' } },\n\n offsetModifier,\n\n /**\n * This modifier is necessary to retain behaviour from popper v1 where untethered poppers are allowed by\n * default. i.e. popper is still rendered fully in the viewport even if anchor element is no longer in the\n * viewport.\n */\n unstable_disableTether && {\n name: 'preventOverflow',\n options: { altAxis: unstable_disableTether === 'all', tether: false },\n },\n\n flipBoundary && {\n name: 'flip',\n options: {\n altBoundary: true,\n boundary: getBoundary(container, flipBoundary),\n },\n },\n overflowBoundary && {\n name: 'preventOverflow',\n options: {\n altBoundary: true,\n boundary: getBoundary(container, overflowBoundary),\n },\n },\n\n {\n // Similar code as popper-maxsize-modifier: https://github.com/atomiks/popper.js/blob/master/src/modifiers/maxSize.js\n // popper-maxsize-modifier only calculates the max sizes.\n // This modifier can apply max sizes always, or apply the max sizes only when overflow is detected\n name: 'applyMaxSize',\n enabled: !!autoSize,\n phase: 'beforeWrite' as PopperJs.ModifierPhases,\n requiresIfExists: ['offset', 'preventOverflow', 'flip'],\n options: {\n altBoundary: true,\n boundary: getBoundary(container, overflowBoundary),\n },\n fn({ state, options: modifierOptions }: PopperJs.ModifierArguments<{}>) {\n const overflow = PopperJs.detectOverflow(state, modifierOptions);\n const { x, y } = state.modifiersData.preventOverflow || { x: 0, y: 0 };\n const { width, height } = state.rects.popper;\n const basePlacement = parsePopperPlacement(state.placement).basePlacement;\n\n const widthProp: keyof PopperJs.SideObject = basePlacement === 'left' ? 'left' : 'right';\n const heightProp: keyof PopperJs.SideObject = 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 state.styles.popper.maxWidth = `${width - overflow[widthProp] - x}px`;\n }\n if (applyMaxHeight) {\n state.styles.popper.maxHeight = `${height - overflow[heightProp] - y}px`;\n }\n },\n },\n\n /**\n * This modifier is necessary in order to render the pointer. Refs are resolved in effects, so it can't be\n * placed under computed modifiers. Deep merge is not required as this modifier has only these properties.\n */\n {\n name: 'arrow',\n enabled: !!arrow,\n options: { element: arrow, padding: arrowPadding },\n },\n\n /**\n * Modifies popper offsets to cover the reference rect, but still keep edge alignment\n */\n {\n name: 'coverTarget',\n enabled: !!coverTarget,\n phase: 'main',\n requiresIfExists: ['offset', 'preventOverflow', 'flip'],\n fn({ state }: PopperJs.ModifierArguments<{}>) {\n const basePlacement = parsePopperPlacement(state.placement).basePlacement;\n switch (basePlacement) {\n case 'bottom':\n state.modifiersData.popperOffsets!.y -= state.rects.reference.height;\n break;\n case 'top':\n state.modifiersData.popperOffsets!.y += state.rects.reference.height;\n break;\n case 'left':\n state.modifiersData.popperOffsets!.x += state.rects.reference.width;\n break;\n case 'right':\n state.modifiersData.popperOffsets!.x -= state.rects.reference.width;\n break;\n }\n },\n },\n ].filter(Boolean) as PopperJs.Options['modifiers']; // filter boolean conditional spreading values\n\n const popperOptions: PopperJs.Options = {\n modifiers,\n\n placement,\n strategy,\n };\n\n return popperOptions;\n },\n [\n arrowPadding,\n autoSize,\n coverTarget,\n flipBoundary,\n offsetModifier,\n overflowBoundary,\n placement,\n strategy,\n unstable_disableTether,\n pinned,\n\n // These can be skipped from deps as they will not ever change\n popperOriginalPositionRef,\n ],\n );\n}\n\n/**\n * @internal\n * Exposes Popper positioning API via React hook. Contains few important differences between an official \"react-popper\"\n * package:\n * - style attributes are applied directly on DOM to avoid re-renders\n * - refs changes and resolution is handled properly without re-renders\n * - contains a specific to React fix related to initial positioning when containers have components with managed focus\n * to avoid focus jumps\n */\nexport function usePositioning(\n options: UsePopperOptions = {},\n): {\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 const { enabled = true } = options;\n const isFirstMount = useFirstMount();\n\n const popperOriginalPositionRef = React.useRef<string>('absolute');\n const resolvePopperOptions = usePopperOptions(options, popperOriginalPositionRef);\n\n const popperInstanceRef = React.useRef<PopperInstance | null>(null);\n\n const handlePopperUpdate = useEventCallback(() => {\n popperInstanceRef.current?.destroy();\n popperInstanceRef.current = null;\n\n const target = overrideTargetRef.current ?? targetRef.current;\n\n let popperInstance: PopperInstance | null = null;\n\n if (canUseDOM() && enabled) {\n if (target && containerRef.current) {\n popperInstance = PopperJs.createPopper(\n target,\n containerRef.current,\n resolvePopperOptions(target, containerRef.current, arrowRef.current),\n );\n }\n }\n\n if (popperInstance) {\n /**\n * The patch updates `.forceUpdate()` Popper function which restores the original position before the first\n * forceUpdate() call. See also \"positionStyleFix\" modifier in usePopperOptions().\n */\n const originalForceUpdate = popperInstance.forceUpdate;\n\n popperInstance.isFirstRun = true;\n popperInstance.forceUpdate = () => {\n if (popperInstance?.isFirstRun) {\n popperInstance.state.elements.popper.style.position = popperOriginalPositionRef.current;\n popperInstance.isFirstRun = false;\n }\n\n originalForceUpdate();\n };\n }\n\n popperInstanceRef.current = popperInstance;\n });\n\n // Refs are managed by useCallbackRef() to handle ref updates scenarios.\n //\n // The first scenario are updates for a targetRef, we can handle it properly only via callback refs, but it causes\n // re-renders (we would like to avoid them).\n //\n // The second problem is related to refs resolution on React's layer: refs are resolved in the same order as effects\n // that causes an issue when you have a container inside a target, for example: a menu in ChatMessage.\n //\n // function ChatMessage(props) {\n // <div className=\"message\" ref={targetRef}> // 3) ref will be resolved only now, but it's too late already\n // <Popper target={targetRef}> // 2) create a popper instance\n // <div className=\"menu\" /> // 1) capture ref from this element\n // </Popper>\n // </div>\n // }\n //\n // Check a demo on CodeSandbox: https://codesandbox.io/s/popper-refs-emy60.\n //\n // This again can be solved with callback refs. It's not a huge issue as with hooks we are moving popper's creation\n // to ChatMessage itself, however, without `useCallback()` refs it's still a Pandora box.\n const targetRef = useCallbackRef<HTMLElement | PopperJs.VirtualElement | null>(null, handlePopperUpdate, true);\n const containerRef = useCallbackRef<HTMLElement | null>(null, handlePopperUpdate, true);\n const arrowRef = useCallbackRef<HTMLElement | null>(null, handlePopperUpdate, true);\n\n // Stores external target from options.target or setTarget\n const overrideTargetRef = useCallbackRef<HTMLElement | PositioningVirtualElement | null>(\n null,\n handlePopperUpdate,\n true,\n );\n\n React.useImperativeHandle(\n options.positioningRef,\n () => ({\n updatePosition: () => {\n popperInstanceRef.current?.update();\n },\n setTarget: (target: HTMLElement | PositioningVirtualElement) => {\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 overrideTargetRef.current = target;\n },\n }),\n // Missing deps:\n // options.target - only used for a runtime warning\n // targetRef - Stable between renders\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [],\n );\n\n useIsomorphicLayoutEffect(() => {\n if (options.target) {\n overrideTargetRef.current = options.target;\n }\n }, [options.target, overrideTargetRef]);\n useIsomorphicLayoutEffect(() => {\n handlePopperUpdate();\n\n return () => {\n popperInstanceRef.current?.destroy();\n popperInstanceRef.current = null;\n };\n }, [handlePopperUpdate, options.enabled]);\n useIsomorphicLayoutEffect(\n () => {\n if (!isFirstMount) {\n popperInstanceRef.current?.setOptions(\n resolvePopperOptions(overrideTargetRef.current ?? targetRef.current, containerRef.current, arrowRef.current),\n );\n }\n },\n // Missing deps:\n // isFirstMount - Should never change after mount\n // arrowRef, containerRef, targetRef - Stable between renders\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [resolvePopperOptions],\n );\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 return { targetRef, containerRef, arrowRef };\n}\n"],"sourceRoot":"../src/"}
@@ -3,12 +3,13 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.usePopperMouseTarget = void 0;
6
+ exports.usePositioningMouseTarget = void 0;
7
7
 
8
8
  const React = /*#__PURE__*/require("react");
9
9
 
10
10
  const createVirtualElementFromClick_1 = /*#__PURE__*/require("./createVirtualElementFromClick");
11
11
  /**
12
+ * @internal
12
13
  * A state hook that manages a popper virtual element from mouseevents.
13
14
  * Useful for scenarios where a component needs to be positioned by mouse click (e.g. contextmenu)
14
15
  * React synthetic events are not persisted by this hook
@@ -18,7 +19,7 @@ const createVirtualElementFromClick_1 = /*#__PURE__*/require("./createVirtualEle
18
19
  */
19
20
 
20
21
 
21
- const usePopperMouseTarget = initialState => {
22
+ const usePositioningMouseTarget = initialState => {
22
23
  const [virtualElement, setVirtualElement] = React.useState(initialState);
23
24
 
24
25
  const setVirtualMouseTarget = event => {
@@ -37,7 +38,7 @@ const usePopperMouseTarget = initialState => {
37
38
 
38
39
  if (!(mouseevent instanceof MouseEvent) && process.env.NODE_ENV !== 'production') {
39
40
  // eslint-disable-next-line no-console
40
- console.error('usePopperMouseTarget should only be used with MouseEvent');
41
+ console.error('usePositioningMouseTarget should only be used with MouseEvent');
41
42
  }
42
43
 
43
44
  const contextTarget = createVirtualElementFromClick_1.createVirtualElementFromClick(mouseevent);
@@ -47,5 +48,5 @@ const usePopperMouseTarget = initialState => {
47
48
  return [virtualElement, setVirtualMouseTarget];
48
49
  };
49
50
 
50
- exports.usePopperMouseTarget = usePopperMouseTarget;
51
- //# sourceMappingURL=usePopperMouseTarget.js.map
51
+ exports.usePositioningMouseTarget = usePositioningMouseTarget;
52
+ //# sourceMappingURL=usePositioningMouseTarget.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["usePositioningMouseTarget.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,+BAAA,gBAAA,OAAA,CAAA,iCAAA,CAAA;AAGA;;;;;;;;AAQG;;;AACI,MAAM,yBAAyB,GACpC,YADuC,IAErC;EACF,MAAM,CAAC,cAAD,EAAiB,iBAAjB,IAAsC,KAAK,CAAC,QAAN,CAAsD,YAAtD,CAA5C;;EAEA,MAAM,qBAAqB,GAAI,KAAD,IAA4D;IACxF,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,+BAAA,CAAA,6BAAA,CAA8B,UAA9B,CAAtB;IACA,iBAAiB,CAAC,aAAD,CAAjB;EACD,CApBD;;EAsBA,OAAO,CAAC,cAAD,EAAiB,qBAAjB,CAAP;AACD,CA5BM;;AAAM,OAAA,CAAA,yBAAA,GAAyB,yBAAzB","sourcesContent":["import * as React from 'react';\nimport { createVirtualElementFromClick } from './createVirtualElementFromClick';\nimport { PositioningVirtualElement } 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 = (event: React.MouseEvent | MouseEvent | undefined | null) => {\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/"}
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.fromPopperPlacement = void 0;
7
+
8
+ const parsePopperPlacement_1 = /*#__PURE__*/require("./parsePopperPlacement");
9
+
10
+ const positionMap = {
11
+ top: 'above',
12
+ bottom: 'below',
13
+ right: 'after',
14
+ left: 'before'
15
+ };
16
+
17
+ const getAlignmentMap = position => {
18
+ if (position === 'above' || position === 'below') {
19
+ return {
20
+ start: 'start',
21
+ end: 'end'
22
+ };
23
+ }
24
+
25
+ return {
26
+ start: 'top',
27
+ end: 'bottom'
28
+ };
29
+ };
30
+ /**
31
+ * Maps Popper.js placement to positioning values
32
+ * @see positioningHelper.test.ts for expected placement values
33
+ */
34
+
35
+
36
+ const fromPopperPlacement = placement => {
37
+ const {
38
+ basePlacement,
39
+ alignment: popperAlignment
40
+ } = parsePopperPlacement_1.parsePopperPlacement(placement);
41
+ const position = positionMap[basePlacement];
42
+ const alignment = popperAlignment && getAlignmentMap(position)[popperAlignment];
43
+ return {
44
+ position,
45
+ alignment
46
+ };
47
+ };
48
+
49
+ exports.fromPopperPlacement = fromPopperPlacement;
50
+ //# sourceMappingURL=fromPopperPlacement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["utils/fromPopperPlacement.ts"],"names":[],"mappings":";;;;;;;AAEA,MAAA,sBAAA,gBAAA,OAAA,CAAA,wBAAA,CAAA;;AAEA,MAAM,WAAW,GAAG;EAClB,GAAG,EAAE,OADa;EAElB,MAAM,EAAE,OAFU;EAGlB,KAAK,EAAE,OAHW;EAIlB,IAAI,EAAE;AAJY,CAApB;;AAOA,MAAM,eAAe,GAAI,QAAD,IAA2D;EACjF,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;;;AACI,MAAM,mBAAmB,GAAI,SAAD,IAAwE;EACzG,MAAM;IAAE,aAAF;IAAiB,SAAS,EAAE;EAA5B,IAAgD,sBAAA,CAAA,oBAAA,CAAqB,SAArB,CAAtD;EACA,MAAM,QAAQ,GAAG,WAAW,CAAC,aAAD,CAA5B;EACA,MAAM,SAAS,GAAG,eAAe,IAAI,eAAe,CAAC,QAAD,CAAf,CAA0B,eAA1B,CAArC;EAEA,OAAO;IAAE,QAAF;IAAY;EAAZ,CAAP;AACD,CANM;;AAAM,OAAA,CAAA,mBAAA,GAAmB,mBAAnB","sourcesContent":["import type { Variation as PopperAlignment, Placement } from '@popperjs/core';\nimport type { Alignment, Position } from '../types';\nimport { parsePopperPlacement } from './parsePopperPlacement';\n\nconst positionMap = {\n top: 'above',\n bottom: 'below',\n right: 'after',\n left: 'before',\n} as const;\n\nconst getAlignmentMap = (position: Position): Record<PopperAlignment, 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 Popper.js placement to positioning values\n * @see positioningHelper.test.ts for expected placement values\n */\nexport const fromPopperPlacement = (placement: Placement): { position: Position; alignment?: Alignment } => {\n const { basePlacement, alignment: popperAlignment } = parsePopperPlacement(placement);\n const position = positionMap[basePlacement];\n const alignment = popperAlignment && getAlignmentMap(position)[popperAlignment];\n\n return { position, alignment };\n};\n"],"sourceRoot":"../src/"}
@@ -26,7 +26,7 @@ function getBoundary(element, boundary) {
26
26
  return boundariesNode;
27
27
  }
28
28
 
29
- return boundary;
29
+ return boundary !== null && boundary !== void 0 ? boundary : undefined;
30
30
  }
31
31
 
32
32
  exports.getBoundary = getBoundary;
@@ -1 +1 @@
1
- {"version":3,"sources":["utils/getBoundary.ts"],"names":[],"mappings":";;;;;;;AAEA,MAAA,iBAAA,gBAAA,OAAA,CAAA,mBAAA,CAAA;AAGA;;AAEG;;;AACH,SAAgB,WAAhB,CAA4B,OAA5B,EAAyD,QAAzD,EAA4E;AAC1E,MAAI,QAAQ,KAAK,QAAjB,EAA2B;AACzB,WAAO,OAAO,KAAA,IAAP,IAAA,OAAO,KAAA,KAAA,CAAP,GAAO,KAAA,CAAP,GAAA,OAAO,CAAE,aAAT,CAAwB,eAA/B;AACD;;AAED,MAAI,QAAQ,KAAK,cAAjB,EAAiC;AAC/B,QAAI,cAAc,GAA4B,iBAAA,CAAA,eAAA,CAAgB,OAAhB,CAA9C;;AAEA,QAAI,cAAc,CAAC,QAAf,KAA4B,MAAhC,EAAwC;AACtC,MAAA,cAAc,GAAG,OAAO,KAAA,IAAP,IAAA,OAAO,KAAA,KAAA,CAAP,GAAO,KAAA,CAAP,GAAA,OAAO,CAAE,aAAT,CAAwB,eAAzC;AACD;;AAED,WAAO,cAAP;AACD;;AAED,SAAO,QAAP;AACD;;AAhBD,OAAA,CAAA,WAAA,GAAA,WAAA","sourcesContent":["import * as PopperJs from '@popperjs/core';\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): PopperJs.Boundary | undefined {\n if (boundary === 'window') {\n return element?.ownerDocument!.documentElement;\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":["utils/getBoundary.ts"],"names":[],"mappings":";;;;;;;AAEA,MAAA,iBAAA,gBAAA,OAAA,CAAA,mBAAA,CAAA;AAGA;;AAEG;;;AACH,SAAgB,WAAhB,CAA4B,OAA5B,EAAyD,QAAzD,EAAmF;EACjF,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,cAAjB,EAAiC;IAC/B,IAAI,cAAc,GAA4B,iBAAA,CAAA,eAAA,CAAgB,OAAhB,CAA9C;;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,QAAQ,KAAA,IAAR,IAAA,QAAQ,KAAA,KAAA,CAAR,GAAA,QAAA,GAAY,SAAnB;AACD;;AAhBD,OAAA,CAAA,WAAA,GAAA,WAAA","sourcesContent":["import * as PopperJs from '@popperjs/core';\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 | null): PopperJs.Boundary | undefined {\n if (boundary === 'window') {\n return element?.ownerDocument!.documentElement;\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 ?? undefined;\n}\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getPopperOffset = void 0;
7
+
8
+ const fromPopperPlacement_1 = /*#__PURE__*/require("./fromPopperPlacement");
9
+ /**
10
+ * Shim to transform offset values from this library to Popper.js
11
+ * @param rawOffset Offset from this library
12
+ * @returns An offset value compatible with Popper.js
13
+ */
14
+
15
+
16
+ function getPopperOffset(rawOffset) {
17
+ if (rawOffset === undefined || rawOffset === null) {
18
+ return rawOffset;
19
+ }
20
+
21
+ if (typeof rawOffset === 'number') {
22
+ return [0, rawOffset];
23
+ }
24
+
25
+ if (typeof rawOffset === 'object') {
26
+ return [rawOffset.crossAxis, rawOffset.mainAxis];
27
+ }
28
+
29
+ return ({
30
+ popper,
31
+ reference,
32
+ placement
33
+ }) => {
34
+ const {
35
+ position,
36
+ alignment
37
+ } = fromPopperPlacement_1.fromPopperPlacement(placement);
38
+ const computedOffset = rawOffset({
39
+ positionedRect: popper,
40
+ targetRect: reference,
41
+ position,
42
+ alignment
43
+ });
44
+
45
+ if (typeof computedOffset === 'number') {
46
+ return [0, computedOffset];
47
+ }
48
+
49
+ return [computedOffset.crossAxis, computedOffset.mainAxis];
50
+ };
51
+ }
52
+
53
+ exports.getPopperOffset = getPopperOffset;
54
+ //# sourceMappingURL=getPopperOffset.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["utils/getPopperOffset.ts"],"names":[],"mappings":";;;;;;;AAEA,MAAA,qBAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;AAyBA;;;;AAIG;;;AACH,SAAgB,eAAhB,CAAgC,SAAhC,EAA6D;EAC3D,IAAI,SAAS,KAAK,SAAd,IAA2B,SAAS,KAAK,IAA7C,EAAmD;IACjD,OAAO,SAAP;EACD;;EAED,IAAI,OAAO,SAAP,KAAqB,QAAzB,EAAmC;IACjC,OAAO,CAAC,CAAD,EAAI,SAAJ,CAAP;EACD;;EAED,IAAI,OAAO,SAAP,KAAqB,QAAzB,EAAmC;IACjC,OAAO,CAAC,SAAS,CAAC,SAAX,EAAsB,SAAS,CAAC,QAAhC,CAAP;EACD;;EAED,OAAO,CAAC;IAAE,MAAF;IAAU,SAAV;IAAqB;EAArB,CAAD,KAAqC;IAC1C,MAAM;MAAE,QAAF;MAAY;IAAZ,IAA0B,qBAAA,CAAA,mBAAA,CAAoB,SAApB,CAAhC;IACA,MAAM,cAAc,GAAG,SAAS,CAAC;MAAE,cAAc,EAAE,MAAlB;MAA0B,UAAU,EAAE,SAAtC;MAAiD,QAAjD;MAA2D;IAA3D,CAAD,CAAhC;;IACA,IAAI,OAAO,cAAP,KAA0B,QAA9B,EAAwC;MACtC,OAAO,CAAC,CAAD,EAAI,cAAJ,CAAP;IACD;;IAED,OAAO,CAAC,cAAc,CAAC,SAAhB,EAA2B,cAAc,CAAC,QAA1C,CAAP;EACD,CARD;AASD;;AAtBD,OAAA,CAAA,eAAA,GAAA,eAAA","sourcesContent":["import type { Offset } from '../types';\nimport type { Rect, Placement } from '@popperjs/core';\nimport { fromPopperPlacement } from './fromPopperPlacement';\n/**\n * Type taken from Popper since it is not exported\n */\nexport type PopperOffsetValue = [number | null | undefined, number | null | undefined];\n\n/**\n * Type taken from Popper since it is not exported\n */\nexport type PopperOffset = PopperOffsetValue | PopperOffsetFunction;\n\n/**\n * Type taken from Popper.js since it is not exported\n */\nexport type PopperOffsetFunctionParam = {\n popper: Rect;\n reference: Rect;\n placement: Placement;\n};\n\n/**\n * Type taken from Popper.js since it is not exported\n */\nexport type PopperOffsetFunction = (args: { popper: Rect; reference: Rect; placement: Placement }) => PopperOffsetValue;\n\n/**\n * Shim to transform offset values from this library to Popper.js\n * @param rawOffset Offset from this library\n * @returns An offset value compatible with Popper.js\n */\nexport function getPopperOffset(rawOffset: Offset | undefined): PopperOffsetValue | PopperOffsetFunction | undefined {\n if (rawOffset === undefined || rawOffset === null) {\n return rawOffset;\n }\n\n if (typeof rawOffset === 'number') {\n return [0, rawOffset];\n }\n\n if (typeof rawOffset === 'object') {\n return [rawOffset.crossAxis, rawOffset.mainAxis];\n }\n\n return ({ popper, reference, placement }) => {\n const { position, alignment } = fromPopperPlacement(placement);\n const computedOffset = rawOffset({ positionedRect: popper, targetRect: reference, position, alignment });\n if (typeof computedOffset === 'number') {\n return [0, computedOffset];\n }\n\n return [computedOffset.crossAxis, computedOffset.mainAxis];\n };\n}\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["utils/getReactFiberFromNode.ts"],"names":[],"mappings":";;;;;;AAuEA,IAAK,OAAL;;AAAA,CAAA,UAAK,OAAL,EAAY;AACV,EAAA,OAAA,CAAA,OAAA,CAAA,mBAAA,CAAA,GAAA,CAAA,CAAA,GAAA,mBAAA;AACA,EAAA,OAAA,CAAA,OAAA,CAAA,gBAAA,CAAA,GAAA,CAAA,CAAA,GAAA,gBAAA;AACA,EAAA,OAAA,CAAA,OAAA,CAAA,wBAAA,CAAA,GAAA,CAAA,CAAA,GAAA,wBAAA;AACA,EAAA,OAAA,CAAA,OAAA,CAAA,UAAA,CAAA,GAAA,CAAA,CAAA,GAAA,UAAA;AACA,EAAA,OAAA,CAAA,OAAA,CAAA,YAAA,CAAA,GAAA,CAAA,CAAA,GAAA,YAAA;AACA,EAAA,OAAA,CAAA,OAAA,CAAA,eAAA,CAAA,GAAA,CAAA,CAAA,GAAA,eAAA;AACA,EAAA,OAAA,CAAA,OAAA,CAAA,UAAA,CAAA,GAAA,CAAA,CAAA,GAAA,UAAA;AACA,EAAA,OAAA,CAAA,OAAA,CAAA,UAAA,CAAA,GAAA,CAAA,CAAA,GAAA,UAAA;AACA,EAAA,OAAA,CAAA,OAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAA;AACA,EAAA,OAAA,CAAA,OAAA,CAAA,iBAAA,CAAA,GAAA,CAAA,CAAA,GAAA,iBAAA;AACA,EAAA,OAAA,CAAA,OAAA,CAAA,iBAAA,CAAA,GAAA,EAAA,CAAA,GAAA,iBAAA;AACA,EAAA,OAAA,CAAA,OAAA,CAAA,YAAA,CAAA,GAAA,EAAA,CAAA,GAAA,YAAA;AACA,EAAA,OAAA,CAAA,OAAA,CAAA,UAAA,CAAA,GAAA,EAAA,CAAA,GAAA,UAAA;AACA,EAAA,OAAA,CAAA,OAAA,CAAA,mBAAA,CAAA,GAAA,EAAA,CAAA,GAAA,mBAAA;AACA,EAAA,OAAA,CAAA,OAAA,CAAA,eAAA,CAAA,GAAA,EAAA,CAAA,GAAA,eAAA;AACA,EAAA,OAAA,CAAA,OAAA,CAAA,qBAAA,CAAA,GAAA,EAAA,CAAA,GAAA,qBAAA;AACA,EAAA,OAAA,CAAA,OAAA,CAAA,eAAA,CAAA,GAAA,EAAA,CAAA,GAAA,eAAA;AACA,EAAA,OAAA,CAAA,OAAA,CAAA,0BAAA,CAAA,GAAA,EAAA,CAAA,GAAA,0BAAA;AACA,EAAA,OAAA,CAAA,OAAA,CAAA,oBAAA,CAAA,GAAA,EAAA,CAAA,GAAA,oBAAA;AACA,EAAA,OAAA,CAAA,OAAA,CAAA,uBAAA,CAAA,GAAA,EAAA,CAAA,GAAA,uBAAA;AACA,EAAA,OAAA,CAAA,OAAA,CAAA,sBAAA,CAAA,GAAA,EAAA,CAAA,GAAA,sBAAA;AACA,EAAA,OAAA,CAAA,OAAA,CAAA,gBAAA,CAAA,GAAA,EAAA,CAAA,GAAA,gBAAA;AACD,CAvBD,EAAK,OAAO,KAAP,OAAO,GAAA,EAAA,CAAZ;;AAsLA,SAAgB,qBAAhB,CAAsC,GAAtC,EAA2D;AACzD,MAAI,CAAC,GAAL,EAAU;AACR,WAAO,IAAP;AACD;;AAED,OAAK,MAAM,CAAX,IAAgB,GAAhB,EAAqB;AACnB;AACA;AACA;AACA,QAAI,CAAC,CAAC,OAAF,CAAU,0BAAV,MAA0C,CAA1C,IAA+C,CAAC,CAAC,OAAF,CAAU,eAAV,MAA+B,CAAlF,EAAqF;AACnF;AACA;AACA,aAAO,GAAG,CAAC,CAAD,CAAV;AACD;AACF;;AAED,QAAM,IAAI,KAAJ,CAAU,yDAAV,CAAN;AACD;;AAjBD,OAAA,CAAA,qBAAA,GAAA,qBAAA","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":["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,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,CAAA,GAAA,EAAA,CAAA,GAAA,gBAAA;AACD,CAvBD,EAAK,OAAO,KAAP,OAAO,GAAA,EAAA,CAAZ;;AAsLA,SAAgB,qBAAhB,CAAsC,GAAtC,EAA2D;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;;AAjBD,OAAA,CAAA,qBAAA,GAAA,qBAAA","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;;AACI,MAAM,aAAa,GAAI,IAAD,IAAmC;AAC9D,MAAI,IAAI,CAAC,QAAL,KAAkB,MAAtB,EAA8B;AAC5B,WAAO,IAAP;AACD,GAH6D,CAI9D;;;AACA,SAAO,IAAI,CAAC,UAAL,IAAoB,IAAY,CAAC,IAAxC;AACD,CANM;;AAAM,OAAA,CAAA,aAAA,GAAa,aAAb;AAQb;;;;AAIG;;AACH,MAAM,wBAAwB,GAAI,IAAD,IAAoD;;;AACnF,MAAI,IAAI,CAAC,QAAL,KAAkB,CAAtB,EAAyB;AACvB,WAAO,EAAP;AACD;;AAED,QAAM,MAAM,GAAG,CAAA,EAAA,GAAA,IAAI,CAAC,aAAL,MAAkB,IAAlB,IAAkB,EAAA,KAAA,KAAA,CAAlB,GAAkB,KAAA,CAAlB,GAAkB,EAAA,CAAE,WAAnC;AACA,SAAO,MAAO,CAAC,gBAAR,CAAyB,IAAzB,EAA+B,IAA/B,CAAP;AACD,CAPD;AASA;;;;AAIG;;;AACI,MAAM,eAAe,GAAI,IAAD,IAAqD;AAClF;AACA,QAAM,UAAU,GAAG,IAAI,IAAI,OAAA,CAAA,aAAA,CAAc,IAAd,CAA3B,CAFkF,CAGlF;;AACA,MAAI,CAAC,UAAL,EAAiB,OAAO,QAAQ,CAAC,IAAhB;;AAEjB,UAAQ,UAAU,CAAC,QAAnB;AACE,SAAK,MAAL;AACA,SAAK,MAAL;AACE,aAAO,UAAU,CAAC,aAAX,CAA0B,IAAjC;;AACF,SAAK,WAAL;AACE,aAAS,UAAmC,CAAC,IAA7C;AALJ,GANkF,CAclF;;;AACA,QAAM;AAAE,IAAA,QAAF;AAAY,IAAA,SAAZ;AAAuB,IAAA;AAAvB,MAAqC,wBAAwB,CAAC,UAAD,CAAnE;;AACA,MAAI,wBAAwB,IAAxB,CAA6B,QAAS,GAAG,SAAZ,GAAyB,SAAtD,CAAJ,EAAsE;AACpE,WAAO,UAAP;AACD;;AAED,SAAO,OAAA,CAAA,eAAA,CAAgB,UAAhB,CAAP;AACD,CArBM;;AAAM,OAAA,CAAA,eAAA,GAAe,eAAf","sourcesContent":["/**\n * Returns the parent node or the host of the node argument.\n * @param node - DOM node.\n * @returns - parent DOM node.\n */\nexport const getParentNode = (node: HTMLElement): HTMLElement => {\n if (node.nodeName === 'HTML') {\n return node;\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return node.parentNode || (node as any).host;\n};\n\n/**\n * Returns CSS styles of the given node.\n * @param node - DOM node.\n * @returns - CSS styles.\n */\nconst getStyleComputedProperty = (node: HTMLElement): Partial<CSSStyleDeclaration> => {\n if (node.nodeType !== 1) {\n return {};\n }\n\n const window = node.ownerDocument?.defaultView;\n return window!.getComputedStyle(node, null);\n};\n\n/**\n * Returns the first scrollable parent of the given element.\n * @param node - DOM node.\n * @returns - the first scrollable parent.\n */\nexport const getScrollParent = (node: Document | HTMLElement | null): HTMLElement => {\n // Return body, `getScroll` will take care to get the correct `scrollTop` from it\n const parentNode = node && getParentNode(node as HTMLElement);\n // eslint-disable-next-line\n if (!parentNode) return document.body;\n\n switch (parentNode.nodeName) {\n case 'HTML':\n case 'BODY':\n return parentNode.ownerDocument!.body;\n case '#document':\n return ((parentNode as unknown) as Document).body;\n }\n\n // If any of the overflow props is defined for the node then we return it as the parent\n const { overflow, overflowX, overflowY } = getStyleComputedProperty(parentNode);\n if (/(auto|scroll|overlay)/.test(overflow! + overflowY! + overflowX)) {\n return parentNode;\n }\n\n return getScrollParent(parentNode);\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["utils/getScrollParent.ts"],"names":[],"mappings":";;;;;;AAAA;;;;AAIG;;AACI,MAA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AAA,CAAA,eAAA,GAAe,eAAf","sourcesContent":["/**\n * Returns the parent node or the host of the node argument.\n * @param node - DOM node.\n * @returns - parent DOM node.\n */\nexport const getParentNode = (node: HTMLElement): HTMLElement => {\n if (node.nodeName === 'HTML') {\n return node;\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return node.parentNode || (node as any).host;\n};\n\n/**\n * Returns CSS styles of the given node.\n * @param node - DOM node.\n * @returns - CSS styles.\n */\nconst getStyleComputedProperty = (node: HTMLElement): Partial<CSSStyleDeclaration> => {\n if (node.nodeType !== 1) {\n return {};\n }\n\n const window = node.ownerDocument?.defaultView;\n return window!.getComputedStyle(node, null);\n};\n\n/**\n * Returns the first scrollable parent of the given element.\n * @param node - DOM node.\n * @returns - the first scrollable parent.\n */\nexport const getScrollParent = (node: Document | HTMLElement | null): HTMLElement => {\n // Return body, `getScroll` will take care to get the correct `scrollTop` from it\n const parentNode = node && getParentNode(node as HTMLElement);\n // eslint-disable-next-line\n if (!parentNode) return document.body;\n\n switch (parentNode.nodeName) {\n case 'HTML':\n case 'BODY':\n return parentNode.ownerDocument!.body;\n case '#document':\n return ((parentNode as unknown) as Document).body;\n }\n\n // If any of the overflow props is defined for the node then we return it as the parent\n const { overflow, overflowX, overflowY } = getStyleComputedProperty(parentNode);\n if (/(auto|scroll|overlay)/.test(overflow! + overflowY! + overflowX)) {\n return parentNode;\n }\n\n return getScrollParent(parentNode);\n};\n"],"sourceRoot":"../src/"}
@@ -6,8 +6,6 @@ Object.defineProperty(exports, "__esModule", {
6
6
 
7
7
  const tslib_1 = /*#__PURE__*/require("tslib");
8
8
 
9
- tslib_1.__exportStar(require("./getBasePlacement"), exports);
10
-
11
9
  tslib_1.__exportStar(require("./getBoundary"), exports);
12
10
 
13
11
  tslib_1.__exportStar(require("./getReactFiberFromNode"), exports);
@@ -21,4 +19,6 @@ tslib_1.__exportStar(require("./positioningHelper"), exports);
21
19
  tslib_1.__exportStar(require("./resolvePositioningShorthand"), exports);
22
20
 
23
21
  tslib_1.__exportStar(require("./useCallbackRef"), exports);
22
+
23
+ tslib_1.__exportStar(require("./parsePopperPlacement"), exports);
24
24
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["utils/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,oBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,eAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,yBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,mBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,oBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,qBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,+BAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,kBAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './getBasePlacement';\nexport * from './getBoundary';\nexport * from './getReactFiberFromNode';\nexport * from './getScrollParent';\nexport * from './mergeArrowOffset';\nexport * from './positioningHelper';\nexport * from './resolvePositioningShorthand';\nexport * from './useCallbackRef';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["utils/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,eAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,yBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,mBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,oBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,qBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,+BAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,kBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,wBAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './getBoundary';\nexport * from './getReactFiberFromNode';\nexport * from './getScrollParent';\nexport * from './mergeArrowOffset';\nexport * from './positioningHelper';\nexport * from './resolvePositioningShorthand';\nexport * from './useCallbackRef';\nexport * from './parsePopperPlacement';\n"],"sourceRoot":"../src/"}