@elliemae/ds-floating-context 3.51.0-rc.8 → 3.51.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.
- package/dist/cjs/DSFloatingContext.js.map +2 -2
- package/dist/cjs/constants/index.js +3 -1
- package/dist/cjs/constants/index.js.map +2 -2
- package/dist/cjs/index.js +3 -3
- package/dist/cjs/parts/FloatingWrapper/FloatingWrapper.js +7 -1
- package/dist/cjs/parts/FloatingWrapper/FloatingWrapper.js.map +2 -2
- package/dist/cjs/parts/PopoverArrow.js +46 -27
- package/dist/cjs/parts/PopoverArrow.js.map +2 -2
- package/dist/cjs/utils/computePosition.js.map +2 -2
- package/dist/esm/DSFloatingContext.js.map +2 -2
- package/dist/esm/constants/index.js +3 -1
- package/dist/esm/constants/index.js.map +2 -2
- package/dist/esm/parts/FloatingWrapper/FloatingWrapper.js +8 -2
- package/dist/esm/parts/FloatingWrapper/FloatingWrapper.js.map +2 -2
- package/dist/esm/parts/PopoverArrow.js +46 -27
- package/dist/esm/parts/PopoverArrow.js.map +2 -2
- package/dist/esm/utils/computePosition.js.map +2 -2
- package/dist/types/DSFloatingContext.d.ts +2 -4
- package/dist/types/constants/index.d.ts +2 -0
- package/dist/types/parts/FloatingWrapper/config/useFloatingWrapper.d.ts +72 -70
- package/dist/types/parts/PopoverArrow.d.ts +4 -3
- package/package.json +6 -6
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/DSFloatingContext.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable no-nested-ternary */\n/* eslint-disable arrow-body-style */\n/* eslint-disable no-unused-vars */\n/* eslint-disable max-lines */\n/* eslint-disable @typescript-eslint/naming-convention */\n/* eslint-disable @typescript-eslint/no-use-before-define */\nimport React, { useState, useEffect, useMemo } from 'react';\nimport { debounce } from 'lodash';\nimport {\n useMemoMergePropsWithDefault,\n useValidateTypescriptPropTypes,\n describe,\n type ValidationMap,\n} from '@elliemae/ds-props-helpers';\nimport { useHeadlessTooltip } from '@elliemae/ds-hooks-headless-tooltip';\nimport { type CSSProperties } from 'styled-components';\nimport { mergeRefs } from '@elliemae/ds-system';\nimport { computePosition } from './utils/computePosition.js';\nimport type { DSHookFloatingContextT } from './react-desc-prop-types.js';\nimport { defaultProps, DSFloatingContextPropTypes } from './react-desc-prop-types.js';\n\nconst useFloatingContext = (props: DSHookFloatingContextT.Props = {}) => {\n const propsWithDefault = useMemoMergePropsWithDefault<DSHookFloatingContextT.InternalProps>(props, defaultProps);\n useValidateTypescriptPropTypes(propsWithDefault, DSFloatingContextPropTypes, 'FloatingContext');\n\n const {\n withoutPortal,\n withoutAnimation,\n portalDOMContainer,\n animationDuration,\n placement,\n customOffset,\n placementOrderPreference,\n onOpen,\n onClose,\n externallyControlledIsOpen,\n } = propsWithDefault;\n\n const [internalIsOpen, setInternalIsOpen] = React.useState<boolean>(false);\n const isOpenSourceOfTruth = useMemo(() => {\n if (externallyControlledIsOpen !== undefined) return externallyControlledIsOpen;\n return internalIsOpen;\n }, [externallyControlledIsOpen, internalIsOpen]);\n\n const overChargedOnOpen = React.useCallback(() => {\n setInternalIsOpen(true);\n onOpen?.();\n }, [onOpen]);\n const overChargedOnClose = React.useCallback(() => {\n setInternalIsOpen(false);\n onClose?.();\n }, [onClose]);\n const tooltipHelpers = useHeadlessTooltip({ onOpen: overChargedOnOpen, onClose: overChargedOnClose });\n\n const { setReferenceElement, hideTooltip, showTooltip } = tooltipHelpers;\n const [floatingStyles, setFloatingStyles] = useState<CSSProperties>({\n position: 'absolute',\n zIndex: 3000,\n top: 0,\n left: 0,\n visibility: 'hidden',\n });\n const [arrowStyles, setArrowStyles] = useState<
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADMvB,mBAAoD;AACpD,oBAAyB;AACzB,8BAKO;AACP,uCAAmC;AAEnC,uBAA0B;AAC1B,6BAAgC;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable no-nested-ternary */\n/* eslint-disable arrow-body-style */\n/* eslint-disable no-unused-vars */\n/* eslint-disable max-lines */\n/* eslint-disable @typescript-eslint/naming-convention */\n/* eslint-disable @typescript-eslint/no-use-before-define */\nimport React, { useState, useEffect, useMemo } from 'react';\nimport { debounce } from 'lodash';\nimport {\n useMemoMergePropsWithDefault,\n useValidateTypescriptPropTypes,\n describe,\n type ValidationMap,\n} from '@elliemae/ds-props-helpers';\nimport { useHeadlessTooltip } from '@elliemae/ds-hooks-headless-tooltip';\nimport { type CSSProperties } from 'styled-components';\nimport { mergeRefs } from '@elliemae/ds-system';\nimport { computePosition } from './utils/computePosition.js';\nimport type { DSHookFloatingContextT } from './react-desc-prop-types.js';\nimport type { PopoverArrowT } from './parts/PopoverArrow.js';\nimport { defaultProps, DSFloatingContextPropTypes } from './react-desc-prop-types.js';\n\nconst useFloatingContext = (props: DSHookFloatingContextT.Props = {}) => {\n const propsWithDefault = useMemoMergePropsWithDefault<DSHookFloatingContextT.InternalProps>(props, defaultProps);\n useValidateTypescriptPropTypes(propsWithDefault, DSFloatingContextPropTypes, 'FloatingContext');\n\n const {\n withoutPortal,\n withoutAnimation,\n portalDOMContainer,\n animationDuration,\n placement,\n customOffset,\n placementOrderPreference,\n onOpen,\n onClose,\n externallyControlledIsOpen,\n } = propsWithDefault;\n\n const [internalIsOpen, setInternalIsOpen] = React.useState<boolean>(false);\n const isOpenSourceOfTruth = useMemo(() => {\n if (externallyControlledIsOpen !== undefined) return externallyControlledIsOpen;\n return internalIsOpen;\n }, [externallyControlledIsOpen, internalIsOpen]);\n\n const overChargedOnOpen = React.useCallback(() => {\n setInternalIsOpen(true);\n onOpen?.();\n }, [onOpen]);\n const overChargedOnClose = React.useCallback(() => {\n setInternalIsOpen(false);\n onClose?.();\n }, [onClose]);\n const tooltipHelpers = useHeadlessTooltip({ onOpen: overChargedOnOpen, onClose: overChargedOnClose });\n\n const { setReferenceElement, hideTooltip, showTooltip } = tooltipHelpers;\n const [floatingStyles, setFloatingStyles] = useState<CSSProperties>({\n position: 'absolute',\n zIndex: 3000,\n top: 0,\n left: 0,\n visibility: 'hidden',\n });\n const [arrowStyles, setArrowStyles] = useState<PopoverArrowT>({\n style: { left: 0 },\n placement: 'top',\n });\n\n const [reference, _setReference] = React.useState<Element | null>(null);\n const [floating, setFloating] = React.useState<HTMLElement | null>(null);\n useEffect(() => {\n const update = () => {\n if (isOpenSourceOfTruth && reference && floating) {\n const { coordsStyle, finalPlacement, coordsArrow } = computePosition({\n reference,\n floating,\n placement,\n placementOrderPreference,\n customOffset,\n withoutPortal,\n });\n\n const styles: CSSProperties = {\n position: 'absolute',\n zIndex: 3000,\n // top: 0,\n // left: 0,\n ...coordsStyle,\n };\n\n setFloatingStyles(styles);\n setArrowStyles({ style: coordsArrow, placement: finalPlacement });\n }\n };\n\n // initial position calculation\n update();\n\n const debouncedCb = debounce(update, 300);\n\n // auto update position on scrolling\n window.addEventListener('scroll', debouncedCb);\n\n return () => {\n window.removeEventListener('scroll', debouncedCb);\n };\n }, [reference, floating, placement, placementOrderPreference, customOffset, withoutPortal, isOpenSourceOfTruth]);\n\n const setReference = mergeRefs(_setReference, setReferenceElement);\n\n const refs = React.useMemo(\n () => ({\n setReference,\n setFloating,\n floating,\n reference,\n }),\n [setReference, floating, reference],\n );\n\n const handlers = React.useMemo(\n () => ({\n onMouseEnter: tooltipHelpers.onMouseEnter,\n onMouseLeave: tooltipHelpers.onMouseLeave,\n onFocus: tooltipHelpers.onFocus,\n onBlur: tooltipHelpers.onBlur,\n }),\n [tooltipHelpers.onBlur, tooltipHelpers.onFocus, tooltipHelpers.onMouseEnter, tooltipHelpers.onMouseLeave],\n );\n\n return useMemo(\n () => ({\n refs,\n floatingStyles,\n handlers,\n isOpen: isOpenSourceOfTruth,\n arrowStyles,\n hideTooltip,\n showTooltip,\n context: {\n withoutPortal,\n withoutAnimation,\n portalDOMContainer,\n animationDuration,\n },\n }),\n [\n refs,\n floatingStyles,\n handlers,\n isOpenSourceOfTruth,\n arrowStyles,\n hideTooltip,\n showTooltip,\n withoutPortal,\n withoutAnimation,\n portalDOMContainer,\n animationDuration,\n ],\n );\n};\n\nuseFloatingContext.displayName = 'FloatingContext';\nconst UseFloatingContextWithSchema = describe(useFloatingContext);\nUseFloatingContextWithSchema.propTypes =\n DSFloatingContextPropTypes as unknown as ValidationMap<DSHookFloatingContextT.Props>;\n\nexport { useFloatingContext, UseFloatingContextWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADMvB,mBAAoD;AACpD,oBAAyB;AACzB,8BAKO;AACP,uCAAmC;AAEnC,uBAA0B;AAC1B,6BAAgC;AAGhC,mCAAyD;AAEzD,MAAM,qBAAqB,CAAC,QAAsC,CAAC,MAAM;AACvE,QAAM,uBAAmB,sDAAmE,OAAO,yCAAY;AAC/G,8DAA+B,kBAAkB,yDAA4B,iBAAiB;AAE9F,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AAEJ,QAAM,CAAC,gBAAgB,iBAAiB,IAAI,aAAAA,QAAM,SAAkB,KAAK;AACzE,QAAM,0BAAsB,sBAAQ,MAAM;AACxC,QAAI,+BAA+B,OAAW,QAAO;AACrD,WAAO;AAAA,EACT,GAAG,CAAC,4BAA4B,cAAc,CAAC;AAE/C,QAAM,oBAAoB,aAAAA,QAAM,YAAY,MAAM;AAChD,sBAAkB,IAAI;AACtB,aAAS;AAAA,EACX,GAAG,CAAC,MAAM,CAAC;AACX,QAAM,qBAAqB,aAAAA,QAAM,YAAY,MAAM;AACjD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BAAmB;AAEjE,QAAM,OAAO,aAAAA,QAAM;AAAA,IACjB,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,cAAc,UAAU,SAAS;AAAA,EACpC;AAEA,QAAM,WAAW,aAAAA,QAAM;AAAA,IACrB,OAAO;AAAA,MACL,cAAc,eAAe;AAAA,MAC7B,cAAc,eAAe;AAAA,MAC7B,SAAS,eAAe;AAAA,MACxB,QAAQ,eAAe;AAAA,IACzB;AAAA,IACA,CAAC,eAAe,QAAQ,eAAe,SAAS,eAAe,cAAc,eAAe,YAAY;AAAA,EAC1G;AAEA,aAAO;AAAA,IACL,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA,QAAQ;AAAA,MACR;AAAA,MACA;AAAA,MACA;AAAA,MACA,SAAS;AAAA,QACP;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;AAEA,mBAAmB,cAAc;AACjC,MAAM,mCAA+B,kCAAS,kBAAkB;AAChE,6BAA6B,YAC3B;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -39,7 +39,9 @@ const DSFloatingWrapperName = "DSFloatingwrapper";
|
|
|
39
39
|
const DSFloatingWrapperSlots = {
|
|
40
40
|
ROOT: "root",
|
|
41
41
|
CONTENT: "content",
|
|
42
|
-
ARROW: "arrow"
|
|
42
|
+
ARROW: "arrow",
|
|
43
|
+
ARROW_SHADOW: "arrow_shadow",
|
|
44
|
+
ARROW_FILL: "arrow_fill"
|
|
43
45
|
};
|
|
44
46
|
const DSFloatingWrapperDataTestids = {
|
|
45
47
|
...(0, import_ds_system.slotObjectToDataTestIds)(DSFloatingWrapperName, DSFloatingWrapperSlots),
|
|
@@ -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 = {\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;
|
|
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 ARROW_SHADOW: 'arrow_shadow',\n ARROW_FILL: 'arrow_fill',\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;AAAA,EACP,cAAc;AAAA,EACd,YAAY;AACd;AAEO,MAAM,+BAA+B;AAAA,EAC1C,OAAG,0CAAwB,uBAAuB,sBAAsB;AAAA;AAAA,EAExE,MAAM;AAAA,EACN,OAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -26,8 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var index_exports = {};
|
|
30
|
+
__export(index_exports, {
|
|
31
31
|
DSFloatingWrapperDataTestids: () => import_FloatingWrapper2.DSFloatingWrapperDataTestids,
|
|
32
32
|
DSFloatingWrapperName: () => import_FloatingWrapper2.DSFloatingWrapperName,
|
|
33
33
|
DSFloatingWrapperSlots: () => import_FloatingWrapper2.DSFloatingWrapperSlots,
|
|
@@ -37,7 +37,7 @@ __export(src_exports, {
|
|
|
37
37
|
UseFloatingContextWithSchema: () => import_DSFloatingContext.UseFloatingContextWithSchema,
|
|
38
38
|
useFloatingContext: () => import_DSFloatingContext.useFloatingContext
|
|
39
39
|
});
|
|
40
|
-
module.exports = __toCommonJS(
|
|
40
|
+
module.exports = __toCommonJS(index_exports);
|
|
41
41
|
var React = __toESM(require("react"));
|
|
42
42
|
var import_DSFloatingContext = require("./DSFloatingContext.js");
|
|
43
43
|
var import_PopoverArrow = require("./parts/PopoverArrow.js");
|
|
@@ -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
|
{
|
|
@@ -62,6 +63,7 @@ const ContentComponent = import_react.default.memo(
|
|
|
62
63
|
role: "complementary",
|
|
63
64
|
"data-testid": "ds-floating-wrapper-root",
|
|
64
65
|
...globalsAttrs,
|
|
66
|
+
...ownerPropsConfig,
|
|
65
67
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
66
68
|
import_styled.StyledFloatingAnimation,
|
|
67
69
|
{
|
|
@@ -69,6 +71,7 @@ const ContentComponent = import_react.default.memo(
|
|
|
69
71
|
isOpen,
|
|
70
72
|
animationDuration,
|
|
71
73
|
withoutAnimation,
|
|
74
|
+
...ownerPropsConfig,
|
|
72
75
|
children
|
|
73
76
|
}
|
|
74
77
|
)
|
|
@@ -78,6 +81,7 @@ const ContentComponent = import_react.default.memo(
|
|
|
78
81
|
const FloatingWrapper = (props) => {
|
|
79
82
|
const { propsWithDefault, xstyledProps, globalsAttrs } = (0, import_useFloatingWrapper.useFloatingWrapper)(props);
|
|
80
83
|
const { isOpen } = propsWithDefault;
|
|
84
|
+
const ownerPropsConfig = (0, import_ds_props_helpers.useOwnerProps)(props);
|
|
81
85
|
const { context, onAnimationEnd, onAnimationStartTriggered, ...contentProps } = propsWithDefault;
|
|
82
86
|
const { portalDOMContainer, withoutPortal, withoutAnimation } = context;
|
|
83
87
|
const [isAnimating, setIsAnimating] = import_react.default.useState(false);
|
|
@@ -101,6 +105,7 @@ const FloatingWrapper = (props) => {
|
|
|
101
105
|
{
|
|
102
106
|
xstyledProps,
|
|
103
107
|
globalsAttrs,
|
|
108
|
+
ownerPropsConfig,
|
|
104
109
|
...contentProps,
|
|
105
110
|
...context,
|
|
106
111
|
handleAnimationEnd
|
|
@@ -113,6 +118,7 @@ const FloatingWrapper = (props) => {
|
|
|
113
118
|
{
|
|
114
119
|
xstyledProps,
|
|
115
120
|
globalsAttrs,
|
|
121
|
+
ownerPropsConfig,
|
|
116
122
|
...contentProps,
|
|
117
123
|
...context,
|
|
118
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 data-testid=\"ds-floating-wrapper-root\"\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,uB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UACA;AAAA,UACC,GAAG;AAAA,UACH,GAAG;AAAA,UACJ;AAAA;AAAA,MACF;AAEJ,QAAI,CAAC;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
|
}
|
|
@@ -33,6 +33,7 @@ __export(PopoverArrow_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(PopoverArrow_exports);
|
|
34
34
|
var React = __toESM(require("react"));
|
|
35
35
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
|
+
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
36
37
|
var import_ds_system = require("@elliemae/ds-system");
|
|
37
38
|
var import_constants = require("../constants/index.js");
|
|
38
39
|
const arrowWidth = 18;
|
|
@@ -89,31 +90,49 @@ const StyledArrow = (0, import_ds_system.styled)("div", {
|
|
|
89
90
|
margin-left: ${(props) => props["data-placement"].startsWith("top") || props["data-placement"].startsWith("bottom") ? `-${arrowWidth / 2}px;` : "0;"};
|
|
90
91
|
margin-top: ${(props) => props["data-placement"].startsWith("left") || props["data-placement"].startsWith("right") ? `-${arrowHeight / 2}px;` : "0;"};
|
|
91
92
|
`;
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
93
|
+
const StylePathShadow = (0, import_ds_system.styled)("path", {
|
|
94
|
+
name: import_constants.DSFloatingWrapperName,
|
|
95
|
+
slot: import_constants.DSFloatingWrapperSlots.ARROW_SHADOW
|
|
96
|
+
})``;
|
|
97
|
+
const StylePathFill = (0, import_ds_system.styled)("path", {
|
|
98
|
+
name: import_constants.DSFloatingWrapperName,
|
|
99
|
+
slot: import_constants.DSFloatingWrapperSlots.ARROW_FILL
|
|
100
|
+
})``;
|
|
101
|
+
const PopoverArrow = ({ placement, style, arrowElementRef, ...rest }) => {
|
|
102
|
+
const ownerProps = (0, import_ds_props_helpers.useOwnerProps)(rest);
|
|
103
|
+
const globalAttributes = (0, import_ds_props_helpers.useGetGlobalAttributes)(rest);
|
|
104
|
+
const xstyledProps = (0, import_ds_props_helpers.useGetXstyledProps)(rest);
|
|
105
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
106
|
+
StyledArrow,
|
|
107
|
+
{
|
|
108
|
+
"data-placement": placement,
|
|
109
|
+
style,
|
|
110
|
+
innerRef: arrowElementRef,
|
|
111
|
+
"data-testid": "ds-tooltip-arrow",
|
|
112
|
+
"aria-hidden": "true",
|
|
113
|
+
...ownerProps,
|
|
114
|
+
...globalAttributes,
|
|
115
|
+
...xstyledProps,
|
|
116
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("svg", { viewBox: "0 0 30 30", children: [
|
|
117
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
118
|
+
StylePathShadow,
|
|
119
|
+
{
|
|
120
|
+
...ownerProps,
|
|
121
|
+
className: "stroke",
|
|
122
|
+
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"
|
|
123
|
+
}
|
|
124
|
+
),
|
|
125
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
126
|
+
StylePathFill,
|
|
127
|
+
{
|
|
128
|
+
...ownerProps,
|
|
129
|
+
className: "fill",
|
|
130
|
+
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"
|
|
131
|
+
}
|
|
132
|
+
)
|
|
133
|
+
] })
|
|
134
|
+
},
|
|
135
|
+
"popper-arrow"
|
|
136
|
+
);
|
|
137
|
+
};
|
|
119
138
|
//# sourceMappingURL=PopoverArrow.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/parts/PopoverArrow.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React from 'react';\nimport { styled } from '@elliemae/ds-system';\nimport { DSFloatingWrapperSlots, DSFloatingWrapperName } from '../constants/index.js';\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { useOwnerProps, useGetGlobalAttributes, useGetXstyledProps } from '@elliemae/ds-props-helpers';\nimport { styled } from '@elliemae/ds-system';\nimport type { TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport { DSFloatingWrapperSlots, DSFloatingWrapperName } from '../constants/index.js';\nexport interface PopoverArrowT\n extends TypescriptHelpersT.PropsForGlobalOnSlots<typeof DSFloatingWrapperName, typeof DSFloatingWrapperSlots> {\n placement: string;\n style: React.CSSProperties;\n arrowElementRef?: React.Dispatch<React.SetStateAction<HTMLDivElement | null>>;\n}\nconst arrowWidth = 18;\nconst arrowHeight = 18;\n\nconst OFFSET_FIX_SHADOW_DEFECT = 0.25;\nconst StyledArrow = styled('div', {\n name: DSFloatingWrapperName,\n slot: DSFloatingWrapperSlots.ARROW,\n})<{ '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 - OFFSET_FIX_SHADOW_DEFECT}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 - OFFSET_FIX_SHADOW_DEFECT}px;\n }\n &[data-placement^='bottom'] {\n top: -${arrowHeight - OFFSET_FIX_SHADOW_DEFECT}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 - OFFSET_FIX_SHADOW_DEFECT}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\nconst StylePathShadow = styled('path', {\n name: DSFloatingWrapperName,\n slot: DSFloatingWrapperSlots.ARROW_SHADOW,\n})``;\n\nconst StylePathFill = styled('path', {\n name: DSFloatingWrapperName,\n slot: DSFloatingWrapperSlots.ARROW_FILL,\n})``;\n\nexport const PopoverArrow = ({ placement, style, arrowElementRef, ...rest }: PopoverArrowT): React.ReactElement => {\n const ownerProps = useOwnerProps(rest);\n const globalAttributes = useGetGlobalAttributes(rest);\n const xstyledProps = useGetXstyledProps(rest);\n return (\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 {...ownerProps}\n {...globalAttributes}\n {...xstyledProps}\n >\n <svg viewBox=\"0 0 30 30\">\n <StylePathShadow\n {...ownerProps}\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 <StylePathFill\n {...ownerProps}\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};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADmGjB;AAlGN,8BAA0E;AAC1E,uBAAuB;AAEvB,uBAA8D;AAO9D,MAAM,aAAa;AACnB,MAAM,cAAc;AAEpB,MAAM,2BAA2B;AACjC,MAAM,kBAAc,yBAAO,OAAO;AAAA,EAChC,MAAM;AAAA,EACN,MAAM,wCAAuB;AAC/B,CAAC;AAAA;AAAA,WAEU,UAAU;AAAA,YACT,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,eAeR,cAAc,wBAAwB;AAAA,YACzC,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;AA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AAA,UAAC;AAAA;AAAA,YACE,GAAG;AAAA,YACJ,WAAU;AAAA,YACV,GAAE;AAAA;AAAA,QACJ;AAAA,SACF;AAAA;AAAA,IAtBI;AAAA,EAuBN;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/utils/computePosition.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* 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
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADQvB,2CAA8C;AAC9C,4BAA+B;AAC/B,kCAAiC;AACjC,4BAA+B;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,gCAA4B,oEAA8B,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,gBAAY,sCAAe,eAAe,cAAc,kBAAkB,YAAY;AAE5F,UAAM,SAAoB,CAAC;AAE3B,UAAM,mBAAmB,uBAAuB;AAEhD,QAAI,oBAAyC,aACzC,mBACE,UACA,SACF,
|
|
4
|
+
"sourcesContent": ["/* 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: {\n left: 0,\n top: 0,\n // we use transform -> translate because we know final computed left/top probably \"split a pixel\" (e.g. 10.005px)\n // when we use transform we force the browser to use hardware acceleration\n // hardware acceleration is faster and more reliable than the browser's own rounding\n // it also helps with css animations and so on\n transform: `translate(${coords.left}px, ${coords.top}px)`,\n },\n finalPlacement,\n coordsArrow: getArrowOffset(finalPlacement, isVertical),\n };\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADQvB,2CAA8C;AAC9C,4BAA+B;AAC/B,kCAAiC;AACjC,4BAA+B;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,0BA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c;AAC/D,uBAAiB;AAEjB;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AAAA,IACL,aAAa;AAAA,MACX,MAAM;AAAA,MACN,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA,MAKL,WAAW,aAAa,OAAO,IAAI,OAAO,OAAO,GAAG;AAAA,IACtD;AAAA,IACA;AAAA,IACA,iBAAa,sCAAe,gBAAgB,UAAU;AAAA,EACxD;AACF;",
|
|
6
6
|
"names": ["getOppositePlacement"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/DSFloatingContext.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable no-nested-ternary */\n/* eslint-disable arrow-body-style */\n/* eslint-disable no-unused-vars */\n/* eslint-disable max-lines */\n/* eslint-disable @typescript-eslint/naming-convention */\n/* eslint-disable @typescript-eslint/no-use-before-define */\nimport React, { useState, useEffect, useMemo } from 'react';\nimport { debounce } from 'lodash';\nimport {\n useMemoMergePropsWithDefault,\n useValidateTypescriptPropTypes,\n describe,\n type ValidationMap,\n} from '@elliemae/ds-props-helpers';\nimport { useHeadlessTooltip } from '@elliemae/ds-hooks-headless-tooltip';\nimport { type CSSProperties } from 'styled-components';\nimport { mergeRefs } from '@elliemae/ds-system';\nimport { computePosition } from './utils/computePosition.js';\nimport type { DSHookFloatingContextT } from './react-desc-prop-types.js';\nimport { defaultProps, DSFloatingContextPropTypes } from './react-desc-prop-types.js';\n\nconst useFloatingContext = (props: DSHookFloatingContextT.Props = {}) => {\n const propsWithDefault = useMemoMergePropsWithDefault<DSHookFloatingContextT.InternalProps>(props, defaultProps);\n useValidateTypescriptPropTypes(propsWithDefault, DSFloatingContextPropTypes, 'FloatingContext');\n\n const {\n withoutPortal,\n withoutAnimation,\n portalDOMContainer,\n animationDuration,\n placement,\n customOffset,\n placementOrderPreference,\n onOpen,\n onClose,\n externallyControlledIsOpen,\n } = propsWithDefault;\n\n const [internalIsOpen, setInternalIsOpen] = React.useState<boolean>(false);\n const isOpenSourceOfTruth = useMemo(() => {\n if (externallyControlledIsOpen !== undefined) return externallyControlledIsOpen;\n return internalIsOpen;\n }, [externallyControlledIsOpen, internalIsOpen]);\n\n const overChargedOnOpen = React.useCallback(() => {\n setInternalIsOpen(true);\n onOpen?.();\n }, [onOpen]);\n const overChargedOnClose = React.useCallback(() => {\n setInternalIsOpen(false);\n onClose?.();\n }, [onClose]);\n const tooltipHelpers = useHeadlessTooltip({ onOpen: overChargedOnOpen, onClose: overChargedOnClose });\n\n const { setReferenceElement, hideTooltip, showTooltip } = tooltipHelpers;\n const [floatingStyles, setFloatingStyles] = useState<CSSProperties>({\n position: 'absolute',\n zIndex: 3000,\n top: 0,\n left: 0,\n visibility: 'hidden',\n });\n const [arrowStyles, setArrowStyles] = useState<
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACMvB,OAAOA,UAAS,UAAU,WAAW,eAAe;AACpD,SAAS,gBAAgB;AACzB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,0BAA0B;AAEnC,SAAS,iBAAiB;AAC1B,SAAS,uBAAuB;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable no-nested-ternary */\n/* eslint-disable arrow-body-style */\n/* eslint-disable no-unused-vars */\n/* eslint-disable max-lines */\n/* eslint-disable @typescript-eslint/naming-convention */\n/* eslint-disable @typescript-eslint/no-use-before-define */\nimport React, { useState, useEffect, useMemo } from 'react';\nimport { debounce } from 'lodash';\nimport {\n useMemoMergePropsWithDefault,\n useValidateTypescriptPropTypes,\n describe,\n type ValidationMap,\n} from '@elliemae/ds-props-helpers';\nimport { useHeadlessTooltip } from '@elliemae/ds-hooks-headless-tooltip';\nimport { type CSSProperties } from 'styled-components';\nimport { mergeRefs } from '@elliemae/ds-system';\nimport { computePosition } from './utils/computePosition.js';\nimport type { DSHookFloatingContextT } from './react-desc-prop-types.js';\nimport type { PopoverArrowT } from './parts/PopoverArrow.js';\nimport { defaultProps, DSFloatingContextPropTypes } from './react-desc-prop-types.js';\n\nconst useFloatingContext = (props: DSHookFloatingContextT.Props = {}) => {\n const propsWithDefault = useMemoMergePropsWithDefault<DSHookFloatingContextT.InternalProps>(props, defaultProps);\n useValidateTypescriptPropTypes(propsWithDefault, DSFloatingContextPropTypes, 'FloatingContext');\n\n const {\n withoutPortal,\n withoutAnimation,\n portalDOMContainer,\n animationDuration,\n placement,\n customOffset,\n placementOrderPreference,\n onOpen,\n onClose,\n externallyControlledIsOpen,\n } = propsWithDefault;\n\n const [internalIsOpen, setInternalIsOpen] = React.useState<boolean>(false);\n const isOpenSourceOfTruth = useMemo(() => {\n if (externallyControlledIsOpen !== undefined) return externallyControlledIsOpen;\n return internalIsOpen;\n }, [externallyControlledIsOpen, internalIsOpen]);\n\n const overChargedOnOpen = React.useCallback(() => {\n setInternalIsOpen(true);\n onOpen?.();\n }, [onOpen]);\n const overChargedOnClose = React.useCallback(() => {\n setInternalIsOpen(false);\n onClose?.();\n }, [onClose]);\n const tooltipHelpers = useHeadlessTooltip({ onOpen: overChargedOnOpen, onClose: overChargedOnClose });\n\n const { setReferenceElement, hideTooltip, showTooltip } = tooltipHelpers;\n const [floatingStyles, setFloatingStyles] = useState<CSSProperties>({\n position: 'absolute',\n zIndex: 3000,\n top: 0,\n left: 0,\n visibility: 'hidden',\n });\n const [arrowStyles, setArrowStyles] = useState<PopoverArrowT>({\n style: { left: 0 },\n placement: 'top',\n });\n\n const [reference, _setReference] = React.useState<Element | null>(null);\n const [floating, setFloating] = React.useState<HTMLElement | null>(null);\n useEffect(() => {\n const update = () => {\n if (isOpenSourceOfTruth && reference && floating) {\n const { coordsStyle, finalPlacement, coordsArrow } = computePosition({\n reference,\n floating,\n placement,\n placementOrderPreference,\n customOffset,\n withoutPortal,\n });\n\n const styles: CSSProperties = {\n position: 'absolute',\n zIndex: 3000,\n // top: 0,\n // left: 0,\n ...coordsStyle,\n };\n\n setFloatingStyles(styles);\n setArrowStyles({ style: coordsArrow, placement: finalPlacement });\n }\n };\n\n // initial position calculation\n update();\n\n const debouncedCb = debounce(update, 300);\n\n // auto update position on scrolling\n window.addEventListener('scroll', debouncedCb);\n\n return () => {\n window.removeEventListener('scroll', debouncedCb);\n };\n }, [reference, floating, placement, placementOrderPreference, customOffset, withoutPortal, isOpenSourceOfTruth]);\n\n const setReference = mergeRefs(_setReference, setReferenceElement);\n\n const refs = React.useMemo(\n () => ({\n setReference,\n setFloating,\n floating,\n reference,\n }),\n [setReference, floating, reference],\n );\n\n const handlers = React.useMemo(\n () => ({\n onMouseEnter: tooltipHelpers.onMouseEnter,\n onMouseLeave: tooltipHelpers.onMouseLeave,\n onFocus: tooltipHelpers.onFocus,\n onBlur: tooltipHelpers.onBlur,\n }),\n [tooltipHelpers.onBlur, tooltipHelpers.onFocus, tooltipHelpers.onMouseEnter, tooltipHelpers.onMouseLeave],\n );\n\n return useMemo(\n () => ({\n refs,\n floatingStyles,\n handlers,\n isOpen: isOpenSourceOfTruth,\n arrowStyles,\n hideTooltip,\n showTooltip,\n context: {\n withoutPortal,\n withoutAnimation,\n portalDOMContainer,\n animationDuration,\n },\n }),\n [\n refs,\n floatingStyles,\n handlers,\n isOpenSourceOfTruth,\n arrowStyles,\n hideTooltip,\n showTooltip,\n withoutPortal,\n withoutAnimation,\n portalDOMContainer,\n animationDuration,\n ],\n );\n};\n\nuseFloatingContext.displayName = 'FloatingContext';\nconst UseFloatingContextWithSchema = describe(useFloatingContext);\nUseFloatingContextWithSchema.propTypes =\n DSFloatingContextPropTypes as unknown as ValidationMap<DSHookFloatingContextT.Props>;\n\nexport { useFloatingContext, UseFloatingContextWithSchema };\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACMvB,OAAOA,UAAS,UAAU,WAAW,eAAe;AACpD,SAAS,gBAAgB;AACzB;A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AAAA,QACP;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;AAEA,mBAAmB,cAAc;AACjC,MAAM,+BAA+B,SAAS,kBAAkB;AAChE,6BAA6B,YAC3B;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -4,7 +4,9 @@ const DSFloatingWrapperName = "DSFloatingwrapper";
|
|
|
4
4
|
const DSFloatingWrapperSlots = {
|
|
5
5
|
ROOT: "root",
|
|
6
6
|
CONTENT: "content",
|
|
7
|
-
ARROW: "arrow"
|
|
7
|
+
ARROW: "arrow",
|
|
8
|
+
ARROW_SHADOW: "arrow_shadow",
|
|
9
|
+
ARROW_FILL: "arrow_fill"
|
|
8
10
|
};
|
|
9
11
|
const DSFloatingWrapperDataTestids = {
|
|
10
12
|
...slotObjectToDataTestIds(DSFloatingWrapperName, DSFloatingWrapperSlots),
|
|
@@ -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 = {\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;
|
|
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 ARROW_SHADOW: 'arrow_shadow',\n ARROW_FILL: 'arrow_fill',\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;AAAA,EACP,cAAc;AAAA,EACd,YAAY;AACd;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
|
{
|
|
@@ -28,6 +29,7 @@ const ContentComponent = React2.memo(
|
|
|
28
29
|
role: "complementary",
|
|
29
30
|
"data-testid": "ds-floating-wrapper-root",
|
|
30
31
|
...globalsAttrs,
|
|
32
|
+
...ownerPropsConfig,
|
|
31
33
|
children: /* @__PURE__ */ jsx(
|
|
32
34
|
StyledFloatingAnimation,
|
|
33
35
|
{
|
|
@@ -35,6 +37,7 @@ const ContentComponent = React2.memo(
|
|
|
35
37
|
isOpen,
|
|
36
38
|
animationDuration,
|
|
37
39
|
withoutAnimation,
|
|
40
|
+
...ownerPropsConfig,
|
|
38
41
|
children
|
|
39
42
|
}
|
|
40
43
|
)
|
|
@@ -44,6 +47,7 @@ const ContentComponent = React2.memo(
|
|
|
44
47
|
const FloatingWrapper = (props) => {
|
|
45
48
|
const { propsWithDefault, xstyledProps, globalsAttrs } = useFloatingWrapper(props);
|
|
46
49
|
const { isOpen } = propsWithDefault;
|
|
50
|
+
const ownerPropsConfig = useOwnerProps(props);
|
|
47
51
|
const { context, onAnimationEnd, onAnimationStartTriggered, ...contentProps } = propsWithDefault;
|
|
48
52
|
const { portalDOMContainer, withoutPortal, withoutAnimation } = context;
|
|
49
53
|
const [isAnimating, setIsAnimating] = React2.useState(false);
|
|
@@ -67,6 +71,7 @@ const FloatingWrapper = (props) => {
|
|
|
67
71
|
{
|
|
68
72
|
xstyledProps,
|
|
69
73
|
globalsAttrs,
|
|
74
|
+
ownerPropsConfig,
|
|
70
75
|
...contentProps,
|
|
71
76
|
...context,
|
|
72
77
|
handleAnimationEnd
|
|
@@ -79,6 +84,7 @@ const FloatingWrapper = (props) => {
|
|
|
79
84
|
{
|
|
80
85
|
xstyledProps,
|
|
81
86
|
globalsAttrs,
|
|
87
|
+
ownerPropsConfig,
|
|
82
88
|
...contentProps,
|
|
83
89
|
...context,
|
|
84
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 data-testid=\"ds-floating-wrapper-root\"\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,qCAAq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;AAAA,UACJ;AAAA;AAAA,MACF;AAEJ,QAAI,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
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useOwnerProps, useGetGlobalAttributes, useGetXstyledProps } from "@elliemae/ds-props-helpers";
|
|
3
4
|
import { styled } from "@elliemae/ds-system";
|
|
4
5
|
import { DSFloatingWrapperSlots, DSFloatingWrapperName } from "../constants/index.js";
|
|
5
6
|
const arrowWidth = 18;
|
|
@@ -56,33 +57,51 @@ const StyledArrow = styled("div", {
|
|
|
56
57
|
margin-left: ${(props) => props["data-placement"].startsWith("top") || props["data-placement"].startsWith("bottom") ? `-${arrowWidth / 2}px;` : "0;"};
|
|
57
58
|
margin-top: ${(props) => props["data-placement"].startsWith("left") || props["data-placement"].startsWith("right") ? `-${arrowHeight / 2}px;` : "0;"};
|
|
58
59
|
`;
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
60
|
+
const StylePathShadow = styled("path", {
|
|
61
|
+
name: DSFloatingWrapperName,
|
|
62
|
+
slot: DSFloatingWrapperSlots.ARROW_SHADOW
|
|
63
|
+
})``;
|
|
64
|
+
const StylePathFill = styled("path", {
|
|
65
|
+
name: DSFloatingWrapperName,
|
|
66
|
+
slot: DSFloatingWrapperSlots.ARROW_FILL
|
|
67
|
+
})``;
|
|
68
|
+
const PopoverArrow = ({ placement, style, arrowElementRef, ...rest }) => {
|
|
69
|
+
const ownerProps = useOwnerProps(rest);
|
|
70
|
+
const globalAttributes = useGetGlobalAttributes(rest);
|
|
71
|
+
const xstyledProps = useGetXstyledProps(rest);
|
|
72
|
+
return /* @__PURE__ */ jsx(
|
|
73
|
+
StyledArrow,
|
|
74
|
+
{
|
|
75
|
+
"data-placement": placement,
|
|
76
|
+
style,
|
|
77
|
+
innerRef: arrowElementRef,
|
|
78
|
+
"data-testid": "ds-tooltip-arrow",
|
|
79
|
+
"aria-hidden": "true",
|
|
80
|
+
...ownerProps,
|
|
81
|
+
...globalAttributes,
|
|
82
|
+
...xstyledProps,
|
|
83
|
+
children: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 30 30", children: [
|
|
84
|
+
/* @__PURE__ */ jsx(
|
|
85
|
+
StylePathShadow,
|
|
86
|
+
{
|
|
87
|
+
...ownerProps,
|
|
88
|
+
className: "stroke",
|
|
89
|
+
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"
|
|
90
|
+
}
|
|
91
|
+
),
|
|
92
|
+
/* @__PURE__ */ jsx(
|
|
93
|
+
StylePathFill,
|
|
94
|
+
{
|
|
95
|
+
...ownerProps,
|
|
96
|
+
className: "fill",
|
|
97
|
+
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"
|
|
98
|
+
}
|
|
99
|
+
)
|
|
100
|
+
] })
|
|
101
|
+
},
|
|
102
|
+
"popper-arrow"
|
|
103
|
+
);
|
|
104
|
+
};
|
|
86
105
|
export {
|
|
87
106
|
PopoverArrow
|
|
88
107
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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';\nimport { DSFloatingWrapperSlots, DSFloatingWrapperName } from '../constants/index.js';\
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { useOwnerProps, useGetGlobalAttributes, useGetXstyledProps } from '@elliemae/ds-props-helpers';\nimport { styled } from '@elliemae/ds-system';\nimport type { TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport { DSFloatingWrapperSlots, DSFloatingWrapperName } from '../constants/index.js';\nexport interface PopoverArrowT\n extends TypescriptHelpersT.PropsForGlobalOnSlots<typeof DSFloatingWrapperName, typeof DSFloatingWrapperSlots> {\n placement: string;\n style: React.CSSProperties;\n arrowElementRef?: React.Dispatch<React.SetStateAction<HTMLDivElement | null>>;\n}\nconst arrowWidth = 18;\nconst arrowHeight = 18;\n\nconst OFFSET_FIX_SHADOW_DEFECT = 0.25;\nconst StyledArrow = styled('div', {\n name: DSFloatingWrapperName,\n slot: DSFloatingWrapperSlots.ARROW,\n})<{ '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 - OFFSET_FIX_SHADOW_DEFECT}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 - OFFSET_FIX_SHADOW_DEFECT}px;\n }\n &[data-placement^='bottom'] {\n top: -${arrowHeight - OFFSET_FIX_SHADOW_DEFECT}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 - OFFSET_FIX_SHADOW_DEFECT}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\nconst StylePathShadow = styled('path', {\n name: DSFloatingWrapperName,\n slot: DSFloatingWrapperSlots.ARROW_SHADOW,\n})``;\n\nconst StylePathFill = styled('path', {\n name: DSFloatingWrapperName,\n slot: DSFloatingWrapperSlots.ARROW_FILL,\n})``;\n\nexport const PopoverArrow = ({ placement, style, arrowElementRef, ...rest }: PopoverArrowT): React.ReactElement => {\n const ownerProps = useOwnerProps(rest);\n const globalAttributes = useGetGlobalAttributes(rest);\n const xstyledProps = useGetXstyledProps(rest);\n return (\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 {...ownerProps}\n {...globalAttributes}\n {...xstyledProps}\n >\n <svg viewBox=\"0 0 30 30\">\n <StylePathShadow\n {...ownerProps}\n className=\"stro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/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
|
|
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,
|
|
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: {\n left: 0,\n top: 0,\n // we use transform -> translate because we know final computed left/top probably \"split a pixel\" (e.g. 10.005px)\n // when we use transform we force the browser to use hardware acceleration\n // hardware acceleration is faster and more reliable than the browser's own rounding\n // it also helps with css animations and so on\n transform: `translate(${coords.left}px, ${coords.top}px)`,\n },\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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
2
2
|
import { type CSSProperties } from 'styled-components';
|
|
3
3
|
import type { DSHookFloatingContextT } from './react-desc-prop-types.js';
|
|
4
|
+
import type { PopoverArrowT } from './parts/PopoverArrow.js';
|
|
4
5
|
declare const useFloatingContext: {
|
|
5
6
|
(props?: DSHookFloatingContextT.Props): {
|
|
6
7
|
refs: {
|
|
@@ -17,10 +18,7 @@ declare const useFloatingContext: {
|
|
|
17
18
|
onBlur: () => void;
|
|
18
19
|
};
|
|
19
20
|
isOpen: boolean;
|
|
20
|
-
arrowStyles:
|
|
21
|
-
style: CSSProperties;
|
|
22
|
-
placement: string;
|
|
23
|
-
};
|
|
21
|
+
arrowStyles: PopoverArrowT;
|
|
24
22
|
hideTooltip: () => void;
|
|
25
23
|
showTooltip: () => void;
|
|
26
24
|
context: {
|
|
@@ -11,30 +11,12 @@ export declare const useFloatingWrapper: (propsFromUser: DSFloatingWrapperT.Prop
|
|
|
11
11
|
propsWithDefault: DSFloatingWrapperT.InternalProps;
|
|
12
12
|
xstyledProps: import("@elliemae/ds-props-helpers").XstyledProps;
|
|
13
13
|
instanceUid: string;
|
|
14
|
-
globalsAttrs: Partial<Pick<object, "start" | "height" | "width" | "
|
|
14
|
+
globalsAttrs: Partial<Pick<object, "start" | "height" | "width" | "content" | "style" | "cite" | "data" | "form" | "label" | "slot" | "span" | "summary" | "title" | "pattern" | "default" | "type" | "name" | "suppressHydrationWarning" | "className" | "color" | "id" | "lang" | "max" | "media" | "method" | "min" | "target" | "role" | "tabIndex" | "crossOrigin" | "href" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "classID" | "useMap" | "wmode" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "enterKeyHint" | "hidden" | "nonce" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "exportparts" | "part" | "scoped" | "download" | "hrefLang" | "alt" | "coords" | "shape" | "autoPlay" | "controls" | "loop" | "mediaGroup" | "muted" | "playsInline" | "preload" | "src" | "disabled" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "value" | "dateTime" | "open" | "acceptCharset" | "action" | "autoComplete" | "encType" | "noValidate" | "manifest" | "allowFullScreen" | "allowTransparency" | "frameBorder" | "marginHeight" | "marginWidth" | "sandbox" | "scrolling" | "seamless" | "srcDoc" | "sizes" | "srcSet" | "accept" | "capture" | "checked" | "list" | "maxLength" | "minLength" | "multiple" | "placeholder" | "readOnly" | "required" | "size" | "step" | "challenge" | "keyType" | "keyParams" | "htmlFor" | "integrity" | "charSet" | "httpEquiv" | "high" | "low" | "optimum" | "reversed" | "selected" | "async" | "defer" | "cellPadding" | "cellSpacing" | "colSpan" | "headers" | "rowSpan" | "scope" | "cols" | "rows" | "wrap" | "kind" | "srcLang" | "poster"> & Omit<{
|
|
15
15
|
start?: number | undefined;
|
|
16
16
|
height?: string | number | undefined;
|
|
17
17
|
width?: string | number | undefined;
|
|
18
|
-
hidden?: boolean | undefined;
|
|
19
|
-
color?: string | undefined;
|
|
20
18
|
content?: string | undefined;
|
|
21
|
-
size?: number | undefined;
|
|
22
19
|
style?: React.CSSProperties | undefined;
|
|
23
|
-
default?: boolean | undefined;
|
|
24
|
-
wrap?: string | undefined;
|
|
25
|
-
open?: boolean | undefined;
|
|
26
|
-
translate?: "yes" | "no" | undefined;
|
|
27
|
-
multiple?: boolean | undefined;
|
|
28
|
-
disabled?: boolean | undefined;
|
|
29
|
-
onMouseEnter?: React.MouseEventHandler<Element> | undefined;
|
|
30
|
-
onMouseLeave?: React.MouseEventHandler<Element> | undefined;
|
|
31
|
-
onFocus?: React.FocusEventHandler<Element> | undefined;
|
|
32
|
-
onBlur?: React.FocusEventHandler<Element> | undefined;
|
|
33
|
-
accessKey?: string | undefined;
|
|
34
|
-
dir?: string | undefined;
|
|
35
|
-
draggable?: (boolean | "false" | "true") | undefined;
|
|
36
|
-
lang?: string | undefined;
|
|
37
|
-
title?: string | undefined;
|
|
38
20
|
cite?: string | undefined;
|
|
39
21
|
data?: string | undefined;
|
|
40
22
|
form?: string | undefined;
|
|
@@ -42,12 +24,16 @@ export declare const useFloatingWrapper: (propsFromUser: DSFloatingWrapperT.Prop
|
|
|
42
24
|
slot?: string | undefined;
|
|
43
25
|
span?: number | undefined;
|
|
44
26
|
summary?: string | undefined;
|
|
27
|
+
title?: string | undefined;
|
|
45
28
|
pattern?: string | undefined;
|
|
29
|
+
default?: boolean | undefined;
|
|
46
30
|
type?: string | undefined;
|
|
47
31
|
name?: string | undefined;
|
|
48
32
|
suppressHydrationWarning?: boolean | undefined;
|
|
49
33
|
className?: string | undefined;
|
|
34
|
+
color?: string | undefined;
|
|
50
35
|
id?: string | undefined;
|
|
36
|
+
lang?: string | undefined;
|
|
51
37
|
max?: string | number | undefined;
|
|
52
38
|
media?: string | undefined;
|
|
53
39
|
method?: string | undefined;
|
|
@@ -58,52 +44,52 @@ export declare const useFloatingWrapper: (propsFromUser: DSFloatingWrapperT.Prop
|
|
|
58
44
|
crossOrigin?: "" | "anonymous" | "use-credentials" | undefined;
|
|
59
45
|
href?: string | undefined;
|
|
60
46
|
"aria-activedescendant"?: string | undefined;
|
|
61
|
-
"aria-atomic"?: (boolean | "
|
|
62
|
-
"aria-autocomplete"?: "
|
|
47
|
+
"aria-atomic"?: (boolean | "true" | "false") | undefined;
|
|
48
|
+
"aria-autocomplete"?: "list" | "none" | "inline" | "both" | undefined;
|
|
63
49
|
"aria-braillelabel"?: string | undefined;
|
|
64
50
|
"aria-brailleroledescription"?: string | undefined;
|
|
65
|
-
"aria-busy"?: (boolean | "
|
|
66
|
-
"aria-checked"?: boolean | "
|
|
51
|
+
"aria-busy"?: (boolean | "true" | "false") | undefined;
|
|
52
|
+
"aria-checked"?: boolean | "true" | "false" | "mixed" | undefined;
|
|
67
53
|
"aria-colcount"?: number | undefined;
|
|
68
54
|
"aria-colindex"?: number | undefined;
|
|
69
55
|
"aria-colindextext"?: string | undefined;
|
|
70
56
|
"aria-colspan"?: number | undefined;
|
|
71
57
|
"aria-controls"?: string | undefined;
|
|
72
|
-
"aria-current"?: boolean | "
|
|
58
|
+
"aria-current"?: boolean | "time" | "step" | "true" | "false" | "page" | "location" | "date" | undefined;
|
|
73
59
|
"aria-describedby"?: string | undefined;
|
|
74
60
|
"aria-description"?: string | undefined;
|
|
75
61
|
"aria-details"?: string | undefined;
|
|
76
|
-
"aria-disabled"?: (boolean | "
|
|
77
|
-
"aria-dropeffect"?: "
|
|
62
|
+
"aria-disabled"?: (boolean | "true" | "false") | undefined;
|
|
63
|
+
"aria-dropeffect"?: "link" | "none" | "copy" | "execute" | "move" | "popup" | undefined;
|
|
78
64
|
"aria-errormessage"?: string | undefined;
|
|
79
|
-
"aria-expanded"?: (boolean | "
|
|
65
|
+
"aria-expanded"?: (boolean | "true" | "false") | undefined;
|
|
80
66
|
"aria-flowto"?: string | undefined;
|
|
81
|
-
"aria-grabbed"?: (boolean | "
|
|
82
|
-
"aria-haspopup"?: boolean | "
|
|
83
|
-
"aria-hidden"?: (boolean | "
|
|
84
|
-
"aria-invalid"?: boolean | "
|
|
67
|
+
"aria-grabbed"?: (boolean | "true" | "false") | undefined;
|
|
68
|
+
"aria-haspopup"?: boolean | "dialog" | "menu" | "true" | "false" | "grid" | "listbox" | "tree" | undefined;
|
|
69
|
+
"aria-hidden"?: (boolean | "true" | "false") | undefined;
|
|
70
|
+
"aria-invalid"?: boolean | "true" | "false" | "grammar" | "spelling" | undefined;
|
|
85
71
|
"aria-keyshortcuts"?: string | undefined;
|
|
86
72
|
"aria-label"?: string | undefined;
|
|
87
73
|
"aria-labelledby"?: string | undefined;
|
|
88
74
|
"aria-level"?: number | undefined;
|
|
89
75
|
"aria-live"?: "off" | "assertive" | "polite" | undefined;
|
|
90
|
-
"aria-modal"?: (boolean | "
|
|
91
|
-
"aria-multiline"?: (boolean | "
|
|
92
|
-
"aria-multiselectable"?: (boolean | "
|
|
76
|
+
"aria-modal"?: (boolean | "true" | "false") | undefined;
|
|
77
|
+
"aria-multiline"?: (boolean | "true" | "false") | undefined;
|
|
78
|
+
"aria-multiselectable"?: (boolean | "true" | "false") | undefined;
|
|
93
79
|
"aria-orientation"?: "horizontal" | "vertical" | undefined;
|
|
94
80
|
"aria-owns"?: string | undefined;
|
|
95
81
|
"aria-placeholder"?: string | undefined;
|
|
96
82
|
"aria-posinset"?: number | undefined;
|
|
97
|
-
"aria-pressed"?: boolean | "
|
|
98
|
-
"aria-readonly"?: (boolean | "
|
|
99
|
-
"aria-relevant"?: "
|
|
100
|
-
"aria-required"?: (boolean | "
|
|
83
|
+
"aria-pressed"?: boolean | "true" | "false" | "mixed" | undefined;
|
|
84
|
+
"aria-readonly"?: (boolean | "true" | "false") | undefined;
|
|
85
|
+
"aria-relevant"?: "text" | "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals" | undefined;
|
|
86
|
+
"aria-required"?: (boolean | "true" | "false") | undefined;
|
|
101
87
|
"aria-roledescription"?: string | undefined;
|
|
102
88
|
"aria-rowcount"?: number | undefined;
|
|
103
89
|
"aria-rowindex"?: number | undefined;
|
|
104
90
|
"aria-rowindextext"?: string | undefined;
|
|
105
91
|
"aria-rowspan"?: number | undefined;
|
|
106
|
-
"aria-selected"?: (boolean | "
|
|
92
|
+
"aria-selected"?: (boolean | "true" | "false") | undefined;
|
|
107
93
|
"aria-setsize"?: number | undefined;
|
|
108
94
|
"aria-sort"?: "none" | "ascending" | "descending" | "other" | undefined;
|
|
109
95
|
"aria-valuemax"?: number | undefined;
|
|
@@ -123,7 +109,9 @@ export declare const useFloatingWrapper: (propsFromUser: DSFloatingWrapperT.Prop
|
|
|
123
109
|
onCompositionStartCapture?: React.CompositionEventHandler<Element> | undefined;
|
|
124
110
|
onCompositionUpdate?: React.CompositionEventHandler<Element> | undefined;
|
|
125
111
|
onCompositionUpdateCapture?: React.CompositionEventHandler<Element> | undefined;
|
|
112
|
+
onFocus?: React.FocusEventHandler<Element> | undefined;
|
|
126
113
|
onFocusCapture?: React.FocusEventHandler<Element> | undefined;
|
|
114
|
+
onBlur?: React.FocusEventHandler<Element> | undefined;
|
|
127
115
|
onBlurCapture?: React.FocusEventHandler<Element> | undefined;
|
|
128
116
|
onChange?: React.FormEventHandler<Element> | undefined;
|
|
129
117
|
onChangeCapture?: React.FormEventHandler<Element> | undefined;
|
|
@@ -219,6 +207,8 @@ export declare const useFloatingWrapper: (propsFromUser: DSFloatingWrapperT.Prop
|
|
|
219
207
|
onDropCapture?: React.DragEventHandler<Element> | undefined;
|
|
220
208
|
onMouseDown?: React.MouseEventHandler<Element> | undefined;
|
|
221
209
|
onMouseDownCapture?: React.MouseEventHandler<Element> | undefined;
|
|
210
|
+
onMouseEnter?: React.MouseEventHandler<Element> | undefined;
|
|
211
|
+
onMouseLeave?: React.MouseEventHandler<Element> | undefined;
|
|
222
212
|
onMouseMove?: React.MouseEventHandler<Element> | undefined;
|
|
223
213
|
onMouseMoveCapture?: React.MouseEventHandler<Element> | undefined;
|
|
224
214
|
onMouseOut?: React.MouseEventHandler<Element> | undefined;
|
|
@@ -273,13 +263,18 @@ export declare const useFloatingWrapper: (propsFromUser: DSFloatingWrapperT.Prop
|
|
|
273
263
|
defaultChecked?: boolean | undefined;
|
|
274
264
|
defaultValue?: string | number | readonly string[] | undefined;
|
|
275
265
|
suppressContentEditableWarning?: boolean | undefined;
|
|
276
|
-
|
|
266
|
+
accessKey?: string | undefined;
|
|
267
|
+
autoCapitalize?: (string & {}) | "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined;
|
|
277
268
|
autoFocus?: boolean | undefined;
|
|
278
|
-
contentEditable?:
|
|
269
|
+
contentEditable?: (boolean | "true" | "false") | "inherit" | "plaintext-only" | undefined;
|
|
279
270
|
contextMenu?: string | undefined;
|
|
280
|
-
|
|
271
|
+
dir?: string | undefined;
|
|
272
|
+
draggable?: (boolean | "true" | "false") | undefined;
|
|
273
|
+
enterKeyHint?: "search" | "enter" | "done" | "go" | "next" | "previous" | "send" | undefined;
|
|
274
|
+
hidden?: boolean | undefined;
|
|
281
275
|
nonce?: string | undefined;
|
|
282
|
-
spellCheck?: (boolean | "
|
|
276
|
+
spellCheck?: (boolean | "true" | "false") | undefined;
|
|
277
|
+
translate?: "yes" | "no" | undefined;
|
|
283
278
|
radioGroup?: string | undefined;
|
|
284
279
|
about?: string | undefined;
|
|
285
280
|
datatype?: string | undefined;
|
|
@@ -301,37 +296,14 @@ export declare const useFloatingWrapper: (propsFromUser: DSFloatingWrapperT.Prop
|
|
|
301
296
|
results?: number | undefined;
|
|
302
297
|
security?: string | undefined;
|
|
303
298
|
unselectable?: "off" | "on" | undefined;
|
|
304
|
-
inputMode?: "
|
|
299
|
+
inputMode?: "search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined;
|
|
305
300
|
is?: string | undefined;
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
formMethod?: string | undefined;
|
|
309
|
-
formNoValidate?: boolean | undefined;
|
|
310
|
-
formTarget?: string | undefined;
|
|
311
|
-
value?: string | number | readonly string[] | undefined;
|
|
312
|
-
high?: number | undefined;
|
|
313
|
-
low?: number | undefined;
|
|
314
|
-
optimum?: number | undefined;
|
|
315
|
-
autoComplete?: string | undefined;
|
|
316
|
-
cols?: number | undefined;
|
|
317
|
-
maxLength?: number | undefined;
|
|
318
|
-
minLength?: number | undefined;
|
|
319
|
-
placeholder?: string | undefined;
|
|
320
|
-
readOnly?: boolean | undefined;
|
|
321
|
-
required?: boolean | undefined;
|
|
322
|
-
rows?: number | undefined;
|
|
301
|
+
exportparts?: string | undefined;
|
|
302
|
+
part?: string | undefined;
|
|
323
303
|
scoped?: boolean | undefined;
|
|
324
|
-
cellPadding?: string | number | undefined;
|
|
325
|
-
cellSpacing?: string | number | undefined;
|
|
326
|
-
src?: string | undefined;
|
|
327
|
-
accept?: string | undefined;
|
|
328
|
-
alt?: string | undefined;
|
|
329
|
-
capture?: boolean | "user" | "environment" | undefined;
|
|
330
|
-
checked?: boolean | undefined;
|
|
331
|
-
list?: string | undefined;
|
|
332
|
-
step?: string | number | undefined;
|
|
333
304
|
download?: any;
|
|
334
305
|
hrefLang?: string | undefined;
|
|
306
|
+
alt?: string | undefined;
|
|
335
307
|
coords?: string | undefined;
|
|
336
308
|
shape?: string | undefined;
|
|
337
309
|
autoPlay?: boolean | undefined;
|
|
@@ -341,9 +313,19 @@ export declare const useFloatingWrapper: (propsFromUser: DSFloatingWrapperT.Prop
|
|
|
341
313
|
muted?: boolean | undefined;
|
|
342
314
|
playsInline?: boolean | undefined;
|
|
343
315
|
preload?: string | undefined;
|
|
316
|
+
src?: string | undefined;
|
|
317
|
+
disabled?: boolean | undefined;
|
|
318
|
+
formAction?: string | undefined;
|
|
319
|
+
formEncType?: string | undefined;
|
|
320
|
+
formMethod?: string | undefined;
|
|
321
|
+
formNoValidate?: boolean | undefined;
|
|
322
|
+
formTarget?: string | undefined;
|
|
323
|
+
value?: string | number | readonly string[] | undefined;
|
|
344
324
|
dateTime?: string | undefined;
|
|
325
|
+
open?: boolean | undefined;
|
|
345
326
|
acceptCharset?: string | undefined;
|
|
346
327
|
action?: string | undefined;
|
|
328
|
+
autoComplete?: string | undefined;
|
|
347
329
|
encType?: string | undefined;
|
|
348
330
|
noValidate?: boolean | undefined;
|
|
349
331
|
manifest?: string | undefined;
|
|
@@ -358,6 +340,18 @@ export declare const useFloatingWrapper: (propsFromUser: DSFloatingWrapperT.Prop
|
|
|
358
340
|
srcDoc?: string | undefined;
|
|
359
341
|
sizes?: string | undefined;
|
|
360
342
|
srcSet?: string | undefined;
|
|
343
|
+
accept?: string | undefined;
|
|
344
|
+
capture?: boolean | "user" | "environment" | undefined;
|
|
345
|
+
checked?: boolean | undefined;
|
|
346
|
+
list?: string | undefined;
|
|
347
|
+
maxLength?: number | undefined;
|
|
348
|
+
minLength?: number | undefined;
|
|
349
|
+
multiple?: boolean | undefined;
|
|
350
|
+
placeholder?: string | undefined;
|
|
351
|
+
readOnly?: boolean | undefined;
|
|
352
|
+
required?: boolean | undefined;
|
|
353
|
+
size?: number | undefined;
|
|
354
|
+
step?: string | number | undefined;
|
|
361
355
|
challenge?: string | undefined;
|
|
362
356
|
keyType?: string | undefined;
|
|
363
357
|
keyParams?: string | undefined;
|
|
@@ -365,14 +359,22 @@ export declare const useFloatingWrapper: (propsFromUser: DSFloatingWrapperT.Prop
|
|
|
365
359
|
integrity?: string | undefined;
|
|
366
360
|
charSet?: string | undefined;
|
|
367
361
|
httpEquiv?: string | undefined;
|
|
362
|
+
high?: number | undefined;
|
|
363
|
+
low?: number | undefined;
|
|
364
|
+
optimum?: number | undefined;
|
|
368
365
|
reversed?: boolean | undefined;
|
|
369
366
|
selected?: boolean | undefined;
|
|
370
367
|
async?: boolean | undefined;
|
|
371
368
|
defer?: boolean | undefined;
|
|
369
|
+
cellPadding?: string | number | undefined;
|
|
370
|
+
cellSpacing?: string | number | undefined;
|
|
372
371
|
colSpan?: number | undefined;
|
|
373
372
|
headers?: string | undefined;
|
|
374
373
|
rowSpan?: number | undefined;
|
|
375
374
|
scope?: string | undefined;
|
|
375
|
+
cols?: number | undefined;
|
|
376
|
+
rows?: number | undefined;
|
|
377
|
+
wrap?: string | undefined;
|
|
376
378
|
kind?: string | undefined;
|
|
377
379
|
srcLang?: string | undefined;
|
|
378
380
|
poster?: string | undefined;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
2
|
+
import type { TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';
|
|
3
|
+
import { DSFloatingWrapperSlots, DSFloatingWrapperName } from '../constants/index.js';
|
|
4
|
+
export interface PopoverArrowT extends TypescriptHelpersT.PropsForGlobalOnSlots<typeof DSFloatingWrapperName, typeof DSFloatingWrapperSlots> {
|
|
3
5
|
placement: string;
|
|
4
6
|
style: React.CSSProperties;
|
|
5
7
|
arrowElementRef?: React.Dispatch<React.SetStateAction<HTMLDivElement | null>>;
|
|
6
8
|
}
|
|
7
|
-
export declare const PopoverArrow: ({ placement, style, arrowElementRef }: PopoverArrowT) => React.ReactElement;
|
|
8
|
-
export {};
|
|
9
|
+
export declare const PopoverArrow: ({ placement, style, arrowElementRef, ...rest }: PopoverArrowT) => React.ReactElement;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-floating-context",
|
|
3
|
-
"version": "3.51.
|
|
3
|
+
"version": "3.51.1",
|
|
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.
|
|
40
|
-
"@elliemae/ds-
|
|
41
|
-
"@elliemae/ds-
|
|
42
|
-
"@elliemae/ds-
|
|
39
|
+
"@elliemae/ds-hooks-headless-tooltip": "3.51.1",
|
|
40
|
+
"@elliemae/ds-system": "3.51.1",
|
|
41
|
+
"@elliemae/ds-props-helpers": "3.51.1",
|
|
42
|
+
"@elliemae/ds-typescript-helpers": "3.51.1"
|
|
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.
|
|
47
|
+
"@elliemae/ds-monorepo-devops": "3.51.1"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"lodash": "^4.17.21",
|