@fluentui/react-positioning 9.1.2 → 9.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. package/CHANGELOG.json +56 -1
  2. package/CHANGELOG.md +18 -2
  3. package/dist/index.d.ts +9 -16
  4. package/lib/constants.js +5 -0
  5. package/lib/constants.js.map +1 -0
  6. package/lib/middleware/coverTarget.js +40 -0
  7. package/lib/middleware/coverTarget.js.map +1 -0
  8. package/lib/middleware/flip.js +19 -0
  9. package/lib/middleware/flip.js.map +1 -0
  10. package/lib/middleware/index.js +7 -0
  11. package/lib/middleware/index.js.map +1 -0
  12. package/lib/middleware/intersecting.js +21 -0
  13. package/lib/middleware/intersecting.js.map +1 -0
  14. package/lib/middleware/maxSize.js +43 -0
  15. package/lib/middleware/maxSize.js.map +1 -0
  16. package/lib/middleware/offset.js +11 -0
  17. package/lib/middleware/offset.js.map +1 -0
  18. package/lib/middleware/shift.js +30 -0
  19. package/lib/middleware/shift.js.map +1 -0
  20. package/lib/usePositioning.js +234 -336
  21. package/lib/usePositioning.js.map +1 -1
  22. package/lib/utils/debounce.js +22 -0
  23. package/lib/utils/debounce.js.map +1 -0
  24. package/lib/utils/fromFloatingUIPlacement.js +43 -0
  25. package/lib/utils/fromFloatingUIPlacement.js.map +1 -0
  26. package/lib/utils/getBoundary.js +5 -1
  27. package/lib/utils/getBoundary.js.map +1 -1
  28. package/lib/utils/getFloatingUIOffset.js +36 -0
  29. package/lib/utils/getFloatingUIOffset.js.map +1 -0
  30. package/lib/utils/getScrollParent.js +6 -0
  31. package/lib/utils/getScrollParent.js.map +1 -1
  32. package/lib/utils/hasAutoFocusFilter.js +28 -0
  33. package/lib/utils/hasAutoFocusFilter.js.map +1 -0
  34. package/lib/utils/index.js +6 -2
  35. package/lib/utils/index.js.map +1 -1
  36. package/lib/utils/mergeArrowOffset.js +1 -1
  37. package/lib/utils/mergeArrowOffset.js.map +1 -1
  38. package/lib/utils/parseFloatingUIPlacement.js +14 -0
  39. package/lib/utils/parseFloatingUIPlacement.js.map +1 -0
  40. package/lib/utils/toFloatingUIPlacement.js +40 -0
  41. package/lib/utils/toFloatingUIPlacement.js.map +1 -0
  42. package/lib/utils/toggleScrollListener.js +24 -0
  43. package/lib/utils/toggleScrollListener.js.map +1 -0
  44. package/lib-commonjs/constants.js +11 -0
  45. package/lib-commonjs/constants.js.map +1 -0
  46. package/lib-commonjs/middleware/coverTarget.js +50 -0
  47. package/lib-commonjs/middleware/coverTarget.js.map +1 -0
  48. package/lib-commonjs/middleware/flip.js +30 -0
  49. package/lib-commonjs/middleware/flip.js.map +1 -0
  50. package/lib-commonjs/middleware/index.js +20 -0
  51. package/lib-commonjs/middleware/index.js.map +1 -0
  52. package/lib-commonjs/middleware/intersecting.js +31 -0
  53. package/lib-commonjs/middleware/intersecting.js.map +1 -0
  54. package/lib-commonjs/middleware/maxSize.js +54 -0
  55. package/lib-commonjs/middleware/maxSize.js.map +1 -0
  56. package/lib-commonjs/middleware/offset.js +22 -0
  57. package/lib-commonjs/middleware/offset.js.map +1 -0
  58. package/lib-commonjs/middleware/shift.js +41 -0
  59. package/lib-commonjs/middleware/shift.js.map +1 -0
  60. package/lib-commonjs/usePositioning.js +236 -337
  61. package/lib-commonjs/usePositioning.js.map +1 -1
  62. package/lib-commonjs/utils/debounce.js +31 -0
  63. package/lib-commonjs/utils/debounce.js.map +1 -0
  64. package/lib-commonjs/utils/fromFloatingUIPlacement.js +52 -0
  65. package/lib-commonjs/utils/fromFloatingUIPlacement.js.map +1 -0
  66. package/lib-commonjs/utils/getBoundary.js +5 -1
  67. package/lib-commonjs/utils/getBoundary.js.map +1 -1
  68. package/lib-commonjs/utils/getFloatingUIOffset.js +46 -0
  69. package/lib-commonjs/utils/getFloatingUIOffset.js.map +1 -0
  70. package/lib-commonjs/utils/getScrollParent.js +10 -1
  71. package/lib-commonjs/utils/getScrollParent.js.map +1 -1
  72. package/lib-commonjs/utils/hasAutoFocusFilter.js +37 -0
  73. package/lib-commonjs/utils/hasAutoFocusFilter.js.map +1 -0
  74. package/lib-commonjs/utils/index.js +10 -2
  75. package/lib-commonjs/utils/index.js.map +1 -1
  76. package/lib-commonjs/utils/mergeArrowOffset.js +1 -1
  77. package/lib-commonjs/utils/mergeArrowOffset.js.map +1 -1
  78. package/lib-commonjs/utils/parseFloatingUIPlacement.js +23 -0
  79. package/lib-commonjs/utils/parseFloatingUIPlacement.js.map +1 -0
  80. package/lib-commonjs/utils/toFloatingUIPlacement.js +49 -0
  81. package/lib-commonjs/utils/toFloatingUIPlacement.js.map +1 -0
  82. package/lib-commonjs/utils/toggleScrollListener.js +34 -0
  83. package/lib-commonjs/utils/toggleScrollListener.js.map +1 -0
  84. package/package.json +7 -7
  85. package/dist/tsdoc-metadata.json +0 -11
  86. package/lib/isIntersectingModifier.js +0 -26
  87. package/lib/isIntersectingModifier.js.map +0 -1
  88. package/lib/utils/fromPopperPlacement.js +0 -40
  89. package/lib/utils/fromPopperPlacement.js.map +0 -1
  90. package/lib/utils/getPopperOffset.js +0 -44
  91. package/lib/utils/getPopperOffset.js.map +0 -1
  92. package/lib/utils/parsePopperPlacement.js +0 -14
  93. package/lib/utils/parsePopperPlacement.js.map +0 -1
  94. package/lib/utils/positioningHelper.js +0 -49
  95. package/lib/utils/positioningHelper.js.map +0 -1
  96. package/lib-commonjs/isIntersectingModifier.js +0 -34
  97. package/lib-commonjs/isIntersectingModifier.js.map +0 -1
  98. package/lib-commonjs/utils/fromPopperPlacement.js +0 -50
  99. package/lib-commonjs/utils/fromPopperPlacement.js.map +0 -1
  100. package/lib-commonjs/utils/getPopperOffset.js +0 -54
  101. package/lib-commonjs/utils/getPopperOffset.js.map +0 -1
  102. package/lib-commonjs/utils/parsePopperPlacement.js +0 -23
  103. package/lib-commonjs/utils/parsePopperPlacement.js.map +0 -1
  104. package/lib-commonjs/utils/positioningHelper.js +0 -61
  105. package/lib-commonjs/utils/positioningHelper.js.map +0 -1
@@ -1,11 +0,0 @@
1
- // This file is read by tools that parse documentation comments conforming to the TSDoc standard.
2
- // It should be published with your NPM package. It should not be tracked by Git.
3
- {
4
- "tsdocVersion": "0.12",
5
- "toolPackages": [
6
- {
7
- "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.18.1"
9
- }
10
- ]
11
- }
@@ -1,26 +0,0 @@
1
- import { detectOverflow } from '@popperjs/core';
2
- export const isIntersectingModifier = {
3
- name: 'is-intersecting-modifier',
4
- enabled: true,
5
- phase: 'main',
6
- requires: ['preventOverflow'],
7
- fn: ({
8
- state,
9
- name
10
- }) => {
11
- const popperRect = state.rects.popper;
12
- const popperAltOverflow = detectOverflow(state, {
13
- altBoundary: true
14
- });
15
- const isIntersectingTop = popperAltOverflow.top < popperRect.height && popperAltOverflow.top > 0;
16
- const isIntersectingBottom = popperAltOverflow.bottom < popperRect.height && popperAltOverflow.bottom > 0;
17
- const isIntersecting = isIntersectingTop || isIntersectingBottom;
18
- state.modifiersData[name] = {
19
- isIntersecting
20
- };
21
- state.attributes.popper = { ...state.attributes.popper,
22
- 'data-popper-is-intersecting': isIntersecting
23
- };
24
- }
25
- };
26
- //# sourceMappingURL=isIntersectingModifier.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["isIntersectingModifier.ts"],"names":[],"mappings":"AAAA,SAAS,cAAT,QAAyC,gBAAzC;AAEA,OAAO,MAAM,sBAAsB,GAA2B;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,cAAc,CAAC,KAAD,EAAQ;MAAE,WAAW,EAAE;IAAf,CAAR,CAAxC;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,CAAvD","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,40 +0,0 @@
1
- import { parsePopperPlacement } from './parsePopperPlacement';
2
- const positionMap = {
3
- top: 'above',
4
- bottom: 'below',
5
- right: 'after',
6
- left: 'before'
7
- };
8
-
9
- const getAlignmentMap = position => {
10
- if (position === 'above' || position === 'below') {
11
- return {
12
- start: 'start',
13
- end: 'end'
14
- };
15
- }
16
-
17
- return {
18
- start: 'top',
19
- end: 'bottom'
20
- };
21
- };
22
- /**
23
- * Maps Popper.js placement to positioning values
24
- * @see positioningHelper.test.ts for expected placement values
25
- */
26
-
27
-
28
- export const fromPopperPlacement = placement => {
29
- const {
30
- basePlacement,
31
- alignment: popperAlignment
32
- } = parsePopperPlacement(placement);
33
- const position = positionMap[basePlacement];
34
- const alignment = popperAlignment && getAlignmentMap(position)[popperAlignment];
35
- return {
36
- position,
37
- alignment
38
- };
39
- };
40
- //# sourceMappingURL=fromPopperPlacement.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["utils/fromPopperPlacement.ts"],"names":[],"mappings":"AAEA,SAAS,oBAAT,QAAqC,wBAArC;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;;;AACH,OAAO,MAAM,mBAAmB,GAAI,SAAD,IAAwE;EACzG,MAAM;IAAE,aAAF;IAAiB,SAAS,EAAE;EAA5B,IAAgD,oBAAoB,CAAC,SAAD,CAA1E;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","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/"}
@@ -1,44 +0,0 @@
1
- import { fromPopperPlacement } from './fromPopperPlacement';
2
- /**
3
- * Shim to transform offset values from this library to Popper.js
4
- * @param rawOffset Offset from this library
5
- * @returns An offset value compatible with Popper.js
6
- */
7
-
8
- export function getPopperOffset(rawOffset) {
9
- if (rawOffset === undefined || rawOffset === null) {
10
- return rawOffset;
11
- }
12
-
13
- if (typeof rawOffset === 'number') {
14
- return [0, rawOffset];
15
- }
16
-
17
- if (typeof rawOffset === 'object') {
18
- return [rawOffset.crossAxis, rawOffset.mainAxis];
19
- }
20
-
21
- return ({
22
- popper,
23
- reference,
24
- placement
25
- }) => {
26
- const {
27
- position,
28
- alignment
29
- } = fromPopperPlacement(placement);
30
- const computedOffset = rawOffset({
31
- positionedRect: popper,
32
- targetRect: reference,
33
- position,
34
- alignment
35
- });
36
-
37
- if (typeof computedOffset === 'number') {
38
- return [0, computedOffset];
39
- }
40
-
41
- return [computedOffset.crossAxis, computedOffset.mainAxis];
42
- };
43
- }
44
- //# sourceMappingURL=getPopperOffset.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["utils/getPopperOffset.ts"],"names":[],"mappings":"AAEA,SAAS,mBAAT,QAAoC,uBAApC;AAyBA;;;;AAIG;;AACH,OAAM,SAAU,eAAV,CAA0B,SAA1B,EAAuD;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,mBAAmB,CAAC,SAAD,CAAnD;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","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,14 +0,0 @@
1
- /**
2
- * Parses Popper placement and returns the different components
3
- * @param placement - the Popper.js placement (i.e. bottom-start)
4
- *
5
- * @returns side and alignment components of the placement
6
- */
7
- export function parsePopperPlacement(placement) {
8
- const tokens = placement.split('-');
9
- return {
10
- basePlacement: tokens[0],
11
- alignment: tokens[1]
12
- };
13
- }
14
- //# sourceMappingURL=parsePopperPlacement.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["utils/parsePopperPlacement.ts"],"names":[],"mappings":"AAEA;;;;;AAKG;AACH,OAAM,SAAU,oBAAV,CAA+B,SAA/B,EAAmD;EACvD,MAAM,MAAM,GAAG,SAAS,CAAC,KAAV,CAAgB,GAAhB,CAAf;EACA,OAAO;IACL,aAAa,EAAE,MAAM,CAAC,CAAD,CADhB;IAEL,SAAS,EAAE,MAAM,CAAC,CAAD;EAFZ,CAAP;AAID","sourcesContent":["import type { BasePlacement, Placement, Variation } from '@popperjs/core';\n\n/**\n * Parses Popper placement and returns the different components\n * @param placement - the Popper.js placement (i.e. bottom-start)\n *\n * @returns side and alignment components of the placement\n */\nexport function parsePopperPlacement(placement: Placement): { basePlacement: BasePlacement; alignment: Variation } {\n const tokens = placement.split('-');\n return {\n basePlacement: tokens[0] as BasePlacement,\n alignment: tokens[1] as Variation,\n };\n}\n"],"sourceRoot":"../src/"}
@@ -1,49 +0,0 @@
1
- const getPositionMap = rtl => ({
2
- above: 'top',
3
- below: 'bottom',
4
- before: rtl ? 'right' : 'left',
5
- after: rtl ? 'left' : 'right'
6
- });
7
-
8
- const getAlignmentMap = rtl => ({
9
- start: rtl ? 'end' : 'start',
10
- end: rtl ? 'start' : 'end',
11
- top: 'start',
12
- bottom: 'end',
13
- center: ''
14
- });
15
-
16
- const shouldAlignToCenter = (p, a) => {
17
- const positionedVertically = p === 'above' || p === 'below';
18
- const alignedVertically = a === 'top' || a === 'bottom';
19
- return positionedVertically && alignedVertically || !positionedVertically && !alignedVertically;
20
- };
21
- /**
22
- * @see positioninHelper.test.ts for expected placement values
23
- */
24
-
25
-
26
- export const getPlacement = (align, position, rtl) => {
27
- const alignment = shouldAlignToCenter(position, align) ? 'center' : align;
28
- const computedPosition = position && getPositionMap(rtl)[position];
29
- const computedAlignmnent = alignment && getAlignmentMap(rtl)[alignment];
30
-
31
- if (computedPosition && computedAlignmnent) {
32
- return `${computedPosition}-${computedAlignmnent}`;
33
- }
34
-
35
- return computedPosition || 'auto';
36
- };
37
- export const applyRtlToOffset = offset => {
38
- if (typeof offset === 'undefined') {
39
- return undefined;
40
- }
41
-
42
- if (Array.isArray(offset)) {
43
- offset[0] = offset[0] * -1;
44
- return offset;
45
- }
46
-
47
- return param => applyRtlToOffset(offset(param));
48
- };
49
- //# sourceMappingURL=positioningHelper.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["utils/positioningHelper.ts"],"names":[],"mappings":"AAOA,MAAM,cAAc,GAAI,GAAD,KAAyD;EAC9E,KAAK,EAAE,KADuE;EAE9E,KAAK,EAAE,QAFuE;EAG9E,MAAM,EAAE,GAAG,GAAG,OAAH,GAAa,MAHsD;EAI9E,KAAK,EAAE,GAAG,GAAG,MAAH,GAAY;AAJwD,CAAzD,CAAvB;;AAOA,MAAM,eAAe,GAAI,GAAD,KAAuD;EAC7E,KAAK,EAAE,GAAG,GAAG,KAAH,GAAW,OADwD;EAE7E,GAAG,EAAE,GAAG,GAAG,OAAH,GAAa,KAFwD;EAG7E,GAAG,EAAE,OAHwE;EAI7E,MAAM,EAAE,KAJqE;EAK7E,MAAM,EAAE;AALqE,CAAvD,CAAxB;;AAQA,MAAM,mBAAmB,GAAG,CAAC,CAAD,EAAe,CAAf,KAAyC;EACnE,MAAM,oBAAoB,GAAG,CAAC,KAAK,OAAN,IAAiB,CAAC,KAAK,OAApD;EACA,MAAM,iBAAiB,GAAG,CAAC,KAAK,KAAN,IAAe,CAAC,KAAK,QAA/C;EAEA,OAAQ,oBAAoB,IAAI,iBAAzB,IAAgD,CAAC,oBAAD,IAAyB,CAAC,iBAAjF;AACD,CALD;AAOA;;AAEG;;;AACH,OAAO,MAAM,YAAY,GAAG,CAAC,KAAD,EAAoB,QAApB,EAAyC,GAAzC,KAA8E;EACxG,MAAM,SAAS,GAAG,mBAAmB,CAAC,QAAD,EAAW,KAAX,CAAnB,GAAuC,QAAvC,GAAkD,KAApE;EAEA,MAAM,gBAAgB,GAAG,QAAQ,IAAI,cAAc,CAAC,GAAD,CAAd,CAAoB,QAApB,CAArC;EACA,MAAM,kBAAkB,GAAG,SAAS,IAAI,eAAe,CAAC,GAAD,CAAf,CAAqB,SAArB,CAAxC;;EAEA,IAAI,gBAAgB,IAAI,kBAAxB,EAA4C;IAC1C,OAAO,GAAG,gBAAgB,IAAI,kBAAkB,EAAhD;EACD;;EAED,OAAO,gBAAgB,IAAK,MAA5B;AACD,CAXM;AAaP,OAAO,MAAM,gBAAgB,GAAI,MAAD,IAA+D;EAC7F,IAAI,OAAO,MAAP,KAAkB,WAAtB,EAAmC;IACjC,OAAO,SAAP;EACD;;EAED,IAAI,KAAK,CAAC,OAAN,CAAc,MAAd,CAAJ,EAA2B;IACzB,MAAM,CAAC,CAAD,CAAN,GAAY,MAAM,CAAC,CAAD,CAAN,GAAa,CAAC,CAA1B;IAEA,OAAO,MAAP;EACD;;EAED,OAAS,KAAD,IAAsC,gBAAgB,CAAC,MAAM,CAAC,KAAD,CAAP,CAA9D;AACD,CAZM","sourcesContent":["import * as PopperJs from '@popperjs/core';\nimport type { Alignment, Position } from '../types';\nimport { PopperOffset, PopperOffsetFunction, PopperOffsetFunctionParam } from './getPopperOffset';\n\ntype PlacementPosition = 'top' | 'bottom' | 'left' | 'right';\ntype PlacementAlign = 'start' | 'end' | ''; // '' represents center\n\nconst getPositionMap = (rtl?: boolean): Record<Position, PlacementPosition> => ({\n above: 'top',\n below: 'bottom',\n before: rtl ? 'right' : 'left',\n after: rtl ? 'left' : 'right',\n});\n\nconst getAlignmentMap = (rtl?: boolean): Record<Alignment, PlacementAlign> => ({\n start: rtl ? 'end' : 'start',\n end: rtl ? 'start' : 'end',\n top: 'start',\n bottom: 'end',\n center: '',\n});\n\nconst shouldAlignToCenter = (p?: Position, a?: Alignment): boolean => {\n const positionedVertically = p === 'above' || p === 'below';\n const alignedVertically = a === 'top' || a === 'bottom';\n\n return (positionedVertically && alignedVertically) || (!positionedVertically && !alignedVertically);\n};\n\n/**\n * @see positioninHelper.test.ts for expected placement values\n */\nexport const getPlacement = (align?: Alignment, position?: Position, rtl?: boolean): PopperJs.Placement => {\n const alignment = shouldAlignToCenter(position, align) ? 'center' : align;\n\n const computedPosition = position && getPositionMap(rtl)[position];\n const computedAlignmnent = alignment && getAlignmentMap(rtl)[alignment];\n\n if (computedPosition && computedAlignmnent) {\n return `${computedPosition}-${computedAlignmnent}` as PopperJs.Placement;\n }\n\n return computedPosition || ('auto' as PopperJs.Placement);\n};\n\nexport const applyRtlToOffset = (offset: PopperOffset | undefined): PopperOffset | undefined => {\n if (typeof offset === 'undefined') {\n return undefined;\n }\n\n if (Array.isArray(offset)) {\n offset[0] = offset[0]! * -1;\n\n return offset;\n }\n\n return ((param: PopperOffsetFunctionParam) => applyRtlToOffset(offset(param))) as PopperOffsetFunction;\n};\n"],"sourceRoot":"../src/"}
@@ -1,34 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.isIntersectingModifier = void 0;
7
-
8
- const core_1 = /*#__PURE__*/require("@popperjs/core");
9
-
10
- exports.isIntersectingModifier = {
11
- name: 'is-intersecting-modifier',
12
- enabled: true,
13
- phase: 'main',
14
- requires: ['preventOverflow'],
15
- fn: ({
16
- state,
17
- name
18
- }) => {
19
- const popperRect = state.rects.popper;
20
- const popperAltOverflow = core_1.detectOverflow(state, {
21
- altBoundary: true
22
- });
23
- const isIntersectingTop = popperAltOverflow.top < popperRect.height && popperAltOverflow.top > 0;
24
- const isIntersectingBottom = popperAltOverflow.bottom < popperRect.height && popperAltOverflow.bottom > 0;
25
- const isIntersecting = isIntersectingTop || isIntersectingBottom;
26
- state.modifiersData[name] = {
27
- isIntersecting
28
- };
29
- state.attributes.popper = { ...state.attributes.popper,
30
- 'data-popper-is-intersecting': isIntersecting
31
- };
32
- }
33
- };
34
- //# sourceMappingURL=isIntersectingModifier.js.map
@@ -1 +0,0 @@
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/"}
@@ -1,50 +0,0 @@
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
@@ -1 +0,0 @@
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/"}
@@ -1,54 +0,0 @@
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
@@ -1 +0,0 @@
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,23 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.parsePopperPlacement = void 0;
7
- /**
8
- * Parses Popper placement and returns the different components
9
- * @param placement - the Popper.js placement (i.e. bottom-start)
10
- *
11
- * @returns side and alignment components of the placement
12
- */
13
-
14
- function parsePopperPlacement(placement) {
15
- const tokens = placement.split('-');
16
- return {
17
- basePlacement: tokens[0],
18
- alignment: tokens[1]
19
- };
20
- }
21
-
22
- exports.parsePopperPlacement = parsePopperPlacement;
23
- //# sourceMappingURL=parsePopperPlacement.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["utils/parsePopperPlacement.ts"],"names":[],"mappings":";;;;;;AAEA;;;;;AAKG;;AACH,SAAgB,oBAAhB,CAAqC,SAArC,EAAyD;EACvD,MAAM,MAAM,GAAG,SAAS,CAAC,KAAV,CAAgB,GAAhB,CAAf;EACA,OAAO;IACL,aAAa,EAAE,MAAM,CAAC,CAAD,CADhB;IAEL,SAAS,EAAE,MAAM,CAAC,CAAD;EAFZ,CAAP;AAID;;AAND,OAAA,CAAA,oBAAA,GAAA,oBAAA","sourcesContent":["import type { BasePlacement, Placement, Variation } from '@popperjs/core';\n\n/**\n * Parses Popper placement and returns the different components\n * @param placement - the Popper.js placement (i.e. bottom-start)\n *\n * @returns side and alignment components of the placement\n */\nexport function parsePopperPlacement(placement: Placement): { basePlacement: BasePlacement; alignment: Variation } {\n const tokens = placement.split('-');\n return {\n basePlacement: tokens[0] as BasePlacement,\n alignment: tokens[1] as Variation,\n };\n}\n"],"sourceRoot":"../src/"}
@@ -1,61 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.applyRtlToOffset = exports.getPlacement = void 0;
7
-
8
- const getPositionMap = rtl => ({
9
- above: 'top',
10
- below: 'bottom',
11
- before: rtl ? 'right' : 'left',
12
- after: rtl ? 'left' : 'right'
13
- });
14
-
15
- const getAlignmentMap = rtl => ({
16
- start: rtl ? 'end' : 'start',
17
- end: rtl ? 'start' : 'end',
18
- top: 'start',
19
- bottom: 'end',
20
- center: ''
21
- });
22
-
23
- const shouldAlignToCenter = (p, a) => {
24
- const positionedVertically = p === 'above' || p === 'below';
25
- const alignedVertically = a === 'top' || a === 'bottom';
26
- return positionedVertically && alignedVertically || !positionedVertically && !alignedVertically;
27
- };
28
- /**
29
- * @see positioninHelper.test.ts for expected placement values
30
- */
31
-
32
-
33
- const getPlacement = (align, position, rtl) => {
34
- const alignment = shouldAlignToCenter(position, align) ? 'center' : align;
35
- const computedPosition = position && getPositionMap(rtl)[position];
36
- const computedAlignmnent = alignment && getAlignmentMap(rtl)[alignment];
37
-
38
- if (computedPosition && computedAlignmnent) {
39
- return `${computedPosition}-${computedAlignmnent}`;
40
- }
41
-
42
- return computedPosition || 'auto';
43
- };
44
-
45
- exports.getPlacement = getPlacement;
46
-
47
- const applyRtlToOffset = offset => {
48
- if (typeof offset === 'undefined') {
49
- return undefined;
50
- }
51
-
52
- if (Array.isArray(offset)) {
53
- offset[0] = offset[0] * -1;
54
- return offset;
55
- }
56
-
57
- return param => exports.applyRtlToOffset(offset(param));
58
- };
59
-
60
- exports.applyRtlToOffset = applyRtlToOffset;
61
- //# sourceMappingURL=positioningHelper.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["utils/positioningHelper.ts"],"names":[],"mappings":";;;;;;;AAOA,MAAM,cAAc,GAAI,GAAD,KAAyD;EAC9E,KAAK,EAAE,KADuE;EAE9E,KAAK,EAAE,QAFuE;EAG9E,MAAM,EAAE,GAAG,GAAG,OAAH,GAAa,MAHsD;EAI9E,KAAK,EAAE,GAAG,GAAG,MAAH,GAAY;AAJwD,CAAzD,CAAvB;;AAOA,MAAM,eAAe,GAAI,GAAD,KAAuD;EAC7E,KAAK,EAAE,GAAG,GAAG,KAAH,GAAW,OADwD;EAE7E,GAAG,EAAE,GAAG,GAAG,OAAH,GAAa,KAFwD;EAG7E,GAAG,EAAE,OAHwE;EAI7E,MAAM,EAAE,KAJqE;EAK7E,MAAM,EAAE;AALqE,CAAvD,CAAxB;;AAQA,MAAM,mBAAmB,GAAG,CAAC,CAAD,EAAe,CAAf,KAAyC;EACnE,MAAM,oBAAoB,GAAG,CAAC,KAAK,OAAN,IAAiB,CAAC,KAAK,OAApD;EACA,MAAM,iBAAiB,GAAG,CAAC,KAAK,KAAN,IAAe,CAAC,KAAK,QAA/C;EAEA,OAAQ,oBAAoB,IAAI,iBAAzB,IAAgD,CAAC,oBAAD,IAAyB,CAAC,iBAAjF;AACD,CALD;AAOA;;AAEG;;;AACI,MAAM,YAAY,GAAG,CAAC,KAAD,EAAoB,QAApB,EAAyC,GAAzC,KAA8E;EACxG,MAAM,SAAS,GAAG,mBAAmB,CAAC,QAAD,EAAW,KAAX,CAAnB,GAAuC,QAAvC,GAAkD,KAApE;EAEA,MAAM,gBAAgB,GAAG,QAAQ,IAAI,cAAc,CAAC,GAAD,CAAd,CAAoB,QAApB,CAArC;EACA,MAAM,kBAAkB,GAAG,SAAS,IAAI,eAAe,CAAC,GAAD,CAAf,CAAqB,SAArB,CAAxC;;EAEA,IAAI,gBAAgB,IAAI,kBAAxB,EAA4C;IAC1C,OAAO,GAAG,gBAAgB,IAAI,kBAAkB,EAAhD;EACD;;EAED,OAAO,gBAAgB,IAAK,MAA5B;AACD,CAXM;;AAAM,OAAA,CAAA,YAAA,GAAY,YAAZ;;AAaN,MAAM,gBAAgB,GAAI,MAAD,IAA+D;EAC7F,IAAI,OAAO,MAAP,KAAkB,WAAtB,EAAmC;IACjC,OAAO,SAAP;EACD;;EAED,IAAI,KAAK,CAAC,OAAN,CAAc,MAAd,CAAJ,EAA2B;IACzB,MAAM,CAAC,CAAD,CAAN,GAAY,MAAM,CAAC,CAAD,CAAN,GAAa,CAAC,CAA1B;IAEA,OAAO,MAAP;EACD;;EAED,OAAS,KAAD,IAAsC,OAAA,CAAA,gBAAA,CAAiB,MAAM,CAAC,KAAD,CAAvB,CAA9C;AACD,CAZM;;AAAM,OAAA,CAAA,gBAAA,GAAgB,gBAAhB","sourcesContent":["import * as PopperJs from '@popperjs/core';\nimport type { Alignment, Position } from '../types';\nimport { PopperOffset, PopperOffsetFunction, PopperOffsetFunctionParam } from './getPopperOffset';\n\ntype PlacementPosition = 'top' | 'bottom' | 'left' | 'right';\ntype PlacementAlign = 'start' | 'end' | ''; // '' represents center\n\nconst getPositionMap = (rtl?: boolean): Record<Position, PlacementPosition> => ({\n above: 'top',\n below: 'bottom',\n before: rtl ? 'right' : 'left',\n after: rtl ? 'left' : 'right',\n});\n\nconst getAlignmentMap = (rtl?: boolean): Record<Alignment, PlacementAlign> => ({\n start: rtl ? 'end' : 'start',\n end: rtl ? 'start' : 'end',\n top: 'start',\n bottom: 'end',\n center: '',\n});\n\nconst shouldAlignToCenter = (p?: Position, a?: Alignment): boolean => {\n const positionedVertically = p === 'above' || p === 'below';\n const alignedVertically = a === 'top' || a === 'bottom';\n\n return (positionedVertically && alignedVertically) || (!positionedVertically && !alignedVertically);\n};\n\n/**\n * @see positioninHelper.test.ts for expected placement values\n */\nexport const getPlacement = (align?: Alignment, position?: Position, rtl?: boolean): PopperJs.Placement => {\n const alignment = shouldAlignToCenter(position, align) ? 'center' : align;\n\n const computedPosition = position && getPositionMap(rtl)[position];\n const computedAlignmnent = alignment && getAlignmentMap(rtl)[alignment];\n\n if (computedPosition && computedAlignmnent) {\n return `${computedPosition}-${computedAlignmnent}` as PopperJs.Placement;\n }\n\n return computedPosition || ('auto' as PopperJs.Placement);\n};\n\nexport const applyRtlToOffset = (offset: PopperOffset | undefined): PopperOffset | undefined => {\n if (typeof offset === 'undefined') {\n return undefined;\n }\n\n if (Array.isArray(offset)) {\n offset[0] = offset[0]! * -1;\n\n return offset;\n }\n\n return ((param: PopperOffsetFunctionParam) => applyRtlToOffset(offset(param))) as PopperOffsetFunction;\n};\n"],"sourceRoot":"../src/"}