@elliemae/ds-floating-context 3.51.0-rc.0 → 3.51.0-rc.10
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.
- package/dist/cjs/constants/index.js +6 -1
- package/dist/cjs/constants/index.js.map +2 -2
- package/dist/cjs/parts/FloatingWrapper/FloatingWrapper.js +8 -1
- package/dist/cjs/parts/FloatingWrapper/FloatingWrapper.js.map +2 -2
- package/dist/esm/constants/index.js +6 -1
- package/dist/esm/constants/index.js.map +2 -2
- package/dist/esm/parts/FloatingWrapper/FloatingWrapper.js +9 -2
- package/dist/esm/parts/FloatingWrapper/FloatingWrapper.js.map +2 -2
- package/dist/types/constants/index.d.ts +4 -1
- package/package.json +6 -6
|
@@ -41,5 +41,10 @@ const DSFloatingWrapperSlots = {
|
|
|
41
41
|
CONTENT: "content",
|
|
42
42
|
ARROW: "arrow"
|
|
43
43
|
};
|
|
44
|
-
const DSFloatingWrapperDataTestids =
|
|
44
|
+
const DSFloatingWrapperDataTestids = {
|
|
45
|
+
...(0, import_ds_system.slotObjectToDataTestIds)(DSFloatingWrapperName, DSFloatingWrapperSlots),
|
|
46
|
+
// for legacy reasons we have to keep those around and override the slots...
|
|
47
|
+
ROOT: "ds-floating-wrapper-root",
|
|
48
|
+
ARROW: "ds-tooltip-arrow"
|
|
49
|
+
};
|
|
45
50
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/constants/index.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { slotObjectToDataTestIds } from '@elliemae/ds-system';\n\nexport const DSFloatingWrapperName = 'DSFloatingwrapper';\n\nexport const DSFloatingWrapperSlots = {\n ROOT: 'root',\n CONTENT: 'content',\n ARROW: 'arrow',\n};\n\nexport const DSFloatingWrapperDataTestids = slotObjectToDataTestIds(DSFloatingWrapperName, DSFloatingWrapperSlots);\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAwC;AAEjC,MAAM,wBAAwB;AAE9B,MAAM,yBAAyB;AAAA,EACpC,MAAM;AAAA,EACN,SAAS;AAAA,EACT,OAAO;AACT;AAEO,MAAM
|
|
4
|
+
"sourcesContent": ["import { slotObjectToDataTestIds } from '@elliemae/ds-system';\n\nexport const DSFloatingWrapperName = 'DSFloatingwrapper';\n\nexport const DSFloatingWrapperSlots = {\n ROOT: 'root',\n CONTENT: 'content',\n ARROW: 'arrow',\n};\n\nexport const DSFloatingWrapperDataTestids = {\n ...slotObjectToDataTestIds(DSFloatingWrapperName, DSFloatingWrapperSlots),\n // for legacy reasons we have to keep those around and override the slots...\n ROOT: 'ds-floating-wrapper-root',\n ARROW: 'ds-tooltip-arrow',\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAwC;AAEjC,MAAM,wBAAwB;AAE9B,MAAM,yBAAyB;AAAA,EACpC,MAAM;AAAA,EACN,SAAS;AAAA,EACT,OAAO;AACT;AAEO,MAAM,+BAA+B;AAAA,EAC1C,OAAG,0CAAwB,uBAAuB,sBAAsB;AAAA;AAAA,EAExE,MAAM;AAAA,EACN,OAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -52,7 +52,8 @@ const ContentComponent = import_react.default.memo(
|
|
|
52
52
|
withoutAnimation,
|
|
53
53
|
handleAnimationEnd,
|
|
54
54
|
xstyledProps,
|
|
55
|
-
globalsAttrs
|
|
55
|
+
globalsAttrs,
|
|
56
|
+
ownerPropsConfig
|
|
56
57
|
}) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
57
58
|
import_styled.StyledFloatingWrapper,
|
|
58
59
|
{
|
|
@@ -60,7 +61,9 @@ const ContentComponent = import_react.default.memo(
|
|
|
60
61
|
style: floatingStyles,
|
|
61
62
|
...xstyledProps,
|
|
62
63
|
role: "complementary",
|
|
64
|
+
"data-testid": "ds-floating-wrapper-root",
|
|
63
65
|
...globalsAttrs,
|
|
66
|
+
...ownerPropsConfig,
|
|
64
67
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
65
68
|
import_styled.StyledFloatingAnimation,
|
|
66
69
|
{
|
|
@@ -68,6 +71,7 @@ const ContentComponent = import_react.default.memo(
|
|
|
68
71
|
isOpen,
|
|
69
72
|
animationDuration,
|
|
70
73
|
withoutAnimation,
|
|
74
|
+
...ownerPropsConfig,
|
|
71
75
|
children
|
|
72
76
|
}
|
|
73
77
|
)
|
|
@@ -77,6 +81,7 @@ const ContentComponent = import_react.default.memo(
|
|
|
77
81
|
const FloatingWrapper = (props) => {
|
|
78
82
|
const { propsWithDefault, xstyledProps, globalsAttrs } = (0, import_useFloatingWrapper.useFloatingWrapper)(props);
|
|
79
83
|
const { isOpen } = propsWithDefault;
|
|
84
|
+
const ownerPropsConfig = (0, import_ds_props_helpers.useOwnerProps)(props);
|
|
80
85
|
const { context, onAnimationEnd, onAnimationStartTriggered, ...contentProps } = propsWithDefault;
|
|
81
86
|
const { portalDOMContainer, withoutPortal, withoutAnimation } = context;
|
|
82
87
|
const [isAnimating, setIsAnimating] = import_react.default.useState(false);
|
|
@@ -100,6 +105,7 @@ const FloatingWrapper = (props) => {
|
|
|
100
105
|
{
|
|
101
106
|
xstyledProps,
|
|
102
107
|
globalsAttrs,
|
|
108
|
+
ownerPropsConfig,
|
|
103
109
|
...contentProps,
|
|
104
110
|
...context,
|
|
105
111
|
handleAnimationEnd
|
|
@@ -112,6 +118,7 @@ const FloatingWrapper = (props) => {
|
|
|
112
118
|
{
|
|
113
119
|
xstyledProps,
|
|
114
120
|
globalsAttrs,
|
|
121
|
+
ownerPropsConfig,
|
|
115
122
|
...contentProps,
|
|
116
123
|
...context,
|
|
117
124
|
handleAnimationEnd
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/FloatingWrapper/FloatingWrapper.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React from 'react';\nimport { createPortal } from 'react-dom';\nimport { describe, type ValidationMap } from '@elliemae/ds-props-helpers';\nimport { StyledFloatingAnimation, StyledFloatingWrapper } from './styled.js';\nimport { type DSFloatingWrapperT, DSFloatingWrapperPropTypes } from './react-desc-prop-types.js';\nimport { useFloatingWrapper } from './config/useFloatingWrapper.js';\nimport { DSFloatingWrapperName } from '../../constants/index.js';\nimport { getDocumentMainLandmarkOrBody } from '../../utils/getDocumentMainLandmarkOrBody.js';\n\ntype ContentComponentPropsT = {\n xstyledProps: ReturnType<typeof useFloatingWrapper>['xstyledProps'];\n globalsAttrs: ReturnType<typeof useFloatingWrapper>['globalsAttrs'];\n handleAnimationEnd: React.AnimationEventHandler<HTMLDivElement>;\n // for performance reasons, it's better for pure component to not receive nested objects\n // so the following is just the typescript way of describing we spread the props\n} & Omit<DSFloatingWrapperT.InternalProps, 'context'> &\n DSFloatingWrapperT.InternalProps['context'];\n\nconst ContentComponent = React.memo<ContentComponentPropsT>(\n ({\n children,\n innerRef,\n floatingStyles,\n isOpen,\n animationDuration,\n withoutAnimation,\n handleAnimationEnd,\n xstyledProps,\n globalsAttrs,\n }) => (\n <StyledFloatingWrapper\n innerRef={innerRef}\n style={floatingStyles}\n {...xstyledProps}\n role=\"complementary\"\n {...globalsAttrs}\n >\n <StyledFloatingAnimation\n onAnimationEnd={handleAnimationEnd}\n isOpen={isOpen}\n animationDuration={animationDuration}\n withoutAnimation={withoutAnimation}\n >\n {children}\n </StyledFloatingAnimation>\n </StyledFloatingWrapper>\n ),\n);\n\nconst FloatingWrapper: React.ComponentType<DSFloatingWrapperT.Props> = (props) => {\n const { propsWithDefault, xstyledProps, globalsAttrs } = useFloatingWrapper(props);\n const { isOpen } = propsWithDefault;\n\n const { context, onAnimationEnd, onAnimationStartTriggered, ...contentProps } = propsWithDefault;\n const { portalDOMContainer, withoutPortal, withoutAnimation } = context;\n\n const [isAnimating, setIsAnimating] = React.useState(false);\n React.useEffect(() => {\n if (isOpen && !withoutAnimation) {\n setIsAnimating(true);\n onAnimationStartTriggered?.();\n }\n }, [isOpen, onAnimationStartTriggered, withoutAnimation]);\n\n const handleAnimationEnd = React.useCallback<React.AnimationEventHandler<HTMLDivElement>>(\n (e) => {\n setIsAnimating(false);\n if (onAnimationEnd) onAnimationEnd(e);\n },\n [onAnimationEnd],\n );\n\n if (isOpen || isAnimating) {\n if (withoutPortal === true)\n return (\n <ContentComponent\n xstyledProps={xstyledProps}\n globalsAttrs={globalsAttrs}\n {...contentProps}\n {...context}\n handleAnimationEnd={handleAnimationEnd}\n />\n );\n if (!withoutPortal)\n return (\n <>\n {createPortal(\n <ContentComponent\n xstyledProps={xstyledProps}\n globalsAttrs={globalsAttrs}\n {...contentProps}\n {...context}\n handleAnimationEnd={handleAnimationEnd}\n />,\n portalDOMContainer || getDocumentMainLandmarkOrBody(),\n )}\n </>\n );\n }\n return null;\n};\n\nFloatingWrapper.displayName = DSFloatingWrapperName;\nconst FloatingWrapperWithSchema = describe(FloatingWrapper);\nFloatingWrapperWithSchema.propTypes = DSFloatingWrapperPropTypes as unknown as ValidationMap<DSFloatingWrapperT.Props>;\nexport { FloatingWrapper, FloatingWrapperWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { createPortal } from 'react-dom';\nimport { describe, type ValidationMap, useOwnerProps } from '@elliemae/ds-props-helpers';\nimport { StyledFloatingAnimation, StyledFloatingWrapper } from './styled.js';\nimport { type DSFloatingWrapperT, DSFloatingWrapperPropTypes } from './react-desc-prop-types.js';\nimport { useFloatingWrapper } from './config/useFloatingWrapper.js';\nimport { DSFloatingWrapperName } from '../../constants/index.js';\nimport { getDocumentMainLandmarkOrBody } from '../../utils/getDocumentMainLandmarkOrBody.js';\n\ntype ContentComponentPropsT = {\n xstyledProps: ReturnType<typeof useFloatingWrapper>['xstyledProps'];\n globalsAttrs: ReturnType<typeof useFloatingWrapper>['globalsAttrs'];\n ownerPropsConfig: {\n getOwnerProps: () => DSFloatingWrapperT.Props;\n getOwnerPropsArguments: () => object;\n };\n handleAnimationEnd: React.AnimationEventHandler<HTMLDivElement>;\n // for performance reasons, it's better for pure component to not receive nested objects\n // so the following is just the typescript way of describing we spread the props\n} & Omit<DSFloatingWrapperT.InternalProps, 'context'> &\n DSFloatingWrapperT.InternalProps['context'];\n\nconst ContentComponent = React.memo<ContentComponentPropsT>(\n ({\n children,\n innerRef,\n floatingStyles,\n isOpen,\n animationDuration,\n withoutAnimation,\n handleAnimationEnd,\n xstyledProps,\n globalsAttrs,\n ownerPropsConfig,\n }) => (\n <StyledFloatingWrapper\n innerRef={innerRef}\n style={floatingStyles}\n {...xstyledProps}\n role=\"complementary\"\n data-testid=\"ds-floating-wrapper-root\"\n {...globalsAttrs}\n {...ownerPropsConfig}\n >\n <StyledFloatingAnimation\n onAnimationEnd={handleAnimationEnd}\n isOpen={isOpen}\n animationDuration={animationDuration}\n withoutAnimation={withoutAnimation}\n {...ownerPropsConfig}\n >\n {children}\n </StyledFloatingAnimation>\n </StyledFloatingWrapper>\n ),\n);\n\nconst FloatingWrapper: React.ComponentType<DSFloatingWrapperT.Props> = (props) => {\n const { propsWithDefault, xstyledProps, globalsAttrs } = useFloatingWrapper(props);\n const { isOpen } = propsWithDefault;\n const ownerPropsConfig = useOwnerProps(props);\n\n const { context, onAnimationEnd, onAnimationStartTriggered, ...contentProps } = propsWithDefault;\n const { portalDOMContainer, withoutPortal, withoutAnimation } = context;\n\n const [isAnimating, setIsAnimating] = React.useState(false);\n React.useEffect(() => {\n if (isOpen && !withoutAnimation) {\n setIsAnimating(true);\n onAnimationStartTriggered?.();\n }\n }, [isOpen, onAnimationStartTriggered, withoutAnimation]);\n\n const handleAnimationEnd = React.useCallback<React.AnimationEventHandler<HTMLDivElement>>(\n (e) => {\n setIsAnimating(false);\n if (onAnimationEnd) onAnimationEnd(e);\n },\n [onAnimationEnd],\n );\n\n if (isOpen || isAnimating) {\n if (withoutPortal === true)\n return (\n <ContentComponent\n xstyledProps={xstyledProps}\n globalsAttrs={globalsAttrs}\n ownerPropsConfig={ownerPropsConfig}\n {...contentProps}\n {...context}\n handleAnimationEnd={handleAnimationEnd}\n />\n );\n if (!withoutPortal)\n return (\n <>\n {createPortal(\n <ContentComponent\n xstyledProps={xstyledProps}\n globalsAttrs={globalsAttrs}\n ownerPropsConfig={ownerPropsConfig}\n {...contentProps}\n {...context}\n handleAnimationEnd={handleAnimationEnd}\n />,\n portalDOMContainer || getDocumentMainLandmarkOrBody(),\n )}\n </>\n );\n }\n return null;\n};\n\nFloatingWrapper.displayName = DSFloatingWrapperName;\nconst FloatingWrapperWithSchema = describe(FloatingWrapper);\nFloatingWrapperWithSchema.propTypes = DSFloatingWrapperPropTypes as unknown as ValidationMap<DSFloatingWrapperT.Props>;\nexport { FloatingWrapper, FloatingWrapperWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD4CjB;AA5CN,mBAAkB;AAClB,uBAA6B;AAC7B,8BAA4D;AAC5D,oBAA+D;AAC/D,mCAAoE;AACpE,gCAAmC;AACnC,uBAAsC;AACtC,2CAA8C;AAe9C,MAAM,mBAAmB,aAAAA,QAAM;AAAA,EAC7B,CAAC;AAAA,IACC;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;AACH,aACE,2EACG;AAAA,QACC;AAAA,UAAC;AAAA;AAAA,YACC;AAAA,YACA;AAAA,YACA;AAAA,YACC,GAAG;AAAA,YACH,GAAG;AAAA,YACJ;AAAA;AAAA,QACF;AAAA,QACA,0BAAsB,oEAA8B;AAAA,MACtD,GACF;AAAA,EAEN;AACA,SAAO;AACT;AAEA,gBAAgB,cAAc;AAC9B,MAAM,gCAA4B,kCAAS,eAAe;AAC1D,0BAA0B,YAAY;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -6,7 +6,12 @@ const DSFloatingWrapperSlots = {
|
|
|
6
6
|
CONTENT: "content",
|
|
7
7
|
ARROW: "arrow"
|
|
8
8
|
};
|
|
9
|
-
const DSFloatingWrapperDataTestids =
|
|
9
|
+
const DSFloatingWrapperDataTestids = {
|
|
10
|
+
...slotObjectToDataTestIds(DSFloatingWrapperName, DSFloatingWrapperSlots),
|
|
11
|
+
// for legacy reasons we have to keep those around and override the slots...
|
|
12
|
+
ROOT: "ds-floating-wrapper-root",
|
|
13
|
+
ARROW: "ds-tooltip-arrow"
|
|
14
|
+
};
|
|
10
15
|
export {
|
|
11
16
|
DSFloatingWrapperDataTestids,
|
|
12
17
|
DSFloatingWrapperName,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/constants/index.ts"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { slotObjectToDataTestIds } from '@elliemae/ds-system';\n\nexport const DSFloatingWrapperName = 'DSFloatingwrapper';\n\nexport const DSFloatingWrapperSlots = {\n ROOT: 'root',\n CONTENT: 'content',\n ARROW: 'arrow',\n};\n\nexport const DSFloatingWrapperDataTestids = slotObjectToDataTestIds(DSFloatingWrapperName, DSFloatingWrapperSlots);\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,+BAA+B;AAEjC,MAAM,wBAAwB;AAE9B,MAAM,yBAAyB;AAAA,EACpC,MAAM;AAAA,EACN,SAAS;AAAA,EACT,OAAO;AACT;AAEO,MAAM,+BAA+B,wBAAwB,uBAAuB,sBAAsB;",
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { slotObjectToDataTestIds } from '@elliemae/ds-system';\n\nexport const DSFloatingWrapperName = 'DSFloatingwrapper';\n\nexport const DSFloatingWrapperSlots = {\n ROOT: 'root',\n CONTENT: 'content',\n ARROW: 'arrow',\n};\n\nexport const DSFloatingWrapperDataTestids = {\n ...slotObjectToDataTestIds(DSFloatingWrapperName, DSFloatingWrapperSlots),\n // for legacy reasons we have to keep those around and override the slots...\n ROOT: 'ds-floating-wrapper-root',\n ARROW: 'ds-tooltip-arrow',\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,+BAA+B;AAEjC,MAAM,wBAAwB;AAE9B,MAAM,yBAAyB;AAAA,EACpC,MAAM;AAAA,EACN,SAAS;AAAA,EACT,OAAO;AACT;AAEO,MAAM,+BAA+B;AAAA,EAC1C,GAAG,wBAAwB,uBAAuB,sBAAsB;AAAA;AAAA,EAExE,MAAM;AAAA,EACN,OAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,7 +2,7 @@ import * as React from "react";
|
|
|
2
2
|
import { Fragment, jsx } from "react/jsx-runtime";
|
|
3
3
|
import React2 from "react";
|
|
4
4
|
import { createPortal } from "react-dom";
|
|
5
|
-
import { describe } from "@elliemae/ds-props-helpers";
|
|
5
|
+
import { describe, useOwnerProps } from "@elliemae/ds-props-helpers";
|
|
6
6
|
import { StyledFloatingAnimation, StyledFloatingWrapper } from "./styled.js";
|
|
7
7
|
import { DSFloatingWrapperPropTypes } from "./react-desc-prop-types.js";
|
|
8
8
|
import { useFloatingWrapper } from "./config/useFloatingWrapper.js";
|
|
@@ -18,7 +18,8 @@ const ContentComponent = React2.memo(
|
|
|
18
18
|
withoutAnimation,
|
|
19
19
|
handleAnimationEnd,
|
|
20
20
|
xstyledProps,
|
|
21
|
-
globalsAttrs
|
|
21
|
+
globalsAttrs,
|
|
22
|
+
ownerPropsConfig
|
|
22
23
|
}) => /* @__PURE__ */ jsx(
|
|
23
24
|
StyledFloatingWrapper,
|
|
24
25
|
{
|
|
@@ -26,7 +27,9 @@ const ContentComponent = React2.memo(
|
|
|
26
27
|
style: floatingStyles,
|
|
27
28
|
...xstyledProps,
|
|
28
29
|
role: "complementary",
|
|
30
|
+
"data-testid": "ds-floating-wrapper-root",
|
|
29
31
|
...globalsAttrs,
|
|
32
|
+
...ownerPropsConfig,
|
|
30
33
|
children: /* @__PURE__ */ jsx(
|
|
31
34
|
StyledFloatingAnimation,
|
|
32
35
|
{
|
|
@@ -34,6 +37,7 @@ const ContentComponent = React2.memo(
|
|
|
34
37
|
isOpen,
|
|
35
38
|
animationDuration,
|
|
36
39
|
withoutAnimation,
|
|
40
|
+
...ownerPropsConfig,
|
|
37
41
|
children
|
|
38
42
|
}
|
|
39
43
|
)
|
|
@@ -43,6 +47,7 @@ const ContentComponent = React2.memo(
|
|
|
43
47
|
const FloatingWrapper = (props) => {
|
|
44
48
|
const { propsWithDefault, xstyledProps, globalsAttrs } = useFloatingWrapper(props);
|
|
45
49
|
const { isOpen } = propsWithDefault;
|
|
50
|
+
const ownerPropsConfig = useOwnerProps(props);
|
|
46
51
|
const { context, onAnimationEnd, onAnimationStartTriggered, ...contentProps } = propsWithDefault;
|
|
47
52
|
const { portalDOMContainer, withoutPortal, withoutAnimation } = context;
|
|
48
53
|
const [isAnimating, setIsAnimating] = React2.useState(false);
|
|
@@ -66,6 +71,7 @@ const FloatingWrapper = (props) => {
|
|
|
66
71
|
{
|
|
67
72
|
xstyledProps,
|
|
68
73
|
globalsAttrs,
|
|
74
|
+
ownerPropsConfig,
|
|
69
75
|
...contentProps,
|
|
70
76
|
...context,
|
|
71
77
|
handleAnimationEnd
|
|
@@ -78,6 +84,7 @@ const FloatingWrapper = (props) => {
|
|
|
78
84
|
{
|
|
79
85
|
xstyledProps,
|
|
80
86
|
globalsAttrs,
|
|
87
|
+
ownerPropsConfig,
|
|
81
88
|
...contentProps,
|
|
82
89
|
...context,
|
|
83
90
|
handleAnimationEnd
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/FloatingWrapper/FloatingWrapper.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { createPortal } from 'react-dom';\nimport { describe, type ValidationMap } from '@elliemae/ds-props-helpers';\nimport { StyledFloatingAnimation, StyledFloatingWrapper } from './styled.js';\nimport { type DSFloatingWrapperT, DSFloatingWrapperPropTypes } from './react-desc-prop-types.js';\nimport { useFloatingWrapper } from './config/useFloatingWrapper.js';\nimport { DSFloatingWrapperName } from '../../constants/index.js';\nimport { getDocumentMainLandmarkOrBody } from '../../utils/getDocumentMainLandmarkOrBody.js';\n\ntype ContentComponentPropsT = {\n xstyledProps: ReturnType<typeof useFloatingWrapper>['xstyledProps'];\n globalsAttrs: ReturnType<typeof useFloatingWrapper>['globalsAttrs'];\n handleAnimationEnd: React.AnimationEventHandler<HTMLDivElement>;\n // for performance reasons, it's better for pure component to not receive nested objects\n // so the following is just the typescript way of describing we spread the props\n} & Omit<DSFloatingWrapperT.InternalProps, 'context'> &\n DSFloatingWrapperT.InternalProps['context'];\n\nconst ContentComponent = React.memo<ContentComponentPropsT>(\n ({\n children,\n innerRef,\n floatingStyles,\n isOpen,\n animationDuration,\n withoutAnimation,\n handleAnimationEnd,\n xstyledProps,\n globalsAttrs,\n }) => (\n <StyledFloatingWrapper\n innerRef={innerRef}\n style={floatingStyles}\n {...xstyledProps}\n role=\"complementary\"\n {...globalsAttrs}\n >\n <StyledFloatingAnimation\n onAnimationEnd={handleAnimationEnd}\n isOpen={isOpen}\n animationDuration={animationDuration}\n withoutAnimation={withoutAnimation}\n >\n {children}\n </StyledFloatingAnimation>\n </StyledFloatingWrapper>\n ),\n);\n\nconst FloatingWrapper: React.ComponentType<DSFloatingWrapperT.Props> = (props) => {\n const { propsWithDefault, xstyledProps, globalsAttrs } = useFloatingWrapper(props);\n const { isOpen } = propsWithDefault;\n\n const { context, onAnimationEnd, onAnimationStartTriggered, ...contentProps } = propsWithDefault;\n const { portalDOMContainer, withoutPortal, withoutAnimation } = context;\n\n const [isAnimating, setIsAnimating] = React.useState(false);\n React.useEffect(() => {\n if (isOpen && !withoutAnimation) {\n setIsAnimating(true);\n onAnimationStartTriggered?.();\n }\n }, [isOpen, onAnimationStartTriggered, withoutAnimation]);\n\n const handleAnimationEnd = React.useCallback<React.AnimationEventHandler<HTMLDivElement>>(\n (e) => {\n setIsAnimating(false);\n if (onAnimationEnd) onAnimationEnd(e);\n },\n [onAnimationEnd],\n );\n\n if (isOpen || isAnimating) {\n if (withoutPortal === true)\n return (\n <ContentComponent\n xstyledProps={xstyledProps}\n globalsAttrs={globalsAttrs}\n {...contentProps}\n {...context}\n handleAnimationEnd={handleAnimationEnd}\n />\n );\n if (!withoutPortal)\n return (\n <>\n {createPortal(\n <ContentComponent\n xstyledProps={xstyledProps}\n globalsAttrs={globalsAttrs}\n {...contentProps}\n {...context}\n handleAnimationEnd={handleAnimationEnd}\n />,\n portalDOMContainer || getDocumentMainLandmarkOrBody(),\n )}\n </>\n );\n }\n return null;\n};\n\nFloatingWrapper.displayName = DSFloatingWrapperName;\nconst FloatingWrapperWithSchema = describe(FloatingWrapper);\nFloatingWrapperWithSchema.propTypes = DSFloatingWrapperPropTypes as unknown as ValidationMap<DSFloatingWrapperT.Props>;\nexport { FloatingWrapper, FloatingWrapperWithSchema };\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { createPortal } from 'react-dom';\nimport { describe, type ValidationMap, useOwnerProps } from '@elliemae/ds-props-helpers';\nimport { StyledFloatingAnimation, StyledFloatingWrapper } from './styled.js';\nimport { type DSFloatingWrapperT, DSFloatingWrapperPropTypes } from './react-desc-prop-types.js';\nimport { useFloatingWrapper } from './config/useFloatingWrapper.js';\nimport { DSFloatingWrapperName } from '../../constants/index.js';\nimport { getDocumentMainLandmarkOrBody } from '../../utils/getDocumentMainLandmarkOrBody.js';\n\ntype ContentComponentPropsT = {\n xstyledProps: ReturnType<typeof useFloatingWrapper>['xstyledProps'];\n globalsAttrs: ReturnType<typeof useFloatingWrapper>['globalsAttrs'];\n ownerPropsConfig: {\n getOwnerProps: () => DSFloatingWrapperT.Props;\n getOwnerPropsArguments: () => object;\n };\n handleAnimationEnd: React.AnimationEventHandler<HTMLDivElement>;\n // for performance reasons, it's better for pure component to not receive nested objects\n // so the following is just the typescript way of describing we spread the props\n} & Omit<DSFloatingWrapperT.InternalProps, 'context'> &\n DSFloatingWrapperT.InternalProps['context'];\n\nconst ContentComponent = React.memo<ContentComponentPropsT>(\n ({\n children,\n innerRef,\n floatingStyles,\n isOpen,\n animationDuration,\n withoutAnimation,\n handleAnimationEnd,\n xstyledProps,\n globalsAttrs,\n ownerPropsConfig,\n }) => (\n <StyledFloatingWrapper\n innerRef={innerRef}\n style={floatingStyles}\n {...xstyledProps}\n role=\"complementary\"\n data-testid=\"ds-floating-wrapper-root\"\n {...globalsAttrs}\n {...ownerPropsConfig}\n >\n <StyledFloatingAnimation\n onAnimationEnd={handleAnimationEnd}\n isOpen={isOpen}\n animationDuration={animationDuration}\n withoutAnimation={withoutAnimation}\n {...ownerPropsConfig}\n >\n {children}\n </StyledFloatingAnimation>\n </StyledFloatingWrapper>\n ),\n);\n\nconst FloatingWrapper: React.ComponentType<DSFloatingWrapperT.Props> = (props) => {\n const { propsWithDefault, xstyledProps, globalsAttrs } = useFloatingWrapper(props);\n const { isOpen } = propsWithDefault;\n const ownerPropsConfig = useOwnerProps(props);\n\n const { context, onAnimationEnd, onAnimationStartTriggered, ...contentProps } = propsWithDefault;\n const { portalDOMContainer, withoutPortal, withoutAnimation } = context;\n\n const [isAnimating, setIsAnimating] = React.useState(false);\n React.useEffect(() => {\n if (isOpen && !withoutAnimation) {\n setIsAnimating(true);\n onAnimationStartTriggered?.();\n }\n }, [isOpen, onAnimationStartTriggered, withoutAnimation]);\n\n const handleAnimationEnd = React.useCallback<React.AnimationEventHandler<HTMLDivElement>>(\n (e) => {\n setIsAnimating(false);\n if (onAnimationEnd) onAnimationEnd(e);\n },\n [onAnimationEnd],\n );\n\n if (isOpen || isAnimating) {\n if (withoutPortal === true)\n return (\n <ContentComponent\n xstyledProps={xstyledProps}\n globalsAttrs={globalsAttrs}\n ownerPropsConfig={ownerPropsConfig}\n {...contentProps}\n {...context}\n handleAnimationEnd={handleAnimationEnd}\n />\n );\n if (!withoutPortal)\n return (\n <>\n {createPortal(\n <ContentComponent\n xstyledProps={xstyledProps}\n globalsAttrs={globalsAttrs}\n ownerPropsConfig={ownerPropsConfig}\n {...contentProps}\n {...context}\n handleAnimationEnd={handleAnimationEnd}\n />,\n portalDOMContainer || getDocumentMainLandmarkOrBody(),\n )}\n </>\n );\n }\n return null;\n};\n\nFloatingWrapper.displayName = DSFloatingWrapperName;\nconst FloatingWrapperWithSchema = describe(FloatingWrapper);\nFloatingWrapperWithSchema.propTypes = DSFloatingWrapperPropTypes as unknown as ValidationMap<DSFloatingWrapperT.Props>;\nexport { FloatingWrapper, FloatingWrapperWithSchema };\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;AC4CjB,SAmDE,UAnDF;AA5CN,OAAOA,YAAW;AAClB,SAAS,oBAAoB;AAC7B,SAAS,UAA8B,qBAAqB;AAC5D,SAAS,yBAAyB,6BAA6B;AAC/D,SAAkC,kCAAkC;AACpE,SAAS,0BAA0B;AACnC,SAAS,6BAA6B;AACtC,SAAS,qCAAqC;AAe9C,MAAM,mBAAmBA,OAAM;AAAA,EAC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I,CAAC;AACH,aACE,gCACG;AAAA,QACC;AAAA,UAAC;AAAA;AAAA,YACC;AAAA,YACA;AAAA,YACA;AAAA,YACC,GAAG;AAAA,YACH,GAAG;AAAA,YACJ;AAAA;AAAA,QACF;AAAA,QACA,sBAAsB,8BAA8B;AAAA,MACtD,GACF;AAAA,EAEN;AACA,SAAO;AACT;AAEA,gBAAgB,cAAc;AAC9B,MAAM,4BAA4B,SAAS,eAAe;AAC1D,0BAA0B,YAAY;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-floating-context",
|
|
3
|
-
"version": "3.51.0-rc.
|
|
3
|
+
"version": "3.51.0-rc.10",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Popper Hook",
|
|
6
6
|
"files": [
|
|
@@ -36,15 +36,15 @@
|
|
|
36
36
|
"indent": 4
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@elliemae/ds-hooks-headless-tooltip": "3.51.0-rc.
|
|
40
|
-
"@elliemae/ds-props-helpers": "3.51.0-rc.
|
|
41
|
-
"@elliemae/ds-system": "3.51.0-rc.
|
|
42
|
-
"@elliemae/ds-typescript-helpers": "3.51.0-rc.
|
|
39
|
+
"@elliemae/ds-hooks-headless-tooltip": "3.51.0-rc.10",
|
|
40
|
+
"@elliemae/ds-props-helpers": "3.51.0-rc.10",
|
|
41
|
+
"@elliemae/ds-system": "3.51.0-rc.10",
|
|
42
|
+
"@elliemae/ds-typescript-helpers": "3.51.0-rc.10"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@elliemae/pui-cli": "9.0.0-next.55",
|
|
46
46
|
"jest": "~29.7.0",
|
|
47
|
-
"@elliemae/ds-monorepo-devops": "3.51.0-rc.
|
|
47
|
+
"@elliemae/ds-monorepo-devops": "3.51.0-rc.10"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"lodash": "^4.17.21",
|