@elliemae/ds-legacy-dropdownmenu 1.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/DSDropdownMenu.js +50 -0
- package/dist/cjs/DSDropdownMenu.js.map +7 -0
- package/dist/cjs/DropdownMenuContext.js +37 -0
- package/dist/cjs/DropdownMenuContext.js.map +7 -0
- package/dist/cjs/DropdownMenuDataTestId.js +42 -0
- package/dist/cjs/DropdownMenuDataTestId.js.map +7 -0
- package/dist/cjs/config/useDropdownMenuConfig.js +114 -0
- package/dist/cjs/config/useDropdownMenuConfig.js.map +7 -0
- package/dist/cjs/config/useReferenceConfig.js +47 -0
- package/dist/cjs/config/useReferenceConfig.js.map +7 -0
- package/dist/cjs/deprecated/CustomPhoneRenderer.js +37 -0
- package/dist/cjs/deprecated/CustomPhoneRenderer.js.map +7 -0
- package/dist/cjs/deprecated/DSDropdownMenu.js +173 -0
- package/dist/cjs/deprecated/DSDropdownMenu.js.map +7 -0
- package/dist/cjs/deprecated/DropdownMenuContext.js +39 -0
- package/dist/cjs/deprecated/DropdownMenuContext.js.map +7 -0
- package/dist/cjs/deprecated/DropdownMenuLoadingIndicator.js +46 -0
- package/dist/cjs/deprecated/DropdownMenuLoadingIndicator.js.map +7 -0
- package/dist/cjs/deprecated/DropdownMenuProvider.js +109 -0
- package/dist/cjs/deprecated/DropdownMenuProvider.js.map +7 -0
- package/dist/cjs/deprecated/DropdownMenuRenderer.js +173 -0
- package/dist/cjs/deprecated/DropdownMenuRenderer.js.map +7 -0
- package/dist/cjs/deprecated/DropdownMenuWrapper.js +41 -0
- package/dist/cjs/deprecated/DropdownMenuWrapper.js.map +7 -0
- package/dist/cjs/deprecated/MenuItemClickableHOC.js +61 -0
- package/dist/cjs/deprecated/MenuItemClickableHOC.js.map +7 -0
- package/dist/cjs/deprecated/MenuItemGroupSelectionHOC.js +59 -0
- package/dist/cjs/deprecated/MenuItemGroupSelectionHOC.js.map +7 -0
- package/dist/cjs/deprecated/decoratedMenuItemFactory.js +49 -0
- package/dist/cjs/deprecated/decoratedMenuItemFactory.js.map +7 -0
- package/dist/cjs/deprecated/index.js +40 -0
- package/dist/cjs/deprecated/index.js.map +7 -0
- package/dist/cjs/exported-related/constants.js +45 -0
- package/dist/cjs/exported-related/constants.js.map +7 -0
- package/dist/cjs/exported-related/index.js +30 -0
- package/dist/cjs/exported-related/index.js.map +7 -0
- package/dist/cjs/hooks/index.js +32 -0
- package/dist/cjs/hooks/index.js.map +7 -0
- package/dist/cjs/hooks/useAutofocusContainerOnOpen.js +49 -0
- package/dist/cjs/hooks/useAutofocusContainerOnOpen.js.map +7 -0
- package/dist/cjs/hooks/useDropdownListboxHandlers.js +126 -0
- package/dist/cjs/hooks/useDropdownListboxHandlers.js.map +7 -0
- package/dist/cjs/hooks/useDropdownMenuItemHandlers.js +128 -0
- package/dist/cjs/hooks/useDropdownMenuItemHandlers.js.map +7 -0
- package/dist/cjs/hooks/useGetOptionSpecialAttributes.js +47 -0
- package/dist/cjs/hooks/useGetOptionSpecialAttributes.js.map +7 -0
- package/dist/cjs/index.js +46 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/package.json +7 -0
- package/dist/cjs/parts/DropdownMenuContent.js +100 -0
- package/dist/cjs/parts/DropdownMenuContent.js.map +7 -0
- package/dist/cjs/parts/DropdownMenuEmptyState.js +38 -0
- package/dist/cjs/parts/DropdownMenuEmptyState.js.map +7 -0
- package/dist/cjs/parts/DropdownMenuItemFactory.js +106 -0
- package/dist/cjs/parts/DropdownMenuItemFactory.js.map +7 -0
- package/dist/cjs/parts/DropdownMenuListBox.js +135 -0
- package/dist/cjs/parts/DropdownMenuListBox.js.map +7 -0
- package/dist/cjs/parts/DropdownMenuLoading.js +73 -0
- package/dist/cjs/parts/DropdownMenuLoading.js.map +7 -0
- package/dist/cjs/parts/DropdownMenuSkeleton.js +42 -0
- package/dist/cjs/parts/DropdownMenuSkeleton.js.map +7 -0
- package/dist/cjs/react-desc-prop-types.js +129 -0
- package/dist/cjs/react-desc-prop-types.js.map +7 -0
- package/dist/cjs/styled.js +120 -0
- package/dist/cjs/styled.js.map +7 -0
- package/dist/cjs/utils/findInCircularList.js +42 -0
- package/dist/cjs/utils/findInCircularList.js.map +7 -0
- package/dist/cjs/utils/index.js +32 -0
- package/dist/cjs/utils/index.js.map +7 -0
- package/dist/cjs/utils/isOptionFocuseable.js +36 -0
- package/dist/cjs/utils/isOptionFocuseable.js.map +7 -0
- package/dist/cjs/utils/manageOpenedSubmenus.js +67 -0
- package/dist/cjs/utils/manageOpenedSubmenus.js.map +7 -0
- package/dist/esm/DSDropdownMenu.js +20 -0
- package/dist/esm/DSDropdownMenu.js.map +7 -0
- package/dist/esm/DropdownMenuContext.js +7 -0
- package/dist/esm/DropdownMenuContext.js.map +7 -0
- package/dist/esm/DropdownMenuDataTestId.js +12 -0
- package/dist/esm/DropdownMenuDataTestId.js.map +7 -0
- package/dist/esm/config/useDropdownMenuConfig.js +84 -0
- package/dist/esm/config/useDropdownMenuConfig.js.map +7 -0
- package/dist/esm/config/useReferenceConfig.js +17 -0
- package/dist/esm/config/useReferenceConfig.js.map +7 -0
- package/dist/esm/deprecated/CustomPhoneRenderer.js +7 -0
- package/dist/esm/deprecated/CustomPhoneRenderer.js.map +7 -0
- package/dist/esm/deprecated/DSDropdownMenu.js +143 -0
- package/dist/esm/deprecated/DSDropdownMenu.js.map +7 -0
- package/dist/esm/deprecated/DropdownMenuContext.js +9 -0
- package/dist/esm/deprecated/DropdownMenuContext.js.map +7 -0
- package/dist/esm/deprecated/DropdownMenuLoadingIndicator.js +16 -0
- package/dist/esm/deprecated/DropdownMenuLoadingIndicator.js.map +7 -0
- package/dist/esm/deprecated/DropdownMenuProvider.js +79 -0
- package/dist/esm/deprecated/DropdownMenuProvider.js.map +7 -0
- package/dist/esm/deprecated/DropdownMenuRenderer.js +143 -0
- package/dist/esm/deprecated/DropdownMenuRenderer.js.map +7 -0
- package/dist/esm/deprecated/DropdownMenuWrapper.js +11 -0
- package/dist/esm/deprecated/DropdownMenuWrapper.js.map +7 -0
- package/dist/esm/deprecated/MenuItemClickableHOC.js +31 -0
- package/dist/esm/deprecated/MenuItemClickableHOC.js.map +7 -0
- package/dist/esm/deprecated/MenuItemGroupSelectionHOC.js +29 -0
- package/dist/esm/deprecated/MenuItemGroupSelectionHOC.js.map +7 -0
- package/dist/esm/deprecated/decoratedMenuItemFactory.js +19 -0
- package/dist/esm/deprecated/decoratedMenuItemFactory.js.map +7 -0
- package/dist/esm/deprecated/index.js +10 -0
- package/dist/esm/deprecated/index.js.map +7 -0
- package/dist/esm/exported-related/constants.js +15 -0
- package/dist/esm/exported-related/constants.js.map +7 -0
- package/dist/esm/exported-related/index.js +3 -0
- package/dist/esm/exported-related/index.js.map +7 -0
- package/dist/esm/hooks/index.js +5 -0
- package/dist/esm/hooks/index.js.map +7 -0
- package/dist/esm/hooks/useAutofocusContainerOnOpen.js +19 -0
- package/dist/esm/hooks/useAutofocusContainerOnOpen.js.map +7 -0
- package/dist/esm/hooks/useDropdownListboxHandlers.js +96 -0
- package/dist/esm/hooks/useDropdownListboxHandlers.js.map +7 -0
- package/dist/esm/hooks/useDropdownMenuItemHandlers.js +98 -0
- package/dist/esm/hooks/useDropdownMenuItemHandlers.js.map +7 -0
- package/dist/esm/hooks/useGetOptionSpecialAttributes.js +17 -0
- package/dist/esm/hooks/useGetOptionSpecialAttributes.js.map +7 -0
- package/dist/esm/index.js +15 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/package.json +7 -0
- package/dist/esm/parts/DropdownMenuContent.js +70 -0
- package/dist/esm/parts/DropdownMenuContent.js.map +7 -0
- package/dist/esm/parts/DropdownMenuEmptyState.js +8 -0
- package/dist/esm/parts/DropdownMenuEmptyState.js.map +7 -0
- package/dist/esm/parts/DropdownMenuItemFactory.js +85 -0
- package/dist/esm/parts/DropdownMenuItemFactory.js.map +7 -0
- package/dist/esm/parts/DropdownMenuListBox.js +105 -0
- package/dist/esm/parts/DropdownMenuListBox.js.map +7 -0
- package/dist/esm/parts/DropdownMenuLoading.js +43 -0
- package/dist/esm/parts/DropdownMenuLoading.js.map +7 -0
- package/dist/esm/parts/DropdownMenuSkeleton.js +12 -0
- package/dist/esm/parts/DropdownMenuSkeleton.js.map +7 -0
- package/dist/esm/react-desc-prop-types.js +102 -0
- package/dist/esm/react-desc-prop-types.js.map +7 -0
- package/dist/esm/styled.js +90 -0
- package/dist/esm/styled.js.map +7 -0
- package/dist/esm/utils/findInCircularList.js +12 -0
- package/dist/esm/utils/findInCircularList.js.map +7 -0
- package/dist/esm/utils/index.js +5 -0
- package/dist/esm/utils/index.js.map +7 -0
- package/dist/esm/utils/isOptionFocuseable.js +6 -0
- package/dist/esm/utils/isOptionFocuseable.js.map +7 -0
- package/dist/esm/utils/manageOpenedSubmenus.js +37 -0
- package/dist/esm/utils/manageOpenedSubmenus.js.map +7 -0
- package/dist/types/DSDropdownMenu.d.ts +5 -0
- package/dist/types/DropdownMenuContext.d.ts +3 -0
- package/dist/types/DropdownMenuDataTestId.d.ts +7 -0
- package/dist/types/config/useDropdownMenuConfig.d.ts +2 -0
- package/dist/types/config/useReferenceConfig.d.ts +7 -0
- package/dist/types/deprecated/CustomPhoneRenderer.d.ts +2 -0
- package/dist/types/deprecated/DSDropdownMenu.d.ts +110 -0
- package/dist/types/deprecated/DropdownMenuContext.d.ts +4 -0
- package/dist/types/deprecated/DropdownMenuLoadingIndicator.d.ts +3 -0
- package/dist/types/deprecated/DropdownMenuProvider.d.ts +12 -0
- package/dist/types/deprecated/DropdownMenuRenderer.d.ts +28 -0
- package/dist/types/deprecated/DropdownMenuWrapper.d.ts +3 -0
- package/dist/types/deprecated/MenuItemClickableHOC.d.ts +6 -0
- package/dist/types/deprecated/MenuItemGroupSelectionHOC.d.ts +6 -0
- package/dist/types/deprecated/decoratedMenuItemFactory.d.ts +2 -0
- package/dist/types/deprecated/index.d.ts +2 -0
- package/dist/types/exported-related/constants.d.ts +9 -0
- package/dist/types/exported-related/index.d.ts +1 -0
- package/dist/types/hooks/index.d.ts +3 -0
- package/dist/types/hooks/useAutofocusContainerOnOpen.d.ts +1 -0
- package/dist/types/hooks/useDropdownListboxHandlers.d.ts +8 -0
- package/dist/types/hooks/useDropdownMenuItemHandlers.d.ts +12 -0
- package/dist/types/hooks/useGetOptionSpecialAttributes.d.ts +3 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/parts/DropdownMenuContent.d.ts +2 -0
- package/dist/types/parts/DropdownMenuEmptyState.d.ts +8 -0
- package/dist/types/parts/DropdownMenuItemFactory.d.ts +8 -0
- package/dist/types/parts/DropdownMenuListBox.d.ts +2 -0
- package/dist/types/parts/DropdownMenuLoading.d.ts +2 -0
- package/dist/types/parts/DropdownMenuSkeleton.d.ts +1 -0
- package/dist/types/react-desc-prop-types.d.ts +120 -0
- package/dist/types/styled.d.ts +20 -0
- package/dist/types/tests/DSDropdownMenuV2.keyboardEvents.test.d.ts +1 -0
- package/dist/types/tests/DSDropdownMenuV2.pointerEvents.test.d.ts +1 -0
- package/dist/types/utils/findInCircularList.d.ts +1 -0
- package/dist/types/utils/index.d.ts +3 -0
- package/dist/types/utils/isOptionFocuseable.d.ts +2 -0
- package/dist/types/utils/manageOpenedSubmenus.d.ts +2 -0
- package/package.json +93 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
3
|
+
import { useVirtual } from "react-virtual";
|
|
4
|
+
import { useMemoMergePropsWithDefault, useValidateTypescriptPropTypes } from "@elliemae/ds-legacy-props-helpers";
|
|
5
|
+
import { defaultProps, DSDropdownMenuV2PropTypes } from "../react-desc-prop-types.js";
|
|
6
|
+
import { useReferenceConfig } from "./useReferenceConfig.js";
|
|
7
|
+
import { isOptionFocuseable } from "../utils/index.js";
|
|
8
|
+
import { DSDropdownMenuName } from "../exported-related/index.js";
|
|
9
|
+
const estimateSize = () => 32;
|
|
10
|
+
const useDropdownMenuConfig = (props, self) => {
|
|
11
|
+
const propsWithDefault = useMemoMergePropsWithDefault(props, defaultProps);
|
|
12
|
+
useValidateTypescriptPropTypes(propsWithDefault, DSDropdownMenuV2PropTypes, DSDropdownMenuName);
|
|
13
|
+
const { options, inputValue, isOpened, actionRef } = propsWithDefault;
|
|
14
|
+
const { triggerReferenceElement, setTriggerReferenceElement, listboxReference, inputReference } = useReferenceConfig();
|
|
15
|
+
const [activeDescendant, setActiveDescendant] = useState(options.find(isOptionFocuseable)?.dsId ?? "");
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
if (isOpened) {
|
|
18
|
+
setActiveDescendant(options.find(isOptionFocuseable)?.dsId ?? "");
|
|
19
|
+
}
|
|
20
|
+
}, [isOpened, inputValue]);
|
|
21
|
+
const virtualListHelpers = useVirtual({
|
|
22
|
+
size: options.length,
|
|
23
|
+
parentRef: listboxReference,
|
|
24
|
+
overscan: 15,
|
|
25
|
+
paddingStart: 0,
|
|
26
|
+
estimateSize
|
|
27
|
+
});
|
|
28
|
+
const { scrollToIndex } = virtualListHelpers;
|
|
29
|
+
const scrollToIndexInternal = useCallback(
|
|
30
|
+
(index, opts) => {
|
|
31
|
+
scrollToIndex(index, opts);
|
|
32
|
+
window.requestAnimationFrame(() => {
|
|
33
|
+
scrollToIndex(index, opts);
|
|
34
|
+
});
|
|
35
|
+
},
|
|
36
|
+
[scrollToIndex]
|
|
37
|
+
);
|
|
38
|
+
const scrollOptionIntoView = useCallback(
|
|
39
|
+
(dsId, opts = { align: "center" }) => {
|
|
40
|
+
const optionIndex = options.findIndex((opt) => opt.dsId === dsId);
|
|
41
|
+
scrollToIndexInternal(optionIndex, opts);
|
|
42
|
+
},
|
|
43
|
+
[options, scrollToIndexInternal]
|
|
44
|
+
);
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
if (actionRef?.current) {
|
|
47
|
+
actionRef.current = {
|
|
48
|
+
setActiveDescendant,
|
|
49
|
+
scrollOptionIntoView,
|
|
50
|
+
scrollToIndex: scrollToIndexInternal
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
}, [actionRef, scrollOptionIntoView, scrollToIndexInternal]);
|
|
54
|
+
const ctx = useMemo(
|
|
55
|
+
() => ({
|
|
56
|
+
props: propsWithDefault,
|
|
57
|
+
virtualListHelpers,
|
|
58
|
+
triggerReferenceElement,
|
|
59
|
+
setTriggerReferenceElement,
|
|
60
|
+
listboxReference,
|
|
61
|
+
inputReference,
|
|
62
|
+
activeDescendant,
|
|
63
|
+
setActiveDescendant,
|
|
64
|
+
scrollOptionIntoView,
|
|
65
|
+
DSDropdownMenuV2: self
|
|
66
|
+
}),
|
|
67
|
+
[
|
|
68
|
+
propsWithDefault,
|
|
69
|
+
virtualListHelpers,
|
|
70
|
+
triggerReferenceElement,
|
|
71
|
+
setTriggerReferenceElement,
|
|
72
|
+
listboxReference,
|
|
73
|
+
inputReference,
|
|
74
|
+
activeDescendant,
|
|
75
|
+
scrollOptionIntoView,
|
|
76
|
+
self
|
|
77
|
+
]
|
|
78
|
+
);
|
|
79
|
+
return ctx;
|
|
80
|
+
};
|
|
81
|
+
export {
|
|
82
|
+
useDropdownMenuConfig
|
|
83
|
+
};
|
|
84
|
+
//# sourceMappingURL=useDropdownMenuConfig.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/useDropdownMenuConfig.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useCallback, useEffect, useMemo, useState } from 'react';\nimport { type ScrollToIndexOptions, useVirtual } from 'react-virtual';\nimport { useMemoMergePropsWithDefault, useValidateTypescriptPropTypes } from '@elliemae/ds-legacy-props-helpers';\nimport type { DSDropdownMenuT } from '../react-desc-prop-types.js';\nimport { defaultProps, DSDropdownMenuV2PropTypes } from '../react-desc-prop-types.js';\nimport { useReferenceConfig } from './useReferenceConfig.js';\nimport { isOptionFocuseable } from '../utils/index.js';\nimport { DSDropdownMenuName } from '../exported-related/index.js';\n\nconst estimateSize = () => 32;\n\nexport const useDropdownMenuConfig = (\n props: DSDropdownMenuT.Props,\n self: React.ComponentType<DSDropdownMenuT.Props>,\n): DSDropdownMenuT.CTX => {\n const propsWithDefault = useMemoMergePropsWithDefault<DSDropdownMenuT.InternalProps>(props, defaultProps);\n useValidateTypescriptPropTypes(propsWithDefault, DSDropdownMenuV2PropTypes, DSDropdownMenuName);\n\n const { options, inputValue, isOpened, actionRef } = propsWithDefault;\n\n const { triggerReferenceElement, setTriggerReferenceElement, listboxReference, inputReference } =\n useReferenceConfig();\n\n const [activeDescendant, setActiveDescendant] = useState<string>(options.find(isOptionFocuseable)?.dsId ?? '');\n\n // ---------------------------------------------------------------------------\n // Focusing first option when dropdown opens or input changes\n // ---------------------------------------------------------------------------\n useEffect(() => {\n if (isOpened) {\n setActiveDescendant(options.find(isOptionFocuseable)?.dsId ?? '');\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isOpened, inputValue]);\n\n // ===========================================================================\n // Virtualization setup\n // ===========================================================================\n const virtualListHelpers = useVirtual({\n size: options.length,\n parentRef: listboxReference,\n overscan: 15,\n paddingStart: 0,\n estimateSize,\n });\n\n const { scrollToIndex } = virtualListHelpers;\n\n // ===========================================================================\n // Scroll to index function\n // ===========================================================================\n const scrollToIndexInternal = useCallback(\n (index: number, opts?: ScrollToIndexOptions) => {\n // Since we could have dynamic sizing on the options, scrolling to an index may not work correctly sometimes.\n // This is a workaround to ensure that the option is scrolled into view.\n // More info -> https://github.com/TanStack/virtual/issues/381\n scrollToIndex(index, opts);\n window.requestAnimationFrame(() => {\n scrollToIndex(index, opts);\n });\n },\n [scrollToIndex],\n );\n\n // ===========================================================================\n // Scroll into view function\n // ===========================================================================\n const scrollOptionIntoView = useCallback(\n (dsId: string, opts: { align: 'start' | 'center' | 'end' | 'auto' } = { align: 'center' }) => {\n const optionIndex = options.findIndex((opt) => opt.dsId === dsId);\n scrollToIndexInternal(optionIndex, opts);\n },\n [options, scrollToIndexInternal],\n );\n\n // ===========================================================================\n // Action ref setup\n // ===========================================================================\n useEffect(() => {\n if (actionRef?.current) {\n actionRef.current = {\n setActiveDescendant,\n scrollOptionIntoView,\n scrollToIndex: scrollToIndexInternal,\n };\n }\n }, [actionRef, scrollOptionIntoView, scrollToIndexInternal]);\n\n // ===========================================================================\n // Context setup\n // ===========================================================================\n const ctx = useMemo(\n () => ({\n props: propsWithDefault,\n virtualListHelpers,\n triggerReferenceElement,\n setTriggerReferenceElement,\n listboxReference,\n inputReference,\n activeDescendant,\n setActiveDescendant,\n scrollOptionIntoView,\n DSDropdownMenuV2: self,\n }),\n [\n propsWithDefault,\n virtualListHelpers,\n triggerReferenceElement,\n setTriggerReferenceElement,\n listboxReference,\n inputReference,\n activeDescendant,\n scrollOptionIntoView,\n self,\n ],\n );\n\n return ctx;\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,aAAa,WAAW,SAAS,gBAAgB;AAC1D,SAAoC,kBAAkB;AACtD,SAAS,8BAA8B,sCAAsC;AAE7E,SAAS,cAAc,iCAAiC;AACxD,SAAS,0BAA0B;AACnC,SAAS,0BAA0B;AACnC,SAAS,0BAA0B;AAEnC,MAAM,eAAe,MAAM;AAEpB,MAAM,wBAAwB,CACnC,OACA,SACwB;AACxB,QAAM,mBAAmB,6BAA4D,OAAO,YAAY;AACxG,iCAA+B,kBAAkB,2BAA2B,kBAAkB;AAE9F,QAAM,EAAE,SAAS,YAAY,UAAU,UAAU,IAAI;AAErD,QAAM,EAAE,yBAAyB,4BAA4B,kBAAkB,eAAe,IAC5F,mBAAmB;AAErB,QAAM,CAAC,kBAAkB,mBAAmB,IAAI,SAAiB,QAAQ,KAAK,kBAAkB,GAAG,QAAQ,EAAE;AAK7G,YAAU,MAAM;AACd,QAAI,UAAU;AACZ,0BAAoB,QAAQ,K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import * as React from "react";
|
|
2
|
+
import { useRef, useState } from "react";
|
|
3
|
+
const useReferenceConfig = () => {
|
|
4
|
+
const [triggerReferenceElement, setTriggerReferenceElement] = useState(null);
|
|
5
|
+
const listboxReference = useRef(null);
|
|
6
|
+
const inputReference = useRef(null);
|
|
7
|
+
return {
|
|
8
|
+
triggerReferenceElement,
|
|
9
|
+
setTriggerReferenceElement,
|
|
10
|
+
listboxReference,
|
|
11
|
+
inputReference
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
useReferenceConfig
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=useReferenceConfig.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/useReferenceConfig.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useRef, useState } from 'react';\n\nexport const useReferenceConfig = () => {\n const [triggerReferenceElement, setTriggerReferenceElement] = useState<HTMLDivElement | null>(null);\n\n const listboxReference = useRef<HTMLDivElement>(null);\n const inputReference = useRef<HTMLInputElement>(null);\n\n return {\n triggerReferenceElement,\n setTriggerReferenceElement,\n listboxReference,\n inputReference,\n };\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,QAAQ,gBAAgB;AAE1B,MAAM,qBAAqB,MAAM;AACtC,QAAM,CAAC,yBAAyB,0BAA0B,IAAI,SAAgC,IAAI;AAElG,QAAM,mBAAmB,OAAuB,IAAI;AACpD,QAAM,iBAAiB,OAAyB,IAAI;AAEpD,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { aggregatedClasses } from "@elliemae/ds-legacy-classnames";
|
|
3
|
+
const CustomPhoneRenderer = aggregatedClasses("div")("menu-item", "custom-phone-render");
|
|
4
|
+
export {
|
|
5
|
+
CustomPhoneRenderer
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=CustomPhoneRenderer.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/deprecated/CustomPhoneRenderer.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "// @ts-nocheck\nimport { aggregatedClasses } from '@elliemae/ds-legacy-classnames';\n\nexport const CustomPhoneRenderer = aggregatedClasses('div')('menu-item', 'custom-phone-render');\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,yBAAyB;AAE3B,MAAM,sBAAsB,kBAAkB,KAAK,EAAE,aAAa,qBAAqB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useDeprecateComponent } from "@elliemae/ds-legacy-utilities";
|
|
4
|
+
import { PropTypes, describe } from "@elliemae/ds-legacy-props-helpers";
|
|
5
|
+
import { TooltipTextProvider } from "@elliemae/ds-legacy-truncated-tooltip-text";
|
|
6
|
+
import { positions, PopperPositions, interactions, PopperInteractions } from "@elliemae/ds-legacy-popper";
|
|
7
|
+
import { DropdownMenuWrapper } from "./DropdownMenuWrapper.js";
|
|
8
|
+
const noop = () => null;
|
|
9
|
+
const DSDropdownMenu = ({
|
|
10
|
+
containerProps = {},
|
|
11
|
+
className = "",
|
|
12
|
+
contentStyle = null,
|
|
13
|
+
options = [],
|
|
14
|
+
onSelectMenuItem = noop,
|
|
15
|
+
onOpenMenu = noop,
|
|
16
|
+
onClickOutsideMenu = noop,
|
|
17
|
+
preventOverflow = "viewport",
|
|
18
|
+
placement = PopperPositions.BOTTOM_START,
|
|
19
|
+
interactionType = PopperInteractions.CLICK,
|
|
20
|
+
triggerComponent = noop,
|
|
21
|
+
customMenu = null,
|
|
22
|
+
isOpen = void 0,
|
|
23
|
+
selection = {},
|
|
24
|
+
menuProps = {},
|
|
25
|
+
referenceNode = void 0,
|
|
26
|
+
focusOnOpen = false,
|
|
27
|
+
onClose = noop,
|
|
28
|
+
itemsRenderer = void 0,
|
|
29
|
+
responsiveHeight = false,
|
|
30
|
+
singleGroupSelection = false,
|
|
31
|
+
onSelectChange = noop,
|
|
32
|
+
minWidth = void 0,
|
|
33
|
+
maxWidth = void 0,
|
|
34
|
+
zIndex,
|
|
35
|
+
type,
|
|
36
|
+
loading = false,
|
|
37
|
+
hideIfNotVisible
|
|
38
|
+
}) => {
|
|
39
|
+
useDeprecateComponent({ componentName: "ds-dropdown-menu", version: "3.x Date: 2023 Q3" });
|
|
40
|
+
return /* @__PURE__ */ jsx(TooltipTextProvider, { children: /* @__PURE__ */ jsx(
|
|
41
|
+
DropdownMenuWrapper,
|
|
42
|
+
{
|
|
43
|
+
hideIfNotVisible,
|
|
44
|
+
className,
|
|
45
|
+
containerProps,
|
|
46
|
+
contentStyle,
|
|
47
|
+
customMenu,
|
|
48
|
+
focusOnOpen,
|
|
49
|
+
interactionType,
|
|
50
|
+
isOpen,
|
|
51
|
+
itemsRenderer,
|
|
52
|
+
maxWidth,
|
|
53
|
+
menuProps,
|
|
54
|
+
minWidth,
|
|
55
|
+
onClickOutsideMenu,
|
|
56
|
+
onClose,
|
|
57
|
+
onOpenMenu,
|
|
58
|
+
onSelectChange,
|
|
59
|
+
onSelectMenuItem,
|
|
60
|
+
options,
|
|
61
|
+
placement,
|
|
62
|
+
preventOverflow,
|
|
63
|
+
referenceNode,
|
|
64
|
+
responsiveHeight,
|
|
65
|
+
selection,
|
|
66
|
+
singleGroupSelection,
|
|
67
|
+
triggerComponent,
|
|
68
|
+
type,
|
|
69
|
+
zIndex,
|
|
70
|
+
loading
|
|
71
|
+
}
|
|
72
|
+
) });
|
|
73
|
+
};
|
|
74
|
+
const dropdownMenuProps = {
|
|
75
|
+
hideIfNotVisible: PropTypes.bool.description("Hide menu component if trigger component is not visible/scrolled away"),
|
|
76
|
+
containerProps: PropTypes.shape({}).description("Set of Properties attached to the main container"),
|
|
77
|
+
contentStyle: PropTypes.shape({}).description("Object style passed to the menu"),
|
|
78
|
+
options: PropTypes.arrayOf(
|
|
79
|
+
PropTypes.shape({
|
|
80
|
+
type: PropTypes.string,
|
|
81
|
+
id: PropTypes.string,
|
|
82
|
+
label: PropTypes.string,
|
|
83
|
+
onClick: PropTypes.func,
|
|
84
|
+
leftAddon: PropTypes.element,
|
|
85
|
+
rightAddon: PropTypes.element,
|
|
86
|
+
rightAddonType: PropTypes.oneOf(["ellipsis"])
|
|
87
|
+
})
|
|
88
|
+
).description("Options items for the dropdown menu. Check menu item types"),
|
|
89
|
+
onSelectMenuItem: PropTypes.func.description("Handler when user clicks on a menu item"),
|
|
90
|
+
onOpenMenu: PropTypes.func.description("Handler when the menu shows up"),
|
|
91
|
+
/** Handler when user clicks outside the menu */
|
|
92
|
+
onClickOutsideMenu: PropTypes.func.description("Handler when user clicks outside the menu"),
|
|
93
|
+
/** Prevent to move the menu outside of the container defined when interacting with the page */
|
|
94
|
+
preventOverflow: PropTypes.oneOf(["viewport", "scrollParent", "window"]).description(
|
|
95
|
+
"Prevent to move the menu outside of the container defined when interacting with the page"
|
|
96
|
+
),
|
|
97
|
+
/** Menu placement */
|
|
98
|
+
placement: PropTypes.oneOf(positions).description("Menu placement"),
|
|
99
|
+
/** How to open the menu with click, hover */
|
|
100
|
+
interactionType: PropTypes.oneOf(interactions).description("How to open the menu with click, hover"),
|
|
101
|
+
/** The component that is going to open / close the menu */
|
|
102
|
+
triggerComponent: PropTypes.element.description("The component that is going to open / close the menu"),
|
|
103
|
+
/** Custom menu component */
|
|
104
|
+
customMenu: PropTypes.element.description("Custom menu component"),
|
|
105
|
+
/** Whether the menu is open or not */
|
|
106
|
+
isOpen: PropTypes.bool.description("Whether the menu is open or not"),
|
|
107
|
+
/** Selection state. Ex: { [itemId]: '{bool}', [idMultiSelectionItem]: '{string}' } */
|
|
108
|
+
selection: PropTypes.shape({}).description(
|
|
109
|
+
"Selection state. Ex: { [itemId]: {bool}, [idMultiSelectionItem]: {string} }"
|
|
110
|
+
),
|
|
111
|
+
/** Props object passed to the menu component */
|
|
112
|
+
menuProps: PropTypes.shape({}).description("Props object passed to the menu component"),
|
|
113
|
+
/** Customize the items render */
|
|
114
|
+
itemsRenderer: PropTypes.func.description("Customize the items render"),
|
|
115
|
+
/** Customize menu format. Can be undefined or 'phone' */
|
|
116
|
+
type: PropTypes.string.description('Customize menu format. Can be undefined or "phone"'),
|
|
117
|
+
/** Customize menu minWidth. Can be undefined or 'number' */
|
|
118
|
+
minWidth: PropTypes.number.description('Customize menu minWidth. Can be undefined or "number"'),
|
|
119
|
+
/** Customize menu maxWidth. Can be undefined or 'number' */
|
|
120
|
+
maxWidth: PropTypes.number.description('Customize menu maxWidth. Can be undefined or "number"'),
|
|
121
|
+
/** Make the menu responsive, it uses a margin of 120 px */
|
|
122
|
+
responsiveHeight: PropTypes.bool.description("Make the menu responsive, it uses a margin of 120 px"),
|
|
123
|
+
/** Customize menu zIndex. Can be undefined or 'number' */
|
|
124
|
+
zIndex: PropTypes.number.description('Customize menu zIndex. Can be undefined or "number"'),
|
|
125
|
+
className: PropTypes.string.description("html class attribute"),
|
|
126
|
+
focusOnOpen: PropTypes.bool.description("focus element on open or not").defaultValue(true),
|
|
127
|
+
loading: PropTypes.bool.description("is loading content or not").defaultValue(false),
|
|
128
|
+
referenceNode: PropTypes.any.description("reference node"),
|
|
129
|
+
onClose: PropTypes.func.description("function called on close mene"),
|
|
130
|
+
onSelectChange: PropTypes.func.description("function called when selection changes"),
|
|
131
|
+
singleGroupSelection: PropTypes.bool.description("select items in same group or not")
|
|
132
|
+
};
|
|
133
|
+
DSDropdownMenu.propTypes = dropdownMenuProps;
|
|
134
|
+
DSDropdownMenu.displayName = "DSDropdownMenu";
|
|
135
|
+
const DropdownMenuWithSchema = describe(DSDropdownMenu);
|
|
136
|
+
DropdownMenuWithSchema.propTypes = dropdownMenuProps;
|
|
137
|
+
var DSDropdownMenu_default = DSDropdownMenu;
|
|
138
|
+
export {
|
|
139
|
+
DSDropdownMenu,
|
|
140
|
+
DropdownMenuWithSchema,
|
|
141
|
+
DSDropdownMenu_default as default
|
|
142
|
+
};
|
|
143
|
+
//# sourceMappingURL=DSDropdownMenu.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/deprecated/DSDropdownMenu.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "// @ts-nocheck\n/* eslint-disable max-lines */\nimport React from 'react';\nimport { useDeprecateComponent } from '@elliemae/ds-legacy-utilities';\nimport { PropTypes, describe } from '@elliemae/ds-legacy-props-helpers';\nimport { TooltipTextProvider } from '@elliemae/ds-legacy-truncated-tooltip-text';\n// todo: docgen handlers at the moment don't get data from alias\nimport { positions, PopperPositions, interactions, PopperInteractions } from '@elliemae/ds-legacy-popper';\nimport { DropdownMenuWrapper } from './DropdownMenuWrapper.js';\n\nconst noop = () => null;\n\nconst DSDropdownMenu = ({\n containerProps = {},\n className = '',\n contentStyle = null,\n options = [],\n onSelectMenuItem = noop,\n onOpenMenu = noop,\n onClickOutsideMenu = noop,\n preventOverflow = 'viewport',\n placement = PopperPositions.BOTTOM_START,\n interactionType = PopperInteractions.CLICK,\n triggerComponent = noop,\n customMenu = null,\n isOpen = undefined,\n selection = {},\n menuProps = {},\n referenceNode = undefined,\n focusOnOpen = false,\n onClose = noop,\n itemsRenderer = undefined,\n responsiveHeight = false,\n singleGroupSelection = false,\n onSelectChange = noop,\n minWidth = undefined,\n maxWidth = undefined,\n zIndex,\n type,\n loading = false,\n hideIfNotVisible,\n}) => {\n useDeprecateComponent({ componentName: 'ds-dropdown-menu', version: '3.x Date: 2023 Q3' });\n\n return (\n <TooltipTextProvider>\n <DropdownMenuWrapper\n hideIfNotVisible={hideIfNotVisible}\n className={className}\n containerProps={containerProps}\n contentStyle={contentStyle}\n customMenu={customMenu}\n focusOnOpen={focusOnOpen}\n interactionType={interactionType}\n isOpen={isOpen}\n itemsRenderer={itemsRenderer}\n maxWidth={maxWidth}\n menuProps={menuProps}\n minWidth={minWidth}\n onClickOutsideMenu={onClickOutsideMenu}\n onClose={onClose}\n onOpenMenu={onOpenMenu}\n onSelectChange={onSelectChange}\n onSelectMenuItem={onSelectMenuItem}\n options={options}\n placement={placement}\n preventOverflow={preventOverflow}\n referenceNode={referenceNode}\n responsiveHeight={responsiveHeight}\n selection={selection}\n singleGroupSelection={singleGroupSelection}\n triggerComponent={triggerComponent}\n type={type}\n zIndex={zIndex}\n loading={loading}\n />\n </TooltipTextProvider>\n );\n};\n\nconst dropdownMenuProps = {\n hideIfNotVisible: PropTypes.bool.description('Hide menu component if trigger component is not visible/scrolled away'),\n containerProps: PropTypes.shape({}).description('Set of Properties attached to the main container'),\n contentStyle: PropTypes.shape({}).description('Object style passed to the menu'),\n options: PropTypes.arrayOf(\n PropTypes.shape({\n type: PropTypes.string,\n id: PropTypes.string,\n label: PropTypes.string,\n onClick: PropTypes.func,\n leftAddon: PropTypes.element,\n rightAddon: PropTypes.element,\n rightAddonType: PropTypes.oneOf(['ellipsis']),\n }),\n ).description('Options items for the dropdown menu. Check menu item types'),\n onSelectMenuItem: PropTypes.func.description('Handler when user clicks on a menu item'),\n onOpenMenu: PropTypes.func.description('Handler when the menu shows up'),\n /** Handler when user clicks outside the menu */\n onClickOutsideMenu: PropTypes.func.description('Handler when user clicks outside the menu'),\n /** Prevent to move the menu outside of the container defined when interacting with the page */\n preventOverflow: PropTypes.oneOf(['viewport', 'scrollParent', 'window']).description(\n 'Prevent to move the menu outside of the container defined when interacting with the page',\n ),\n /** Menu placement */\n placement: PropTypes.oneOf(positions).description('Menu placement'),\n /** How to open the menu with click, hover */\n interactionType: PropTypes.oneOf(interactions).description('How to open the menu with click, hover'),\n /** The component that is going to open / close the menu */\n triggerComponent: PropTypes.element.description('The component that is going to open / close the menu'),\n /** Custom menu component */\n customMenu: PropTypes.element.description('Custom menu component'),\n /** Whether the menu is open or not */\n isOpen: PropTypes.bool.description('Whether the menu is open or not'),\n /** Selection state. Ex: { [itemId]: '{bool}', [idMultiSelectionItem]: '{string}' } */\n selection: PropTypes.shape({}).description(\n 'Selection state. Ex: { [itemId]: {bool}, [idMultiSelectionItem]: {string} }',\n ),\n /** Props object passed to the menu component */\n menuProps: PropTypes.shape({}).description('Props object passed to the menu component'),\n /** Customize the items render */\n itemsRenderer: PropTypes.func.description('Customize the items render'),\n /** Customize menu format. Can be undefined or 'phone' */\n type: PropTypes.string.description('Customize menu format. Can be undefined or \"phone\"'),\n /** Customize menu minWidth. Can be undefined or 'number' */\n minWidth: PropTypes.number.description('Customize menu minWidth. Can be undefined or \"number\"'),\n /** Customize menu maxWidth. Can be undefined or 'number' */\n maxWidth: PropTypes.number.description('Customize menu maxWidth. Can be undefined or \"number\"'),\n /** Make the menu responsive, it uses a margin of 120 px */\n responsiveHeight: PropTypes.bool.description('Make the menu responsive, it uses a margin of 120 px'),\n /** Customize menu zIndex. Can be undefined or 'number' */\n zIndex: PropTypes.number.description('Customize menu zIndex. Can be undefined or \"number\"'),\n className: PropTypes.string.description('html class attribute'),\n focusOnOpen: PropTypes.bool.description('focus element on open or not').defaultValue(true),\n loading: PropTypes.bool.description('is loading content or not').defaultValue(false),\n referenceNode: PropTypes.any.description('reference node'),\n onClose: PropTypes.func.description('function called on close mene'),\n onSelectChange: PropTypes.func.description('function called when selection changes'),\n singleGroupSelection: PropTypes.bool.description('select items in same group or not'),\n};\n\nDSDropdownMenu.propTypes = dropdownMenuProps;\nDSDropdownMenu.displayName = 'DSDropdownMenu';\nconst DropdownMenuWithSchema = describe(DSDropdownMenu);\nDropdownMenuWithSchema.propTypes = dropdownMenuProps;\n\nexport { DropdownMenuWithSchema, DSDropdownMenu };\nexport default DSDropdownMenu;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;AC8CjB;AA3CN,SAAS,6BAA6B;AACtC,SAAS,WAAW,gBAAgB;AACpC,SAAS,2BAA2B;AAEpC,SAAS,WAAW,iBAAiB,cAAc,0BAA0B;AAC7E,SAAS,2BAA2B;AAEpC,MAAM,OAAO,MAAM;AAEnB,MAAM,iBAAiB,CAAC;AAAA,EACtB,iBAAiB,CAAC;AAAA,EAClB,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,UAAU,CAAC;AAAA,EACX,mBAAmB;AAAA,EACnB,aAAa;AAAA,EACb,qBAAqB;AAAA,EACrB,kBAAkB;AAAA,EAClB,YAAY,gBAAgB;AAAA,EAC5B,kBAAkB,mBAAmB;AAAA,EACrC,mBAAmB;AAAA,EACnB,aAAa;AAAA,EACb,SAAS;AAAA,EACT,YAAY,CAAC;AAAA,EACb,YAAY,CAAC;AAAA,EACb,gBAAgB;AAAA,EAChB,cAAc;AAAA,EACd,UAAU;AAAA,EACV,gBAAgB;AAAA,EAChB,mBAAmB;AAAA,EACnB,uBAAuB;AAAA,EACvB,iBAAiB;AAAA,EACjB,WAAW;AAAA,EACX,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV;AACF,MAAM;AACJ,wBAAsB,EAAE,eAAe,oBAAoB,SAAS,oBAAoB,CAAC;AAEzF,SACE,oBAAC,uBACC;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MAC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AAM,CAAC,CAAC,EAAE,YAAY,2CAA2C;AAAA;AAAA,EAEtF,eAAe,UAAU,KAAK,YAAY,4BAA4B;AAAA;AAAA,EAEtE,MAAM,UAAU,OAAO,YAAY,oDAAoD;AAAA;AAAA,EAEvF,UAAU,UAAU,OAAO,YAAY,uDAAuD;AAAA;AAAA,EAE9F,UAAU,UAAU,OAAO,YAAY,uDAAuD;AAAA;AAAA,EAE9F,kBAAkB,UAAU,KAAK,YAAY,sDAAsD;AAAA;AAAA,EAEnG,QAAQ,UAAU,OAAO,YAAY,qDAAqD;AAAA,EAC1F,WAAW,UAAU,OAAO,YAAY,sBAAsB;AAAA,EAC9D,aAAa,UAAU,KAAK,YAAY,8BAA8B,EAAE,aAAa,IAAI;AAAA,EACzF,SAAS,UAAU,KAAK,YAAY,2BAA2B,EAAE,aAAa,KAAK;AAAA,EACnF,eAAe,UAAU,IAAI,YAAY,gBAAgB;AAAA,EACzD,SAAS,UAAU,KAAK,YAAY,+BAA+B;AAAA,EACnE,gBAAgB,UAAU,KAAK,YAAY,wCAAwC;AAAA,EACnF,sBAAsB,UAAU,KAAK,YAAY,mCAAmC;AACtF;AAEA,eAAe,YAAY;AAC3B,eAAe,cAAc;AAC7B,MAAM,yBAAyB,SAAS,cAAc;AACtD,uBAAuB,YAAY;AAGnC,IAAO,yBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import React2 from "react";
|
|
3
|
+
const DropdownMenuContext = React2.createContext();
|
|
4
|
+
var DropdownMenuContext_default = DropdownMenuContext;
|
|
5
|
+
export {
|
|
6
|
+
DropdownMenuContext,
|
|
7
|
+
DropdownMenuContext_default as default
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=DropdownMenuContext.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/deprecated/DropdownMenuContext.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "// @ts-nocheck\nimport React from 'react';\n\nconst DropdownMenuContext = React.createContext();\nexport { DropdownMenuContext };\nexport default DropdownMenuContext;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACCvB,OAAOA,YAAW;AAElB,MAAM,sBAAsBA,OAAM,cAAc;AAEhD,IAAO,8BAAQ;",
|
|
6
|
+
"names": ["React"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { styled } from "@elliemae/ds-legacy-system";
|
|
4
|
+
import { DSCircularProgressIndicator } from "@elliemae/ds-legacy-circular-progress-indicator";
|
|
5
|
+
const Wrapper = styled.div`
|
|
6
|
+
display: flex;
|
|
7
|
+
justify-content: center;
|
|
8
|
+
height: 56px;
|
|
9
|
+
`;
|
|
10
|
+
const LoadingIndicator = () => /* @__PURE__ */ jsx(Wrapper, { children: /* @__PURE__ */ jsx(DSCircularProgressIndicator, { size: "m" }) });
|
|
11
|
+
var DropdownMenuLoadingIndicator_default = LoadingIndicator;
|
|
12
|
+
export {
|
|
13
|
+
LoadingIndicator,
|
|
14
|
+
DropdownMenuLoadingIndicator_default as default
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=DropdownMenuLoadingIndicator.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/deprecated/DropdownMenuLoadingIndicator.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "// @ts-nocheck\nimport React from 'react';\nimport { styled } from '@elliemae/ds-legacy-system';\nimport { DSCircularProgressIndicator } from '@elliemae/ds-legacy-circular-progress-indicator';\n\nconst Wrapper = styled.div`\n display: flex;\n justify-content: center;\n height: 56px;\n`;\n\nconst LoadingIndicator = () => (\n <Wrapper>\n <DSCircularProgressIndicator size=\"m\" />\n </Wrapper>\n);\n\nexport { LoadingIndicator };\nexport default LoadingIndicator;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACanB;AAXJ,SAAS,cAAc;AACvB,SAAS,mCAAmC;AAE5C,MAAM,UAAU,OAAO;AAAA;AAAA;AAAA;AAAA;AAMvB,MAAM,mBAAmB,MACvB,oBAAC,WACC,8BAAC,+BAA4B,MAAK,KAAI,GACxC;AAIF,IAAO,uCAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback, useMemo, useState } from "react";
|
|
4
|
+
import { runAll, toggleInObject } from "@elliemae/ds-legacy-utilities";
|
|
5
|
+
import { DropdownMenuContext } from "./DropdownMenuContext.js";
|
|
6
|
+
const noop = () => null;
|
|
7
|
+
const DropdownMenuProvider = ({
|
|
8
|
+
onSelectMenuItem = noop,
|
|
9
|
+
onOpenMenu = noop,
|
|
10
|
+
onClose,
|
|
11
|
+
children,
|
|
12
|
+
isOpen,
|
|
13
|
+
selection,
|
|
14
|
+
singleGroupSelection,
|
|
15
|
+
onSelectChange = noop
|
|
16
|
+
}) => {
|
|
17
|
+
const [isMenuOpen, setMenuOpen] = useState(isOpen);
|
|
18
|
+
const closeMenu = useCallback(() => {
|
|
19
|
+
setMenuOpen(false);
|
|
20
|
+
onOpenMenu(false);
|
|
21
|
+
onClose();
|
|
22
|
+
});
|
|
23
|
+
const openMenu = useCallback(() => {
|
|
24
|
+
setMenuOpen(true);
|
|
25
|
+
onOpenMenu(true);
|
|
26
|
+
});
|
|
27
|
+
const handleItemClick = ({ item, group }) => {
|
|
28
|
+
let activeState;
|
|
29
|
+
let nextSelection = !singleGroupSelection ? selection : {};
|
|
30
|
+
if (group) {
|
|
31
|
+
activeState = group.active;
|
|
32
|
+
nextSelection = {
|
|
33
|
+
...nextSelection,
|
|
34
|
+
[group.id]: activeState
|
|
35
|
+
};
|
|
36
|
+
} else {
|
|
37
|
+
const selectionItem = group || item;
|
|
38
|
+
activeState = selectionItem.active || selectionItem.checked;
|
|
39
|
+
nextSelection = Array.isArray(activeState) ? {
|
|
40
|
+
...nextSelection,
|
|
41
|
+
[selectionItem.id]: activeState
|
|
42
|
+
} : toggleInObject(nextSelection, selectionItem.id, item.label || activeState || true);
|
|
43
|
+
}
|
|
44
|
+
onSelectChange({
|
|
45
|
+
item,
|
|
46
|
+
group,
|
|
47
|
+
selection: nextSelection
|
|
48
|
+
});
|
|
49
|
+
onSelectMenuItem(item, activeState, nextSelection);
|
|
50
|
+
};
|
|
51
|
+
const handleCloseOnClick = useCallback(({ item, group = {} }) => {
|
|
52
|
+
if (item.closeOnClick !== void 0) {
|
|
53
|
+
if (item.closeOnClick)
|
|
54
|
+
closeMenu();
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (group.closeOnClick !== void 0) {
|
|
58
|
+
if (group.closeOnClick)
|
|
59
|
+
closeMenu();
|
|
60
|
+
}
|
|
61
|
+
}, []);
|
|
62
|
+
const valueProvider = useMemo(
|
|
63
|
+
() => ({
|
|
64
|
+
onItemClick: runAll(handleItemClick, handleCloseOnClick),
|
|
65
|
+
closeMenu,
|
|
66
|
+
openMenu,
|
|
67
|
+
isMenuOpen,
|
|
68
|
+
selection
|
|
69
|
+
}),
|
|
70
|
+
[isMenuOpen, selection]
|
|
71
|
+
);
|
|
72
|
+
return /* @__PURE__ */ jsx(DropdownMenuContext.Provider, { value: valueProvider, children });
|
|
73
|
+
};
|
|
74
|
+
var DropdownMenuProvider_default = DropdownMenuProvider;
|
|
75
|
+
export {
|
|
76
|
+
DropdownMenuProvider,
|
|
77
|
+
DropdownMenuProvider_default as default
|
|
78
|
+
};
|
|
79
|
+
//# sourceMappingURL=DropdownMenuProvider.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/deprecated/DropdownMenuProvider.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "// @ts-nocheck\n/* eslint-disable react/prop-types */\n/* eslint-disable indent */\nimport React, { useCallback, useMemo, useState } from 'react';\nimport { runAll, toggleInObject } from '@elliemae/ds-legacy-utilities';\nimport { DropdownMenuContext } from './DropdownMenuContext.js';\n\nconst noop = () => null;\n\nconst DropdownMenuProvider = ({\n onSelectMenuItem = noop,\n onOpenMenu = noop,\n onClose,\n children,\n isOpen,\n selection,\n singleGroupSelection,\n onSelectChange = noop,\n}) => {\n const [isMenuOpen, setMenuOpen] = useState(isOpen);\n\n const closeMenu = useCallback(() => {\n setMenuOpen(false);\n onOpenMenu(false);\n onClose();\n });\n const openMenu = useCallback(() => {\n setMenuOpen(true);\n onOpenMenu(true);\n });\n\n const handleItemClick = ({ item, group }) => {\n let activeState;\n // reset selection if single selection group is activated\n let nextSelection = !singleGroupSelection ? selection : {};\n\n if (group) {\n activeState = group.active;\n nextSelection = {\n ...nextSelection,\n [group.id]: activeState,\n };\n } else {\n const selectionItem = group || item;\n activeState = selectionItem.active || selectionItem.checked;\n\n // can be toggled (radio with unselection)\n nextSelection = Array.isArray(activeState)\n ? {\n ...nextSelection,\n [selectionItem.id]: activeState,\n }\n : toggleInObject(nextSelection, selectionItem.id, item.label || activeState || true);\n }\n onSelectChange({\n item,\n group,\n selection: nextSelection,\n });\n // todo: just pass item on item and group when selection callback,\n // use onSelectchange for nextSelection\n onSelectMenuItem(item, activeState, nextSelection);\n };\n\n const handleCloseOnClick = useCallback(({ item, group = {} }) => {\n if (item.closeOnClick !== undefined) {\n if (item.closeOnClick) closeMenu();\n return;\n }\n if (group.closeOnClick !== undefined) {\n if (group.closeOnClick) closeMenu();\n }\n }, []);\n\n const valueProvider = useMemo(\n () => ({\n onItemClick: runAll(handleItemClick, handleCloseOnClick),\n closeMenu,\n openMenu,\n isMenuOpen,\n selection,\n }),\n [isMenuOpen, selection],\n );\n return <DropdownMenuContext.Provider value={valueProvider}>{children}</DropdownMenuContext.Provider>;\n};\n\nexport { DropdownMenuProvider };\nexport default DropdownMenuProvider;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACoFd;AAjFT,SAAgB,aAAa,SAAS,gBAAgB;AACtD,SAAS,QAAQ,sBAAsB;AACvC,SAAS,2BAA2B;AAEpC,MAAM,OAAO,MAAM;AAEnB,MAAM,uBAAuB,CAAC;AAAA,EAC5B,mBAAmB;AAAA,EACnB,aAAa;AAAA,EACb;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,iBAAiB;AACnB,MAAM;AACJ,QAAM,CAAC,YAAY,WAAW,IAAI,SAAS,MAAM;AAEjD,QAAM,YAAY,YAAY,MAAM;AAClC,gBAAY,KAAK;AACjB,eAAW,KAAK;AAChB,YAAQ;AAAA,EACV,CAAC;AACD,QAAM,WAAW,YAAY,MAAM;AACjC,gBAAY,IAAI;AAChB,eAAW,IAAI;AAAA,EACjB,CAAC;AAED,QAAM,kBAAkB,CAAC,EAAE,MAAM,MAAM,MAAM;AAC3C,QAAI;AAEJ,QAAI,gBAAgB,CAAC,uBAAuB,YAAY,CAAC;AAEzD,QAAI,OAAO;AACT,oBAAc,MAAM;AACpB,sBAAgB;AAAA,QACd,GAAG;AAAA,QACH,CAAC,MAAM,EAAE,GAAG;AAAA,MACd;AAAA,IACF,OAAO;AACL,YAAM,gBAAgB,SAAS;AAC/B,oBAAc,cAAc,UAAU,cAAc;AAGpD,sBAAgB,MAAM,QAAQ,WAAW,IACrC;AAAA,QACE,GAAG;AAAA,QACH,CAAC,cAAc,EAAE,GAAG;AAAA,MACtB,IACA,eAAe,eAAe,cAAc,IAAI,KAAK,SAAS,eAAe,IAAI;AAAA,IACvF;AACA,mBAAe;AAAA,MACb;AAAA,MACA;AAAA,MACA,WAAW;AAAA,IACb,CAAC;AAGD,qBAAiB,MAAM,aAAa,aAAa;AAAA,EACnD;AAEA,QAAM,qBAAqB,YAAY,CAAC,EAAE,MAAM,QAAQ,CAAC,EAAE,MAAM;AAC/D,QAAI,KAAK,iBAAiB,QAAW;AACnC,UAAI,KAAK;AAAc,kBAAU;AACjC;AAAA,IACF;AACA,QAAI,MAAM,iBAAiB,QAAW;AACpC,UAAI,MAAM;AAAc,kBAAU;AAAA,IACpC;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,QAAM,gBAAgB;AAAA,IACpB,OAAO;AAAA,MACL,aAAa,OAAO,iBAAiB,kBAAkB;AAAA,MACvD;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,YAAY,SAAS;AAAA,EACxB;AACA,SAAO,oBAAC,oBAAoB,UAApB,EAA6B,OAAO,eAAgB,UAAS;AACvE;AAGA,IAAO,+BAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useContext, useEffect, useMemo, useState } from "react";
|
|
4
|
+
import { DSPopper } from "@elliemae/ds-legacy-popper";
|
|
5
|
+
import { Menu } from "@elliemae/ds-legacy-common";
|
|
6
|
+
import { convertPropToCssClassName } from "@elliemae/ds-legacy-classnames";
|
|
7
|
+
import { runAll, isFunction, getComponentFromProps } from "@elliemae/ds-legacy-utilities";
|
|
8
|
+
import { DropdownMenuContext } from "./DropdownMenuContext.js";
|
|
9
|
+
import { renderOptions, factory } from "./decoratedMenuItemFactory.js";
|
|
10
|
+
import { LoadingIndicator } from "./DropdownMenuLoadingIndicator.js";
|
|
11
|
+
const blockName = "menu";
|
|
12
|
+
const getMax = (options) => {
|
|
13
|
+
let max = 0;
|
|
14
|
+
options.forEach((o) => {
|
|
15
|
+
if (o && o.label && String(o.label).length > max)
|
|
16
|
+
max = String(o.label).length;
|
|
17
|
+
});
|
|
18
|
+
return max;
|
|
19
|
+
};
|
|
20
|
+
const DropdownMenuRenderer = ({
|
|
21
|
+
containerProps,
|
|
22
|
+
className,
|
|
23
|
+
options = [],
|
|
24
|
+
triggerComponent,
|
|
25
|
+
placement,
|
|
26
|
+
interactionType,
|
|
27
|
+
preventOverflow,
|
|
28
|
+
customMenu,
|
|
29
|
+
contentOffset,
|
|
30
|
+
contentStyle,
|
|
31
|
+
isOpen,
|
|
32
|
+
children,
|
|
33
|
+
menuProps,
|
|
34
|
+
referenceNode,
|
|
35
|
+
focusOnOpen: focusOnOpenProp,
|
|
36
|
+
onClickOutsideMenu,
|
|
37
|
+
responsiveHeight,
|
|
38
|
+
itemsRenderer,
|
|
39
|
+
maxWidth,
|
|
40
|
+
minWidth,
|
|
41
|
+
zIndex,
|
|
42
|
+
type,
|
|
43
|
+
loading,
|
|
44
|
+
hideIfNotVisible
|
|
45
|
+
}) => {
|
|
46
|
+
const [focusOnOpen, setFocusOnOpenMenu] = useState(focusOnOpenProp);
|
|
47
|
+
const { isMenuOpen, openMenu, closeMenu } = useContext(DropdownMenuContext);
|
|
48
|
+
const maxOption = useMemo(() => {
|
|
49
|
+
let max = 0;
|
|
50
|
+
options.forEach((o) => {
|
|
51
|
+
if (o && o.label && String(o.label).length > max)
|
|
52
|
+
max = String(o.label).length;
|
|
53
|
+
if (o && o.items) {
|
|
54
|
+
const nestedMax = getMax(o.items);
|
|
55
|
+
if (nestedMax > max)
|
|
56
|
+
max = nestedMax;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
return max;
|
|
60
|
+
}, [options]);
|
|
61
|
+
const optionsRendererd = useMemo(() => {
|
|
62
|
+
if (options[0] && options[0].type === "separator") {
|
|
63
|
+
options[0].showSeparator = false;
|
|
64
|
+
}
|
|
65
|
+
return isFunction(itemsRenderer) ? itemsRenderer(options, factory) : renderOptions(options);
|
|
66
|
+
}, [options]);
|
|
67
|
+
const dropdownBlockName = convertPropToCssClassName(blockName);
|
|
68
|
+
const menuContent = () => {
|
|
69
|
+
if (loading)
|
|
70
|
+
return /* @__PURE__ */ jsx(LoadingIndicator, {});
|
|
71
|
+
if (children)
|
|
72
|
+
return children;
|
|
73
|
+
if (optionsRendererd)
|
|
74
|
+
return optionsRendererd;
|
|
75
|
+
};
|
|
76
|
+
const MenuComponent = customMenu ? getComponentFromProps(customMenu, {
|
|
77
|
+
options,
|
|
78
|
+
focusOnOpen,
|
|
79
|
+
maxOption,
|
|
80
|
+
...menuProps,
|
|
81
|
+
closeMenu,
|
|
82
|
+
loading
|
|
83
|
+
}) : /* @__PURE__ */ jsx(
|
|
84
|
+
Menu,
|
|
85
|
+
{
|
|
86
|
+
closeMenu,
|
|
87
|
+
focusOnOpen,
|
|
88
|
+
containerProps,
|
|
89
|
+
maxOption: type === "phone" ? maxOption : void 0,
|
|
90
|
+
maxWidth,
|
|
91
|
+
minWidth,
|
|
92
|
+
onClickOutside: onClickOutsideMenu,
|
|
93
|
+
onExitFocusGroup: closeMenu,
|
|
94
|
+
responsiveHeight,
|
|
95
|
+
type,
|
|
96
|
+
visible: true,
|
|
97
|
+
...menuProps,
|
|
98
|
+
children: menuContent()
|
|
99
|
+
}
|
|
100
|
+
);
|
|
101
|
+
useEffect(() => {
|
|
102
|
+
setFocusOnOpenMenu(focusOnOpenProp);
|
|
103
|
+
});
|
|
104
|
+
return /* @__PURE__ */ jsx(
|
|
105
|
+
DSPopper,
|
|
106
|
+
{
|
|
107
|
+
hideIfNotVisible,
|
|
108
|
+
blockName: dropdownBlockName,
|
|
109
|
+
containerProps,
|
|
110
|
+
contentComponent: MenuComponent,
|
|
111
|
+
contentOffset,
|
|
112
|
+
contentStyle,
|
|
113
|
+
interactionType,
|
|
114
|
+
isOpen: isOpen !== void 0 ? isOpen : isMenuOpen,
|
|
115
|
+
onOpen: (opening) => opening ? openMenu() : closeMenu(),
|
|
116
|
+
placement,
|
|
117
|
+
preventOverflow,
|
|
118
|
+
referenceNode,
|
|
119
|
+
showArrow: false,
|
|
120
|
+
triggerComponent: getComponentFromProps(triggerComponent, {
|
|
121
|
+
onClick: interactionType === "hover" ? runAll(openMenu, triggerComponent.props.onClick) : runAll(!isMenuOpen ? openMenu : closeMenu, triggerComponent.props.onClick),
|
|
122
|
+
onMouseEnter: interactionType === "hover" ? openMenu : void 0,
|
|
123
|
+
onKeyDown: (e) => {
|
|
124
|
+
if (e.key === "ArrowDown" || e.key === " ") {
|
|
125
|
+
e.preventDefault();
|
|
126
|
+
setFocusOnOpenMenu(true);
|
|
127
|
+
openMenu();
|
|
128
|
+
}
|
|
129
|
+
if (triggerComponent.props.onKeyPress)
|
|
130
|
+
triggerComponent.props.onKeyPress(e);
|
|
131
|
+
},
|
|
132
|
+
className: `${triggerComponent.props.className} ${className}`
|
|
133
|
+
}),
|
|
134
|
+
zIndex: zIndex || menuProps.zIndex
|
|
135
|
+
}
|
|
136
|
+
);
|
|
137
|
+
};
|
|
138
|
+
var DropdownMenuRenderer_default = DropdownMenuRenderer;
|
|
139
|
+
export {
|
|
140
|
+
DropdownMenuRenderer,
|
|
141
|
+
DropdownMenuRenderer_default as default
|
|
142
|
+
};
|
|
143
|
+
//# sourceMappingURL=DropdownMenuRenderer.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/deprecated/DropdownMenuRenderer.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "// @ts-nocheck\nimport React, { useContext, useEffect, useMemo, useState } from 'react';\nimport { DSPopper } from '@elliemae/ds-legacy-popper';\nimport { Menu } from '@elliemae/ds-legacy-common';\nimport { convertPropToCssClassName } from '@elliemae/ds-legacy-classnames';\nimport { runAll, isFunction, getComponentFromProps } from '@elliemae/ds-legacy-utilities';\nimport { DropdownMenuContext } from './DropdownMenuContext.js';\nimport { renderOptions, factory } from './decoratedMenuItemFactory.js';\nimport { LoadingIndicator } from './DropdownMenuLoadingIndicator.js';\n\nconst blockName = 'menu';\n\nconst getMax = (options) => {\n let max = 0;\n options.forEach((o) => {\n if (o && o.label && String(o.label).length > max) max = String(o.label).length;\n });\n return max;\n};\n\nconst DropdownMenuRenderer = ({\n containerProps,\n className,\n options = [],\n triggerComponent,\n placement,\n interactionType,\n preventOverflow,\n customMenu,\n contentOffset,\n contentStyle,\n isOpen,\n children,\n menuProps,\n referenceNode,\n focusOnOpen: focusOnOpenProp,\n onClickOutsideMenu,\n responsiveHeight,\n itemsRenderer,\n maxWidth,\n minWidth,\n zIndex,\n type,\n loading,\n hideIfNotVisible,\n}) => {\n const [focusOnOpen, setFocusOnOpenMenu] = useState(focusOnOpenProp);\n const { isMenuOpen, openMenu, closeMenu } = useContext(DropdownMenuContext);\n const maxOption = useMemo(() => {\n let max = 0;\n options.forEach((o) => {\n if (o && o.label && String(o.label).length > max) max = String(o.label).length;\n if (o && o.items) {\n const nestedMax = getMax(o.items);\n if (nestedMax > max) max = nestedMax;\n }\n });\n return max;\n }, [options]);\n const optionsRendererd = useMemo(() => {\n if (options[0] && options[0].type === 'separator') {\n options[0].showSeparator = false;\n }\n return isFunction(itemsRenderer) ? itemsRenderer(options, factory) : renderOptions(options);\n }, [options]);\n\n const dropdownBlockName = convertPropToCssClassName(blockName);\n const menuContent = () => {\n if (loading) return <LoadingIndicator />;\n if (children) return children;\n if (optionsRendererd) return optionsRendererd;\n };\n\n const MenuComponent = customMenu ? (\n getComponentFromProps(customMenu, {\n options,\n focusOnOpen,\n maxOption,\n ...menuProps,\n closeMenu,\n loading,\n })\n ) : (\n <Menu\n closeMenu={closeMenu}\n focusOnOpen={focusOnOpen}\n containerProps={containerProps}\n maxOption={type === 'phone' ? maxOption : undefined}\n maxWidth={maxWidth}\n minWidth={minWidth}\n onClickOutside={onClickOutsideMenu}\n onExitFocusGroup={closeMenu}\n responsiveHeight={responsiveHeight}\n type={type}\n visible\n {...menuProps}\n >\n {menuContent()}\n </Menu>\n );\n\n useEffect(() => {\n setFocusOnOpenMenu(focusOnOpenProp);\n });\n\n return (\n <DSPopper\n hideIfNotVisible={hideIfNotVisible}\n blockName={dropdownBlockName}\n containerProps={containerProps}\n contentComponent={MenuComponent}\n contentOffset={contentOffset}\n contentStyle={contentStyle}\n interactionType={interactionType}\n isOpen={isOpen !== undefined ? isOpen : isMenuOpen}\n onOpen={(opening) => (opening ? openMenu() : closeMenu())}\n placement={placement}\n preventOverflow={preventOverflow}\n referenceNode={referenceNode}\n showArrow={false}\n triggerComponent={getComponentFromProps(triggerComponent, {\n onClick:\n interactionType === 'hover'\n ? runAll(openMenu, triggerComponent.props.onClick)\n : runAll(!isMenuOpen ? openMenu : closeMenu, triggerComponent.props.onClick),\n onMouseEnter: interactionType === 'hover' ? openMenu : undefined,\n onKeyDown: (e) => {\n if (e.key === 'ArrowDown' || e.key === ' ') {\n e.preventDefault();\n setFocusOnOpenMenu(true);\n openMenu();\n }\n if (triggerComponent.props.onKeyPress) triggerComponent.props.onKeyPress(e);\n },\n className: `${triggerComponent.props.className} ${className}`,\n })}\n zIndex={zIndex || menuProps.zIndex}\n />\n );\n};\n\nexport { DropdownMenuRenderer };\nexport default DropdownMenuRenderer;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACoEC;AAnExB,SAAgB,YAAY,WAAW,SAAS,gBAAgB;AAChE,SAAS,gBAAgB;AACzB,SAAS,YAAY;AACrB,SAAS,iCAAiC;AAC1C,SAAS,QAAQ,YAAY,6BAA6B;AAC1D,SAAS,2BAA2B;AACpC,SAAS,eAAe,eAAe;AACvC,SAAS,wBAAwB;AAEjC,MAAM,YAAY;AAElB,MAAM,SAAS,CAAC,YAAY;AAC1B,MAAI,MAAM;AACV,UAAQ,QAAQ,CAAC,MAAM;AACrB,QAAI,KAAK,EAAE,SAAS,OAAO,EAAE,KAAK,EAAE,SAAS;AAAK,YAAM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AEJ;AAGA,IAAO,+BAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { DropdownMenuProvider } from "./DropdownMenuProvider.js";
|
|
4
|
+
import { DropdownMenuRenderer } from "./DropdownMenuRenderer.js";
|
|
5
|
+
const DropdownMenuWrapper = (props) => /* @__PURE__ */ jsx(DropdownMenuProvider, { ...props, children: /* @__PURE__ */ jsx(DropdownMenuRenderer, { ...props }) });
|
|
6
|
+
var DropdownMenuWrapper_default = DropdownMenuWrapper;
|
|
7
|
+
export {
|
|
8
|
+
DropdownMenuWrapper,
|
|
9
|
+
DropdownMenuWrapper_default as default
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=DropdownMenuWrapper.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/deprecated/DropdownMenuWrapper.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "// @ts-nocheck\nimport React from 'react';\nimport { DropdownMenuProvider } from './DropdownMenuProvider.js';\nimport { DropdownMenuRenderer } from './DropdownMenuRenderer.js';\n\nconst DropdownMenuWrapper = (props) => (\n <DropdownMenuProvider {...props}>\n <DropdownMenuRenderer {...props} />\n </DropdownMenuProvider>\n);\n\nexport { DropdownMenuWrapper };\nexport default DropdownMenuWrapper;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACOnB;AALJ,SAAS,4BAA4B;AACrC,SAAS,4BAA4B;AAErC,MAAM,sBAAsB,CAAC,UAC3B,oBAAC,wBAAsB,GAAG,OACxB,8BAAC,wBAAsB,GAAG,OAAO,GACnC;AAIF,IAAO,8BAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|