@elliemae/ds-floating-context 3.44.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/dist/cjs/DSFloatingContext.js +151 -0
  2. package/dist/cjs/DSFloatingContext.js.map +7 -0
  3. package/dist/cjs/index.js +42 -0
  4. package/dist/cjs/index.js.map +7 -0
  5. package/dist/cjs/package.json +7 -0
  6. package/dist/cjs/parts/FloatingWrapper/FloatingWrapper.js +95 -0
  7. package/dist/cjs/parts/FloatingWrapper/FloatingWrapper.js.map +7 -0
  8. package/dist/cjs/parts/FloatingWrapper/config/useFloatingWrapper.js +58 -0
  9. package/dist/cjs/parts/FloatingWrapper/config/useFloatingWrapper.js.map +7 -0
  10. package/dist/cjs/parts/FloatingWrapper/config/useValidateProps.js +39 -0
  11. package/dist/cjs/parts/FloatingWrapper/config/useValidateProps.js.map +7 -0
  12. package/dist/cjs/parts/FloatingWrapper/constants/index.js +40 -0
  13. package/dist/cjs/parts/FloatingWrapper/constants/index.js.map +7 -0
  14. package/dist/cjs/parts/FloatingWrapper/index.js +37 -0
  15. package/dist/cjs/parts/FloatingWrapper/index.js.map +7 -0
  16. package/dist/cjs/parts/FloatingWrapper/react-desc-prop-types.js +63 -0
  17. package/dist/cjs/parts/FloatingWrapper/react-desc-prop-types.js.map +7 -0
  18. package/dist/cjs/parts/FloatingWrapper/styled.js +77 -0
  19. package/dist/cjs/parts/FloatingWrapper/styled.js.map +7 -0
  20. package/dist/cjs/parts/PopoverArrow.js +114 -0
  21. package/dist/cjs/parts/PopoverArrow.js.map +7 -0
  22. package/dist/cjs/react-desc-prop-types.js +84 -0
  23. package/dist/cjs/react-desc-prop-types.js.map +7 -0
  24. package/dist/cjs/utils/computeOffsets.js +90 -0
  25. package/dist/cjs/utils/computeOffsets.js.map +7 -0
  26. package/dist/cjs/utils/computePosition.js +105 -0
  27. package/dist/cjs/utils/computePosition.js.map +7 -0
  28. package/dist/cjs/utils/detectOverflow.js +82 -0
  29. package/dist/cjs/utils/detectOverflow.js.map +7 -0
  30. package/dist/cjs/utils/getAlteredPosition.js +44 -0
  31. package/dist/cjs/utils/getAlteredPosition.js.map +7 -0
  32. package/dist/cjs/utils/getArrowOffset.js +41 -0
  33. package/dist/cjs/utils/getArrowOffset.js.map +7 -0
  34. package/dist/cjs/utils/getExpandedFallbackPlacements.js +58 -0
  35. package/dist/cjs/utils/getExpandedFallbackPlacements.js.map +7 -0
  36. package/dist/cjs/utils/getOppositePlacement.js +44 -0
  37. package/dist/cjs/utils/getOppositePlacement.js.map +7 -0
  38. package/dist/cjs/utils/getOppositeVariationPlacement.js +46 -0
  39. package/dist/cjs/utils/getOppositeVariationPlacement.js.map +7 -0
  40. package/dist/esm/DSFloatingContext.js +125 -0
  41. package/dist/esm/DSFloatingContext.js.map +7 -0
  42. package/dist/esm/index.js +12 -0
  43. package/dist/esm/index.js.map +7 -0
  44. package/dist/esm/package.json +7 -0
  45. package/dist/esm/parts/FloatingWrapper/FloatingWrapper.js +65 -0
  46. package/dist/esm/parts/FloatingWrapper/FloatingWrapper.js.map +7 -0
  47. package/dist/esm/parts/FloatingWrapper/config/useFloatingWrapper.js +28 -0
  48. package/dist/esm/parts/FloatingWrapper/config/useFloatingWrapper.js.map +7 -0
  49. package/dist/esm/parts/FloatingWrapper/config/useValidateProps.js +9 -0
  50. package/dist/esm/parts/FloatingWrapper/config/useValidateProps.js.map +7 -0
  51. package/dist/esm/parts/FloatingWrapper/constants/index.js +10 -0
  52. package/dist/esm/parts/FloatingWrapper/constants/index.js.map +7 -0
  53. package/dist/esm/parts/FloatingWrapper/index.js +7 -0
  54. package/dist/esm/parts/FloatingWrapper/index.js.map +7 -0
  55. package/dist/esm/parts/FloatingWrapper/react-desc-prop-types.js +38 -0
  56. package/dist/esm/parts/FloatingWrapper/react-desc-prop-types.js.map +7 -0
  57. package/dist/esm/parts/FloatingWrapper/styled.js +47 -0
  58. package/dist/esm/parts/FloatingWrapper/styled.js.map +7 -0
  59. package/dist/esm/parts/PopoverArrow.js +84 -0
  60. package/dist/esm/parts/PopoverArrow.js.map +7 -0
  61. package/dist/esm/react-desc-prop-types.js +54 -0
  62. package/dist/esm/react-desc-prop-types.js.map +7 -0
  63. package/dist/esm/utils/computeOffsets.js +60 -0
  64. package/dist/esm/utils/computeOffsets.js.map +7 -0
  65. package/dist/esm/utils/computePosition.js +75 -0
  66. package/dist/esm/utils/computePosition.js.map +7 -0
  67. package/dist/esm/utils/detectOverflow.js +52 -0
  68. package/dist/esm/utils/detectOverflow.js.map +7 -0
  69. package/dist/esm/utils/getAlteredPosition.js +14 -0
  70. package/dist/esm/utils/getAlteredPosition.js.map +7 -0
  71. package/dist/esm/utils/getArrowOffset.js +11 -0
  72. package/dist/esm/utils/getArrowOffset.js.map +7 -0
  73. package/dist/esm/utils/getExpandedFallbackPlacements.js +28 -0
  74. package/dist/esm/utils/getExpandedFallbackPlacements.js.map +7 -0
  75. package/dist/esm/utils/getOppositePlacement.js +14 -0
  76. package/dist/esm/utils/getOppositePlacement.js.map +7 -0
  77. package/dist/esm/utils/getOppositeVariationPlacement.js +16 -0
  78. package/dist/esm/utils/getOppositeVariationPlacement.js.map +7 -0
  79. package/dist/types/DSFloatingContext.d.ts +34 -0
  80. package/dist/types/index.d.ts +4 -0
  81. package/dist/types/parts/FloatingWrapper/FloatingWrapper.d.ts +5 -0
  82. package/dist/types/parts/FloatingWrapper/config/useFloatingWrapper.d.ts +12 -0
  83. package/dist/types/parts/FloatingWrapper/config/useValidateProps.d.ts +3 -0
  84. package/dist/types/parts/FloatingWrapper/constants/index.d.ts +4 -0
  85. package/dist/types/parts/FloatingWrapper/index.d.ts +1 -0
  86. package/dist/types/parts/FloatingWrapper/react-desc-prop-types.d.ts +30 -0
  87. package/dist/types/parts/FloatingWrapper/styled.d.ts +8 -0
  88. package/dist/types/parts/PopoverArrow.d.ts +8 -0
  89. package/dist/types/react-desc-prop-types.d.ts +23 -0
  90. package/dist/types/utils/computeOffsets.d.ts +5 -0
  91. package/dist/types/utils/computePosition.d.ts +23 -0
  92. package/dist/types/utils/detectOverflow.d.ts +7 -0
  93. package/dist/types/utils/getAlteredPosition.d.ts +1 -0
  94. package/dist/types/utils/getArrowOffset.d.ts +7 -0
  95. package/dist/types/utils/getExpandedFallbackPlacements.d.ts +2 -0
  96. package/dist/types/utils/getOppositePlacement.d.ts +1 -0
  97. package/dist/types/utils/getOppositeVariationPlacement.d.ts +1 -0
  98. package/package.json +68 -0
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/FloatingWrapper/index.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export { FloatingWrapper, FloatingWrapperWithSchema } from './FloatingWrapper.js';\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,iBAAiB,iCAAiC;",
6
+ "names": []
7
+ }
@@ -0,0 +1,38 @@
1
+ import * as React from "react";
2
+ import {
3
+ PropTypes,
4
+ getPropsPerSlotPropTypes,
5
+ globalAttributesPropTypes,
6
+ xstyledPropTypes
7
+ } from "@elliemae/ds-props-helpers";
8
+ import { DSFloatingWrapperName, DSFloatingWrapperSlots } from "./constants/index.js";
9
+ const defaultProps = {
10
+ context: {
11
+ portalDOMContainer: document.body,
12
+ withoutPortal: false,
13
+ animationDuration: 300,
14
+ withoutAnimation: false
15
+ }
16
+ };
17
+ const DSFloatingWrapperPropTypes = {
18
+ ...getPropsPerSlotPropTypes(DSFloatingWrapperName, DSFloatingWrapperSlots),
19
+ ...globalAttributesPropTypes,
20
+ ...xstyledPropTypes,
21
+ children: PropTypes.node.description("Content of the floating wrapper").isRequired,
22
+ innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func]).description("Ref for the floating wrapper").isRequired,
23
+ isOpen: PropTypes.bool.description("Whether the floating wrapper is open").isRequired,
24
+ floatingStyles: PropTypes.object.description("Style for the floating wrapper").isRequired,
25
+ context: PropTypes.shape({
26
+ portalDOMContainer: PropTypes.instanceOf(HTMLElement).description("DOM container for the portal"),
27
+ withoutPortal: PropTypes.bool.description("Whether to render the floating wrapper without a portal"),
28
+ animationDuration: PropTypes.number.description("Duration of the animation"),
29
+ withoutAnimation: PropTypes.bool.description("Whether to render the floating wrapper without animation")
30
+ }).description("Context for the floating wrapper")
31
+ };
32
+ const DSFloatingWrapperPropTypesSchema = DSFloatingWrapperPropTypes;
33
+ export {
34
+ DSFloatingWrapperPropTypes,
35
+ DSFloatingWrapperPropTypesSchema,
36
+ defaultProps
37
+ };
38
+ //# sourceMappingURL=react-desc-prop-types.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/FloatingWrapper/react-desc-prop-types.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-empty-interface */\nimport type { GlobalAttributesT, XstyledProps, DSPropTypesSchema, ValidationMap } from '@elliemae/ds-props-helpers';\nimport {\n PropTypes,\n getPropsPerSlotPropTypes,\n globalAttributesPropTypes,\n xstyledPropTypes,\n} from '@elliemae/ds-props-helpers';\nimport { type TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport { DSFloatingWrapperName, DSFloatingWrapperSlots } from './constants/index.js';\n\nexport declare namespace DSFloatingWrapperT {\n export interface RequiredProps {\n children: React.ReactNode;\n innerRef: TypescriptHelpersT.AnyRef<HTMLDivElement>;\n isOpen: boolean;\n floatingStyles: React.CSSProperties;\n }\n\n export interface DefaultProps {\n context: {\n portalDOMContainer: HTMLElement;\n withoutPortal: boolean;\n animationDuration: number;\n withoutAnimation: boolean;\n };\n }\n\n export interface OptionalProps\n extends TypescriptHelpersT.PropsForGlobalOnSlots<typeof DSFloatingWrapperName, typeof DSFloatingWrapperSlots> {}\n\n export interface Props\n extends Partial<DefaultProps>,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLElement>, keyof DefaultProps | keyof XstyledProps>,\n XstyledProps,\n Omit<RequiredProps, 'children'> {}\n\n export interface InternalProps\n extends DefaultProps,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLElement>, keyof DefaultProps | keyof XstyledProps>,\n XstyledProps,\n Omit<RequiredProps, 'children'> {}\n\n export type ExampleState = '0' | '1';\n}\n\nexport const defaultProps: Partial<DSFloatingWrapperT.DefaultProps> = {\n context: {\n portalDOMContainer: document.body,\n withoutPortal: false,\n animationDuration: 300,\n withoutAnimation: false,\n },\n};\n\nexport const DSFloatingWrapperPropTypes: DSPropTypesSchema<DSFloatingWrapperT.Props> = {\n ...getPropsPerSlotPropTypes(DSFloatingWrapperName, DSFloatingWrapperSlots),\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n children: PropTypes.node.description('Content of the floating wrapper').isRequired,\n innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func]).description('Ref for the floating wrapper')\n .isRequired,\n isOpen: PropTypes.bool.description('Whether the floating wrapper is open').isRequired,\n floatingStyles: PropTypes.object.description('Style for the floating wrapper').isRequired,\n context: PropTypes.shape({\n portalDOMContainer: PropTypes.instanceOf(HTMLElement).description('DOM container for the portal'),\n withoutPortal: PropTypes.bool.description('Whether to render the floating wrapper without a portal'),\n animationDuration: PropTypes.number.description('Duration of the animation'),\n withoutAnimation: PropTypes.bool.description('Whether to render the floating wrapper without animation'),\n }).description('Context for the floating wrapper'),\n};\n\nexport const DSFloatingWrapperPropTypesSchema =\n DSFloatingWrapperPropTypes as unknown as ValidationMap<DSFloatingWrapperT.Props>;\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACEvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,uBAAuB,8BAA8B;AAuCvD,MAAM,eAAyD;AAAA,EACpE,SAAS;AAAA,IACP,oBAAoB,SAAS;AAAA,IAC7B,eAAe;AAAA,IACf,mBAAmB;AAAA,IACnB,kBAAkB;AAAA,EACpB;AACF;AAEO,MAAM,6BAA0E;AAAA,EACrF,GAAG,yBAAyB,uBAAuB,sBAAsB;AAAA,EACzE,GAAG;AAAA,EACH,GAAG;AAAA,EACH,UAAU,UAAU,KAAK,YAAY,iCAAiC,EAAE;AAAA,EACxE,UAAU,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,IAAI,CAAC,EAAE,YAAY,8BAA8B,EACzG;AAAA,EACH,QAAQ,UAAU,KAAK,YAAY,sCAAsC,EAAE;AAAA,EAC3E,gBAAgB,UAAU,OAAO,YAAY,gCAAgC,EAAE;AAAA,EAC/E,SAAS,UAAU,MAAM;AAAA,IACvB,oBAAoB,UAAU,WAAW,WAAW,EAAE,YAAY,8BAA8B;AAAA,IAChG,eAAe,UAAU,KAAK,YAAY,yDAAyD;AAAA,IACnG,mBAAmB,UAAU,OAAO,YAAY,2BAA2B;AAAA,IAC3E,kBAAkB,UAAU,KAAK,YAAY,0DAA0D;AAAA,EACzG,CAAC,EAAE,YAAY,kCAAkC;AACnD;AAEO,MAAM,mCACX;",
6
+ "names": []
7
+ }
@@ -0,0 +1,47 @@
1
+ import * as React from "react";
2
+ import { styled, css, kfrm } from "@elliemae/ds-system";
3
+ import { DSFloatingWrapperSlots, DSFloatingWrapperName } from "./constants/index.js";
4
+ const showAnimation = kfrm`
5
+ from {
6
+ opacity: 0;
7
+ transform: scale(0.8);
8
+ }
9
+
10
+ to {
11
+ opacity: 1;
12
+ transform: scale(1);
13
+ visibility: visible;
14
+ }
15
+ `;
16
+ const hideAnimation = kfrm`
17
+ from {
18
+ opacity: 1;
19
+ transform: scale(1);
20
+ }
21
+
22
+ to {
23
+ opacity: 0;
24
+ transform: scale(0.8);
25
+ visibility: hidden;
26
+ }
27
+ `;
28
+ const StyledFloatingAnimation = styled.div`
29
+ background-color: #fff;
30
+ box-shadow:
31
+ 0 0 0 1px rgba(16, 22, 26, 0.1),
32
+ 0 2px 4px rgba(16, 22, 26, 0.2),
33
+ 0 8px 24px rgba(16, 22, 26, 0.2);
34
+
35
+ ${({ isOpen, animationDuration, withoutAnimation }) => !withoutAnimation && css`
36
+ animation: ${isOpen ? showAnimation : hideAnimation} ${animationDuration ?? 100}ms ease-in;
37
+ `}
38
+ `;
39
+ const StyledFloatingWrapper = styled("div", {
40
+ name: DSFloatingWrapperName,
41
+ slot: DSFloatingWrapperSlots.ROOT
42
+ })``;
43
+ export {
44
+ StyledFloatingAnimation,
45
+ StyledFloatingWrapper
46
+ };
47
+ //# sourceMappingURL=styled.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/FloatingWrapper/styled.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { styled, css, kfrm } from '@elliemae/ds-system';\nimport { DSFloatingWrapperSlots, DSFloatingWrapperName } from './constants/index.js';\ninterface StyledAnimatedPopperPropsT {\n isOpen?: boolean;\n animationDuration?: number;\n withoutAnimation?: boolean;\n}\n\nconst showAnimation = kfrm`\n from {\n opacity: 0;\n transform: scale(0.8);\n }\n\n to {\n opacity: 1;\n transform: scale(1);\n visibility: visible;\n }\n`;\n\nconst hideAnimation = kfrm`\n from {\n opacity: 1;\n transform: scale(1);\n }\n\n to {\n opacity: 0;\n transform: scale(0.8);\n visibility: hidden;\n }\n`;\n\nexport const StyledFloatingAnimation = styled.div<StyledAnimatedPopperPropsT>`\n background-color: #fff;\n box-shadow:\n 0 0 0 1px rgba(16, 22, 26, 0.1),\n 0 2px 4px rgba(16, 22, 26, 0.2),\n 0 8px 24px rgba(16, 22, 26, 0.2);\n\n ${({ isOpen, animationDuration, withoutAnimation }) =>\n !withoutAnimation &&\n css`\n animation: ${isOpen ? showAnimation : hideAnimation} ${animationDuration ?? 100}ms ease-in;\n `}\n`;\n\nexport const StyledFloatingWrapper = styled('div', {\n name: DSFloatingWrapperName,\n slot: DSFloatingWrapperSlots.ROOT,\n})``;\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,QAAQ,KAAK,YAAY;AAClC,SAAS,wBAAwB,6BAA6B;AAO9D,MAAM,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAatB,MAAM,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAaf,MAAM,0BAA0B,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAO1C,CAAC,EAAE,QAAQ,mBAAmB,iBAAiB,MAC/C,CAAC,oBACD;AAAA,mBACe,SAAS,gBAAgB,aAAa,IAAI,qBAAqB,GAAG;AAAA,KAChF;AAAA;AAGE,MAAM,wBAAwB,OAAO,OAAO;AAAA,EACjD,MAAM;AAAA,EACN,MAAM,uBAAuB;AAC/B,CAAC;",
6
+ "names": []
7
+ }
@@ -0,0 +1,84 @@
1
+ import * as React from "react";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { styled } from "@elliemae/ds-system";
4
+ const arrowWidth = 18;
5
+ const arrowHeight = 18;
6
+ const StyledArrow = styled.div`
7
+ position: absolute;
8
+ width: ${arrowWidth}px;
9
+ height: ${arrowHeight}px;
10
+ pointer-events: none;
11
+ background-color: transparent;
12
+ & .stroke {
13
+ fill: rgb(105, 116, 137);
14
+ fill-opacity: 0.4;
15
+ }
16
+ & .fill {
17
+ fill: rgb(255, 255, 255);
18
+ }
19
+
20
+ &[data-placement^='top'] {
21
+ svg {
22
+ transform: rotateZ(180deg);
23
+ }
24
+ bottom: -${arrowHeight}px;
25
+ left: ${(props) => {
26
+ if (props["data-placement"].endsWith("start")) return `25%`;
27
+ if (props["data-placement"].endsWith("end")) return `75%`;
28
+ return "";
29
+ }};
30
+ }
31
+ &[data-placement^='right'] {
32
+ svg {
33
+ transform: rotateZ(-90deg);
34
+ }
35
+ left: -${arrowWidth}px;
36
+ }
37
+ &[data-placement^='bottom'] {
38
+ top: -${arrowHeight}px;
39
+ left: ${(props) => {
40
+ if (props["data-placement"].endsWith("start")) return `25%`;
41
+ if (props["data-placement"].endsWith("end")) return `75%`;
42
+ return "";
43
+ }};
44
+ }
45
+ &[data-placement^='left'] {
46
+ svg {
47
+ transform: rotateZ(90deg);
48
+ }
49
+ right: -${arrowWidth}px;
50
+ }
51
+ margin-left: ${(props) => props["data-placement"].startsWith("top") || props["data-placement"].startsWith("bottom") ? `-${arrowWidth / 2}px;` : "0;"};
52
+ margin-top: ${(props) => props["data-placement"].startsWith("left") || props["data-placement"].startsWith("right") ? `-${arrowHeight / 2}px;` : "0;"};
53
+ `;
54
+ const PopoverArrow = ({ placement, style, arrowElementRef }) => /* @__PURE__ */ jsx(
55
+ StyledArrow,
56
+ {
57
+ "data-placement": placement,
58
+ style,
59
+ innerRef: arrowElementRef,
60
+ "data-testid": "ds-tooltip-arrow",
61
+ "aria-hidden": "true",
62
+ children: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 30 30", children: [
63
+ /* @__PURE__ */ jsx(
64
+ "path",
65
+ {
66
+ className: "stroke",
67
+ d: "M23.7,27.1L17,19.9C16.5,19.3,15.8,19,15,19s-1.6,0.3-2.1,0.9l-6.6,7.2C5.3,28.1,3.4,29,2,29h26\n C26.7,29,24.6,28.1,23.7,27.1z"
68
+ }
69
+ ),
70
+ /* @__PURE__ */ jsx(
71
+ "path",
72
+ {
73
+ className: "fill",
74
+ d: "M23,27.8c1.1,1.2,3.4,2.2,5,2.2h2H0h2c1.7,0,3.9-1,5-2.2l6.6-7.2c0.7-0.8,2-0.8,2.7,0L23,27.8L23,27.8z"
75
+ }
76
+ )
77
+ ] })
78
+ },
79
+ "popper-arrow"
80
+ );
81
+ export {
82
+ PopoverArrow
83
+ };
84
+ //# sourceMappingURL=PopoverArrow.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/parts/PopoverArrow.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { styled } from '@elliemae/ds-system';\n\ninterface PopoverArrowT {\n placement: string;\n style: React.CSSProperties;\n arrowElementRef?: React.Dispatch<React.SetStateAction<HTMLDivElement | null>>;\n}\nconst arrowWidth = 18;\nconst arrowHeight = 18;\n\nconst StyledArrow = styled.div<{ 'data-placement': string }>`\n position: absolute;\n width: ${arrowWidth}px;\n height: ${arrowHeight}px;\n pointer-events: none;\n background-color: transparent;\n & .stroke {\n fill: rgb(105, 116, 137);\n fill-opacity: 0.4;\n }\n & .fill {\n fill: rgb(255, 255, 255);\n }\n\n &[data-placement^='top'] {\n svg {\n transform: rotateZ(180deg);\n }\n bottom: -${arrowHeight}px;\n left: ${(props) => {\n if (props['data-placement'].endsWith('start')) return `25%`;\n if (props['data-placement'].endsWith('end')) return `75%`;\n return '';\n }};\n }\n &[data-placement^='right'] {\n svg {\n transform: rotateZ(-90deg);\n }\n left: -${arrowWidth}px;\n }\n &[data-placement^='bottom'] {\n top: -${arrowHeight}px;\n left: ${(props) => {\n if (props['data-placement'].endsWith('start')) return `25%`;\n if (props['data-placement'].endsWith('end')) return `75%`;\n return '';\n }};\n }\n &[data-placement^='left'] {\n svg {\n transform: rotateZ(90deg);\n }\n right: -${arrowWidth}px;\n }\n margin-left: ${(props) =>\n props['data-placement'].startsWith('top') || props['data-placement'].startsWith('bottom')\n ? `-${arrowWidth / 2}px;`\n : '0;'};\n margin-top: ${(props) =>\n props['data-placement'].startsWith('left') || props['data-placement'].startsWith('right')\n ? `-${arrowHeight / 2}px;`\n : '0;'};\n`;\n\nexport const PopoverArrow = ({ placement, style, arrowElementRef }: PopoverArrowT): React.ReactElement => (\n <StyledArrow\n key=\"popper-arrow\"\n data-placement={placement}\n style={style}\n innerRef={arrowElementRef}\n data-testid=\"ds-tooltip-arrow\"\n aria-hidden=\"true\"\n >\n <svg viewBox=\"0 0 30 30\">\n <path\n className=\"stroke\"\n d=\"M23.7,27.1L17,19.9C16.5,19.3,15.8,19,15,19s-1.6,0.3-2.1,0.9l-6.6,7.2C5.3,28.1,3.4,29,2,29h26\n C26.7,29,24.6,28.1,23.7,27.1z\"\n />\n <path\n className=\"fill\"\n d=\"M23,27.8c1.1,1.2,3.4,2.2,5,2.2h2H0h2c1.7,0,3.9-1,5-2.2l6.6-7.2c0.7-0.8,2-0.8,2.7,0L23,27.8L23,27.8z\"\n />\n </svg>\n </StyledArrow>\n);\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;AC2EnB,SACE,KADF;AA1EJ,SAAS,cAAc;AAOvB,MAAM,aAAa;AACnB,MAAM,cAAc;AAEpB,MAAM,cAAc,OAAO;AAAA;AAAA,WAEhB,UAAU;AAAA,YACT,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,eAeR,WAAW;AAAA,YACd,CAAC,UAAU;AACjB,MAAI,MAAM,gBAAgB,EAAE,SAAS,OAAO,EAAG,QAAO;AACtD,MAAI,MAAM,gBAAgB,EAAE,SAAS,KAAK,EAAG,QAAO;AACpD,SAAO;AACT,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAMQ,UAAU;AAAA;AAAA;AAAA,YAGX,WAAW;AAAA,YACX,CAAC,UAAU;AACjB,MAAI,MAAM,gBAAgB,EAAE,SAAS,OAAO,EAAG,QAAO;AACtD,MAAI,MAAM,gBAAgB,EAAE,SAAS,KAAK,EAAG,QAAO;AACpD,SAAO;AACT,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cAMS,UAAU;AAAA;AAAA,iBAEP,CAAC,UACd,MAAM,gBAAgB,EAAE,WAAW,KAAK,KAAK,MAAM,gBAAgB,EAAE,WAAW,QAAQ,IACpF,IAAI,aAAa,CAAC,QAClB,IAAI;AAAA,gBACI,CAAC,UACb,MAAM,gBAAgB,EAAE,WAAW,MAAM,KAAK,MAAM,gBAAgB,EAAE,WAAW,OAAO,IACpF,IAAI,cAAc,CAAC,QACnB,IAAI;AAAA;AAGL,MAAM,eAAe,CAAC,EAAE,WAAW,OAAO,gBAAgB,MAC/D;AAAA,EAAC;AAAA;AAAA,IAEC,kBAAgB;AAAA,IAChB;AAAA,IACA,UAAU;AAAA,IACV,eAAY;AAAA,IACZ,eAAY;AAAA,IAEZ,+BAAC,SAAI,SAAQ,aACX;AAAA;AAAA,QAAC;AAAA;AAAA,UACC,WAAU;AAAA,UACV,GAAE;AAAA;AAAA,MAEJ;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACC,WAAU;AAAA,UACV,GAAE;AAAA;AAAA,MACJ;AAAA,OACF;AAAA;AAAA,EAjBI;AAkBN;",
6
+ "names": []
7
+ }
@@ -0,0 +1,54 @@
1
+ import * as React from "react";
2
+ import { PropTypes } from "@elliemae/ds-props-helpers";
3
+ const defaultProps = {
4
+ withoutAnimation: false,
5
+ animationDuration: 300,
6
+ portalDOMContainer: document.body,
7
+ withoutPortal: false,
8
+ placement: "top",
9
+ customOffset: [12, 12]
10
+ };
11
+ const DSFloatingContextPropTypes = {
12
+ withoutPortal: PropTypes.bool.description("If true, the tooltip will not be rendered inside a portal.").defaultValue(false),
13
+ withoutAnimation: PropTypes.bool.description("If true, the tooltip will not have an animation.").defaultValue(false),
14
+ portalDOMContainer: PropTypes.instanceOf(HTMLElement).description("The DOM element where the tooltip will be rendered.").defaultValue(document.body),
15
+ animationDuration: PropTypes.number.description("The duration of the animation in milliseconds.").defaultValue(300),
16
+ placement: PropTypes.oneOf([
17
+ "top-start",
18
+ "top",
19
+ "top-end",
20
+ "right-start",
21
+ "right",
22
+ "right-end",
23
+ "bottom-end",
24
+ "bottom",
25
+ "bottom-start",
26
+ "left-end",
27
+ "left",
28
+ "left-start"
29
+ ]).description("The placement of the tooltip.").defaultValue("top"),
30
+ customOffset: PropTypes.arrayOf(PropTypes.number).description("The custom offset of the tooltip.").defaultValue([12, 12]),
31
+ placementOrderPreference: PropTypes.arrayOf(
32
+ PropTypes.oneOf([
33
+ "top-start",
34
+ "top",
35
+ "top-end",
36
+ "right-start",
37
+ "right",
38
+ "right-end",
39
+ "bottom-end",
40
+ "bottom",
41
+ "bottom-start",
42
+ "left-end",
43
+ "left",
44
+ "left-start"
45
+ ])
46
+ ).description("The order of the placement preference."),
47
+ onOpen: PropTypes.func.description("Callback when the tooltip is opened."),
48
+ onClose: PropTypes.func.description("Callback when the tooltip is closed.")
49
+ };
50
+ export {
51
+ DSFloatingContextPropTypes,
52
+ defaultProps
53
+ };
54
+ //# sourceMappingURL=react-desc-prop-types.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/react-desc-prop-types.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-empty-interface */\nimport type { DSPropTypesSchema } from '@elliemae/ds-props-helpers';\nimport { PropTypes } from '@elliemae/ds-props-helpers';\nexport declare namespace DSHookFloatingContextT {\n export interface DefaultProps {\n withoutPortal: boolean;\n withoutAnimation: boolean;\n portalDOMContainer: HTMLElement;\n animationDuration: number;\n placement: PopperPlacementsT;\n customOffset: [number, number];\n }\n\n export interface OptionalProps {\n placementOrderPreference?: PopperPlacementsT[];\n onOpen?: () => void;\n onClose?: () => void;\n }\n export interface Props extends Partial<DefaultProps>, OptionalProps {}\n\n export interface InternalProps extends DefaultProps, OptionalProps {}\n\n export type PopperPlacementsT =\n | 'top-start'\n | 'top'\n | 'top-end'\n | 'right-start'\n | 'right'\n | 'right-end'\n | 'bottom-end'\n | 'bottom'\n | 'bottom-start'\n | 'left-end'\n | 'left'\n | 'left-start';\n}\n\nexport const defaultProps: DSHookFloatingContextT.DefaultProps = {\n withoutAnimation: false,\n animationDuration: 300,\n portalDOMContainer: document.body,\n withoutPortal: false,\n placement: 'top',\n customOffset: [12, 12],\n};\n\nexport const DSFloatingContextPropTypes: DSPropTypesSchema<DSHookFloatingContextT.Props> = {\n withoutPortal: PropTypes.bool\n .description('If true, the tooltip will not be rendered inside a portal.')\n .defaultValue(false),\n withoutAnimation: PropTypes.bool.description('If true, the tooltip will not have an animation.').defaultValue(false),\n portalDOMContainer: PropTypes.instanceOf(HTMLElement)\n .description('The DOM element where the tooltip will be rendered.')\n .defaultValue(document.body),\n animationDuration: PropTypes.number.description('The duration of the animation in milliseconds.').defaultValue(300),\n placement: PropTypes.oneOf([\n 'top-start',\n 'top',\n 'top-end',\n 'right-start',\n 'right',\n 'right-end',\n 'bottom-end',\n 'bottom',\n 'bottom-start',\n 'left-end',\n 'left',\n 'left-start',\n ])\n .description('The placement of the tooltip.')\n .defaultValue('top'),\n customOffset: PropTypes.arrayOf(PropTypes.number)\n .description('The custom offset of the tooltip.')\n .defaultValue([12, 12]),\n placementOrderPreference: PropTypes.arrayOf(\n PropTypes.oneOf([\n 'top-start',\n 'top',\n 'top-end',\n 'right-start',\n 'right',\n 'right-end',\n 'bottom-end',\n 'bottom',\n 'bottom-start',\n 'left-end',\n 'left',\n 'left-start',\n ]),\n ).description('The order of the placement preference.'),\n onOpen: PropTypes.func.description('Callback when the tooltip is opened.'),\n onClose: PropTypes.func.description('Callback when the tooltip is closed.'),\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACEvB,SAAS,iBAAiB;AAmCnB,MAAM,eAAoD;AAAA,EAC/D,kBAAkB;AAAA,EAClB,mBAAmB;AAAA,EACnB,oBAAoB,SAAS;AAAA,EAC7B,eAAe;AAAA,EACf,WAAW;AAAA,EACX,cAAc,CAAC,IAAI,EAAE;AACvB;AAEO,MAAM,6BAA8E;AAAA,EACzF,eAAe,UAAU,KACtB,YAAY,4DAA4D,EACxE,aAAa,KAAK;AAAA,EACrB,kBAAkB,UAAU,KAAK,YAAY,kDAAkD,EAAE,aAAa,KAAK;AAAA,EACnH,oBAAoB,UAAU,WAAW,WAAW,EACjD,YAAY,qDAAqD,EACjE,aAAa,SAAS,IAAI;AAAA,EAC7B,mBAAmB,UAAU,OAAO,YAAY,gDAAgD,EAAE,aAAa,GAAG;AAAA,EAClH,WAAW,UAAU,MAAM;AAAA,IACzB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC,EACE,YAAY,+BAA+B,EAC3C,aAAa,KAAK;AAAA,EACrB,cAAc,UAAU,QAAQ,UAAU,MAAM,EAC7C,YAAY,mCAAmC,EAC/C,aAAa,CAAC,IAAI,EAAE,CAAC;AAAA,EACxB,0BAA0B,UAAU;AAAA,IAClC,UAAU,MAAM;AAAA,MACd;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH,EAAE,YAAY,wCAAwC;AAAA,EACtD,QAAQ,UAAU,KAAK,YAAY,sCAAsC;AAAA,EACzE,SAAS,UAAU,KAAK,YAAY,sCAAsC;AAC5E;",
6
+ "names": []
7
+ }
@@ -0,0 +1,60 @@
1
+ import * as React from "react";
2
+ function getMainAxisFromPlacement(placement) {
3
+ return ["top", "bottom"].indexOf(placement) >= 0 ? "x" : "y";
4
+ }
5
+ function computeOffsets(placement, referenceRect, floatingRect) {
6
+ const basePlacement = placement.split("-")[0];
7
+ const constiation = placement.split("-")[1];
8
+ const commonX = referenceRect.x + referenceRect.width / 2 - floatingRect.width / 2;
9
+ const commonY = referenceRect.y + referenceRect.height / 2 - floatingRect.height / 2;
10
+ let offsets = { x: 0, y: 0 };
11
+ switch (basePlacement) {
12
+ case "top":
13
+ offsets = {
14
+ x: commonX,
15
+ y: referenceRect.y - floatingRect.height
16
+ };
17
+ break;
18
+ case "bottom":
19
+ offsets = {
20
+ x: commonX,
21
+ y: referenceRect.y + referenceRect.height
22
+ };
23
+ break;
24
+ case "right":
25
+ offsets = {
26
+ x: referenceRect.x + referenceRect.width,
27
+ y: commonY
28
+ };
29
+ break;
30
+ case "left":
31
+ offsets = {
32
+ x: referenceRect.x - floatingRect.width,
33
+ y: commonY
34
+ };
35
+ break;
36
+ default:
37
+ offsets = {
38
+ x: referenceRect.x,
39
+ y: referenceRect.y
40
+ };
41
+ }
42
+ const mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
43
+ if (mainAxis != null) {
44
+ const len = mainAxis === "y" ? "height" : "width";
45
+ switch (constiation) {
46
+ case "start":
47
+ offsets[mainAxis] = offsets[mainAxis] - (referenceRect[len] / 2 - floatingRect[len] / 2);
48
+ break;
49
+ case "end":
50
+ offsets[mainAxis] = offsets[mainAxis] + (referenceRect[len] / 2 - floatingRect[len] / 2);
51
+ break;
52
+ default:
53
+ }
54
+ }
55
+ return offsets;
56
+ }
57
+ export {
58
+ computeOffsets as default
59
+ };
60
+ //# sourceMappingURL=computeOffsets.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/utils/computeOffsets.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable operator-assignment */\nimport type { DSHookFloatingContextT } from '../react-desc-prop-types.js';\n\nfunction getMainAxisFromPlacement(placement: DSHookFloatingContextT.PopperPlacementsT) {\n return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';\n}\n\nexport default function computeOffsets(\n placement: DSHookFloatingContextT.PopperPlacementsT,\n referenceRect: DOMRect,\n floatingRect: DOMRect,\n) {\n const basePlacement = placement.split('-')[0];\n const constiation = placement.split('-')[1];\n const commonX = referenceRect.x + referenceRect.width / 2 - floatingRect.width / 2;\n const commonY = referenceRect.y + referenceRect.height / 2 - floatingRect.height / 2;\n let offsets: { x: number; y: number } = { x: 0, y: 0 };\n\n switch (basePlacement) {\n case 'top':\n offsets = {\n x: commonX,\n y: referenceRect.y - floatingRect.height,\n };\n break;\n\n case 'bottom':\n offsets = {\n x: commonX,\n y: referenceRect.y + referenceRect.height,\n };\n break;\n\n case 'right':\n offsets = {\n x: referenceRect.x + referenceRect.width,\n y: commonY,\n };\n break;\n\n case 'left':\n offsets = {\n x: referenceRect.x - floatingRect.width,\n y: commonY,\n };\n break;\n\n default:\n offsets = {\n x: referenceRect.x,\n y: referenceRect.y,\n };\n }\n\n const mainAxis = basePlacement\n ? getMainAxisFromPlacement(basePlacement as DSHookFloatingContextT.PopperPlacementsT)\n : null;\n\n if (mainAxis != null) {\n const len = mainAxis === 'y' ? 'height' : 'width';\n\n switch (constiation) {\n case 'start':\n offsets[mainAxis] = offsets[mainAxis] - (referenceRect[len] / 2 - floatingRect[len] / 2);\n\n break;\n\n case 'end':\n offsets[mainAxis] = offsets[mainAxis] + (referenceRect[len] / 2 - floatingRect[len] / 2);\n break;\n\n default:\n }\n }\n\n return offsets;\n}\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACGvB,SAAS,yBAAyB,WAAqD;AACrF,SAAO,CAAC,OAAO,QAAQ,EAAE,QAAQ,SAAS,KAAK,IAAI,MAAM;AAC3D;AAEe,SAAR,eACL,WACA,eACA,cACA;AACA,QAAM,gBAAgB,UAAU,MAAM,GAAG,EAAE,CAAC;AAC5C,QAAM,cAAc,UAAU,MAAM,GAAG,EAAE,CAAC;AAC1C,QAAM,UAAU,cAAc,IAAI,cAAc,QAAQ,IAAI,aAAa,QAAQ;AACjF,QAAM,UAAU,cAAc,IAAI,cAAc,SAAS,IAAI,aAAa,SAAS;AACnF,MAAI,UAAoC,EAAE,GAAG,GAAG,GAAG,EAAE;AAErD,UAAQ,eAAe;AAAA,IACrB,KAAK;AACH,gBAAU;AAAA,QACR,GAAG;AAAA,QACH,GAAG,cAAc,IAAI,aAAa;AAAA,MACpC;AACA;AAAA,IAEF,KAAK;AACH,gBAAU;AAAA,QACR,GAAG;AAAA,QACH,GAAG,cAAc,IAAI,cAAc;AAAA,MACrC;AACA;AAAA,IAEF,KAAK;AACH,gBAAU;AAAA,QACR,GAAG,cAAc,IAAI,cAAc;AAAA,QACnC,GAAG;AAAA,MACL;AACA;AAAA,IAEF,KAAK;AACH,gBAAU;AAAA,QACR,GAAG,cAAc,IAAI,aAAa;AAAA,QAClC,GAAG;AAAA,MACL;AACA;AAAA,IAEF;AACE,gBAAU;AAAA,QACR,GAAG,cAAc;AAAA,QACjB,GAAG,cAAc;AAAA,MACnB;AAAA,EACJ;AAEA,QAAM,WAAW,gBACb,yBAAyB,aAAyD,IAClF;AAEJ,MAAI,YAAY,MAAM;AACpB,UAAM,MAAM,aAAa,MAAM,WAAW;AAE1C,YAAQ,aAAa;AAAA,MACnB,KAAK;AACH,gBAAQ,QAAQ,IAAI,QAAQ,QAAQ,KAAK,cAAc,GAAG,IAAI,IAAI,aAAa,GAAG,IAAI;AAEtF;AAAA,MAEF,KAAK;AACH,gBAAQ,QAAQ,IAAI,QAAQ,QAAQ,KAAK,cAAc,GAAG,IAAI,IAAI,aAAa,GAAG,IAAI;AACtF;AAAA,MAEF;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;",
6
+ "names": []
7
+ }
@@ -0,0 +1,75 @@
1
+ import * as React from "react";
2
+ import { getExpandedFallbackPlacements } from "./getExpandedFallbackPlacements.js";
3
+ import { getArrowOffset } from "./getArrowOffset.js";
4
+ import getOppositePlacement from "./getOppositePlacement.js";
5
+ import { detectOverflow } from "./detectOverflow.js";
6
+ const findFixedParent = (el) => {
7
+ let element = el;
8
+ while (element && element !== document.body) {
9
+ const style = getComputedStyle(element);
10
+ if (style.position === "fixed" || style.position === "absolute") {
11
+ return element;
12
+ }
13
+ element = element.parentElement;
14
+ }
15
+ return null;
16
+ };
17
+ const adjustForFixedParent = (child) => {
18
+ const fixedParent = findFixedParent(child);
19
+ if (fixedParent) {
20
+ const rect = fixedParent.getBoundingClientRect();
21
+ return { top: rect.top, left: rect.left };
22
+ }
23
+ return {
24
+ top: 0,
25
+ left: 0
26
+ };
27
+ };
28
+ const computePosition = (props) => {
29
+ const { reference, floating, placement, placementOrderPreference, customOffset, withoutPortal } = props;
30
+ const parentOffsets = withoutPortal ? adjustForFixedParent(reference) : {
31
+ top: 0,
32
+ left: 0
33
+ };
34
+ const referenceRect = reference.getBoundingClientRect();
35
+ const floatingRect = floating.getBoundingClientRect();
36
+ const variationPlacement = placement.split("-")[1];
37
+ const fallbackPlacements = placementOrderPreference || getExpandedFallbackPlacements(placement);
38
+ const coords = {};
39
+ let isVertical = false;
40
+ const placements = [placement].concat(fallbackPlacements);
41
+ let finalPlacement = "";
42
+ for (let i = 0; i < placements.length; i += 1) {
43
+ const currentPlacement = placements[i];
44
+ const currentBasePlacement = currentPlacement.split("-")[0];
45
+ isVertical = ["top", "bottom"].indexOf(currentBasePlacement) >= 0;
46
+ const overflows = detectOverflow(referenceRect, floatingRect, currentPlacement, customOffset);
47
+ const checks = [];
48
+ const isStartVariation = variationPlacement === "start";
49
+ let mainVariationSide = isVertical ? isStartVariation ? "right" : "left" : isStartVariation ? "bottom" : "top";
50
+ const len = isVertical ? "width" : "height";
51
+ if (referenceRect[len] > floatingRect[len]) {
52
+ mainVariationSide = getOppositePlacement(mainVariationSide);
53
+ }
54
+ const altVariationSide = getOppositePlacement(mainVariationSide);
55
+ checks.push(overflows[currentBasePlacement] <= 0);
56
+ checks.push(overflows[mainVariationSide] <= 0, overflows[altVariationSide] <= 0);
57
+ if (checks.every((check) => {
58
+ return check;
59
+ })) {
60
+ coords.top = -overflows.top + window.scrollY - parentOffsets.top;
61
+ coords.left = -overflows.left + window.scrollX - parentOffsets.left;
62
+ finalPlacement = currentPlacement;
63
+ break;
64
+ }
65
+ }
66
+ return {
67
+ coordsStyle: { transform: `translate(${coords.left}px, ${coords.top}px)` },
68
+ finalPlacement,
69
+ coordsArrow: getArrowOffset(finalPlacement, isVertical)
70
+ };
71
+ };
72
+ export {
73
+ computePosition
74
+ };
75
+ //# sourceMappingURL=computePosition.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/utils/computePosition.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable no-nested-ternary */\n/* eslint-disable complexity */\n/* eslint-disable max-statements */\n/* eslint-disable @typescript-eslint/no-use-before-define */\n/* eslint-disable max-params */\n/* eslint-disable @typescript-eslint/no-unsafe-assignment */\n/* eslint-disable arrow-body-style */\nimport type { DSHookFloatingContextT } from '../react-desc-prop-types.js';\nimport { getExpandedFallbackPlacements } from './getExpandedFallbackPlacements.js';\nimport { getArrowOffset } from './getArrowOffset.js';\nimport getOppositePlacement from './getOppositePlacement.js';\nimport { detectOverflow } from './detectOverflow.js';\n\ninterface ComputePositionProps {\n reference: Element;\n floating: HTMLElement;\n placement: DSHookFloatingContextT.PopperPlacementsT;\n placementOrderPreference?: DSHookFloatingContextT.PopperPlacementsT[];\n customOffset: [number, number];\n withoutPortal: boolean;\n}\n\nconst findFixedParent = (el: Element | null) => {\n let element = el;\n while (element && element !== document.body) {\n const style = getComputedStyle(element);\n if (style.position === 'fixed' || style.position === 'absolute') {\n return element;\n }\n element = element.parentElement;\n }\n return null;\n};\n\nconst adjustForFixedParent = (child: Element) => {\n const fixedParent = findFixedParent(child);\n if (fixedParent) {\n const rect = fixedParent.getBoundingClientRect();\n return { top: rect.top, left: rect.left };\n }\n return {\n top: 0,\n left: 0,\n };\n};\n\nexport const computePosition = (props: ComputePositionProps) => {\n const { reference, floating, placement, placementOrderPreference, customOffset, withoutPortal } = props;\n\n const parentOffsets = withoutPortal\n ? adjustForFixedParent(reference)\n : {\n top: 0,\n left: 0,\n };\n const referenceRect = reference.getBoundingClientRect();\n const floatingRect = floating.getBoundingClientRect();\n\n const variationPlacement = placement.split('-')[1];\n const fallbackPlacements = placementOrderPreference || getExpandedFallbackPlacements(placement);\n\n const coords: { top?: number; left?: number; bottom?: number; right?: number } = {};\n\n let isVertical = false;\n const placements = [placement].concat(fallbackPlacements as DSHookFloatingContextT.PopperPlacementsT[]);\n let finalPlacement = '';\n\n for (let i = 0; i < placements.length; i += 1) {\n const currentPlacement = placements[i];\n\n const currentBasePlacement = currentPlacement.split('-')[0] as keyof typeof coords;\n isVertical = ['top', 'bottom'].indexOf(currentBasePlacement) >= 0;\n\n const overflows = detectOverflow(referenceRect, floatingRect, currentPlacement, customOffset);\n\n const checks: boolean[] = [];\n\n const isStartVariation = variationPlacement === 'start';\n\n let mainVariationSide: keyof typeof coords = isVertical\n ? isStartVariation\n ? 'right'\n : 'left'\n : isStartVariation\n ? 'bottom'\n : 'top';\n\n const len = isVertical ? 'width' : 'height';\n\n if (referenceRect[len] > floatingRect[len]) {\n mainVariationSide = getOppositePlacement(mainVariationSide) as keyof typeof coords;\n }\n\n const altVariationSide = getOppositePlacement(mainVariationSide) as keyof typeof coords;\n\n checks.push(overflows[currentBasePlacement] <= 0);\n checks.push(overflows[mainVariationSide] <= 0, overflows[altVariationSide] <= 0);\n\n if (\n checks.every((check) => {\n return check;\n })\n ) {\n coords.top = -overflows.top + window.scrollY - parentOffsets.top;\n coords.left = -overflows.left + window.scrollX - parentOffsets.left;\n finalPlacement = currentPlacement;\n\n break;\n }\n }\n\n return {\n coordsStyle: { transform: `translate(${coords.left}px, ${coords.top}px)` },\n finalPlacement,\n coordsArrow: getArrowOffset(finalPlacement, isVertical),\n };\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACQvB,SAAS,qCAAqC;AAC9C,SAAS,sBAAsB;AAC/B,OAAO,0BAA0B;AACjC,SAAS,sBAAsB;AAW/B,MAAM,kBAAkB,CAAC,OAAuB;AAC9C,MAAI,UAAU;AACd,SAAO,WAAW,YAAY,SAAS,MAAM;AAC3C,UAAM,QAAQ,iBAAiB,OAAO;AACtC,QAAI,MAAM,aAAa,WAAW,MAAM,aAAa,YAAY;AAC/D,aAAO;AAAA,IACT;AACA,cAAU,QAAQ;AAAA,EACpB;AACA,SAAO;AACT;AAEA,MAAM,uBAAuB,CAAC,UAAmB;AAC/C,QAAM,cAAc,gBAAgB,KAAK;AACzC,MAAI,aAAa;AACf,UAAM,OAAO,YAAY,sBAAsB;AAC/C,WAAO,EAAE,KAAK,KAAK,KAAK,MAAM,KAAK,KAAK;AAAA,EAC1C;AACA,SAAO;AAAA,IACL,KAAK;AAAA,IACL,MAAM;AAAA,EACR;AACF;AAEO,MAAM,kBAAkB,CAAC,UAAgC;AAC9D,QAAM,EAAE,WAAW,UAAU,WAAW,0BAA0B,cAAc,cAAc,IAAI;AAElG,QAAM,gBAAgB,gBAClB,qBAAqB,SAAS,IAC9B;AAAA,IACE,KAAK;AAAA,IACL,MAAM;AAAA,EACR;AACJ,QAAM,gBAAgB,UAAU,sBAAsB;AACtD,QAAM,eAAe,SAAS,sBAAsB;AAEpD,QAAM,qBAAqB,UAAU,MAAM,GAAG,EAAE,CAAC;AACjD,QAAM,qBAAqB,4BAA4B,8BAA8B,SAAS;AAE9F,QAAM,SAA2E,CAAC;AAElF,MAAI,aAAa;AACjB,QAAM,aAAa,CAAC,SAAS,EAAE,OAAO,kBAAgE;AACtG,MAAI,iBAAiB;AAErB,WAAS,IAAI,GAAG,IAAI,WAAW,QAAQ,KAAK,GAAG;AAC7C,UAAM,mBAAmB,WAAW,CAAC;AAErC,UAAM,uBAAuB,iBAAiB,MAAM,GAAG,EAAE,CAAC;AAC1D,iBAAa,CAAC,OAAO,QAAQ,EAAE,QAAQ,oBAAoB,KAAK;AAEhE,UAAM,YAAY,eAAe,eAAe,cAAc,kBAAkB,YAAY;AAE5F,UAAM,SAAoB,CAAC;AAE3B,UAAM,mBAAmB,uBAAuB;AAEhD,QAAI,oBAAyC,aACzC,mBACE,UACA,SACF,mBACA,WACA;AAEJ,UAAM,MAAM,aAAa,UAAU;AAEnC,QAAI,cAAc,GAAG,IAAI,aAAa,GAAG,GAAG;AAC1C,0BAAoB,qBAAqB,iBAAiB;AAAA,IAC5D;AAEA,UAAM,mBAAmB,qBAAqB,iBAAiB;AAE/D,WAAO,KAAK,UAAU,oBAAoB,KAAK,CAAC;AAChD,WAAO,KAAK,UAAU,iBAAiB,KAAK,GAAG,UAAU,gBAAgB,KAAK,CAAC;AAE/E,QACE,OAAO,MAAM,CAAC,UAAU;AACtB,aAAO;AAAA,IACT,CAAC,GACD;AACA,aAAO,MAAM,CAAC,UAAU,MAAM,OAAO,UAAU,cAAc;AAC7D,aAAO,OAAO,CAAC,UAAU,OAAO,OAAO,UAAU,cAAc;AAC/D,uBAAiB;AAEjB;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AAAA,IACL,aAAa,EAAE,WAAW,aAAa,OAAO,IAAI,OAAO,OAAO,GAAG,MAAM;AAAA,IACzE;AAAA,IACA,aAAa,eAAe,gBAAgB,UAAU;AAAA,EACxD;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,52 @@
1
+ import * as React from "react";
2
+ import computeOffsets from "./computeOffsets.js";
3
+ const paddingObject = { top: 0, right: 0, bottom: 0, left: 0 };
4
+ function rectToClientRect(rect) {
5
+ return { ...rect, left: rect.x, top: rect.y, right: rect.x + rect.width, bottom: rect.y + rect.height };
6
+ }
7
+ function domRectToObject(rect) {
8
+ return {
9
+ x: rect.x,
10
+ y: rect.y,
11
+ width: rect.width,
12
+ height: rect.height,
13
+ top: rect.top,
14
+ right: rect.right,
15
+ bottom: rect.bottom,
16
+ left: rect.left,
17
+ toJSON: () => {
18
+ }
19
+ };
20
+ }
21
+ const detectOverflow = (referenceRect, floatingRect, placement, customOffset) => {
22
+ const basePlacement = placement.split("-")[0];
23
+ const isVertical = ["top", "bottom"].indexOf(basePlacement) >= 0;
24
+ const clippingClientRect = {
25
+ top: 0,
26
+ right: document.documentElement.clientWidth,
27
+ bottom: document.documentElement.clientHeight,
28
+ left: 0
29
+ };
30
+ const popperOffsets = computeOffsets(placement, referenceRect, floatingRect);
31
+ const popperClientRect = rectToClientRect({ ...domRectToObject(floatingRect), ...popperOffsets });
32
+ const overflowOffsets = {
33
+ top: clippingClientRect.top - popperClientRect.top + paddingObject.top,
34
+ bottom: popperClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
35
+ left: clippingClientRect.left - popperClientRect.left + paddingObject.left,
36
+ right: popperClientRect.right - clippingClientRect.right + paddingObject.right
37
+ };
38
+ const offset = {
39
+ x: !isVertical ? basePlacement === "left" ? -(customOffset?.[0] ?? 12) : customOffset?.[0] ?? 12 : 0,
40
+ y: isVertical ? basePlacement === "top" ? -(customOffset?.[1] ?? 12) : customOffset?.[1] ?? 12 : 0
41
+ };
42
+ Object.keys(overflowOffsets).forEach((key) => {
43
+ const multiply = ["right", "bottom"].indexOf(key) >= 0 ? 1 : -1;
44
+ const axis = ["top", "bottom"].indexOf(key) >= 0 ? "y" : "x";
45
+ overflowOffsets[key] += offset[axis] * multiply;
46
+ });
47
+ return overflowOffsets;
48
+ };
49
+ export {
50
+ detectOverflow
51
+ };
52
+ //# sourceMappingURL=detectOverflow.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/utils/detectOverflow.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable no-nested-ternary */\n/* eslint-disable max-params */\nimport { type DSHookFloatingContextT } from '../react-desc-prop-types.js';\nimport computeOffsets from './computeOffsets.js';\n\nconst paddingObject = { top: 0, right: 0, bottom: 0, left: 0 };\n\nfunction rectToClientRect(rect: DOMRect) {\n return { ...rect, left: rect.x, top: rect.y, right: rect.x + rect.width, bottom: rect.y + rect.height };\n}\n\nfunction domRectToObject(rect: {\n x: number;\n y: number;\n width: number;\n height: number;\n top: number;\n right: number;\n bottom: number;\n left: number;\n}): DOMRect {\n return {\n x: rect.x,\n y: rect.y,\n width: rect.width,\n height: rect.height,\n top: rect.top,\n right: rect.right,\n bottom: rect.bottom,\n left: rect.left,\n toJSON: () => {},\n };\n}\n\nexport const detectOverflow = (\n referenceRect: DOMRect,\n floatingRect: DOMRect,\n placement: DSHookFloatingContextT.PopperPlacementsT,\n customOffset: [number, number],\n) => {\n const basePlacement = placement.split('-')[0];\n const isVertical = ['top', 'bottom'].indexOf(basePlacement) >= 0;\n const clippingClientRect = {\n top: 0,\n right: document.documentElement.clientWidth,\n bottom: document.documentElement.clientHeight,\n left: 0,\n };\n const popperOffsets = computeOffsets(placement, referenceRect, floatingRect);\n const popperClientRect = rectToClientRect({ ...domRectToObject(floatingRect), ...popperOffsets });\n\n const overflowOffsets = {\n top: clippingClientRect.top - popperClientRect.top + paddingObject.top,\n bottom: popperClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,\n left: clippingClientRect.left - popperClientRect.left + paddingObject.left,\n right: popperClientRect.right - clippingClientRect.right + paddingObject.right,\n };\n\n const offset = {\n x: !isVertical ? (basePlacement === 'left' ? -(customOffset?.[0] ?? 12) : customOffset?.[0] ?? 12) : 0,\n y: isVertical ? (basePlacement === 'top' ? -(customOffset?.[1] ?? 12) : customOffset?.[1] ?? 12) : 0,\n };\n\n Object.keys(overflowOffsets).forEach((key) => {\n const multiply = ['right', 'bottom'].indexOf(key) >= 0 ? 1 : -1;\n const axis = ['top', 'bottom'].indexOf(key) >= 0 ? 'y' : 'x';\n overflowOffsets[key as keyof typeof overflowOffsets] += offset[axis] * multiply;\n });\n return overflowOffsets;\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACGvB,OAAO,oBAAoB;AAE3B,MAAM,gBAAgB,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,EAAE;AAE7D,SAAS,iBAAiB,MAAe;AACvC,SAAO,EAAE,GAAG,MAAM,MAAM,KAAK,GAAG,KAAK,KAAK,GAAG,OAAO,KAAK,IAAI,KAAK,OAAO,QAAQ,KAAK,IAAI,KAAK,OAAO;AACxG;AAEA,SAAS,gBAAgB,MASb;AACV,SAAO;AAAA,IACL,GAAG,KAAK;AAAA,IACR,GAAG,KAAK;AAAA,IACR,OAAO,KAAK;AAAA,IACZ,QAAQ,KAAK;AAAA,IACb,KAAK,KAAK;AAAA,IACV,OAAO,KAAK;AAAA,IACZ,QAAQ,KAAK;AAAA,IACb,MAAM,KAAK;AAAA,IACX,QAAQ,MAAM;AAAA,IAAC;AAAA,EACjB;AACF;AAEO,MAAM,iBAAiB,CAC5B,eACA,cACA,WACA,iBACG;AACH,QAAM,gBAAgB,UAAU,MAAM,GAAG,EAAE,CAAC;AAC5C,QAAM,aAAa,CAAC,OAAO,QAAQ,EAAE,QAAQ,aAAa,KAAK;AAC/D,QAAM,qBAAqB;AAAA,IACzB,KAAK;AAAA,IACL,OAAO,SAAS,gBAAgB;AAAA,IAChC,QAAQ,SAAS,gBAAgB;AAAA,IACjC,MAAM;AAAA,EACR;AACA,QAAM,gBAAgB,eAAe,WAAW,eAAe,YAAY;AAC3E,QAAM,mBAAmB,iBAAiB,EAAE,GAAG,gBAAgB,YAAY,GAAG,GAAG,cAAc,CAAC;AAEhG,QAAM,kBAAkB;AAAA,IACtB,KAAK,mBAAmB,MAAM,iBAAiB,MAAM,cAAc;AAAA,IACnE,QAAQ,iBAAiB,SAAS,mBAAmB,SAAS,cAAc;AAAA,IAC5E,MAAM,mBAAmB,OAAO,iBAAiB,OAAO,cAAc;AAAA,IACtE,OAAO,iBAAiB,QAAQ,mBAAmB,QAAQ,cAAc;AAAA,EAC3E;AAEA,QAAM,SAAS;AAAA,IACb,GAAG,CAAC,aAAc,kBAAkB,SAAS,EAAE,eAAe,CAAC,KAAK,MAAM,eAAe,CAAC,KAAK,KAAM;AAAA,IACrG,GAAG,aAAc,kBAAkB,QAAQ,EAAE,eAAe,CAAC,KAAK,MAAM,eAAe,CAAC,KAAK,KAAM;AAAA,EACrG;AAEA,SAAO,KAAK,eAAe,EAAE,QAAQ,CAAC,QAAQ;AAC5C,UAAM,WAAW,CAAC,SAAS,QAAQ,EAAE,QAAQ,GAAG,KAAK,IAAI,IAAI;AAC7D,UAAM,OAAO,CAAC,OAAO,QAAQ,EAAE,QAAQ,GAAG,KAAK,IAAI,MAAM;AACzD,oBAAgB,GAAmC,KAAK,OAAO,IAAI,IAAI;AAAA,EACzE,CAAC;AACD,SAAO;AACT;",
6
+ "names": []
7
+ }
@@ -0,0 +1,14 @@
1
+ import * as React from "react";
2
+ const hash = {
3
+ left: "top",
4
+ right: "bottom",
5
+ bottom: "right",
6
+ top: "left"
7
+ };
8
+ function getAlteredPosition(placement) {
9
+ return placement.replace(/left|right|bottom|top/g, (matched) => hash[matched]);
10
+ }
11
+ export {
12
+ getAlteredPosition as default
13
+ };
14
+ //# sourceMappingURL=getAlteredPosition.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/utils/getAlteredPosition.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "const hash = {\n left: 'top',\n right: 'bottom',\n bottom: 'right',\n top: 'left',\n} as const;\n\ntype Placements = keyof typeof hash;\n\nexport default function getAlteredPosition(placement: string) {\n return placement.replace(/left|right|bottom|top/g, (matched: string) => hash[matched as Placements]);\n}\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,MAAM,OAAO;AAAA,EACX,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,KAAK;AACP;AAIe,SAAR,mBAAoC,WAAmB;AAC5D,SAAO,UAAU,QAAQ,0BAA0B,CAAC,YAAoB,KAAK,OAAqB,CAAC;AACrG;",
6
+ "names": []
7
+ }
@@ -0,0 +1,11 @@
1
+ import * as React from "react";
2
+ const getArrowOffset = (placement, isVertical) => {
3
+ if (isVertical) {
4
+ return { left: placement.endsWith("end") ? "95%" : placement.endsWith("start") ? "5%" : "50%" };
5
+ }
6
+ return { top: placement.endsWith("start") ? "75%" : placement.endsWith("end") ? "25%" : "50%" };
7
+ };
8
+ export {
9
+ getArrowOffset
10
+ };
11
+ //# sourceMappingURL=getArrowOffset.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/utils/getArrowOffset.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable no-nested-ternary */\nexport const getArrowOffset = (placement: string, isVertical: boolean) => {\n if (isVertical) {\n return { left: placement.endsWith('end') ? '95%' : placement.endsWith('start') ? '5%' : '50%' };\n }\n return { top: placement.endsWith('start') ? '75%' : placement.endsWith('end') ? '25%' : '50%' };\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACChB,MAAM,iBAAiB,CAAC,WAAmB,eAAwB;AACxE,MAAI,YAAY;AACd,WAAO,EAAE,MAAM,UAAU,SAAS,KAAK,IAAI,QAAQ,UAAU,SAAS,OAAO,IAAI,OAAO,MAAM;AAAA,EAChG;AACA,SAAO,EAAE,KAAK,UAAU,SAAS,OAAO,IAAI,QAAQ,UAAU,SAAS,KAAK,IAAI,QAAQ,MAAM;AAChG;",
6
+ "names": []
7
+ }
@@ -0,0 +1,28 @@
1
+ import * as React from "react";
2
+ import getOppositePlacement from "./getOppositePlacement.js";
3
+ import getOppositeVariationPlacement from "./getOppositeVariationPlacement.js";
4
+ import getAlteredPosition from "./getAlteredPosition.js";
5
+ const hash = {
6
+ left: "bottom-start",
7
+ right: "top-start",
8
+ bottom: "top-start",
9
+ top: "bottom-start"
10
+ };
11
+ function getAuxPlacement(placement) {
12
+ return placement.replace(/left|right|bottom|top/g, (matched) => hash[matched]);
13
+ }
14
+ const getExpandedFallbackPlacements = (placement) => {
15
+ const oppositePlacement = getOppositePlacement(placement);
16
+ return [
17
+ oppositePlacement,
18
+ getOppositeVariationPlacement(placement),
19
+ getAlteredPosition(placement),
20
+ getOppositePlacement(getAlteredPosition(placement)),
21
+ getAuxPlacement(placement),
22
+ getOppositePlacement(getAuxPlacement(placement))
23
+ ];
24
+ };
25
+ export {
26
+ getExpandedFallbackPlacements
27
+ };
28
+ //# sourceMappingURL=getExpandedFallbackPlacements.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/utils/getExpandedFallbackPlacements.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import getOppositePlacement from './getOppositePlacement.js';\nimport getOppositeVariationPlacement from './getOppositeVariationPlacement.js';\nimport getAlteredPosition from './getAlteredPosition.js';\nimport type { DSHookFloatingContextT } from '../react-desc-prop-types.js';\n\nconst hash = {\n left: 'bottom-start',\n right: 'top-start',\n bottom: 'top-start',\n top: 'bottom-start',\n} as const;\n\nfunction getAuxPlacement(placement: string) {\n return placement.replace(/left|right|bottom|top/g, (matched: string) => hash[matched as keyof typeof hash]);\n}\n\nexport const getExpandedFallbackPlacements = (placement: DSHookFloatingContextT.PopperPlacementsT) => {\n const oppositePlacement = getOppositePlacement(placement);\n return [\n oppositePlacement,\n getOppositeVariationPlacement(placement),\n getAlteredPosition(placement),\n getOppositePlacement(getAlteredPosition(placement)),\n getAuxPlacement(placement),\n getOppositePlacement(getAuxPlacement(placement)),\n ];\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,OAAO,0BAA0B;AACjC,OAAO,mCAAmC;AAC1C,OAAO,wBAAwB;AAG/B,MAAM,OAAO;AAAA,EACX,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,KAAK;AACP;AAEA,SAAS,gBAAgB,WAAmB;AAC1C,SAAO,UAAU,QAAQ,0BAA0B,CAAC,YAAoB,KAAK,OAA4B,CAAC;AAC5G;AAEO,MAAM,gCAAgC,CAAC,cAAwD;AACpG,QAAM,oBAAoB,qBAAqB,SAAS;AACxD,SAAO;AAAA,IACL;AAAA,IACA,8BAA8B,SAAS;AAAA,IACvC,mBAAmB,SAAS;AAAA,IAC5B,qBAAqB,mBAAmB,SAAS,CAAC;AAAA,IAClD,gBAAgB,SAAS;AAAA,IACzB,qBAAqB,gBAAgB,SAAS,CAAC;AAAA,EACjD;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,14 @@
1
+ import * as React from "react";
2
+ const hash = {
3
+ left: "right",
4
+ right: "left",
5
+ bottom: "top",
6
+ top: "bottom"
7
+ };
8
+ function getOppositePlacement(placement) {
9
+ return placement.replace(/left|right|bottom|top/g, (matched) => hash[matched]);
10
+ }
11
+ export {
12
+ getOppositePlacement as default
13
+ };
14
+ //# sourceMappingURL=getOppositePlacement.js.map