@elliemae/ds-popperjs 3.18.0 → 3.18.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/PopoverContent.js.map +1 -1
- package/dist/cjs/config/useConfigDSPopperjs.js.map +2 -2
- package/dist/cjs/config/useConfiguredDefaultModifiers.js +7 -2
- package/dist/cjs/config/useConfiguredDefaultModifiers.js.map +2 -2
- package/dist/cjs/config/useConfiguredDefaultProps.js +4 -2
- package/dist/cjs/config/useConfiguredDefaultProps.js.map +2 -2
- package/dist/cjs/config/useConfiguredMergedProps.js.map +2 -2
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/react-desc-prop-types.js +42 -49
- package/dist/cjs/react-desc-prop-types.js.map +2 -2
- package/dist/esm/PopoverContent.js.map +1 -1
- package/dist/esm/config/useConfigDSPopperjs.js.map +2 -2
- package/dist/esm/config/useConfiguredDefaultModifiers.js +7 -2
- package/dist/esm/config/useConfiguredDefaultModifiers.js.map +2 -2
- package/dist/esm/config/useConfiguredDefaultProps.js +4 -2
- package/dist/esm/config/useConfiguredDefaultProps.js.map +2 -2
- package/dist/esm/config/useConfiguredMergedProps.js.map +2 -2
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/react-desc-prop-types.js +42 -49
- package/dist/esm/react-desc-prop-types.js.map +2 -2
- package/dist/types/PopoverContent.d.ts +1 -1
- package/dist/types/config/useConfigDSPopperjs.d.ts +18 -2
- package/dist/types/config/useConfiguredDefaultModifiers.d.ts +49 -4
- package/dist/types/config/useConfiguredDefaultProps.d.ts +57 -18
- package/dist/types/config/useConfiguredMergedProps.d.ts +3 -3
- package/dist/types/index.d.ts +3 -3
- package/dist/types/react-desc-prop-types.d.ts +31 -35
- package/package.json +4 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/PopoverContent.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React, { useCallback, useMemo } from 'react';\nimport type {} from '@elliemae/ds-utilities';\nimport type { GlobalAttributesT, XstyledProps } from '@elliemae/ds-props-helpers';\nimport { PopoverArrow } from './PopoverArrow.js';\nimport { StyledPopoverContentWrapper, StyledAnimatedPopper } from './styled.js';\n\nexport interface PopoverContentPropsT {\n setPopperElement: React.Dispatch<React.SetStateAction<HTMLDivElement | null>>;\n popperStyles: React.CSSProperties;\n arrowStyle: React.CSSProperties;\n popperAttributes: Record<string, string> | undefined;\n children:
|
|
4
|
+
"sourcesContent": ["import React, { useCallback, useMemo } from 'react';\nimport type {} from '@elliemae/ds-utilities';\nimport type { GlobalAttributesT, XstyledProps } from '@elliemae/ds-props-helpers';\nimport { PopoverArrow } from './PopoverArrow.js';\nimport { StyledPopoverContentWrapper, StyledAnimatedPopper } from './styled.js';\n\nexport interface PopoverContentPropsT {\n setPopperElement: React.Dispatch<React.SetStateAction<HTMLDivElement | null>>;\n popperStyles: React.CSSProperties;\n arrowStyle: React.CSSProperties;\n popperAttributes: Record<string, string> | undefined;\n children: ReactChildrenComplete;\n setArrowElement: React.Dispatch<React.SetStateAction<HTMLDivElement | null>>;\n withoutArrow: boolean;\n withoutAnimation: boolean;\n animationDuration: number;\n zIndex: number;\n showPopover: boolean;\n setIsAnimating: React.Dispatch<React.SetStateAction<boolean>>;\n globalAttrs: GlobalAttributesT;\n xStyledAttrs: XstyledProps;\n}\n\nexport const PopoverContent = ({\n setPopperElement,\n popperStyles,\n popperAttributes,\n children,\n showPopover,\n setArrowElement,\n setIsAnimating,\n arrowStyle,\n withoutArrow,\n withoutAnimation,\n animationDuration,\n zIndex,\n globalAttrs,\n xStyledAttrs,\n}: PopoverContentPropsT): JSX.Element => {\n const checkAnimationStatus = useCallback(() => {\n if (!showPopover && !withoutAnimation) {\n setIsAnimating(false);\n }\n }, [showPopover, withoutAnimation, setIsAnimating]);\n\n const popperContent = useMemo(\n () => (\n <>\n {children}\n {withoutArrow === false ? (\n <>\n <PopoverArrow\n arrowElementRef={setArrowElement}\n style={arrowStyle}\n placement={popperAttributes ? popperAttributes['data-popper-placement'] : 'bottom'}\n />\n <div ref={setArrowElement} style={arrowStyle} />\n </>\n ) : null}\n </>\n ),\n [children, withoutArrow, arrowStyle, popperAttributes, setArrowElement],\n );\n return (\n <StyledPopoverContentWrapper\n ref={setPopperElement}\n style={popperStyles}\n {...popperAttributes}\n {...globalAttrs}\n {...xStyledAttrs}\n zIndex={zIndex}\n >\n <StyledAnimatedPopper\n showPopover={showPopover}\n animationDuration={animationDuration}\n withoutAnimation={withoutAnimation}\n onAnimationEnd={checkAnimationStatus}\n >\n {popperContent}\n </StyledAnimatedPopper>\n </StyledPopoverContentWrapper>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADkDb;AAlDV,mBAA4C;AAG5C,0BAA6B;AAC7B,oBAAkE;AAmB3D,MAAM,iBAAiB,CAAC;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAyC;AACvC,QAAM,2BAAuB,0BAAY,MAAM;AAC7C,QAAI,CAAC,eAAe,CAAC,kBAAkB;AACrC,qBAAe,KAAK;AAAA,IACtB;AAAA,EACF,GAAG,CAAC,aAAa,kBAAkB,cAAc,CAAC;AAElD,QAAM,oBAAgB;AAAA,IACpB,MACE,4EACG;AAAA;AAAA,MACA,iBAAiB,QAChB,4EACE;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,iBAAiB;AAAA,YACjB,OAAO;AAAA,YACP,WAAW,mBAAmB,iBAAiB,uBAAuB,IAAI;AAAA;AAAA,QAC5E;AAAA,QACA,4CAAC,SAAI,KAAK,iBAAiB,OAAO,YAAY;AAAA,SAChD,IACE;AAAA,OACN;AAAA,IAEF,CAAC,UAAU,cAAc,YAAY,kBAAkB,eAAe;AAAA,EACxE;AACA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,KAAK;AAAA,MACL,OAAO;AAAA,MACN,GAAG;AAAA,MACH,GAAG;AAAA,MACH,GAAG;AAAA,MACJ;AAAA,MAEA;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA,UACA,gBAAgB;AAAA,UAEf;AAAA;AAAA,MACH;AAAA;AAAA,EACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/config/useConfigDSPopperjs.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { useMemo, useState, useEffect } from 'react';\nimport { usePopper } from 'react-popper';\nimport { useGetGlobalAttributes, useGetXstyledProps } from '@elliemae/ds-props-helpers';\nimport { useConfiguredMergedProps } from './useConfiguredMergedProps.js';\nimport type {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["import type React from 'react';\nimport { useMemo, useState, useEffect } from 'react';\nimport { usePopper } from 'react-popper';\nimport { useGetGlobalAttributes, useGetXstyledProps } from '@elliemae/ds-props-helpers';\nimport { useConfiguredMergedProps } from './useConfiguredMergedProps.js';\nimport type { DSPopperJST } from '../react-desc-prop-types.js';\nimport { useOnClickOutside } from '../utils/hooks/useOnClickOutside.js';\nimport type { GlobalAttributesT, XstyledProps } from '@elliemae/ds-props-helpers';\ninterface UseDSPopperjsRT {\n props: DSPopperJST.InternalProps;\n popperElement: HTMLDivElement | null;\n setIsAnimating: React.Dispatch<React.SetStateAction<boolean>>;\n isAnimating: boolean;\n setPopperElement: React.Dispatch<React.SetStateAction<HTMLDivElement | null>>;\n arrowElement: HTMLDivElement | null;\n setArrowElement: React.Dispatch<React.SetStateAction<HTMLDivElement | null>>;\n popoverHelper: ReturnType<typeof usePopper>;\n globalAttrs: GlobalAttributesT<Element>;\n xStyledAttrs: XstyledProps;\n}\n\nexport const useConfigDSPopperjs = (appProps: DSPopperJST.Props): UseDSPopperjsRT => {\n const [popperElement, setPopperElement] = useState<HTMLDivElement | null>(null);\n const [arrowElement, setArrowElement] = useState<HTMLDivElement | null>(null);\n const [isAnimating, setIsAnimating] = useState(false);\n\n const props = useConfiguredMergedProps({ props: appProps, arrowElement });\n const { referenceElement, closeContextMenu, onClickOutside, modifiers, startPlacementPreference } = props;\n const popperExtraOpts = useMemo(\n () => ({ placement: startPlacementPreference, modifiers }),\n [modifiers, startPlacementPreference],\n );\n\n const popoverHelper = usePopper(referenceElement, popperElement, popperExtraOpts);\n\n const { showPopover, withoutAnimation } = props;\n\n useEffect(() => {\n if (showPopover && !withoutAnimation) {\n setIsAnimating(true);\n }\n }, [showPopover, withoutAnimation]);\n\n useOnClickOutside(popperElement as Node, (e) => {\n if (!referenceElement?.contains?.(e?.target as Node)) {\n onClickOutside(e);\n closeContextMenu();\n }\n });\n\n const globalAttrs = useGetGlobalAttributes(props);\n const xStyledAttrs = useGetXstyledProps(props);\n\n return useMemo(\n () => ({\n props,\n popperElement,\n setPopperElement,\n arrowElement,\n setArrowElement,\n popoverHelper,\n isAnimating,\n setIsAnimating,\n globalAttrs,\n xStyledAttrs,\n }),\n [props, popperElement, arrowElement, popoverHelper, isAnimating, globalAttrs, xStyledAttrs],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAA6C;AAC7C,0BAA0B;AAC1B,8BAA2D;AAC3D,sCAAyC;AAEzC,+BAAkC;AAe3B,MAAM,sBAAsB,CAAC,aAAiD;AACnF,QAAM,CAAC,eAAe,gBAAgB,QAAI,uBAAgC,IAAI;AAC9E,QAAM,CAAC,cAAc,eAAe,QAAI,uBAAgC,IAAI;AAC5E,QAAM,CAAC,aAAa,cAAc,QAAI,uBAAS,KAAK;AAEpD,QAAM,YAAQ,0DAAyB,EAAE,OAAO,UAAU,aAAa,CAAC;AACxE,QAAM,EAAE,kBAAkB,kBAAkB,gBAAgB,WAAW,yBAAyB,IAAI;AACpG,QAAM,sBAAkB;AAAA,IACtB,OAAO,EAAE,WAAW,0BAA0B,UAAU;AAAA,IACxD,CAAC,WAAW,wBAAwB;AAAA,EACtC;AAEA,QAAM,oBAAgB,+BAAU,kBAAkB,eAAe,eAAe;AAEhF,QAAM,EAAE,aAAa,iBAAiB,IAAI;AAE1C,8BAAU,MAAM;AACd,QAAI,eAAe,CAAC,kBAAkB;AACpC,qBAAe,IAAI;AAAA,IACrB;AAAA,EACF,GAAG,CAAC,aAAa,gBAAgB,CAAC;AAElC,kDAAkB,eAAuB,CAAC,MAAM;AAC9C,QAAI,CAAC,kBAAkB,WAAW,GAAG,MAAc,GAAG;AACpD,qBAAe,CAAC;AAChB,uBAAiB;AAAA,IACnB;AAAA,EACF,CAAC;AAED,QAAM,kBAAc,gDAAuB,KAAK;AAChD,QAAM,mBAAe,4CAAmB,KAAK;AAE7C,aAAO;AAAA,IACL,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,OAAO,eAAe,cAAc,eAAe,aAAa,aAAa,YAAY;AAAA,EAC5F;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -33,7 +33,11 @@ __export(useConfiguredDefaultModifiers_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(useConfiguredDefaultModifiers_exports);
|
|
34
34
|
var React = __toESM(require("react"));
|
|
35
35
|
var import_react = require("react");
|
|
36
|
-
const useConfiguredDefaultModifiers = ({
|
|
36
|
+
const useConfiguredDefaultModifiers = ({
|
|
37
|
+
props,
|
|
38
|
+
arrowElement,
|
|
39
|
+
defaultProps
|
|
40
|
+
}) => {
|
|
37
41
|
const {
|
|
38
42
|
boundaryElement: explicitAppBoundaryElement,
|
|
39
43
|
withoutArrow: explicitAppWithoutArrow = false,
|
|
@@ -50,7 +54,7 @@ const useConfiguredDefaultModifiers = ({ props, arrowElement }) => {
|
|
|
50
54
|
}
|
|
51
55
|
});
|
|
52
56
|
if (!explicitAppWithoutArrow || explictAppOffset) {
|
|
53
|
-
const defaultOffset = explictAppOffset ||
|
|
57
|
+
const defaultOffset = explictAppOffset || defaultProps.customOffset;
|
|
54
58
|
mod.push({
|
|
55
59
|
name: "offset",
|
|
56
60
|
enabled: true,
|
|
@@ -77,6 +81,7 @@ const useConfiguredDefaultModifiers = ({ props, arrowElement }) => {
|
|
|
77
81
|
return mod;
|
|
78
82
|
}, [
|
|
79
83
|
arrowElement,
|
|
84
|
+
defaultProps,
|
|
80
85
|
explicitAppBoundaryElement,
|
|
81
86
|
explicitAppWithoutArrow,
|
|
82
87
|
explicitPlacementOrderPreference,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/config/useConfiguredDefaultModifiers.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { useMemo } from 'react';\nimport type {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAwB;
|
|
4
|
+
"sourcesContent": ["import { useMemo } from 'react';\nimport type { DSPopperJST } from '../react-desc-prop-types.js';\n\ninterface UseConfiguredDefaultModifiersT {\n props: DSPopperJST.Props;\n arrowElement: HTMLDivElement | null;\n defaultProps: Omit<DSPopperJST.DefaultProps, 'zIndex'>;\n}\n\nexport const useConfiguredDefaultModifiers = ({\n props,\n arrowElement,\n defaultProps,\n}: UseConfiguredDefaultModifiersT) => {\n // we destructure explicit app definitions before merge\n const {\n boundaryElement: explicitAppBoundaryElement,\n withoutArrow: explicitAppWithoutArrow = false,\n placementOrderPreference: explicitPlacementOrderPreference = ['top', 'bottom', 'left', 'right'],\n customOffset: explictAppOffset = undefined,\n } = props;\n // to build default modifiers on top of it\n const defaultModifiers = useMemo(() => {\n const mod = [];\n mod.push({ name: 'hide', enabled: true });\n mod.push({\n name: 'flip',\n options: {\n fallbackPlacements: explicitPlacementOrderPreference,\n },\n });\n // we apply an offset if the app defines one or if the app wants the arrow\n if (!explicitAppWithoutArrow || explictAppOffset) {\n const defaultOffset = explictAppOffset || defaultProps.customOffset;\n mod.push({\n name: 'offset',\n enabled: true,\n options: {\n offset: defaultOffset,\n },\n });\n }\n // the app can opt for a \"no arrow\" implementation (we do so in datatable/calendar etc...)\n if (!explicitAppWithoutArrow)\n mod.push({\n name: 'arrow',\n options: {\n element: arrowElement,\n padding: 18,\n },\n });\n\n // the app can define an explicit element to act as a boundary instead of popperjs default one\n if (explicitAppBoundaryElement)\n mod.push({\n name: 'preventOverflow',\n options: {\n boundary: explicitAppBoundaryElement,\n },\n });\n return mod;\n }, [\n arrowElement,\n defaultProps,\n explicitAppBoundaryElement,\n explicitAppWithoutArrow,\n explicitPlacementOrderPreference,\n explictAppOffset,\n ]);\n // if the app pass custom modifier, we don't use \"default modifiers\"\n const { modifiers: explicitAppModifiers = defaultModifiers } = props;\n\n return useMemo(\n () => ({\n modifiers: explicitAppModifiers,\n }),\n [explicitAppModifiers],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAwB;AASjB,MAAM,gCAAgC,CAAC;AAAA,EAC5C;AAAA,EACA;AAAA,EACA;AACF,MAAsC;AAEpC,QAAM;AAAA,IACJ,iBAAiB;AAAA,IACjB,cAAc,0BAA0B;AAAA,IACxC,0BAA0B,mCAAmC,CAAC,OAAO,UAAU,QAAQ,OAAO;AAAA,IAC9F,cAAc,mBAAmB;AAAA,EACnC,IAAI;AAEJ,QAAM,uBAAmB,sBAAQ,MAAM;AACrC,UAAM,MAAM,CAAC;AACb,QAAI,KAAK,EAAE,MAAM,QAAQ,SAAS,KAAK,CAAC;AACxC,QAAI,KAAK;AAAA,MACP,MAAM;AAAA,MACN,SAAS;AAAA,QACP,oBAAoB;AAAA,MACtB;AAAA,IACF,CAAC;AAED,QAAI,CAAC,2BAA2B,kBAAkB;AAChD,YAAM,gBAAgB,oBAAoB,aAAa;AACvD,UAAI,KAAK;AAAA,QACP,MAAM;AAAA,QACN,SAAS;AAAA,QACT,SAAS;AAAA,UACP,QAAQ;AAAA,QACV;AAAA,MACF,CAAC;AAAA,IACH;AAEA,QAAI,CAAC;AACH,UAAI,KAAK;AAAA,QACP,MAAM;AAAA,QACN,SAAS;AAAA,UACP,SAAS;AAAA,UACT,SAAS;AAAA,QACX;AAAA,MACF,CAAC;AAGH,QAAI;AACF,UAAI,KAAK;AAAA,QACP,MAAM;AAAA,QACN,SAAS;AAAA,UACP,UAAU;AAAA,QACZ;AAAA,MACF,CAAC;AACH,WAAO;AAAA,EACT,GAAG;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAED,QAAM,EAAE,WAAW,uBAAuB,iBAAiB,IAAI;AAE/D,aAAO;AAAA,IACL,OAAO;AAAA,MACL,WAAW;AAAA,IACb;AAAA,IACA,CAAC,oBAAoB;AAAA,EACvB;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -51,13 +51,15 @@ const useConfiguredDefaultProps = ({ props, arrowElement }) => {
|
|
|
51
51
|
portalDOMContainer: document.body,
|
|
52
52
|
startPlacementPreference: "top",
|
|
53
53
|
placementOrderPreference: ["top", "bottom", "left", "right"],
|
|
54
|
-
extraPopperStyles: emptyObj
|
|
54
|
+
extraPopperStyles: emptyObj,
|
|
55
|
+
customOffset: [0, 14]
|
|
55
56
|
}),
|
|
56
57
|
[]
|
|
57
58
|
);
|
|
58
59
|
const { modifiers: configuredModifiers } = (0, import_useConfiguredDefaultModifiers.useConfiguredDefaultModifiers)({
|
|
59
60
|
props,
|
|
60
|
-
arrowElement
|
|
61
|
+
arrowElement,
|
|
62
|
+
defaultProps: staticDefaultProps
|
|
61
63
|
});
|
|
62
64
|
const defaultProps = (0, import_react.useMemo)(
|
|
63
65
|
() => ({ ...staticDefaultProps, modifiers: configuredModifiers }),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/config/useConfiguredDefaultProps.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { useMemo } from 'react';\nimport { useConfiguredDefaultModifiers } from './useConfiguredDefaultModifiers.js';\nimport type {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAwB;AACxB,2CAA8C;AAG9C,MAAM,OAAO,MAAM;AAAC;AAEpB,MAAM,WAAW,CAAC;AAOX,MAAM,4BAA4B,CAAC,EAAE,OAAO,aAAa,MAA4C;
|
|
4
|
+
"sourcesContent": ["import { useMemo } from 'react';\nimport { useConfiguredDefaultModifiers } from './useConfiguredDefaultModifiers.js';\nimport type { DSPopperJST } from '../react-desc-prop-types.js';\n\nconst noop = () => {};\n\nconst emptyObj = {};\n\ninterface UseConfiguredDefaultPropsT {\n props: DSPopperJST.Props;\n arrowElement: HTMLDivElement | null;\n}\n\nexport const useConfiguredDefaultProps = ({ props, arrowElement }: Required<UseConfiguredDefaultPropsT>) => {\n // the global object 'document' is in scope only if the staticDefaultProps is defined inside the react hook\n // moving this declaration outside of the hook will cause \"body.document\" to be undefined and cause an error\n // we exclude zIndex from the staticDefaultProps because it is being applied from styled-components theme.props.popper\n const staticDefaultProps: Omit<DSPopperJST.DefaultProps, 'zIndex'> = useMemo(\n () => ({\n referenceElement: null,\n showPopover: false,\n closeContextMenu: noop,\n onClickOutside: noop,\n withoutPortal: false,\n withoutArrow: false,\n withoutAnimation: false,\n animationDuration: 100,\n portalDOMContainer: document.body,\n startPlacementPreference: 'top',\n placementOrderPreference: ['top', 'bottom', 'left', 'right'],\n extraPopperStyles: emptyObj,\n customOffset: [0, 14],\n }),\n [],\n );\n const { modifiers: configuredModifiers } = useConfiguredDefaultModifiers({\n props,\n arrowElement,\n defaultProps: staticDefaultProps,\n });\n\n const defaultProps = useMemo(\n () => ({ ...staticDefaultProps, modifiers: configuredModifiers }),\n [configuredModifiers, staticDefaultProps],\n );\n\n return defaultProps;\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAwB;AACxB,2CAA8C;AAG9C,MAAM,OAAO,MAAM;AAAC;AAEpB,MAAM,WAAW,CAAC;AAOX,MAAM,4BAA4B,CAAC,EAAE,OAAO,aAAa,MAA4C;AAI1G,QAAM,yBAA+D;AAAA,IACnE,OAAO;AAAA,MACL,kBAAkB;AAAA,MAClB,aAAa;AAAA,MACb,kBAAkB;AAAA,MAClB,gBAAgB;AAAA,MAChB,eAAe;AAAA,MACf,cAAc;AAAA,MACd,kBAAkB;AAAA,MAClB,mBAAmB;AAAA,MACnB,oBAAoB,SAAS;AAAA,MAC7B,0BAA0B;AAAA,MAC1B,0BAA0B,CAAC,OAAO,UAAU,QAAQ,OAAO;AAAA,MAC3D,mBAAmB;AAAA,MACnB,cAAc,CAAC,GAAG,EAAE;AAAA,IACtB;AAAA,IACA,CAAC;AAAA,EACH;AACA,QAAM,EAAE,WAAW,oBAAoB,QAAI,oEAA8B;AAAA,IACvE;AAAA,IACA;AAAA,IACA,cAAc;AAAA,EAChB,CAAC;AAED,QAAM,mBAAe;AAAA,IACnB,OAAO,EAAE,GAAG,oBAAoB,WAAW,oBAAoB;AAAA,IAC/D,CAAC,qBAAqB,kBAAkB;AAAA,EAC1C;AAEA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/config/useConfiguredMergedProps.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';\nimport { useConfiguredDefaultProps } from './useConfiguredDefaultProps.js';\nimport type {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,8BAA6C;AAC7C,uCAA0C;AAQnC,MAAM,2BAA2B,CAAC,EAAE,OAAO,aAAa,MAAiC;AAC9F,QAAM,mBAAe,4DAA0B,EAAE,OAAO,aAAa,CAAC;AAEtE,aAAO,
|
|
4
|
+
"sourcesContent": ["import { useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';\nimport { useConfiguredDefaultProps } from './useConfiguredDefaultProps.js';\nimport type { DSPopperJST } from '../react-desc-prop-types.js';\n\ninterface UseConfiguredMergedPropsT {\n props: DSPopperJST.Props;\n arrowElement: HTMLDivElement | null;\n}\n\nexport const useConfiguredMergedProps = ({ props, arrowElement }: UseConfiguredMergedPropsT) => {\n const defaultProps = useConfiguredDefaultProps({ props, arrowElement });\n\n return useMemoMergePropsWithDefault<DSPopperJST.InternalProps>(props, defaultProps);\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,8BAA6C;AAC7C,uCAA0C;AAQnC,MAAM,2BAA2B,CAAC,EAAE,OAAO,aAAa,MAAiC;AAC9F,QAAM,mBAAe,4DAA0B,EAAE,OAAO,aAAa,CAAC;AAEtE,aAAO,sDAAwD,OAAO,YAAY;AACpF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -104,7 +104,7 @@ const DSPopperJS = (props) => {
|
|
|
104
104
|
if (showPopover || isAnimating) {
|
|
105
105
|
if (withoutPortal === true)
|
|
106
106
|
return contentJSX;
|
|
107
|
-
if (withoutPortal === false)
|
|
107
|
+
if (portalDOMContainer && withoutPortal === false)
|
|
108
108
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: (0, import_react_dom.createPortal)(contentJSX, portalDOMContainer) });
|
|
109
109
|
}
|
|
110
110
|
return null;
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React, { useMemo } from 'react';\nimport { createPortal } from 'react-dom';\nimport { describe } from '@elliemae/ds-props-helpers';\nimport { PopoverContent } from './PopoverContent.js';\nimport { useConfigDSPopperjs } from './config/useConfigDSPopperjs.js';\nimport type {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADgCjB;AAhCN,mBAA+B;AAC/B,uBAA6B;AAC7B,8BAAyB;AACzB,4BAA+B;AAC/B,iCAAoC;AAEpC,mCAAoC;AAEpC,MAAM,
|
|
4
|
+
"sourcesContent": ["import React, { useMemo } from 'react';\nimport { createPortal } from 'react-dom';\nimport { describe } from '@elliemae/ds-props-helpers';\nimport { PopoverContent } from './PopoverContent.js';\nimport { useConfigDSPopperjs } from './config/useConfigDSPopperjs.js';\nimport type { DSPopperJST } from './react-desc-prop-types.js';\nimport { dspopperjsPropTypes } from './react-desc-prop-types.js';\n\nconst DSPopperJS: React.ComponentType<DSPopperJST.Props> = (props) => {\n const {\n props: {\n showPopover,\n withoutAnimation,\n animationDuration,\n withoutPortal,\n withoutArrow,\n portalDOMContainer,\n zIndex,\n extraPopperStyles,\n },\n globalAttrs,\n xStyledAttrs,\n setPopperElement,\n setArrowElement,\n setIsAnimating,\n popoverHelper,\n isAnimating,\n } = useConfigDSPopperjs(props);\n const { children } = props;\n const { styles, attributes } = popoverHelper;\n const contentJSX = useMemo(\n () => (\n <PopoverContent\n setPopperElement={setPopperElement}\n popperStyles={{ ...styles.popper, ...extraPopperStyles }}\n popperAttributes={attributes.popper}\n setArrowElement={setArrowElement}\n arrowStyle={styles.arrow}\n withoutArrow={withoutArrow}\n withoutAnimation={withoutAnimation}\n animationDuration={animationDuration}\n zIndex={zIndex}\n showPopover={showPopover}\n setIsAnimating={setIsAnimating}\n globalAttrs={globalAttrs}\n xStyledAttrs={xStyledAttrs}\n >\n {children}\n </PopoverContent>\n ),\n [\n attributes.popper,\n children,\n setIsAnimating,\n showPopover,\n extraPopperStyles,\n setArrowElement,\n setPopperElement,\n styles.arrow,\n styles.popper,\n withoutArrow,\n withoutAnimation,\n animationDuration,\n zIndex,\n globalAttrs,\n xStyledAttrs,\n ],\n );\n if (showPopover || isAnimating) {\n if (withoutPortal === true) return contentJSX;\n if (portalDOMContainer && withoutPortal === false) return <>{createPortal(contentJSX, portalDOMContainer)}</>;\n }\n return null;\n};\n\nDSPopperJS.propTypes = dspopperjsPropTypes;\nDSPopperJS.displayName = 'DSPopperJS';\nconst DSPopperJSWithSchema = describe(DSPopperJS).description('A dimsum custom styling wrapper on top of popperjs');\nDSPopperJSWithSchema.propTypes = dspopperjsPropTypes;\n\nexport { DSPopperJS, DSPopperJSWithSchema };\nexport default DSPopperJS;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADgCjB;AAhCN,mBAA+B;AAC/B,uBAA6B;AAC7B,8BAAyB;AACzB,4BAA+B;AAC/B,iCAAoC;AAEpC,mCAAoC;AAEpC,MAAM,aAAqD,CAAC,UAAU;AACpE,QAAM;AAAA,IACJ,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,QAAI,gDAAoB,KAAK;AAC7B,QAAM,EAAE,SAAS,IAAI;AACrB,QAAM,EAAE,QAAQ,WAAW,IAAI;AAC/B,QAAM,iBAAa;AAAA,IACjB,MACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,cAAc,EAAE,GAAG,OAAO,QAAQ,GAAG,kBAAkB;AAAA,QACvD,kBAAkB,WAAW;AAAA,QAC7B;AAAA,QACA,YAAY,OAAO;AAAA,QACnB;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QAEC;AAAA;AAAA,IACH;AAAA,IAEF;AAAA,MACE,WAAW;AAAA,MACX;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,OAAO;AAAA,MACP,OAAO;AAAA,MACP;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACA,MAAI,eAAe,aAAa;AAC9B,QAAI,kBAAkB;AAAM,aAAO;AACnC,QAAI,sBAAsB,kBAAkB;AAAO,aAAO,2EAAG,6CAAa,YAAY,kBAAkB,GAAE;AAAA,EAC5G;AACA,SAAO;AACT;AAEA,WAAW,YAAY;AACvB,WAAW,cAAc;AACzB,MAAM,2BAAuB,kCAAS,UAAU,EAAE,YAAY,oDAAoD;AAClH,qBAAqB,YAAY;AAGjC,IAAO,cAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -33,14 +33,32 @@ __export(react_desc_prop_types_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(react_desc_prop_types_exports);
|
|
34
34
|
var React = __toESM(require("react"));
|
|
35
35
|
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
36
|
+
const placementPreferenceArray = [
|
|
37
|
+
"top-start",
|
|
38
|
+
"top",
|
|
39
|
+
"top-end",
|
|
40
|
+
"right-start",
|
|
41
|
+
"right",
|
|
42
|
+
"right-end",
|
|
43
|
+
"bottom-end",
|
|
44
|
+
"bottom",
|
|
45
|
+
"bottom-start",
|
|
46
|
+
"left-end",
|
|
47
|
+
"left",
|
|
48
|
+
"left-start"
|
|
49
|
+
];
|
|
36
50
|
const dspopperjsPropTypes = {
|
|
37
51
|
...import_ds_props_helpers.globalAttributesPropTypes,
|
|
38
52
|
...import_ds_props_helpers.xstyledPropTypes,
|
|
39
53
|
/**
|
|
40
|
-
*
|
|
54
|
+
* The content of the popper
|
|
55
|
+
*/
|
|
56
|
+
children: import_ds_props_helpers.PropTypes.node.description("The content of the popper").isRequired,
|
|
57
|
+
/**
|
|
58
|
+
* The DOM element that needs to be used as a reference for positioning the popper.
|
|
41
59
|
*/
|
|
42
60
|
referenceElement: import_ds_props_helpers.PropTypes.oneOfType([import_ds_props_helpers.PropTypes.instanceOf(Element), import_ds_props_helpers.PropTypes.oneOf([null])]).description(
|
|
43
|
-
"
|
|
61
|
+
"The DOM element that needs to be used as a reference for positioning the popper."
|
|
44
62
|
).isRequired,
|
|
45
63
|
/**
|
|
46
64
|
* Wheter or not to show the popper content
|
|
@@ -69,68 +87,43 @@ const dspopperjsPropTypes = {
|
|
|
69
87
|
* Popper context menus Animation duration in ms
|
|
70
88
|
*/
|
|
71
89
|
animationDuration: import_ds_props_helpers.PropTypes.number.description("Popper context menus Animation duration in ms").defaultValue(100),
|
|
72
|
-
/**
|
|
73
|
-
* Bounding element to calculate upon, defaults to it is "clippingParents",
|
|
74
|
-
* which are the scrolling containers that may cause the element to be partially or fully cut off.
|
|
75
|
-
*/
|
|
76
|
-
boundaryElement: import_ds_props_helpers.PropTypes.oneOfType([import_ds_props_helpers.PropTypes.instanceOf(Element), import_ds_props_helpers.PropTypes.oneOf([null])]).description(
|
|
77
|
-
'Bounding element to calculate upon, defaults to "clippingParents",which are the scrolling containers that may cause element to be partially or fully cut off'
|
|
78
|
-
).defaultValue(void 0),
|
|
79
|
-
/**
|
|
80
|
-
* When using portal, the container in which to append the DOM content, defaults to document body
|
|
81
|
-
*/
|
|
82
|
-
portalDOMContainer: import_ds_props_helpers.PropTypes.oneOfType([import_ds_props_helpers.PropTypes.instanceOf(Element), import_ds_props_helpers.PropTypes.oneOf([null])]).description("When using portal, the container in which to append the DOM content, defaults to document body").defaultValue(void 0),
|
|
83
90
|
/**
|
|
84
91
|
* start placement preferences, as per popperjs placement option
|
|
85
92
|
*/
|
|
86
|
-
startPlacementPreference: import_ds_props_helpers.PropTypes.oneOf(
|
|
87
|
-
"top-start",
|
|
88
|
-
"top",
|
|
89
|
-
"top-end",
|
|
90
|
-
"right-start",
|
|
91
|
-
"right",
|
|
92
|
-
"right-end",
|
|
93
|
-
"bottom-end",
|
|
94
|
-
"bottom",
|
|
95
|
-
"bottom-start",
|
|
96
|
-
"left-end",
|
|
97
|
-
"left",
|
|
98
|
-
"left-start"
|
|
99
|
-
]).description("start placement preferences, as per popperjs placement option").defaultValue("'top'"),
|
|
93
|
+
startPlacementPreference: import_ds_props_helpers.PropTypes.oneOf(placementPreferenceArray).description("start placement preferences, as per popperjs placement option").defaultValue("'top'"),
|
|
100
94
|
/**
|
|
101
95
|
* Array of placement preferences, as per popperjs "flip" placement option
|
|
102
96
|
*/
|
|
103
|
-
placementOrderPreference: import_ds_props_helpers.PropTypes.arrayOf(
|
|
104
|
-
import_ds_props_helpers.PropTypes.oneOf([
|
|
105
|
-
"top-start",
|
|
106
|
-
"top",
|
|
107
|
-
"top-end",
|
|
108
|
-
"right-start",
|
|
109
|
-
"right",
|
|
110
|
-
"right-end",
|
|
111
|
-
"bottom-end",
|
|
112
|
-
"bottom",
|
|
113
|
-
"bottom-start",
|
|
114
|
-
"left-end",
|
|
115
|
-
"left",
|
|
116
|
-
"left-start"
|
|
117
|
-
])
|
|
118
|
-
).description('Array of placement preferences, as per popperjs "flip" placement option').defaultValue("['top', 'bottom', 'left', 'right']"),
|
|
97
|
+
placementOrderPreference: import_ds_props_helpers.PropTypes.arrayOf(import_ds_props_helpers.PropTypes.oneOf(placementPreferenceArray)).description('Array of placement preferences, as per popperjs "flip" placement option').defaultValue("['top', 'bottom', 'left', 'right']"),
|
|
119
98
|
/**
|
|
120
99
|
* popperjs content z-index
|
|
121
100
|
*/
|
|
122
|
-
zIndex: import_ds_props_helpers.PropTypes.number.description("popperjs content z-index").defaultValue(
|
|
101
|
+
zIndex: import_ds_props_helpers.PropTypes.number.description("popperjs content z-index").defaultValue("theme.zIndex.popper"),
|
|
123
102
|
/**
|
|
124
103
|
* placement offset array
|
|
125
104
|
*/
|
|
126
|
-
customOffset: import_ds_props_helpers.PropTypes.arrayOf(import_ds_props_helpers.PropTypes.number).description("placement offset array").defaultValue(
|
|
105
|
+
customOffset: import_ds_props_helpers.PropTypes.arrayOf(import_ds_props_helpers.PropTypes.number).description("placement offset array").defaultValue("[0,14]"),
|
|
106
|
+
extraPopperStyles: import_ds_props_helpers.PropTypes.object.description("Extra object styles to attach to the popper element").defaultValue({}),
|
|
107
|
+
onClickOutside: import_ds_props_helpers.PropTypes.func.description("Callback triggered when clicking outside the popper").defaultValue(() => null),
|
|
108
|
+
/**
|
|
109
|
+
* Bounding element to calculate upon, defaults to it is "clippingParents",
|
|
110
|
+
* which are the scrolling containers that may cause the element to be partially or fully cut off.
|
|
111
|
+
*/
|
|
112
|
+
boundaryElement: import_ds_props_helpers.PropTypes.oneOfType([import_ds_props_helpers.PropTypes.instanceOf(Element), import_ds_props_helpers.PropTypes.oneOf([null])]).description(
|
|
113
|
+
'Bounding element to calculate upon, defaults to "clippingParents",which are the scrolling containers that may cause element to be partially or fully cut off'
|
|
114
|
+
),
|
|
115
|
+
/**
|
|
116
|
+
* When using portal, the container in which to append the DOM content, defaults to document body
|
|
117
|
+
*/
|
|
118
|
+
portalDOMContainer: import_ds_props_helpers.PropTypes.oneOfType([import_ds_props_helpers.PropTypes.instanceOf(Element), import_ds_props_helpers.PropTypes.oneOf([null])]).description(
|
|
119
|
+
"When using portal, the container in which to append the DOM content, defaults to document body"
|
|
120
|
+
),
|
|
127
121
|
/**
|
|
128
122
|
* modifiers array for full-custom popper-js override
|
|
129
123
|
* https://popper.js.org/docs/v2/modifiers/
|
|
130
124
|
*/
|
|
131
|
-
modifiers: import_ds_props_helpers.PropTypes.array.description(
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
children: import_ds_props_helpers.PropTypes.node.description("The content of the popper").defaultValue(void 0)
|
|
125
|
+
modifiers: import_ds_props_helpers.PropTypes.array.description(
|
|
126
|
+
'If you provide the modifiers array for full-custom override in popper.js, it means you are responsible for completely overwriting all the existing modifiers. This includes the modifiers that control "boundaryElement," "withoutArrow," "placementOrderPreference," and "customOffset".For more detailed information, please refer to the documentation at https://popper.js.org/docs/v2/modifiers/.'
|
|
127
|
+
)
|
|
135
128
|
};
|
|
136
129
|
//# sourceMappingURL=react-desc-prop-types.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/react-desc-prop-types.ts", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,8BAAuE;
|
|
4
|
+
"sourcesContent": ["import {} from '@popperjs/core'; // fix for pnpm not portable typescript\nimport type { WeakValidationMap } from 'react';\nimport { globalAttributesPropTypes, PropTypes, xstyledPropTypes } from '@elliemae/ds-props-helpers';\nimport type {} from '@elliemae/ds-utilities';\nimport type { GlobalAttributesT, XstyledProps } from '@elliemae/ds-props-helpers';\nimport type { usePopper } from 'react-popper';\n\nexport declare namespace DSPopperJST {\n export type PopperPlacementsT =\n | 'top-start'\n | 'top'\n | 'top-end'\n | 'right-start'\n | 'right'\n | 'right-end'\n | 'bottom-end'\n | 'bottom'\n | 'bottom-start'\n | 'left-end'\n | 'left'\n | 'left-start';\n export interface DefaultProps {\n closeContextMenu: () => void;\n withoutPortal: boolean;\n withoutArrow: boolean;\n withoutAnimation: boolean;\n animationDuration: number;\n startPlacementPreference: PopperPlacementsT;\n placementOrderPreference: PopperPlacementsT[];\n zIndex: number;\n extraPopperStyles: Record<string, unknown>;\n onClickOutside: (e: MouseEvent | TouchEvent) => void;\n customOffset: [number, number];\n }\n export interface OptionalProps {\n boundaryElement?: HTMLElement;\n portalDOMContainer?: HTMLElement;\n modifiers?: NonNullable<Parameters<typeof usePopper>[2]>['modifiers'];\n }\n export interface RequiredProps {\n children: ReactChildrenComplete;\n referenceElement: HTMLElement;\n showPopover: boolean;\n }\n\n export interface Props\n extends Partial<DefaultProps>,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof OptionalProps | keyof RequiredProps>,\n Omit<XstyledProps, 'zIndex'>,\n RequiredProps {}\n\n export interface InternalProps\n extends DefaultProps,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof OptionalProps | keyof RequiredProps>,\n Omit<XstyledProps, 'zIndex'>,\n RequiredProps {}\n}\n\nconst placementPreferenceArray = [\n 'top-start',\n 'top',\n 'top-end',\n 'right-start',\n 'right',\n 'right-end',\n 'bottom-end',\n 'bottom',\n 'bottom-start',\n 'left-end',\n 'left',\n 'left-start',\n];\nexport const dspopperjsPropTypes = {\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n /**\n * The content of the popper\n */\n children: PropTypes.node.description('The content of the popper').isRequired,\n /**\n * The DOM element that needs to be used as a reference for positioning the popper.\n */\n referenceElement: PropTypes.oneOfType([PropTypes.instanceOf(Element), PropTypes.oneOf([null])]).description(\n 'The DOM element that needs to be used as a reference for positioning the popper.',\n ).isRequired,\n /**\n * Wheter or not to show the popper content\n */\n showPopover: PropTypes.bool.description('whether or not to show the popper content').isRequired,\n /**\n * Callback to close the context menu, used for \"on click outside\",\n * if not provided click outside will not trigger anything\n */\n closeContextMenu: PropTypes.func\n .description(\n 'Callback to close the context menu, used for \"on click outside\",' +\n ' if not provided click outside will not trigger anything',\n )\n .defaultValue('() => {}'),\n /**\n * Wheter or not the popper content should appear in a DOM portal or not\n */\n withoutPortal: PropTypes.bool\n .description('Whether or not the popper content should appear in a DOM portal or not')\n .defaultValue(true),\n /**\n * Wheter or not the popper context menu should print the arrow\n */\n withoutArrow: PropTypes.bool\n .description('Whether or not the popper context menu should print the arrow')\n .defaultValue(false),\n /**\n * Whether or not the popper context menu should be animated\n */\n withoutAnimation: PropTypes.bool\n .description('Whether or not the popper context menu should be animated')\n .defaultValue(false),\n /**\n * Popper context menus Animation duration in ms\n */\n animationDuration: PropTypes.number.description('Popper context menus Animation duration in ms').defaultValue(100),\n /**\n * start placement preferences, as per popperjs placement option\n */\n startPlacementPreference: PropTypes.oneOf(placementPreferenceArray)\n .description('start placement preferences, as per popperjs placement option')\n .defaultValue(\"'top'\"),\n /**\n * Array of placement preferences, as per popperjs \"flip\" placement option\n */\n placementOrderPreference: PropTypes.arrayOf(PropTypes.oneOf(placementPreferenceArray))\n .description('Array of placement preferences, as per popperjs \"flip\" placement option')\n .defaultValue(\"['top', 'bottom', 'left', 'right']\"),\n /**\n * popperjs content z-index\n */\n zIndex: PropTypes.number.description('popperjs content z-index').defaultValue('theme.zIndex.popper'),\n /**\n * placement offset array\n */\n customOffset: PropTypes.arrayOf(PropTypes.number).description('placement offset array').defaultValue('[0,14]'),\n extraPopperStyles: PropTypes.object\n .description('Extra object styles to attach to the popper element')\n .defaultValue({}),\n onClickOutside: PropTypes.func\n .description('Callback triggered when clicking outside the popper')\n .defaultValue(() => null),\n /**\n * Bounding element to calculate upon, defaults to it is \"clippingParents\",\n * which are the scrolling containers that may cause the element to be partially or fully cut off.\n */\n boundaryElement: PropTypes.oneOfType([PropTypes.instanceOf(Element), PropTypes.oneOf([null])]).description(\n 'Bounding element to calculate upon, defaults to \"clippingParents\",' +\n 'which are the scrolling containers that may cause element to be partially or fully cut off',\n ),\n /**\n * When using portal, the container in which to append the DOM content, defaults to document body\n */\n portalDOMContainer: PropTypes.oneOfType([PropTypes.instanceOf(Element), PropTypes.oneOf([null])]).description(\n 'When using portal, the container in which to append the DOM content, defaults to document body',\n ),\n /**\n * modifiers array for full-custom popper-js override\n * https://popper.js.org/docs/v2/modifiers/\n */\n modifiers: PropTypes.array.description(\n 'If you provide the modifiers array for full-custom override in popper.js,' +\n ' it means you are responsible for completely overwriting all the existing modifiers.' +\n ' This includes the modifiers that control \"boundaryElement,\" \"withoutArrow,\" \"placementOrderPreference,\" and \"customOffset\".' +\n 'For more detailed information, please refer to the documentation at https://popper.js.org/docs/v2/modifiers/.',\n ),\n} as WeakValidationMap<unknown>;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,8BAAuE;AA0DvE,MAAM,2BAA2B;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AACO,MAAM,sBAAsB;AAAA,EACjC,GAAG;AAAA,EACH,GAAG;AAAA;AAAA;AAAA;AAAA,EAIH,UAAU,kCAAU,KAAK,YAAY,2BAA2B,EAAE;AAAA;AAAA;AAAA;AAAA,EAIlE,kBAAkB,kCAAU,UAAU,CAAC,kCAAU,WAAW,OAAO,GAAG,kCAAU,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;AAAA,IAC9F;AAAA,EACF,EAAE;AAAA;AAAA;AAAA;AAAA,EAIF,aAAa,kCAAU,KAAK,YAAY,2CAA2C,EAAE;AAAA;AAAA;AAAA;AAAA;AAAA,EAKrF,kBAAkB,kCAAU,KACzB;AAAA,IACC;AAAA,EAEF,EACC,aAAa,UAAU;AAAA;AAAA;AAAA;AAAA,EAI1B,eAAe,kCAAU,KACtB,YAAY,wEAAwE,EACpF,aAAa,IAAI;AAAA;AAAA;AAAA;AAAA,EAIpB,cAAc,kCAAU,KACrB,YAAY,+DAA+D,EAC3E,aAAa,KAAK;AAAA;AAAA;AAAA;AAAA,EAIrB,kBAAkB,kCAAU,KACzB,YAAY,2DAA2D,EACvE,aAAa,KAAK;AAAA;AAAA;AAAA;AAAA,EAIrB,mBAAmB,kCAAU,OAAO,YAAY,+CAA+C,EAAE,aAAa,GAAG;AAAA;AAAA;AAAA;AAAA,EAIjH,0BAA0B,kCAAU,MAAM,wBAAwB,EAC/D,YAAY,+DAA+D,EAC3E,aAAa,OAAO;AAAA;AAAA;AAAA;AAAA,EAIvB,0BAA0B,kCAAU,QAAQ,kCAAU,MAAM,wBAAwB,CAAC,EAClF,YAAY,yEAAyE,EACrF,aAAa,oCAAoC;AAAA;AAAA;AAAA;AAAA,EAIpD,QAAQ,kCAAU,OAAO,YAAY,0BAA0B,EAAE,aAAa,qBAAqB;AAAA;AAAA;AAAA;AAAA,EAInG,cAAc,kCAAU,QAAQ,kCAAU,MAAM,EAAE,YAAY,wBAAwB,EAAE,aAAa,QAAQ;AAAA,EAC7G,mBAAmB,kCAAU,OAC1B,YAAY,qDAAqD,EACjE,aAAa,CAAC,CAAC;AAAA,EAClB,gBAAgB,kCAAU,KACvB,YAAY,qDAAqD,EACjE,aAAa,MAAM,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA,EAK1B,iBAAiB,kCAAU,UAAU,CAAC,kCAAU,WAAW,OAAO,GAAG,kCAAU,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;AAAA,IAC7F;AAAA,EAEF;AAAA;AAAA;AAAA;AAAA,EAIA,oBAAoB,kCAAU,UAAU,CAAC,kCAAU,WAAW,OAAO,GAAG,kCAAU,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;AAAA,IAChG;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA,EAKA,WAAW,kCAAU,MAAM;AAAA,IACzB;AAAA,EAIF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/PopoverContent.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useCallback, useMemo } from 'react';\nimport type {} from '@elliemae/ds-utilities';\nimport type { GlobalAttributesT, XstyledProps } from '@elliemae/ds-props-helpers';\nimport { PopoverArrow } from './PopoverArrow.js';\nimport { StyledPopoverContentWrapper, StyledAnimatedPopper } from './styled.js';\n\nexport interface PopoverContentPropsT {\n setPopperElement: React.Dispatch<React.SetStateAction<HTMLDivElement | null>>;\n popperStyles: React.CSSProperties;\n arrowStyle: React.CSSProperties;\n popperAttributes: Record<string, string> | undefined;\n children:
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useCallback, useMemo } from 'react';\nimport type {} from '@elliemae/ds-utilities';\nimport type { GlobalAttributesT, XstyledProps } from '@elliemae/ds-props-helpers';\nimport { PopoverArrow } from './PopoverArrow.js';\nimport { StyledPopoverContentWrapper, StyledAnimatedPopper } from './styled.js';\n\nexport interface PopoverContentPropsT {\n setPopperElement: React.Dispatch<React.SetStateAction<HTMLDivElement | null>>;\n popperStyles: React.CSSProperties;\n arrowStyle: React.CSSProperties;\n popperAttributes: Record<string, string> | undefined;\n children: ReactChildrenComplete;\n setArrowElement: React.Dispatch<React.SetStateAction<HTMLDivElement | null>>;\n withoutArrow: boolean;\n withoutAnimation: boolean;\n animationDuration: number;\n zIndex: number;\n showPopover: boolean;\n setIsAnimating: React.Dispatch<React.SetStateAction<boolean>>;\n globalAttrs: GlobalAttributesT;\n xStyledAttrs: XstyledProps;\n}\n\nexport const PopoverContent = ({\n setPopperElement,\n popperStyles,\n popperAttributes,\n children,\n showPopover,\n setArrowElement,\n setIsAnimating,\n arrowStyle,\n withoutArrow,\n withoutAnimation,\n animationDuration,\n zIndex,\n globalAttrs,\n xStyledAttrs,\n}: PopoverContentPropsT): JSX.Element => {\n const checkAnimationStatus = useCallback(() => {\n if (!showPopover && !withoutAnimation) {\n setIsAnimating(false);\n }\n }, [showPopover, withoutAnimation, setIsAnimating]);\n\n const popperContent = useMemo(\n () => (\n <>\n {children}\n {withoutArrow === false ? (\n <>\n <PopoverArrow\n arrowElementRef={setArrowElement}\n style={arrowStyle}\n placement={popperAttributes ? popperAttributes['data-popper-placement'] : 'bottom'}\n />\n <div ref={setArrowElement} style={arrowStyle} />\n </>\n ) : null}\n </>\n ),\n [children, withoutArrow, arrowStyle, popperAttributes, setArrowElement],\n );\n return (\n <StyledPopoverContentWrapper\n ref={setPopperElement}\n style={popperStyles}\n {...popperAttributes}\n {...globalAttrs}\n {...xStyledAttrs}\n zIndex={zIndex}\n >\n <StyledAnimatedPopper\n showPopover={showPopover}\n animationDuration={animationDuration}\n withoutAnimation={withoutAnimation}\n onAnimationEnd={checkAnimationStatus}\n >\n {popperContent}\n </StyledAnimatedPopper>\n </StyledPopoverContentWrapper>\n );\n};\n"],
|
|
5
5
|
"mappings": "AAAA,YAAY,WAAW;ACkDb,mBACE,KADF;AAlDV,SAAgB,aAAa,eAAe;AAG5C,SAAS,oBAAoB;AAC7B,SAAS,6BAA6B,4BAA4B;AAmB3D,MAAM,iBAAiB,CAAC;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAyC;AACvC,QAAM,uBAAuB,YAAY,MAAM;AAC7C,QAAI,CAAC,eAAe,CAAC,kBAAkB;AACrC,qBAAe,KAAK;AAAA,IACtB;AAAA,EACF,GAAG,CAAC,aAAa,kBAAkB,cAAc,CAAC;AAElD,QAAM,gBAAgB;AAAA,IACpB,MACE,iCACG;AAAA;AAAA,MACA,iBAAiB,QAChB,iCACE;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,iBAAiB;AAAA,YACjB,OAAO;AAAA,YACP,WAAW,mBAAmB,iBAAiB,uBAAuB,IAAI;AAAA;AAAA,QAC5E;AAAA,QACA,oBAAC,SAAI,KAAK,iBAAiB,OAAO,YAAY;AAAA,SAChD,IACE;AAAA,OACN;AAAA,IAEF,CAAC,UAAU,cAAc,YAAY,kBAAkB,eAAe;AAAA,EACxE;AACA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,KAAK;AAAA,MACL,OAAO;AAAA,MACN,GAAG;AAAA,MACH,GAAG;AAAA,MACH,GAAG;AAAA,MACJ;AAAA,MAEA;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA,UACA,gBAAgB;AAAA,UAEf;AAAA;AAAA,MACH;AAAA;AAAA,EACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/useConfigDSPopperjs.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useMemo, useState, useEffect } from 'react';\nimport { usePopper } from 'react-popper';\nimport { useGetGlobalAttributes, useGetXstyledProps } from '@elliemae/ds-props-helpers';\nimport { useConfiguredMergedProps } from './useConfiguredMergedProps.js';\nimport type {
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type React from 'react';\nimport { useMemo, useState, useEffect } from 'react';\nimport { usePopper } from 'react-popper';\nimport { useGetGlobalAttributes, useGetXstyledProps } from '@elliemae/ds-props-helpers';\nimport { useConfiguredMergedProps } from './useConfiguredMergedProps.js';\nimport type { DSPopperJST } from '../react-desc-prop-types.js';\nimport { useOnClickOutside } from '../utils/hooks/useOnClickOutside.js';\nimport type { GlobalAttributesT, XstyledProps } from '@elliemae/ds-props-helpers';\ninterface UseDSPopperjsRT {\n props: DSPopperJST.InternalProps;\n popperElement: HTMLDivElement | null;\n setIsAnimating: React.Dispatch<React.SetStateAction<boolean>>;\n isAnimating: boolean;\n setPopperElement: React.Dispatch<React.SetStateAction<HTMLDivElement | null>>;\n arrowElement: HTMLDivElement | null;\n setArrowElement: React.Dispatch<React.SetStateAction<HTMLDivElement | null>>;\n popoverHelper: ReturnType<typeof usePopper>;\n globalAttrs: GlobalAttributesT<Element>;\n xStyledAttrs: XstyledProps;\n}\n\nexport const useConfigDSPopperjs = (appProps: DSPopperJST.Props): UseDSPopperjsRT => {\n const [popperElement, setPopperElement] = useState<HTMLDivElement | null>(null);\n const [arrowElement, setArrowElement] = useState<HTMLDivElement | null>(null);\n const [isAnimating, setIsAnimating] = useState(false);\n\n const props = useConfiguredMergedProps({ props: appProps, arrowElement });\n const { referenceElement, closeContextMenu, onClickOutside, modifiers, startPlacementPreference } = props;\n const popperExtraOpts = useMemo(\n () => ({ placement: startPlacementPreference, modifiers }),\n [modifiers, startPlacementPreference],\n );\n\n const popoverHelper = usePopper(referenceElement, popperElement, popperExtraOpts);\n\n const { showPopover, withoutAnimation } = props;\n\n useEffect(() => {\n if (showPopover && !withoutAnimation) {\n setIsAnimating(true);\n }\n }, [showPopover, withoutAnimation]);\n\n useOnClickOutside(popperElement as Node, (e) => {\n if (!referenceElement?.contains?.(e?.target as Node)) {\n onClickOutside(e);\n closeContextMenu();\n }\n });\n\n const globalAttrs = useGetGlobalAttributes(props);\n const xStyledAttrs = useGetXstyledProps(props);\n\n return useMemo(\n () => ({\n props,\n popperElement,\n setPopperElement,\n arrowElement,\n setArrowElement,\n popoverHelper,\n isAnimating,\n setIsAnimating,\n globalAttrs,\n xStyledAttrs,\n }),\n [props, popperElement, arrowElement, popoverHelper, isAnimating, globalAttrs, xStyledAttrs],\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,SAAS,UAAU,iBAAiB;AAC7C,SAAS,iBAAiB;AAC1B,SAAS,wBAAwB,0BAA0B;AAC3D,SAAS,gCAAgC;AAEzC,SAAS,yBAAyB;AAe3B,MAAM,sBAAsB,CAAC,aAAiD;AACnF,QAAM,CAAC,eAAe,gBAAgB,IAAI,SAAgC,IAAI;AAC9E,QAAM,CAAC,cAAc,eAAe,IAAI,SAAgC,IAAI;AAC5E,QAAM,CAAC,aAAa,cAAc,IAAI,SAAS,KAAK;AAEpD,QAAM,QAAQ,yBAAyB,EAAE,OAAO,UAAU,aAAa,CAAC;AACxE,QAAM,EAAE,kBAAkB,kBAAkB,gBAAgB,WAAW,yBAAyB,IAAI;AACpG,QAAM,kBAAkB;AAAA,IACtB,OAAO,EAAE,WAAW,0BAA0B,UAAU;AAAA,IACxD,CAAC,WAAW,wBAAwB;AAAA,EACtC;AAEA,QAAM,gBAAgB,UAAU,kBAAkB,eAAe,eAAe;AAEhF,QAAM,EAAE,aAAa,iBAAiB,IAAI;AAE1C,YAAU,MAAM;AACd,QAAI,eAAe,CAAC,kBAAkB;AACpC,qBAAe,IAAI;AAAA,IACrB;AAAA,EACF,GAAG,CAAC,aAAa,gBAAgB,CAAC;AAElC,oBAAkB,eAAuB,CAAC,MAAM;AAC9C,QAAI,CAAC,kBAAkB,WAAW,GAAG,MAAc,GAAG;AACpD,qBAAe,CAAC;AAChB,uBAAiB;AAAA,IACnB;AAAA,EACF,CAAC;AAED,QAAM,cAAc,uBAAuB,KAAK;AAChD,QAAM,eAAe,mBAAmB,KAAK;AAE7C,SAAO;AAAA,IACL,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,OAAO,eAAe,cAAc,eAAe,aAAa,aAAa,YAAY;AAAA,EAC5F;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { useMemo } from "react";
|
|
3
|
-
const useConfiguredDefaultModifiers = ({
|
|
3
|
+
const useConfiguredDefaultModifiers = ({
|
|
4
|
+
props,
|
|
5
|
+
arrowElement,
|
|
6
|
+
defaultProps
|
|
7
|
+
}) => {
|
|
4
8
|
const {
|
|
5
9
|
boundaryElement: explicitAppBoundaryElement,
|
|
6
10
|
withoutArrow: explicitAppWithoutArrow = false,
|
|
@@ -17,7 +21,7 @@ const useConfiguredDefaultModifiers = ({ props, arrowElement }) => {
|
|
|
17
21
|
}
|
|
18
22
|
});
|
|
19
23
|
if (!explicitAppWithoutArrow || explictAppOffset) {
|
|
20
|
-
const defaultOffset = explictAppOffset ||
|
|
24
|
+
const defaultOffset = explictAppOffset || defaultProps.customOffset;
|
|
21
25
|
mod.push({
|
|
22
26
|
name: "offset",
|
|
23
27
|
enabled: true,
|
|
@@ -44,6 +48,7 @@ const useConfiguredDefaultModifiers = ({ props, arrowElement }) => {
|
|
|
44
48
|
return mod;
|
|
45
49
|
}, [
|
|
46
50
|
arrowElement,
|
|
51
|
+
defaultProps,
|
|
47
52
|
explicitAppBoundaryElement,
|
|
48
53
|
explicitAppWithoutArrow,
|
|
49
54
|
explicitPlacementOrderPreference,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/useConfiguredDefaultModifiers.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useMemo } from 'react';\nimport type {
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,eAAe;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useMemo } from 'react';\nimport type { DSPopperJST } from '../react-desc-prop-types.js';\n\ninterface UseConfiguredDefaultModifiersT {\n props: DSPopperJST.Props;\n arrowElement: HTMLDivElement | null;\n defaultProps: Omit<DSPopperJST.DefaultProps, 'zIndex'>;\n}\n\nexport const useConfiguredDefaultModifiers = ({\n props,\n arrowElement,\n defaultProps,\n}: UseConfiguredDefaultModifiersT) => {\n // we destructure explicit app definitions before merge\n const {\n boundaryElement: explicitAppBoundaryElement,\n withoutArrow: explicitAppWithoutArrow = false,\n placementOrderPreference: explicitPlacementOrderPreference = ['top', 'bottom', 'left', 'right'],\n customOffset: explictAppOffset = undefined,\n } = props;\n // to build default modifiers on top of it\n const defaultModifiers = useMemo(() => {\n const mod = [];\n mod.push({ name: 'hide', enabled: true });\n mod.push({\n name: 'flip',\n options: {\n fallbackPlacements: explicitPlacementOrderPreference,\n },\n });\n // we apply an offset if the app defines one or if the app wants the arrow\n if (!explicitAppWithoutArrow || explictAppOffset) {\n const defaultOffset = explictAppOffset || defaultProps.customOffset;\n mod.push({\n name: 'offset',\n enabled: true,\n options: {\n offset: defaultOffset,\n },\n });\n }\n // the app can opt for a \"no arrow\" implementation (we do so in datatable/calendar etc...)\n if (!explicitAppWithoutArrow)\n mod.push({\n name: 'arrow',\n options: {\n element: arrowElement,\n padding: 18,\n },\n });\n\n // the app can define an explicit element to act as a boundary instead of popperjs default one\n if (explicitAppBoundaryElement)\n mod.push({\n name: 'preventOverflow',\n options: {\n boundary: explicitAppBoundaryElement,\n },\n });\n return mod;\n }, [\n arrowElement,\n defaultProps,\n explicitAppBoundaryElement,\n explicitAppWithoutArrow,\n explicitPlacementOrderPreference,\n explictAppOffset,\n ]);\n // if the app pass custom modifier, we don't use \"default modifiers\"\n const { modifiers: explicitAppModifiers = defaultModifiers } = props;\n\n return useMemo(\n () => ({\n modifiers: explicitAppModifiers,\n }),\n [explicitAppModifiers],\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,eAAe;AASjB,MAAM,gCAAgC,CAAC;AAAA,EAC5C;AAAA,EACA;AAAA,EACA;AACF,MAAsC;AAEpC,QAAM;AAAA,IACJ,iBAAiB;AAAA,IACjB,cAAc,0BAA0B;AAAA,IACxC,0BAA0B,mCAAmC,CAAC,OAAO,UAAU,QAAQ,OAAO;AAAA,IAC9F,cAAc,mBAAmB;AAAA,EACnC,IAAI;AAEJ,QAAM,mBAAmB,QAAQ,MAAM;AACrC,UAAM,MAAM,CAAC;AACb,QAAI,KAAK,EAAE,MAAM,QAAQ,SAAS,KAAK,CAAC;AACxC,QAAI,KAAK;AAAA,MACP,MAAM;AAAA,MACN,SAAS;AAAA,QACP,oBAAoB;AAAA,MACtB;AAAA,IACF,CAAC;AAED,QAAI,CAAC,2BAA2B,kBAAkB;AAChD,YAAM,gBAAgB,oBAAoB,aAAa;AACvD,UAAI,KAAK;AAAA,QACP,MAAM;AAAA,QACN,SAAS;AAAA,QACT,SAAS;AAAA,UACP,QAAQ;AAAA,QACV;AAAA,MACF,CAAC;AAAA,IACH;AAEA,QAAI,CAAC;AACH,UAAI,KAAK;AAAA,QACP,MAAM;AAAA,QACN,SAAS;AAAA,UACP,SAAS;AAAA,UACT,SAAS;AAAA,QACX;AAAA,MACF,CAAC;AAGH,QAAI;AACF,UAAI,KAAK;AAAA,QACP,MAAM;AAAA,QACN,SAAS;AAAA,UACP,UAAU;AAAA,QACZ;AAAA,MACF,CAAC;AACH,WAAO;AAAA,EACT,GAAG;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAED,QAAM,EAAE,WAAW,uBAAuB,iBAAiB,IAAI;AAE/D,SAAO;AAAA,IACL,OAAO;AAAA,MACL,WAAW;AAAA,IACb;AAAA,IACA,CAAC,oBAAoB;AAAA,EACvB;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -18,13 +18,15 @@ const useConfiguredDefaultProps = ({ props, arrowElement }) => {
|
|
|
18
18
|
portalDOMContainer: document.body,
|
|
19
19
|
startPlacementPreference: "top",
|
|
20
20
|
placementOrderPreference: ["top", "bottom", "left", "right"],
|
|
21
|
-
extraPopperStyles: emptyObj
|
|
21
|
+
extraPopperStyles: emptyObj,
|
|
22
|
+
customOffset: [0, 14]
|
|
22
23
|
}),
|
|
23
24
|
[]
|
|
24
25
|
);
|
|
25
26
|
const { modifiers: configuredModifiers } = useConfiguredDefaultModifiers({
|
|
26
27
|
props,
|
|
27
|
-
arrowElement
|
|
28
|
+
arrowElement,
|
|
29
|
+
defaultProps: staticDefaultProps
|
|
28
30
|
});
|
|
29
31
|
const defaultProps = useMemo(
|
|
30
32
|
() => ({ ...staticDefaultProps, modifiers: configuredModifiers }),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/useConfiguredDefaultProps.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useMemo } from 'react';\nimport { useConfiguredDefaultModifiers } from './useConfiguredDefaultModifiers.js';\nimport type {
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,eAAe;AACxB,SAAS,qCAAqC;AAG9C,MAAM,OAAO,MAAM;AAAC;AAEpB,MAAM,WAAW,CAAC;AAOX,MAAM,4BAA4B,CAAC,EAAE,OAAO,aAAa,MAA4C;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useMemo } from 'react';\nimport { useConfiguredDefaultModifiers } from './useConfiguredDefaultModifiers.js';\nimport type { DSPopperJST } from '../react-desc-prop-types.js';\n\nconst noop = () => {};\n\nconst emptyObj = {};\n\ninterface UseConfiguredDefaultPropsT {\n props: DSPopperJST.Props;\n arrowElement: HTMLDivElement | null;\n}\n\nexport const useConfiguredDefaultProps = ({ props, arrowElement }: Required<UseConfiguredDefaultPropsT>) => {\n // the global object 'document' is in scope only if the staticDefaultProps is defined inside the react hook\n // moving this declaration outside of the hook will cause \"body.document\" to be undefined and cause an error\n // we exclude zIndex from the staticDefaultProps because it is being applied from styled-components theme.props.popper\n const staticDefaultProps: Omit<DSPopperJST.DefaultProps, 'zIndex'> = useMemo(\n () => ({\n referenceElement: null,\n showPopover: false,\n closeContextMenu: noop,\n onClickOutside: noop,\n withoutPortal: false,\n withoutArrow: false,\n withoutAnimation: false,\n animationDuration: 100,\n portalDOMContainer: document.body,\n startPlacementPreference: 'top',\n placementOrderPreference: ['top', 'bottom', 'left', 'right'],\n extraPopperStyles: emptyObj,\n customOffset: [0, 14],\n }),\n [],\n );\n const { modifiers: configuredModifiers } = useConfiguredDefaultModifiers({\n props,\n arrowElement,\n defaultProps: staticDefaultProps,\n });\n\n const defaultProps = useMemo(\n () => ({ ...staticDefaultProps, modifiers: configuredModifiers }),\n [configuredModifiers, staticDefaultProps],\n );\n\n return defaultProps;\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,eAAe;AACxB,SAAS,qCAAqC;AAG9C,MAAM,OAAO,MAAM;AAAC;AAEpB,MAAM,WAAW,CAAC;AAOX,MAAM,4BAA4B,CAAC,EAAE,OAAO,aAAa,MAA4C;AAI1G,QAAM,qBAA+D;AAAA,IACnE,OAAO;AAAA,MACL,kBAAkB;AAAA,MAClB,aAAa;AAAA,MACb,kBAAkB;AAAA,MAClB,gBAAgB;AAAA,MAChB,eAAe;AAAA,MACf,cAAc;AAAA,MACd,kBAAkB;AAAA,MAClB,mBAAmB;AAAA,MACnB,oBAAoB,SAAS;AAAA,MAC7B,0BAA0B;AAAA,MAC1B,0BAA0B,CAAC,OAAO,UAAU,QAAQ,OAAO;AAAA,MAC3D,mBAAmB;AAAA,MACnB,cAAc,CAAC,GAAG,EAAE;AAAA,IACtB;AAAA,IACA,CAAC;AAAA,EACH;AACA,QAAM,EAAE,WAAW,oBAAoB,IAAI,8BAA8B;AAAA,IACvE;AAAA,IACA;AAAA,IACA,cAAc;AAAA,EAChB,CAAC;AAED,QAAM,eAAe;AAAA,IACnB,OAAO,EAAE,GAAG,oBAAoB,WAAW,oBAAoB;AAAA,IAC/D,CAAC,qBAAqB,kBAAkB;AAAA,EAC1C;AAEA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/useConfiguredMergedProps.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';\nimport { useConfiguredDefaultProps } from './useConfiguredDefaultProps.js';\nimport type {
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,oCAAoC;AAC7C,SAAS,iCAAiC;AAQnC,MAAM,2BAA2B,CAAC,EAAE,OAAO,aAAa,MAAiC;AAC9F,QAAM,eAAe,0BAA0B,EAAE,OAAO,aAAa,CAAC;AAEtE,SAAO,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';\nimport { useConfiguredDefaultProps } from './useConfiguredDefaultProps.js';\nimport type { DSPopperJST } from '../react-desc-prop-types.js';\n\ninterface UseConfiguredMergedPropsT {\n props: DSPopperJST.Props;\n arrowElement: HTMLDivElement | null;\n}\n\nexport const useConfiguredMergedProps = ({ props, arrowElement }: UseConfiguredMergedPropsT) => {\n const defaultProps = useConfiguredDefaultProps({ props, arrowElement });\n\n return useMemoMergePropsWithDefault<DSPopperJST.InternalProps>(props, defaultProps);\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,oCAAoC;AAC7C,SAAS,iCAAiC;AAQnC,MAAM,2BAA2B,CAAC,EAAE,OAAO,aAAa,MAAiC;AAC9F,QAAM,eAAe,0BAA0B,EAAE,OAAO,aAAa,CAAC;AAEtE,SAAO,6BAAwD,OAAO,YAAY;AACpF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -69,7 +69,7 @@ const DSPopperJS = (props) => {
|
|
|
69
69
|
if (showPopover || isAnimating) {
|
|
70
70
|
if (withoutPortal === true)
|
|
71
71
|
return contentJSX;
|
|
72
|
-
if (withoutPortal === false)
|
|
72
|
+
if (portalDOMContainer && withoutPortal === false)
|
|
73
73
|
return /* @__PURE__ */ jsx(Fragment, { children: createPortal(contentJSX, portalDOMContainer) });
|
|
74
74
|
}
|
|
75
75
|
return null;
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useMemo } from 'react';\nimport { createPortal } from 'react-dom';\nimport { describe } from '@elliemae/ds-props-helpers';\nimport { PopoverContent } from './PopoverContent.js';\nimport { useConfigDSPopperjs } from './config/useConfigDSPopperjs.js';\nimport type {
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACgCjB,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useMemo } from 'react';\nimport { createPortal } from 'react-dom';\nimport { describe } from '@elliemae/ds-props-helpers';\nimport { PopoverContent } from './PopoverContent.js';\nimport { useConfigDSPopperjs } from './config/useConfigDSPopperjs.js';\nimport type { DSPopperJST } from './react-desc-prop-types.js';\nimport { dspopperjsPropTypes } from './react-desc-prop-types.js';\n\nconst DSPopperJS: React.ComponentType<DSPopperJST.Props> = (props) => {\n const {\n props: {\n showPopover,\n withoutAnimation,\n animationDuration,\n withoutPortal,\n withoutArrow,\n portalDOMContainer,\n zIndex,\n extraPopperStyles,\n },\n globalAttrs,\n xStyledAttrs,\n setPopperElement,\n setArrowElement,\n setIsAnimating,\n popoverHelper,\n isAnimating,\n } = useConfigDSPopperjs(props);\n const { children } = props;\n const { styles, attributes } = popoverHelper;\n const contentJSX = useMemo(\n () => (\n <PopoverContent\n setPopperElement={setPopperElement}\n popperStyles={{ ...styles.popper, ...extraPopperStyles }}\n popperAttributes={attributes.popper}\n setArrowElement={setArrowElement}\n arrowStyle={styles.arrow}\n withoutArrow={withoutArrow}\n withoutAnimation={withoutAnimation}\n animationDuration={animationDuration}\n zIndex={zIndex}\n showPopover={showPopover}\n setIsAnimating={setIsAnimating}\n globalAttrs={globalAttrs}\n xStyledAttrs={xStyledAttrs}\n >\n {children}\n </PopoverContent>\n ),\n [\n attributes.popper,\n children,\n setIsAnimating,\n showPopover,\n extraPopperStyles,\n setArrowElement,\n setPopperElement,\n styles.arrow,\n styles.popper,\n withoutArrow,\n withoutAnimation,\n animationDuration,\n zIndex,\n globalAttrs,\n xStyledAttrs,\n ],\n );\n if (showPopover || isAnimating) {\n if (withoutPortal === true) return contentJSX;\n if (portalDOMContainer && withoutPortal === false) return <>{createPortal(contentJSX, portalDOMContainer)}</>;\n }\n return null;\n};\n\nDSPopperJS.propTypes = dspopperjsPropTypes;\nDSPopperJS.displayName = 'DSPopperJS';\nconst DSPopperJSWithSchema = describe(DSPopperJS).description('A dimsum custom styling wrapper on top of popperjs');\nDSPopperJSWithSchema.propTypes = dspopperjsPropTypes;\n\nexport { DSPopperJS, DSPopperJSWithSchema };\nexport default DSPopperJS;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACgCjB,SAsCwD,UAtCxD;AAhCN,SAAgB,eAAe;AAC/B,SAAS,oBAAoB;AAC7B,SAAS,gBAAgB;AACzB,SAAS,sBAAsB;AAC/B,SAAS,2BAA2B;AAEpC,SAAS,2BAA2B;AAEpC,MAAM,aAAqD,CAAC,UAAU;AACpE,QAAM;AAAA,IACJ,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,oBAAoB,KAAK;AAC7B,QAAM,EAAE,SAAS,IAAI;AACrB,QAAM,EAAE,QAAQ,WAAW,IAAI;AAC/B,QAAM,aAAa;AAAA,IACjB,MACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,cAAc,EAAE,GAAG,OAAO,QAAQ,GAAG,kBAAkB;AAAA,QACvD,kBAAkB,WAAW;AAAA,QAC7B;AAAA,QACA,YAAY,OAAO;AAAA,QACnB;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QAEC;AAAA;AAAA,IACH;AAAA,IAEF;AAAA,MACE,WAAW;AAAA,MACX;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,OAAO;AAAA,MACP,OAAO;AAAA,MACP;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACA,MAAI,eAAe,aAAa;AAC9B,QAAI,kBAAkB;AAAM,aAAO;AACnC,QAAI,sBAAsB,kBAAkB;AAAO,aAAO,gCAAG,uBAAa,YAAY,kBAAkB,GAAE;AAAA,EAC5G;AACA,SAAO;AACT;AAEA,WAAW,YAAY;AACvB,WAAW,cAAc;AACzB,MAAM,uBAAuB,SAAS,UAAU,EAAE,YAAY,oDAAoD;AAClH,qBAAqB,YAAY;AAGjC,IAAO,cAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,13 +1,31 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { globalAttributesPropTypes, PropTypes, xstyledPropTypes } from "@elliemae/ds-props-helpers";
|
|
3
|
+
const placementPreferenceArray = [
|
|
4
|
+
"top-start",
|
|
5
|
+
"top",
|
|
6
|
+
"top-end",
|
|
7
|
+
"right-start",
|
|
8
|
+
"right",
|
|
9
|
+
"right-end",
|
|
10
|
+
"bottom-end",
|
|
11
|
+
"bottom",
|
|
12
|
+
"bottom-start",
|
|
13
|
+
"left-end",
|
|
14
|
+
"left",
|
|
15
|
+
"left-start"
|
|
16
|
+
];
|
|
3
17
|
const dspopperjsPropTypes = {
|
|
4
18
|
...globalAttributesPropTypes,
|
|
5
19
|
...xstyledPropTypes,
|
|
6
20
|
/**
|
|
7
|
-
*
|
|
21
|
+
* The content of the popper
|
|
22
|
+
*/
|
|
23
|
+
children: PropTypes.node.description("The content of the popper").isRequired,
|
|
24
|
+
/**
|
|
25
|
+
* The DOM element that needs to be used as a reference for positioning the popper.
|
|
8
26
|
*/
|
|
9
27
|
referenceElement: PropTypes.oneOfType([PropTypes.instanceOf(Element), PropTypes.oneOf([null])]).description(
|
|
10
|
-
"
|
|
28
|
+
"The DOM element that needs to be used as a reference for positioning the popper."
|
|
11
29
|
).isRequired,
|
|
12
30
|
/**
|
|
13
31
|
* Wheter or not to show the popper content
|
|
@@ -36,69 +54,44 @@ const dspopperjsPropTypes = {
|
|
|
36
54
|
* Popper context menus Animation duration in ms
|
|
37
55
|
*/
|
|
38
56
|
animationDuration: PropTypes.number.description("Popper context menus Animation duration in ms").defaultValue(100),
|
|
39
|
-
/**
|
|
40
|
-
* Bounding element to calculate upon, defaults to it is "clippingParents",
|
|
41
|
-
* which are the scrolling containers that may cause the element to be partially or fully cut off.
|
|
42
|
-
*/
|
|
43
|
-
boundaryElement: PropTypes.oneOfType([PropTypes.instanceOf(Element), PropTypes.oneOf([null])]).description(
|
|
44
|
-
'Bounding element to calculate upon, defaults to "clippingParents",which are the scrolling containers that may cause element to be partially or fully cut off'
|
|
45
|
-
).defaultValue(void 0),
|
|
46
|
-
/**
|
|
47
|
-
* When using portal, the container in which to append the DOM content, defaults to document body
|
|
48
|
-
*/
|
|
49
|
-
portalDOMContainer: PropTypes.oneOfType([PropTypes.instanceOf(Element), PropTypes.oneOf([null])]).description("When using portal, the container in which to append the DOM content, defaults to document body").defaultValue(void 0),
|
|
50
57
|
/**
|
|
51
58
|
* start placement preferences, as per popperjs placement option
|
|
52
59
|
*/
|
|
53
|
-
startPlacementPreference: PropTypes.oneOf(
|
|
54
|
-
"top-start",
|
|
55
|
-
"top",
|
|
56
|
-
"top-end",
|
|
57
|
-
"right-start",
|
|
58
|
-
"right",
|
|
59
|
-
"right-end",
|
|
60
|
-
"bottom-end",
|
|
61
|
-
"bottom",
|
|
62
|
-
"bottom-start",
|
|
63
|
-
"left-end",
|
|
64
|
-
"left",
|
|
65
|
-
"left-start"
|
|
66
|
-
]).description("start placement preferences, as per popperjs placement option").defaultValue("'top'"),
|
|
60
|
+
startPlacementPreference: PropTypes.oneOf(placementPreferenceArray).description("start placement preferences, as per popperjs placement option").defaultValue("'top'"),
|
|
67
61
|
/**
|
|
68
62
|
* Array of placement preferences, as per popperjs "flip" placement option
|
|
69
63
|
*/
|
|
70
|
-
placementOrderPreference: PropTypes.arrayOf(
|
|
71
|
-
PropTypes.oneOf([
|
|
72
|
-
"top-start",
|
|
73
|
-
"top",
|
|
74
|
-
"top-end",
|
|
75
|
-
"right-start",
|
|
76
|
-
"right",
|
|
77
|
-
"right-end",
|
|
78
|
-
"bottom-end",
|
|
79
|
-
"bottom",
|
|
80
|
-
"bottom-start",
|
|
81
|
-
"left-end",
|
|
82
|
-
"left",
|
|
83
|
-
"left-start"
|
|
84
|
-
])
|
|
85
|
-
).description('Array of placement preferences, as per popperjs "flip" placement option').defaultValue("['top', 'bottom', 'left', 'right']"),
|
|
64
|
+
placementOrderPreference: PropTypes.arrayOf(PropTypes.oneOf(placementPreferenceArray)).description('Array of placement preferences, as per popperjs "flip" placement option').defaultValue("['top', 'bottom', 'left', 'right']"),
|
|
86
65
|
/**
|
|
87
66
|
* popperjs content z-index
|
|
88
67
|
*/
|
|
89
|
-
zIndex: PropTypes.number.description("popperjs content z-index").defaultValue(
|
|
68
|
+
zIndex: PropTypes.number.description("popperjs content z-index").defaultValue("theme.zIndex.popper"),
|
|
90
69
|
/**
|
|
91
70
|
* placement offset array
|
|
92
71
|
*/
|
|
93
|
-
customOffset: PropTypes.arrayOf(PropTypes.number).description("placement offset array").defaultValue(
|
|
72
|
+
customOffset: PropTypes.arrayOf(PropTypes.number).description("placement offset array").defaultValue("[0,14]"),
|
|
73
|
+
extraPopperStyles: PropTypes.object.description("Extra object styles to attach to the popper element").defaultValue({}),
|
|
74
|
+
onClickOutside: PropTypes.func.description("Callback triggered when clicking outside the popper").defaultValue(() => null),
|
|
75
|
+
/**
|
|
76
|
+
* Bounding element to calculate upon, defaults to it is "clippingParents",
|
|
77
|
+
* which are the scrolling containers that may cause the element to be partially or fully cut off.
|
|
78
|
+
*/
|
|
79
|
+
boundaryElement: PropTypes.oneOfType([PropTypes.instanceOf(Element), PropTypes.oneOf([null])]).description(
|
|
80
|
+
'Bounding element to calculate upon, defaults to "clippingParents",which are the scrolling containers that may cause element to be partially or fully cut off'
|
|
81
|
+
),
|
|
82
|
+
/**
|
|
83
|
+
* When using portal, the container in which to append the DOM content, defaults to document body
|
|
84
|
+
*/
|
|
85
|
+
portalDOMContainer: PropTypes.oneOfType([PropTypes.instanceOf(Element), PropTypes.oneOf([null])]).description(
|
|
86
|
+
"When using portal, the container in which to append the DOM content, defaults to document body"
|
|
87
|
+
),
|
|
94
88
|
/**
|
|
95
89
|
* modifiers array for full-custom popper-js override
|
|
96
90
|
* https://popper.js.org/docs/v2/modifiers/
|
|
97
91
|
*/
|
|
98
|
-
modifiers: PropTypes.array.description(
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
children: PropTypes.node.description("The content of the popper").defaultValue(void 0)
|
|
92
|
+
modifiers: PropTypes.array.description(
|
|
93
|
+
'If you provide the modifiers array for full-custom override in popper.js, it means you are responsible for completely overwriting all the existing modifiers. This includes the modifiers that control "boundaryElement," "withoutArrow," "placementOrderPreference," and "customOffset".For more detailed information, please refer to the documentation at https://popper.js.org/docs/v2/modifiers/.'
|
|
94
|
+
)
|
|
102
95
|
};
|
|
103
96
|
export {
|
|
104
97
|
dspopperjsPropTypes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/react-desc-prop-types.ts"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACEvB,SAAS,2BAA2B,WAAW,wBAAwB;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import {} from '@popperjs/core'; // fix for pnpm not portable typescript\nimport type { WeakValidationMap } from 'react';\nimport { globalAttributesPropTypes, PropTypes, xstyledPropTypes } from '@elliemae/ds-props-helpers';\nimport type {} from '@elliemae/ds-utilities';\nimport type { GlobalAttributesT, XstyledProps } from '@elliemae/ds-props-helpers';\nimport type { usePopper } from 'react-popper';\n\nexport declare namespace DSPopperJST {\n export type PopperPlacementsT =\n | 'top-start'\n | 'top'\n | 'top-end'\n | 'right-start'\n | 'right'\n | 'right-end'\n | 'bottom-end'\n | 'bottom'\n | 'bottom-start'\n | 'left-end'\n | 'left'\n | 'left-start';\n export interface DefaultProps {\n closeContextMenu: () => void;\n withoutPortal: boolean;\n withoutArrow: boolean;\n withoutAnimation: boolean;\n animationDuration: number;\n startPlacementPreference: PopperPlacementsT;\n placementOrderPreference: PopperPlacementsT[];\n zIndex: number;\n extraPopperStyles: Record<string, unknown>;\n onClickOutside: (e: MouseEvent | TouchEvent) => void;\n customOffset: [number, number];\n }\n export interface OptionalProps {\n boundaryElement?: HTMLElement;\n portalDOMContainer?: HTMLElement;\n modifiers?: NonNullable<Parameters<typeof usePopper>[2]>['modifiers'];\n }\n export interface RequiredProps {\n children: ReactChildrenComplete;\n referenceElement: HTMLElement;\n showPopover: boolean;\n }\n\n export interface Props\n extends Partial<DefaultProps>,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof OptionalProps | keyof RequiredProps>,\n Omit<XstyledProps, 'zIndex'>,\n RequiredProps {}\n\n export interface InternalProps\n extends DefaultProps,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof OptionalProps | keyof RequiredProps>,\n Omit<XstyledProps, 'zIndex'>,\n RequiredProps {}\n}\n\nconst placementPreferenceArray = [\n 'top-start',\n 'top',\n 'top-end',\n 'right-start',\n 'right',\n 'right-end',\n 'bottom-end',\n 'bottom',\n 'bottom-start',\n 'left-end',\n 'left',\n 'left-start',\n];\nexport const dspopperjsPropTypes = {\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n /**\n * The content of the popper\n */\n children: PropTypes.node.description('The content of the popper').isRequired,\n /**\n * The DOM element that needs to be used as a reference for positioning the popper.\n */\n referenceElement: PropTypes.oneOfType([PropTypes.instanceOf(Element), PropTypes.oneOf([null])]).description(\n 'The DOM element that needs to be used as a reference for positioning the popper.',\n ).isRequired,\n /**\n * Wheter or not to show the popper content\n */\n showPopover: PropTypes.bool.description('whether or not to show the popper content').isRequired,\n /**\n * Callback to close the context menu, used for \"on click outside\",\n * if not provided click outside will not trigger anything\n */\n closeContextMenu: PropTypes.func\n .description(\n 'Callback to close the context menu, used for \"on click outside\",' +\n ' if not provided click outside will not trigger anything',\n )\n .defaultValue('() => {}'),\n /**\n * Wheter or not the popper content should appear in a DOM portal or not\n */\n withoutPortal: PropTypes.bool\n .description('Whether or not the popper content should appear in a DOM portal or not')\n .defaultValue(true),\n /**\n * Wheter or not the popper context menu should print the arrow\n */\n withoutArrow: PropTypes.bool\n .description('Whether or not the popper context menu should print the arrow')\n .defaultValue(false),\n /**\n * Whether or not the popper context menu should be animated\n */\n withoutAnimation: PropTypes.bool\n .description('Whether or not the popper context menu should be animated')\n .defaultValue(false),\n /**\n * Popper context menus Animation duration in ms\n */\n animationDuration: PropTypes.number.description('Popper context menus Animation duration in ms').defaultValue(100),\n /**\n * start placement preferences, as per popperjs placement option\n */\n startPlacementPreference: PropTypes.oneOf(placementPreferenceArray)\n .description('start placement preferences, as per popperjs placement option')\n .defaultValue(\"'top'\"),\n /**\n * Array of placement preferences, as per popperjs \"flip\" placement option\n */\n placementOrderPreference: PropTypes.arrayOf(PropTypes.oneOf(placementPreferenceArray))\n .description('Array of placement preferences, as per popperjs \"flip\" placement option')\n .defaultValue(\"['top', 'bottom', 'left', 'right']\"),\n /**\n * popperjs content z-index\n */\n zIndex: PropTypes.number.description('popperjs content z-index').defaultValue('theme.zIndex.popper'),\n /**\n * placement offset array\n */\n customOffset: PropTypes.arrayOf(PropTypes.number).description('placement offset array').defaultValue('[0,14]'),\n extraPopperStyles: PropTypes.object\n .description('Extra object styles to attach to the popper element')\n .defaultValue({}),\n onClickOutside: PropTypes.func\n .description('Callback triggered when clicking outside the popper')\n .defaultValue(() => null),\n /**\n * Bounding element to calculate upon, defaults to it is \"clippingParents\",\n * which are the scrolling containers that may cause the element to be partially or fully cut off.\n */\n boundaryElement: PropTypes.oneOfType([PropTypes.instanceOf(Element), PropTypes.oneOf([null])]).description(\n 'Bounding element to calculate upon, defaults to \"clippingParents\",' +\n 'which are the scrolling containers that may cause element to be partially or fully cut off',\n ),\n /**\n * When using portal, the container in which to append the DOM content, defaults to document body\n */\n portalDOMContainer: PropTypes.oneOfType([PropTypes.instanceOf(Element), PropTypes.oneOf([null])]).description(\n 'When using portal, the container in which to append the DOM content, defaults to document body',\n ),\n /**\n * modifiers array for full-custom popper-js override\n * https://popper.js.org/docs/v2/modifiers/\n */\n modifiers: PropTypes.array.description(\n 'If you provide the modifiers array for full-custom override in popper.js,' +\n ' it means you are responsible for completely overwriting all the existing modifiers.' +\n ' This includes the modifiers that control \"boundaryElement,\" \"withoutArrow,\" \"placementOrderPreference,\" and \"customOffset\".' +\n 'For more detailed information, please refer to the documentation at https://popper.js.org/docs/v2/modifiers/.',\n ),\n} as WeakValidationMap<unknown>;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACEvB,SAAS,2BAA2B,WAAW,wBAAwB;AA0DvE,MAAM,2BAA2B;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AACO,MAAM,sBAAsB;AAAA,EACjC,GAAG;AAAA,EACH,GAAG;AAAA;AAAA;AAAA;AAAA,EAIH,UAAU,UAAU,KAAK,YAAY,2BAA2B,EAAE;AAAA;AAAA;AAAA;AAAA,EAIlE,kBAAkB,UAAU,UAAU,CAAC,UAAU,WAAW,OAAO,GAAG,UAAU,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;AAAA,IAC9F;AAAA,EACF,EAAE;AAAA;AAAA;AAAA;AAAA,EAIF,aAAa,UAAU,KAAK,YAAY,2CAA2C,EAAE;AAAA;AAAA;AAAA;AAAA;AAAA,EAKrF,kBAAkB,UAAU,KACzB;AAAA,IACC;AAAA,EAEF,EACC,aAAa,UAAU;AAAA;AAAA;AAAA;AAAA,EAI1B,eAAe,UAAU,KACtB,YAAY,wEAAwE,EACpF,aAAa,IAAI;AAAA;AAAA;AAAA;AAAA,EAIpB,cAAc,UAAU,KACrB,YAAY,+DAA+D,EAC3E,aAAa,KAAK;AAAA;AAAA;AAAA;AAAA,EAIrB,kBAAkB,UAAU,KACzB,YAAY,2DAA2D,EACvE,aAAa,KAAK;AAAA;AAAA;AAAA;AAAA,EAIrB,mBAAmB,UAAU,OAAO,YAAY,+CAA+C,EAAE,aAAa,GAAG;AAAA;AAAA;AAAA;AAAA,EAIjH,0BAA0B,UAAU,MAAM,wBAAwB,EAC/D,YAAY,+DAA+D,EAC3E,aAAa,OAAO;AAAA;AAAA;AAAA;AAAA,EAIvB,0BAA0B,UAAU,QAAQ,UAAU,MAAM,wBAAwB,CAAC,EAClF,YAAY,yEAAyE,EACrF,aAAa,oCAAoC;AAAA;AAAA;AAAA;AAAA,EAIpD,QAAQ,UAAU,OAAO,YAAY,0BAA0B,EAAE,aAAa,qBAAqB;AAAA;AAAA;AAAA;AAAA,EAInG,cAAc,UAAU,QAAQ,UAAU,MAAM,EAAE,YAAY,wBAAwB,EAAE,aAAa,QAAQ;AAAA,EAC7G,mBAAmB,UAAU,OAC1B,YAAY,qDAAqD,EACjE,aAAa,CAAC,CAAC;AAAA,EAClB,gBAAgB,UAAU,KACvB,YAAY,qDAAqD,EACjE,aAAa,MAAM,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA,EAK1B,iBAAiB,UAAU,UAAU,CAAC,UAAU,WAAW,OAAO,GAAG,UAAU,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;AAAA,IAC7F;AAAA,EAEF;AAAA;AAAA;AAAA;AAAA,EAIA,oBAAoB,UAAU,UAAU,CAAC,UAAU,WAAW,OAAO,GAAG,UAAU,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;AAAA,IAChG;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA,EAKA,WAAW,UAAU,MAAM;AAAA,IACzB;AAAA,EAIF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -5,7 +5,7 @@ export interface PopoverContentPropsT {
|
|
|
5
5
|
popperStyles: React.CSSProperties;
|
|
6
6
|
arrowStyle: React.CSSProperties;
|
|
7
7
|
popperAttributes: Record<string, string> | undefined;
|
|
8
|
-
children:
|
|
8
|
+
children: ReactChildrenComplete;
|
|
9
9
|
setArrowElement: React.Dispatch<React.SetStateAction<HTMLDivElement | null>>;
|
|
10
10
|
withoutArrow: boolean;
|
|
11
11
|
withoutAnimation: boolean;
|
|
@@ -1,2 +1,18 @@
|
|
|
1
|
-
import type
|
|
2
|
-
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import { usePopper } from 'react-popper';
|
|
3
|
+
import type { DSPopperJST } from '../react-desc-prop-types.js';
|
|
4
|
+
import type { GlobalAttributesT, XstyledProps } from '@elliemae/ds-props-helpers';
|
|
5
|
+
interface UseDSPopperjsRT {
|
|
6
|
+
props: DSPopperJST.InternalProps;
|
|
7
|
+
popperElement: HTMLDivElement | null;
|
|
8
|
+
setIsAnimating: React.Dispatch<React.SetStateAction<boolean>>;
|
|
9
|
+
isAnimating: boolean;
|
|
10
|
+
setPopperElement: React.Dispatch<React.SetStateAction<HTMLDivElement | null>>;
|
|
11
|
+
arrowElement: HTMLDivElement | null;
|
|
12
|
+
setArrowElement: React.Dispatch<React.SetStateAction<HTMLDivElement | null>>;
|
|
13
|
+
popoverHelper: ReturnType<typeof usePopper>;
|
|
14
|
+
globalAttrs: GlobalAttributesT<Element>;
|
|
15
|
+
xStyledAttrs: XstyledProps;
|
|
16
|
+
}
|
|
17
|
+
export declare const useConfigDSPopperjs: (appProps: DSPopperJST.Props) => UseDSPopperjsRT;
|
|
18
|
+
export {};
|
|
@@ -1,9 +1,54 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { DSPopperJST } from '../react-desc-prop-types.js';
|
|
2
2
|
interface UseConfiguredDefaultModifiersT {
|
|
3
|
-
props:
|
|
3
|
+
props: DSPopperJST.Props;
|
|
4
4
|
arrowElement: HTMLDivElement | null;
|
|
5
|
+
defaultProps: Omit<DSPopperJST.DefaultProps, 'zIndex'>;
|
|
5
6
|
}
|
|
6
|
-
export declare const useConfiguredDefaultModifiers: ({ props, arrowElement }: UseConfiguredDefaultModifiersT) => {
|
|
7
|
-
modifiers:
|
|
7
|
+
export declare const useConfiguredDefaultModifiers: ({ props, arrowElement, defaultProps, }: UseConfiguredDefaultModifiersT) => {
|
|
8
|
+
modifiers: readonly Partial<import("@popperjs/core/index.js").Modifier<unknown, object>>[] | ({
|
|
9
|
+
name: string;
|
|
10
|
+
enabled: boolean;
|
|
11
|
+
options?: undefined;
|
|
12
|
+
} | {
|
|
13
|
+
name: string;
|
|
14
|
+
options: {
|
|
15
|
+
fallbackPlacements: DSPopperJST.PopperPlacementsT[];
|
|
16
|
+
offset?: undefined;
|
|
17
|
+
element?: undefined;
|
|
18
|
+
padding?: undefined;
|
|
19
|
+
boundary?: undefined;
|
|
20
|
+
};
|
|
21
|
+
enabled?: undefined;
|
|
22
|
+
} | {
|
|
23
|
+
name: string;
|
|
24
|
+
enabled: boolean;
|
|
25
|
+
options: {
|
|
26
|
+
offset: [number, number];
|
|
27
|
+
fallbackPlacements?: undefined;
|
|
28
|
+
element?: undefined;
|
|
29
|
+
padding?: undefined;
|
|
30
|
+
boundary?: undefined;
|
|
31
|
+
};
|
|
32
|
+
} | {
|
|
33
|
+
name: string;
|
|
34
|
+
options: {
|
|
35
|
+
element: HTMLDivElement | null;
|
|
36
|
+
padding: number;
|
|
37
|
+
fallbackPlacements?: undefined;
|
|
38
|
+
offset?: undefined;
|
|
39
|
+
boundary?: undefined;
|
|
40
|
+
};
|
|
41
|
+
enabled?: undefined;
|
|
42
|
+
} | {
|
|
43
|
+
name: string;
|
|
44
|
+
options: {
|
|
45
|
+
boundary: HTMLElement;
|
|
46
|
+
fallbackPlacements?: undefined;
|
|
47
|
+
offset?: undefined;
|
|
48
|
+
element?: undefined;
|
|
49
|
+
padding?: undefined;
|
|
50
|
+
};
|
|
51
|
+
enabled?: undefined;
|
|
52
|
+
})[];
|
|
8
53
|
};
|
|
9
54
|
export {};
|
|
@@ -1,24 +1,63 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { DSPopperJST } from '../react-desc-prop-types.js';
|
|
2
2
|
interface UseConfiguredDefaultPropsT {
|
|
3
|
-
props:
|
|
3
|
+
props: DSPopperJST.Props;
|
|
4
4
|
arrowElement: HTMLDivElement | null;
|
|
5
5
|
}
|
|
6
6
|
export declare const useConfiguredDefaultProps: ({ props, arrowElement }: Required<UseConfiguredDefaultPropsT>) => {
|
|
7
|
-
modifiers:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
7
|
+
modifiers: readonly Partial<import("@popperjs/core/index.js").Modifier<unknown, object>>[] | ({
|
|
8
|
+
name: string;
|
|
9
|
+
enabled: boolean;
|
|
10
|
+
options?: undefined;
|
|
11
|
+
} | {
|
|
12
|
+
name: string;
|
|
13
|
+
options: {
|
|
14
|
+
fallbackPlacements: DSPopperJST.PopperPlacementsT[];
|
|
15
|
+
offset?: undefined;
|
|
16
|
+
element?: undefined;
|
|
17
|
+
padding?: undefined;
|
|
18
|
+
boundary?: undefined;
|
|
19
|
+
};
|
|
20
|
+
enabled?: undefined;
|
|
21
|
+
} | {
|
|
22
|
+
name: string;
|
|
23
|
+
enabled: boolean;
|
|
24
|
+
options: {
|
|
25
|
+
offset: [number, number];
|
|
26
|
+
fallbackPlacements?: undefined;
|
|
27
|
+
element?: undefined;
|
|
28
|
+
padding?: undefined;
|
|
29
|
+
boundary?: undefined;
|
|
30
|
+
};
|
|
31
|
+
} | {
|
|
32
|
+
name: string;
|
|
33
|
+
options: {
|
|
34
|
+
element: HTMLDivElement | null;
|
|
35
|
+
padding: number;
|
|
36
|
+
fallbackPlacements?: undefined;
|
|
37
|
+
offset?: undefined;
|
|
38
|
+
boundary?: undefined;
|
|
39
|
+
};
|
|
40
|
+
enabled?: undefined;
|
|
41
|
+
} | {
|
|
42
|
+
name: string;
|
|
43
|
+
options: {
|
|
44
|
+
boundary: HTMLElement;
|
|
45
|
+
fallbackPlacements?: undefined;
|
|
46
|
+
offset?: undefined;
|
|
47
|
+
element?: undefined;
|
|
48
|
+
padding?: undefined;
|
|
49
|
+
};
|
|
50
|
+
enabled?: undefined;
|
|
51
|
+
})[];
|
|
52
|
+
animationDuration: number;
|
|
53
|
+
withoutAnimation: boolean;
|
|
54
|
+
withoutArrow: boolean;
|
|
55
|
+
closeContextMenu: () => void;
|
|
56
|
+
withoutPortal: boolean;
|
|
57
|
+
startPlacementPreference: DSPopperJST.PopperPlacementsT;
|
|
58
|
+
placementOrderPreference: DSPopperJST.PopperPlacementsT[];
|
|
59
|
+
extraPopperStyles: Record<string, unknown>;
|
|
60
|
+
onClickOutside: (e: MouseEvent | TouchEvent) => void;
|
|
61
|
+
customOffset: [number, number];
|
|
23
62
|
};
|
|
24
63
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { DSPopperJST } from '../react-desc-prop-types.js';
|
|
2
2
|
interface UseConfiguredMergedPropsT {
|
|
3
|
-
props:
|
|
3
|
+
props: DSPopperJST.Props;
|
|
4
4
|
arrowElement: HTMLDivElement | null;
|
|
5
5
|
}
|
|
6
|
-
export declare const useConfiguredMergedProps: ({ props, arrowElement }: UseConfiguredMergedPropsT) =>
|
|
6
|
+
export declare const useConfiguredMergedProps: ({ props, arrowElement }: UseConfiguredMergedPropsT) => DSPopperJST.InternalProps;
|
|
7
7
|
export {};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type {
|
|
3
|
-
declare const DSPopperJS: React.ComponentType<
|
|
4
|
-
declare const DSPopperJSWithSchema: import("@elliemae/ds-props-helpers/dist/types/propTypes/types.js").DocumentedReactComponent<
|
|
2
|
+
import type { DSPopperJST } from './react-desc-prop-types.js';
|
|
3
|
+
declare const DSPopperJS: React.ComponentType<DSPopperJST.Props>;
|
|
4
|
+
declare const DSPopperJSWithSchema: import("@elliemae/ds-props-helpers/dist/types/propTypes/types.js").DocumentedReactComponent<DSPopperJST.Props>;
|
|
5
5
|
export { DSPopperJS, DSPopperJSWithSchema };
|
|
6
6
|
export default DSPopperJS;
|
|
@@ -1,38 +1,34 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type { WeakValidationMap } from 'react';
|
|
2
2
|
import type { GlobalAttributesT, XstyledProps } from '@elliemae/ds-props-helpers';
|
|
3
3
|
import type { usePopper } from 'react-popper';
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
4
|
+
export declare namespace DSPopperJST {
|
|
5
|
+
type PopperPlacementsT = 'top-start' | 'top' | 'top-end' | 'right-start' | 'right' | 'right-end' | 'bottom-end' | 'bottom' | 'bottom-start' | 'left-end' | 'left' | 'left-start';
|
|
6
|
+
interface DefaultProps {
|
|
7
|
+
closeContextMenu: () => void;
|
|
8
|
+
withoutPortal: boolean;
|
|
9
|
+
withoutArrow: boolean;
|
|
10
|
+
withoutAnimation: boolean;
|
|
11
|
+
animationDuration: number;
|
|
12
|
+
startPlacementPreference: PopperPlacementsT;
|
|
13
|
+
placementOrderPreference: PopperPlacementsT[];
|
|
14
|
+
zIndex: number;
|
|
15
|
+
extraPopperStyles: Record<string, unknown>;
|
|
16
|
+
onClickOutside: (e: MouseEvent | TouchEvent) => void;
|
|
17
|
+
customOffset: [number, number];
|
|
18
|
+
}
|
|
19
|
+
interface OptionalProps {
|
|
20
|
+
boundaryElement?: HTMLElement;
|
|
21
|
+
portalDOMContainer?: HTMLElement;
|
|
22
|
+
modifiers?: NonNullable<Parameters<typeof usePopper>[2]>['modifiers'];
|
|
23
|
+
}
|
|
24
|
+
interface RequiredProps {
|
|
25
|
+
children: ReactChildrenComplete;
|
|
26
|
+
referenceElement: HTMLElement;
|
|
27
|
+
showPopover: boolean;
|
|
28
|
+
}
|
|
29
|
+
interface Props extends Partial<DefaultProps>, OptionalProps, Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof OptionalProps | keyof RequiredProps>, Omit<XstyledProps, 'zIndex'>, RequiredProps {
|
|
30
|
+
}
|
|
31
|
+
interface InternalProps extends DefaultProps, OptionalProps, Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof OptionalProps | keyof RequiredProps>, Omit<XstyledProps, 'zIndex'>, RequiredProps {
|
|
32
|
+
}
|
|
22
33
|
}
|
|
23
|
-
export
|
|
24
|
-
props: Required<UseDSPopperjsPropsArgT>;
|
|
25
|
-
popperElement: HTMLDivElement | null;
|
|
26
|
-
setIsAnimating: React.Dispatch<React.SetStateAction<boolean>>;
|
|
27
|
-
isAnimating: boolean;
|
|
28
|
-
setPopperElement: React.Dispatch<React.SetStateAction<HTMLDivElement | null>>;
|
|
29
|
-
arrowElement: HTMLDivElement | null;
|
|
30
|
-
setArrowElement: React.Dispatch<React.SetStateAction<HTMLDivElement | null>>;
|
|
31
|
-
popoverHelper: ReturnType<typeof usePopper>;
|
|
32
|
-
globalAttrs: GlobalAttributesT<Element>;
|
|
33
|
-
xStyledAttrs: XstyledProps;
|
|
34
|
-
}
|
|
35
|
-
export interface DSDSPopperjsPropsT extends UseDSPopperjsPropsArgT {
|
|
36
|
-
children: JSX.Element | JSX.Element[];
|
|
37
|
-
}
|
|
38
|
-
export declare const dspopperjsPropTypes: React.WeakValidationMap<unknown>;
|
|
34
|
+
export declare const dspopperjsPropTypes: WeakValidationMap<unknown>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-popperjs",
|
|
3
|
-
"version": "3.18.
|
|
3
|
+
"version": "3.18.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Popper JS Wrapper",
|
|
6
6
|
"files": [
|
|
@@ -73,9 +73,9 @@
|
|
|
73
73
|
"dependencies": {
|
|
74
74
|
"@xstyled/system": "~3.7.3",
|
|
75
75
|
"react-popper": "~2.3.0",
|
|
76
|
-
"@elliemae/ds-
|
|
77
|
-
"@elliemae/ds-
|
|
78
|
-
"@elliemae/ds-utilities": "3.18.
|
|
76
|
+
"@elliemae/ds-system": "3.18.1",
|
|
77
|
+
"@elliemae/ds-props-helpers": "3.18.1",
|
|
78
|
+
"@elliemae/ds-utilities": "3.18.1"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
81
|
"styled-components": "~5.3.9"
|