@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,85 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useContext, useMemo } from "react";
|
|
4
|
+
import {
|
|
5
|
+
ActionMenuItem,
|
|
6
|
+
SingleMenuItem,
|
|
7
|
+
MultiMenuItem,
|
|
8
|
+
SubmenuItem,
|
|
9
|
+
Separator,
|
|
10
|
+
Section,
|
|
11
|
+
SingleWithSubmenuItem,
|
|
12
|
+
SkeletonMenuItem
|
|
13
|
+
} from "@elliemae/ds-legacy-menu-items";
|
|
14
|
+
import { DSDropdownMenuContext } from "../DropdownMenuContext.js";
|
|
15
|
+
import { useDropdownMenuItemHandlers } from "../hooks/index.js";
|
|
16
|
+
const menuItemMap = {
|
|
17
|
+
action: ActionMenuItem,
|
|
18
|
+
single: SingleMenuItem,
|
|
19
|
+
checkbox: MultiMenuItem,
|
|
20
|
+
submenu: SubmenuItem,
|
|
21
|
+
separator: Separator,
|
|
22
|
+
section: Section,
|
|
23
|
+
singleWithSubmenu: SingleWithSubmenuItem,
|
|
24
|
+
skeleton: SkeletonMenuItem
|
|
25
|
+
};
|
|
26
|
+
const DropdownMenuItemFactory = ({ option, style, innerRef, optionsShouldHavePadding }) => {
|
|
27
|
+
const {
|
|
28
|
+
props: { selectedOptions, onOptionClick, openedSubmenus, onSubmenuToggle, onClickOutside },
|
|
29
|
+
activeDescendant,
|
|
30
|
+
DSDropdownMenuV2
|
|
31
|
+
} = useContext(DSDropdownMenuContext);
|
|
32
|
+
if (!(option.type in menuItemMap)) {
|
|
33
|
+
throw new Error(
|
|
34
|
+
`Provided option type (${option.type}) is not valid. Please provide one of ${Object.keys(menuItemMap).join(
|
|
35
|
+
", "
|
|
36
|
+
)}`
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
const type = option.type;
|
|
40
|
+
const Component = menuItemMap[type];
|
|
41
|
+
const { onDropdownKeyDown, ...handlers } = useDropdownMenuItemHandlers(option);
|
|
42
|
+
const itemProps = useMemo(
|
|
43
|
+
() => ({
|
|
44
|
+
...handlers,
|
|
45
|
+
innerRef,
|
|
46
|
+
isActive: activeDescendant === option.dsId,
|
|
47
|
+
isSelected: selectedOptions ? !!selectedOptions[option.dsId] : false,
|
|
48
|
+
isSubmenuOpened: openedSubmenus ? !!openedSubmenus[option.dsId] : false,
|
|
49
|
+
tabIndex: -1,
|
|
50
|
+
optionsShouldHavePadding,
|
|
51
|
+
wrapperStyles: style,
|
|
52
|
+
Dropdown: DSDropdownMenuV2,
|
|
53
|
+
dropdownProps: {
|
|
54
|
+
...option,
|
|
55
|
+
options: option.type === "submenu" || option.type === "singleWithSubmenu" ? option.options : [],
|
|
56
|
+
onClickOutside,
|
|
57
|
+
onOptionClick,
|
|
58
|
+
onSubmenuToggle,
|
|
59
|
+
selectedOptions,
|
|
60
|
+
openedSubmenus,
|
|
61
|
+
onKeyDown: onDropdownKeyDown
|
|
62
|
+
}
|
|
63
|
+
}),
|
|
64
|
+
[
|
|
65
|
+
handlers,
|
|
66
|
+
innerRef,
|
|
67
|
+
activeDescendant,
|
|
68
|
+
option,
|
|
69
|
+
selectedOptions,
|
|
70
|
+
openedSubmenus,
|
|
71
|
+
optionsShouldHavePadding,
|
|
72
|
+
style,
|
|
73
|
+
DSDropdownMenuV2,
|
|
74
|
+
onClickOutside,
|
|
75
|
+
onOptionClick,
|
|
76
|
+
onSubmenuToggle,
|
|
77
|
+
onDropdownKeyDown
|
|
78
|
+
]
|
|
79
|
+
);
|
|
80
|
+
return /* @__PURE__ */ jsx(Component, { ...option, ...itemProps });
|
|
81
|
+
};
|
|
82
|
+
export {
|
|
83
|
+
DropdownMenuItemFactory
|
|
84
|
+
};
|
|
85
|
+
//# sourceMappingURL=DropdownMenuItemFactory.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/parts/DropdownMenuItemFactory.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/prop-types */\nimport React, { useContext, useMemo } from 'react';\nimport {\n ActionMenuItem,\n SingleMenuItem,\n MultiMenuItem,\n SubmenuItem,\n Separator,\n Section,\n SingleWithSubmenuItem,\n SkeletonMenuItem,\n} from '@elliemae/ds-legacy-menu-items';\nimport type { DSDropdownMenuT } from '../react-desc-prop-types.js';\nimport { DSDropdownMenuContext } from '../DropdownMenuContext.js';\nimport { useDropdownMenuItemHandlers } from '../hooks/index.js';\n\nconst menuItemMap = {\n action: ActionMenuItem,\n single: SingleMenuItem,\n checkbox: MultiMenuItem,\n submenu: SubmenuItem,\n separator: Separator,\n section: Section,\n singleWithSubmenu: SingleWithSubmenuItem,\n skeleton: SkeletonMenuItem,\n};\n\nexport const DropdownMenuItemFactory: React.ComponentType<{\n option: DSDropdownMenuT.Item;\n style?: Record<string, unknown>;\n innerRef?: (el: HTMLElement) => void;\n optionsShouldHavePadding: boolean;\n}> = ({ option, style, innerRef, optionsShouldHavePadding }): JSX.Element => {\n const {\n props: { selectedOptions, onOptionClick, openedSubmenus, onSubmenuToggle, onClickOutside },\n activeDescendant,\n DSDropdownMenuV2,\n } = useContext(DSDropdownMenuContext);\n\n if (!(option.type in menuItemMap)) {\n throw new Error(\n `Provided option type (${option.type}) is not valid. Please provide one of ${Object.keys(menuItemMap).join(\n ', ',\n )}`,\n );\n }\n const type = option.type as\n | 'action'\n | 'single'\n | 'checkbox'\n | 'separator'\n | 'section'\n | 'skeleton'\n | 'singleWithSubmenu';\n\n const Component = menuItemMap[type];\n\n const { onDropdownKeyDown, ...handlers } = useDropdownMenuItemHandlers(option);\n\n const itemProps = useMemo(\n () => ({\n ...handlers,\n innerRef,\n isActive: activeDescendant === option.dsId,\n isSelected: selectedOptions ? !!selectedOptions[option.dsId] : false,\n isSubmenuOpened: openedSubmenus ? !!openedSubmenus[option.dsId] : false,\n tabIndex: -1 as const,\n optionsShouldHavePadding,\n wrapperStyles: style,\n Dropdown: DSDropdownMenuV2,\n dropdownProps: {\n ...option,\n options: option.type === 'submenu' || option.type === 'singleWithSubmenu' ? option.options : [],\n onClickOutside,\n onOptionClick,\n onSubmenuToggle,\n selectedOptions,\n openedSubmenus,\n onKeyDown: onDropdownKeyDown,\n },\n }),\n [\n handlers,\n innerRef,\n activeDescendant,\n option,\n selectedOptions,\n openedSubmenus,\n optionsShouldHavePadding,\n style,\n DSDropdownMenuV2,\n onClickOutside,\n onOptionClick,\n onSubmenuToggle,\n onDropdownKeyDown,\n ],\n );\n\n return <Component {...option} {...itemProps} />;\n};\n"],
|
|
5
|
+
"mappings":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A,QAC9F;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,WAAW;AAAA,MACb;AAAA,IACF;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,SAAO,oBAAC,aAAW,GAAG,QAAS,GAAG,WAAW;AAC/C;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useContext, useMemo } from "react";
|
|
4
|
+
import { DSInputText } from "@elliemae/ds-legacy-form-input-text";
|
|
5
|
+
import { DSDropdownMenuContext } from "../DropdownMenuContext.js";
|
|
6
|
+
import { DropdownMenuDataTestId } from "../DropdownMenuDataTestId.js";
|
|
7
|
+
import { useDropdownListboxHandlers } from "../hooks/useDropdownListboxHandlers.js";
|
|
8
|
+
import { StyledInputWrapper, StyledListBoxWrapper, StyledHeaderWrapper, StyledOptionListWrapper } from "../styled.js";
|
|
9
|
+
import { DropdownMenuEmptyState } from "./DropdownMenuEmptyState.js";
|
|
10
|
+
import { DropdownMenuItemFactory } from "./DropdownMenuItemFactory.js";
|
|
11
|
+
import { DropdownMenuSkeleton } from "./DropdownMenuSkeleton.js";
|
|
12
|
+
import { useAutofocusContainerOnOpen, useGetOptionSpecialAttributes } from "../hooks/index.js";
|
|
13
|
+
const DropdownMenuListBox = () => {
|
|
14
|
+
const ctx = useContext(DSDropdownMenuContext);
|
|
15
|
+
const {
|
|
16
|
+
triggerReferenceElement,
|
|
17
|
+
props: {
|
|
18
|
+
isSkeleton,
|
|
19
|
+
options,
|
|
20
|
+
hasInput,
|
|
21
|
+
inputValue,
|
|
22
|
+
onInputChange,
|
|
23
|
+
HeaderComp,
|
|
24
|
+
minWidth: userMinWidth,
|
|
25
|
+
maxHeight: userMaxHeight
|
|
26
|
+
},
|
|
27
|
+
activeDescendant,
|
|
28
|
+
listboxReference,
|
|
29
|
+
inputReference,
|
|
30
|
+
virtualListHelpers: { totalSize, virtualItems }
|
|
31
|
+
} = ctx;
|
|
32
|
+
useAutofocusContainerOnOpen();
|
|
33
|
+
const { onKeyDown, onMouseEnter, onMouseLeave } = useDropdownListboxHandlers();
|
|
34
|
+
const { optionsShouldHavePadding } = useGetOptionSpecialAttributes();
|
|
35
|
+
const minWidth = useMemo(
|
|
36
|
+
() => userMinWidth !== void 0 ? userMinWidth : Math.max(triggerReferenceElement?.offsetWidth ?? 0, 162),
|
|
37
|
+
[triggerReferenceElement?.offsetWidth, userMinWidth]
|
|
38
|
+
);
|
|
39
|
+
return useMemo(() => {
|
|
40
|
+
if (virtualItems.length === 0) {
|
|
41
|
+
return /* @__PURE__ */ jsx(DropdownMenuEmptyState, { minWidth, maxHeight: userMaxHeight || 400 });
|
|
42
|
+
}
|
|
43
|
+
return /* @__PURE__ */ jsx(
|
|
44
|
+
StyledListBoxWrapper,
|
|
45
|
+
{
|
|
46
|
+
minWidth,
|
|
47
|
+
maxHeight: userMaxHeight || 400,
|
|
48
|
+
ref: listboxReference,
|
|
49
|
+
tabIndex: 0,
|
|
50
|
+
"data-testid": DropdownMenuDataTestId.MENU_WRAPPER,
|
|
51
|
+
onKeyDown,
|
|
52
|
+
onMouseEnter,
|
|
53
|
+
onMouseLeave,
|
|
54
|
+
hasHeader: !!HeaderComp,
|
|
55
|
+
children: isSkeleton ? /* @__PURE__ */ jsx(DropdownMenuSkeleton, {}) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
56
|
+
HeaderComp && /* @__PURE__ */ jsx(StyledHeaderWrapper, { alignItems: "center", children: /* @__PURE__ */ jsx(HeaderComp, { ctx }) }),
|
|
57
|
+
hasInput && /* @__PURE__ */ jsx(StyledInputWrapper, { hasHeader: !!HeaderComp, children: /* @__PURE__ */ jsx(DSInputText, { value: inputValue, onChange: onInputChange, innerRef: inputReference }) }, "dropdown-listbox-input-wrapper"),
|
|
58
|
+
/* @__PURE__ */ jsx(
|
|
59
|
+
StyledOptionListWrapper,
|
|
60
|
+
{
|
|
61
|
+
"aria-activedescendant": activeDescendant,
|
|
62
|
+
"data-testid": DropdownMenuDataTestId.LISTBOX,
|
|
63
|
+
role: "listbox",
|
|
64
|
+
"aria-label": "List of options",
|
|
65
|
+
style: { height: totalSize || 16 },
|
|
66
|
+
children: virtualItems.map((vItem) => /* @__PURE__ */ jsx(
|
|
67
|
+
DropdownMenuItemFactory,
|
|
68
|
+
{
|
|
69
|
+
option: options[vItem.index],
|
|
70
|
+
style: { position: "absolute", top: vItem.start, left: 0, width: "100%" },
|
|
71
|
+
innerRef: vItem.measureRef,
|
|
72
|
+
optionsShouldHavePadding
|
|
73
|
+
},
|
|
74
|
+
`dropdown-listbox-option-${options[vItem.index].dsId}`
|
|
75
|
+
))
|
|
76
|
+
}
|
|
77
|
+
)
|
|
78
|
+
] })
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
}, [
|
|
82
|
+
HeaderComp,
|
|
83
|
+
activeDescendant,
|
|
84
|
+
ctx,
|
|
85
|
+
hasInput,
|
|
86
|
+
inputReference,
|
|
87
|
+
inputValue,
|
|
88
|
+
isSkeleton,
|
|
89
|
+
listboxReference,
|
|
90
|
+
minWidth,
|
|
91
|
+
onInputChange,
|
|
92
|
+
onKeyDown,
|
|
93
|
+
onMouseEnter,
|
|
94
|
+
onMouseLeave,
|
|
95
|
+
options,
|
|
96
|
+
optionsShouldHavePadding,
|
|
97
|
+
totalSize,
|
|
98
|
+
userMaxHeight,
|
|
99
|
+
virtualItems
|
|
100
|
+
]);
|
|
101
|
+
};
|
|
102
|
+
export {
|
|
103
|
+
DropdownMenuListBox
|
|
104
|
+
};
|
|
105
|
+
//# sourceMappingURL=DropdownMenuListBox.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/parts/DropdownMenuListBox.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext, useMemo } from 'react';\nimport { DSInputText } from '@elliemae/ds-legacy-form-input-text';\nimport { DSDropdownMenuContext } from '../DropdownMenuContext.js';\nimport { DropdownMenuDataTestId } from '../DropdownMenuDataTestId.js';\nimport { useDropdownListboxHandlers } from '../hooks/useDropdownListboxHandlers.js';\nimport { StyledInputWrapper, StyledListBoxWrapper, StyledHeaderWrapper, StyledOptionListWrapper } from '../styled.js';\nimport { DropdownMenuEmptyState } from './DropdownMenuEmptyState.js';\nimport { DropdownMenuItemFactory } from './DropdownMenuItemFactory.js';\nimport { DropdownMenuSkeleton } from './DropdownMenuSkeleton.js';\n\nimport { useAutofocusContainerOnOpen, useGetOptionSpecialAttributes } from '../hooks/index.js';\n\nexport const DropdownMenuListBox: React.ComponentType<Record<string, never>> = () => {\n const ctx = useContext(DSDropdownMenuContext);\n const {\n triggerReferenceElement,\n props: {\n isSkeleton,\n options,\n hasInput,\n inputValue,\n onInputChange,\n HeaderComp,\n minWidth: userMinWidth,\n maxHeight: userMaxHeight,\n },\n activeDescendant,\n listboxReference,\n inputReference,\n virtualListHelpers: { totalSize, virtualItems },\n } = ctx;\n\n useAutofocusContainerOnOpen();\n\n const { onKeyDown, onMouseEnter, onMouseLeave } = useDropdownListboxHandlers();\n\n const { optionsShouldHavePadding } = useGetOptionSpecialAttributes();\n\n const minWidth = useMemo(\n () => (userMinWidth !== undefined ? userMinWidth : Math.max(triggerReferenceElement?.offsetWidth ?? 0, 162)),\n [triggerReferenceElement?.offsetWidth, userMinWidth],\n );\n\n return useMemo(() => {\n if (virtualItems.length === 0) {\n return <DropdownMenuEmptyState minWidth={minWidth} maxHeight={userMaxHeight || 400} />;\n }\n return (\n <StyledListBoxWrapper\n minWidth={minWidth}\n maxHeight={userMaxHeight || 400}\n ref={listboxReference}\n tabIndex={0}\n data-testid={DropdownMenuDataTestId.MENU_WRAPPER}\n onKeyDown={onKeyDown}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n hasHeader={!!HeaderComp}\n >\n {isSkeleton ? (\n <DropdownMenuSkeleton />\n ) : (\n <>\n {HeaderComp && (\n <StyledHeaderWrapper alignItems=\"center\">\n <HeaderComp ctx={ctx} />\n </StyledHeaderWrapper>\n )}\n {hasInput && (\n <StyledInputWrapper key=\"dropdown-listbox-input-wrapper\" hasHeader={!!HeaderComp}>\n <DSInputText value={inputValue} onChange={onInputChange} innerRef={inputReference} />\n </StyledInputWrapper>\n )}\n <StyledOptionListWrapper\n aria-activedescendant={activeDescendant}\n data-testid={DropdownMenuDataTestId.LISTBOX}\n role=\"listbox\"\n aria-label=\"List of options\"\n style={{ height: totalSize || 16 }}\n >\n {virtualItems.map((vItem) => (\n <DropdownMenuItemFactory\n option={options[vItem.index]}\n style={{ position: 'absolute', top: vItem.start, left: 0, width: '100%' }}\n key={`dropdown-listbox-option-${options[vItem.index].dsId}`}\n innerRef={vItem.measureRef}\n optionsShouldHavePadding={optionsShouldHavePadding}\n />\n ))}\n </StyledOptionListWrapper>\n </>\n )}\n </StyledListBoxWrapper>\n );\n }, [\n HeaderComp,\n activeDescendant,\n ctx,\n hasInput,\n inputReference,\n inputValue,\n isSkeleton,\n listboxReference,\n minWidth,\n onInputChange,\n onKeyDown,\n onMouseEnter,\n onMouseLeave,\n options,\n optionsShouldHavePadding,\n totalSize,\n userMaxHeight,\n virtualItems,\n ]);\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;AC6CV,SAiBH,UAjBG,KAiBH,YAjBG;AA7Cb,SAAgB,YAAY,eAAe;AAC3C,SAAS,mBAAmB;AAC5B,SAAS,6BAA6B;AACtC,SAAS,8BAA8B;AACvC,SAAS,kCAAkC;AAC3C,SAAS,oBAAoB,sBAAsB,q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;AAAA;AAAA,cACC,yBAAuB;AAAA,cACvB,eAAa,uBAAuB;AAAA,cACpC,MAAK;AAAA,cACL,cAAW;AAAA,cACX,OAAO,EAAE,QAAQ,aAAa,GAAG;AAAA,cAEhC,uBAAa,IAAI,CAAC,UACjB;AAAA,gBAAC;AAAA;AAAA,kBACC,QAAQ,QAAQ,MAAM,KAAK;AAAA,kBAC3B,OAAO,EAAE,UAAU,YAAY,KAAK,MAAM,OAAO,MAAM,GAAG,OAAO,OAAO;AAAA,kBAExE,UAAU,MAAM;AAAA,kBAChB;AAAA;AAAA,gBAFK,2BAA2B,QAAQ,MAAM,KAAK,EAAE;AAAA,cAGvD,CACD;AAAA;AAAA,UACH;AAAA,WACF;AAAA;AAAA,IAEJ;AAAA,EAEJ,GAAG;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACH;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback, useContext, useLayoutEffect, useRef } from "react";
|
|
4
|
+
import { DSCircularProgressIndicator } from "@elliemae/ds-legacy-circular-progress-indicator";
|
|
5
|
+
import { DSDropdownMenuContext } from "../DropdownMenuContext.js";
|
|
6
|
+
import { DropdownMenuDataTestId } from "../DropdownMenuDataTestId.js";
|
|
7
|
+
import { StyledLoadingWrapper } from "../styled.js";
|
|
8
|
+
const DropdownMenuLoading = () => {
|
|
9
|
+
const {
|
|
10
|
+
props: { onClickOutside },
|
|
11
|
+
triggerReferenceElement
|
|
12
|
+
} = useContext(DSDropdownMenuContext);
|
|
13
|
+
const loadingRef = useRef(null);
|
|
14
|
+
useLayoutEffect(() => {
|
|
15
|
+
loadingRef.current?.focus();
|
|
16
|
+
}, [loadingRef]);
|
|
17
|
+
const onKeyDown = useCallback(
|
|
18
|
+
(e) => {
|
|
19
|
+
if (e.code === "Escape" || e.code === "ArrowLeft")
|
|
20
|
+
onClickOutside(e);
|
|
21
|
+
},
|
|
22
|
+
[onClickOutside]
|
|
23
|
+
);
|
|
24
|
+
return /* @__PURE__ */ jsx(
|
|
25
|
+
StyledLoadingWrapper,
|
|
26
|
+
{
|
|
27
|
+
minWidth: triggerReferenceElement?.offsetWidth ?? 0,
|
|
28
|
+
justifyContent: "center",
|
|
29
|
+
alignItems: "center",
|
|
30
|
+
"data-testid": DropdownMenuDataTestId.LOADING,
|
|
31
|
+
tabIndex: 0,
|
|
32
|
+
role: "status",
|
|
33
|
+
"aria-busy": "true",
|
|
34
|
+
ref: loadingRef,
|
|
35
|
+
onKeyDown,
|
|
36
|
+
children: /* @__PURE__ */ jsx(DSCircularProgressIndicator, { size: "l" })
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
export {
|
|
41
|
+
DropdownMenuLoading
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=DropdownMenuLoading.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/parts/DropdownMenuLoading.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useCallback, useContext, useLayoutEffect, useRef } from 'react';\nimport { DSCircularProgressIndicator } from '@elliemae/ds-legacy-circular-progress-indicator';\nimport { DSDropdownMenuContext } from '../DropdownMenuContext.js';\nimport { DropdownMenuDataTestId } from '../DropdownMenuDataTestId.js';\nimport { StyledLoadingWrapper } from '../styled.js';\n\nexport const DropdownMenuLoading: React.ComponentType<Record<string, never>> = () => {\n const {\n props: { onClickOutside },\n triggerReferenceElement,\n } = useContext(DSDropdownMenuContext);\n\n const loadingRef = useRef<HTMLDivElement>(null);\n\n useLayoutEffect(() => {\n loadingRef.current?.focus();\n }, [loadingRef]);\n\n const onKeyDown: React.KeyboardEventHandler = useCallback(\n (e) => {\n if (e.code === 'Escape' || e.code === 'ArrowLeft') onClickOutside(e);\n },\n [onClickOutside],\n );\n\n return (\n <StyledLoadingWrapper\n minWidth={triggerReferenceElement?.offsetWidth ?? 0}\n justifyContent=\"center\"\n alignItems=\"center\"\n data-testid={DropdownMenuDataTestId.LOADING}\n tabIndex={0}\n role=\"status\"\n aria-busy=\"true\"\n ref={loadingRef}\n onKeyDown={onKeyDown}\n >\n <DSCircularProgressIndicator size=\"l\" />\n </StyledLoadingWrapper>\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACqCjB;AArCN,SAAgB,aAAa,YAAY,iBAAiB,cAAc;AACxE,SAAS,mCAAmC;AAC5C,SAAS,6BAA6B;AACtC,SAAS,8BAA8B;AACvC,SAAS,4BAA4B;AAE9B,MAAM,sBAAkE,MAAM;AACnF,QAAM;AAAA,IACJ,OAAO,EAAE,eAAe;AAAA,IACxB;AAAA,EACF,IAAI,WAAW,qBAAqB;AAEpC,QAAM,aAAa,OAAuB,IAAI;AAE9C,kBAAgB,MAAM;AACpB,eAAW,SAAS,MAAM;AAAA,EAC5B,GAAG,CAAC,UAAU,CAAC;AAEf,QAAM,YAAwC;AAAA,IAC5C,CAAC,MAAM;AACL,UAAI,EAAE,SAAS,YAAY,EAAE,SAAS;AAAa,uBAAe,CAAC;AAAA,IACrE;AAAA,IACA,CAAC,cAAc;AAAA,EACjB;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,UAAU,yBAAyB,eAAe;AAAA,MAClD,gBAAe;AAAA,MACf,YAAW;AAAA,MACX,eAAa,uBAAuB;AAAA,MACpC,UAAU;AAAA,MACV,MAAK;AAAA,MACL,aAAU;AAAA,MACV,KAAK;AAAA,MACL;AAAA,MAEA,8BAAC,+BAA4B,MAAK,KAAI;AAAA;AAAA,EACxC;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { SkeletonMenuItem } from "@elliemae/ds-legacy-menu-items";
|
|
4
|
+
import { Grid } from "@elliemae/ds-legacy-grid";
|
|
5
|
+
const DropdownMenuSkeleton = () => {
|
|
6
|
+
const SKELETON_AMOUNT = 5;
|
|
7
|
+
return /* @__PURE__ */ jsx(Grid, { children: Array(SKELETON_AMOUNT).fill(0).map((_, index) => /* @__PURE__ */ jsx(SkeletonMenuItem, { dsId: `${index}-skeleton` }, index)) });
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
DropdownMenuSkeleton
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=DropdownMenuSkeleton.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/parts/DropdownMenuSkeleton.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { SkeletonMenuItem } from '@elliemae/ds-legacy-menu-items';\nimport { Grid } from '@elliemae/ds-legacy-grid';\n\nexport const DropdownMenuSkeleton = () => {\n const SKELETON_AMOUNT = 5;\n\n return (\n <Grid>\n {Array(SKELETON_AMOUNT)\n .fill(0)\n .map((_, index) => (\n <SkeletonMenuItem key={index} dsId={`${index}-skeleton`} />\n ))}\n </Grid>\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACYb;AAXV,SAAS,wBAAwB;AACjC,SAAS,YAAY;AAEd,MAAM,uBAAuB,MAAM;AACxC,QAAM,kBAAkB;AAExB,SACE,oBAAC,QACE,gBAAM,eAAe,EACnB,KAAK,CAAC,EACN,IAAI,CAAC,GAAG,UACP,oBAAC,oBAA6B,MAAM,GAAG,oBAAhB,KAAkC,CAC1D,GACL;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import {
|
|
3
|
+
PropTypes,
|
|
4
|
+
globalAttributesPropTypes
|
|
5
|
+
} from "@elliemae/ds-legacy-props-helpers";
|
|
6
|
+
const optionTypes = PropTypes.oneOfType([
|
|
7
|
+
PropTypes.shape({
|
|
8
|
+
dsId: PropTypes.string.isRequired,
|
|
9
|
+
type: PropTypes.oneOf(["action"]),
|
|
10
|
+
label: PropTypes.string.isRequired,
|
|
11
|
+
secondaryLabel: PropTypes.string,
|
|
12
|
+
disabled: PropTypes.bool,
|
|
13
|
+
render: PropTypes.func
|
|
14
|
+
}),
|
|
15
|
+
PropTypes.shape({
|
|
16
|
+
dsId: PropTypes.string.isRequired,
|
|
17
|
+
type: PropTypes.oneOf(["single", "checkbox"]),
|
|
18
|
+
label: PropTypes.string.isRequired,
|
|
19
|
+
secondaryLabel: PropTypes.string,
|
|
20
|
+
value: PropTypes.any.isRequired,
|
|
21
|
+
disabled: PropTypes.bool,
|
|
22
|
+
render: PropTypes.func
|
|
23
|
+
}),
|
|
24
|
+
PropTypes.shape({
|
|
25
|
+
dsId: PropTypes.string.isRequired,
|
|
26
|
+
type: PropTypes.oneOf(["submenu", "singleWithSubmenu"]),
|
|
27
|
+
label: PropTypes.string.isRequired,
|
|
28
|
+
secondaryLabel: PropTypes.string,
|
|
29
|
+
value: PropTypes.any.isRequired,
|
|
30
|
+
disabled: PropTypes.bool,
|
|
31
|
+
rightAddon: PropTypes.oneOf(["chevron", "ellipsis"]),
|
|
32
|
+
options: PropTypes.array,
|
|
33
|
+
minWidth: PropTypes.any,
|
|
34
|
+
maxHeight: PropTypes.any,
|
|
35
|
+
render: PropTypes.func
|
|
36
|
+
}),
|
|
37
|
+
PropTypes.shape({
|
|
38
|
+
dsId: PropTypes.string.isRequired,
|
|
39
|
+
type: PropTypes.oneOf(["separator", "section"]),
|
|
40
|
+
label: PropTypes.string.isRequired,
|
|
41
|
+
render: PropTypes.func
|
|
42
|
+
})
|
|
43
|
+
]);
|
|
44
|
+
const DSDropdownMenuV2PropTypes = {
|
|
45
|
+
options: PropTypes.arrayOf(optionTypes).description("The array of option for the menu").omitValidation().isRequired,
|
|
46
|
+
isOpened: PropTypes.bool.description("Whether the dropdown menu is opened or not").isRequired,
|
|
47
|
+
onClickOutside: PropTypes.func.description("Callback executed when you click outside the dropdown menu, or press the Esc key").defaultValue(() => null),
|
|
48
|
+
selectedOptions: PropTypes.object.description(
|
|
49
|
+
"Object with the ids of the options as keys, and booleans as keys. Represents the state of the current selection in the dropdown menu"
|
|
50
|
+
).defaultValue({}),
|
|
51
|
+
onOptionClick: PropTypes.func.description(
|
|
52
|
+
"Callback triggered when an item is clicked or pressed. We provide the next selected options, the clicked option and the event, in that order"
|
|
53
|
+
).defaultValue(() => null),
|
|
54
|
+
openedSubmenus: PropTypes.object.description(
|
|
55
|
+
"Object with the ids of the submenus as keys, and booleans as keys. Represents the state of the current opened submenus"
|
|
56
|
+
).defaultValue({}),
|
|
57
|
+
onSubmenuToggle: PropTypes.func.description(
|
|
58
|
+
"Callback triggered when a submenu is opened or closed. We provide the next opened submenus, the clicked one and the event, in that order"
|
|
59
|
+
).defaultValue(() => null),
|
|
60
|
+
startPlacementPreference: PropTypes.string.description("Where to place the popper for the dropdown menu").defaultValue("bottom-start"),
|
|
61
|
+
placementOrderPreference: PropTypes.arrayOf(PropTypes.string).description("Placement priorities for the dropdown menu").defaultValue(["bottom-start", "top-start", "right-start", "right-end", "left-start", "left-end"]),
|
|
62
|
+
customOffset: PropTypes.arrayOf(PropTypes.number).description("Custom offset for the dropdown menu").defaultValue([0, 4]),
|
|
63
|
+
wrapperStyles: PropTypes.object.description("Styling for the dropdown menu wrapper").defaultValue({}),
|
|
64
|
+
isLoading: PropTypes.bool.description("Whether the dropdown menu should render the loading indicator").defaultValue(false),
|
|
65
|
+
zIndex: PropTypes.number.description("ZIndex for the popper").defaultValue(10),
|
|
66
|
+
HeaderComp: PropTypes.func.description("Component to render as a header for the dropdown menu").defaultValue(void 0),
|
|
67
|
+
actionRef: PropTypes.object.description("Reference where all the exposed action callbacks will be exposed"),
|
|
68
|
+
minWidth: PropTypes.any.description("Minimum width for the dropdown menu").defaultValue(void 0),
|
|
69
|
+
maxHeight: PropTypes.any.description("Maximum height for the dropdown menu").defaultValue(void 0),
|
|
70
|
+
...globalAttributesPropTypes,
|
|
71
|
+
onKeyDown: PropTypes.func.description("Callback executed when a key is pressed").defaultValue(() => null),
|
|
72
|
+
onMouseEnter: PropTypes.func.description("Callback executed when the mouse enter the dropdown menu").defaultValue(() => null),
|
|
73
|
+
onMouseLeave: PropTypes.func.description("Callback executed when the mouse leaves the dropdown menu").defaultValue(() => null),
|
|
74
|
+
isSkeleton: PropTypes.bool.description("Whether the dropdown menu should render the skeleton").defaultValue(false)
|
|
75
|
+
};
|
|
76
|
+
const defaultProps = {
|
|
77
|
+
onClickOutside: () => null,
|
|
78
|
+
onKeyDown: () => null,
|
|
79
|
+
onMouseEnter: () => null,
|
|
80
|
+
onMouseLeave: () => null,
|
|
81
|
+
selectedOptions: {},
|
|
82
|
+
onOptionClick: () => null,
|
|
83
|
+
openedSubmenus: {},
|
|
84
|
+
onSubmenuToggle: () => null,
|
|
85
|
+
isLoading: false,
|
|
86
|
+
hasInput: false,
|
|
87
|
+
inputValue: "",
|
|
88
|
+
inputPlaceholder: "Hint text",
|
|
89
|
+
onInputChange: () => null,
|
|
90
|
+
startPlacementPreference: "bottom-start",
|
|
91
|
+
placementOrderPreference: ["bottom-start", "top-start", "right-start", "right-end", "left-start", "left-end"],
|
|
92
|
+
customOffset: [0, 4],
|
|
93
|
+
wrapperStyles: {},
|
|
94
|
+
actionRef: { current: {} },
|
|
95
|
+
as: "div",
|
|
96
|
+
isSkeleton: false
|
|
97
|
+
};
|
|
98
|
+
export {
|
|
99
|
+
DSDropdownMenuV2PropTypes,
|
|
100
|
+
defaultProps
|
|
101
|
+
};
|
|
102
|
+
//# sourceMappingURL=react-desc-prop-types.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/react-desc-prop-types.ts"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable no-use-before-define */\n/* eslint-disable max-lines */\nimport type { WeakValidationMap } from 'react';\nimport type React from 'react';\nimport type { useVirtual } from 'react-virtual';\nimport {\n type GlobalAttributesT,\n PropTypes,\n type XstyledProps,\n globalAttributesPropTypes,\n} from '@elliemae/ds-legacy-props-helpers';\nimport type { SizingProps } from '@elliemae/ds-legacy-system';\n\nexport namespace DSDropdownMenuT {\n type PopperPlacementsT =\n | 'top-start'\n | 'top'\n | 'top-end'\n | 'right-start'\n | 'right'\n | 'right-end'\n | 'bottom-end'\n | 'bottom'\n | 'bottom-start'\n | 'left-end'\n | 'left'\n | 'left-start';\n\n export interface RequiredProps {\n options: Item[];\n isOpened: boolean;\n }\n\n export interface DefaultProps {\n onClickOutside: (e: MouseEvent | React.KeyboardEvent | TouchEvent) => void;\n onKeyDown: React.KeyboardEventHandler;\n onMouseEnter: React.MouseEventHandler;\n onMouseLeave: React.MouseEventHandler;\n selectedOptions: Record<string, boolean>;\n onOptionClick: (\n nextSelectedOptions: Record<string, boolean>,\n clickedOption: Item,\n e: React.MouseEvent | React.KeyboardEvent,\n ) => void;\n openedSubmenus: Record<string, boolean>;\n onSubmenuToggle: (\n nextOpenedSubmenus: Record<string, boolean>,\n submenu: Item,\n e: React.MouseEvent | React.KeyboardEvent,\n ) => void;\n isLoading: boolean;\n hasInput: boolean;\n inputValue: string;\n inputPlaceholder: string;\n onInputChange: React.FormEventHandler<HTMLInputElement>;\n startPlacementPreference: PopperPlacementsT;\n placementOrderPreference: PopperPlacementsT[];\n customOffset: [number, number];\n wrapperStyles: Record<string, unknown>;\n actionRef: React.MutableRefObject<Record<string, unknown>>;\n as: keyof JSX.IntrinsicElements;\n children?: React.ReactNode;\n isSkeleton: false;\n }\n\n export interface OptionalProps {\n zIndex?: number;\n minWidth?: SizingProps['minWidth'];\n maxHeight?: SizingProps['maxHeight'];\n HeaderComp?: React.ComponentType<{ ctx?: DSDropdownMenuT.CTX }>;\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 export interface CTX {\n props: React.PropsWithChildren<InternalProps>;\n triggerReferenceElement: HTMLDivElement | null;\n setTriggerReferenceElement: React.Dispatch<React.SetStateAction<HTMLDivElement | null>>;\n listboxReference: React.RefObject<HTMLDivElement>;\n inputReference: React.RefObject<HTMLInputElement>;\n activeDescendant: string;\n setActiveDescendant: React.Dispatch<React.SetStateAction<string>>;\n scrollOptionIntoView: (dsId: string) => void;\n virtualListHelpers: ReturnType<typeof useVirtual>;\n DSDropdownMenuV2: React.ComponentType<Props>;\n }\n\n interface CommonItemOptions {\n dsId: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n render?: React.ComponentType<any>;\n onClick?: (e: React.MouseEvent | React.KeyboardEvent) => void;\n onKeyDown?: (e: React.KeyboardEvent) => null;\n }\n\n export interface ItemActionOptions extends CommonItemOptions {\n type: 'action';\n label: string;\n value: unknown;\n disabled?: boolean;\n }\n\n export interface ItemSingleOptions extends CommonItemOptions {\n type: 'single';\n label: string;\n value: unknown;\n disabled?: boolean;\n }\n\n export interface ItemSingleWithSubmenuOptions extends CommonItemOptions {\n type: 'singleWithSubmenu';\n label: string;\n value: unknown;\n disabled?: boolean;\n rightAddon?: 'chevron' | 'ellipsis';\n options: Item[];\n }\n\n export interface ItemCheckboxOptions extends CommonItemOptions {\n type: 'checkbox';\n label: string;\n value: unknown;\n disabled?: boolean;\n }\n\n export interface ItemSubmenuOptions extends CommonItemOptions {\n type: 'submenu';\n label: string;\n value: unknown;\n disabled?: boolean;\n rightAddon?: 'chevron' | 'ellipsis';\n options: Item[];\n }\n\n export interface ItemSeparatorOptions extends CommonItemOptions {\n type: 'separator';\n }\n\n export interface ItemSectionOptions extends CommonItemOptions {\n type: 'section';\n label: string;\n }\n\n export interface ItemSkeletonOptions extends CommonItemOptions {\n type: 'skeleton';\n }\n\n export type Item =\n | ItemActionOptions\n | ItemSingleOptions\n | ItemCheckboxOptions\n | ItemSubmenuOptions\n | ItemSingleWithSubmenuOptions\n | ItemSeparatorOptions\n | ItemSectionOptions\n | ItemSkeletonOptions;\n\n export interface ItemDictionary {\n [dsId: string]: {\n original: Item;\n containerRef: React.RefObject<HTMLDivElement>;\n parent: string | null;\n };\n }\n}\n\nconst optionTypes = PropTypes.oneOfType([\n PropTypes.shape({\n dsId: PropTypes.string.isRequired,\n type: PropTypes.oneOf(['action']),\n label: PropTypes.string.isRequired,\n secondaryLabel: PropTypes.string,\n disabled: PropTypes.bool,\n render: PropTypes.func,\n }),\n PropTypes.shape({\n dsId: PropTypes.string.isRequired,\n type: PropTypes.oneOf(['single', 'checkbox']),\n label: PropTypes.string.isRequired,\n secondaryLabel: PropTypes.string,\n value: PropTypes.any.isRequired,\n disabled: PropTypes.bool,\n render: PropTypes.func,\n }),\n PropTypes.shape({\n dsId: PropTypes.string.isRequired,\n type: PropTypes.oneOf(['submenu', 'singleWithSubmenu']),\n label: PropTypes.string.isRequired,\n secondaryLabel: PropTypes.string,\n value: PropTypes.any.isRequired,\n disabled: PropTypes.bool,\n rightAddon: PropTypes.oneOf(['chevron', 'ellipsis']),\n options: PropTypes.array,\n minWidth: PropTypes.any,\n maxHeight: PropTypes.any,\n render: PropTypes.func,\n }),\n PropTypes.shape({\n dsId: PropTypes.string.isRequired,\n type: PropTypes.oneOf(['separator', 'section']),\n label: PropTypes.string.isRequired,\n render: PropTypes.func,\n }),\n]);\n\nexport const DSDropdownMenuV2PropTypes = {\n options: PropTypes.arrayOf(optionTypes).description('The array of option for the menu').omitValidation().isRequired,\n isOpened: PropTypes.bool.description('Whether the dropdown menu is opened or not').isRequired,\n onClickOutside: PropTypes.func\n .description('Callback executed when you click outside the dropdown menu, or press the Esc key')\n .defaultValue(() => null),\n selectedOptions: PropTypes.object\n .description(\n 'Object with the ids of the options as keys, and booleans as keys. Represents the state of the current selection in the dropdown menu',\n )\n .defaultValue({}),\n onOptionClick: PropTypes.func\n .description(\n 'Callback triggered when an item is clicked or pressed. We provide the next selected options, the clicked option and the event, in that order',\n )\n .defaultValue(() => null),\n openedSubmenus: PropTypes.object\n .description(\n 'Object with the ids of the submenus as keys, and booleans as keys. Represents the state of the current opened submenus',\n )\n .defaultValue({}),\n onSubmenuToggle: PropTypes.func\n .description(\n 'Callback triggered when a submenu is opened or closed. We provide the next opened submenus, the clicked one and the event, in that order',\n )\n .defaultValue(() => null),\n startPlacementPreference: PropTypes.string\n .description('Where to place the popper for the dropdown menu')\n .defaultValue('bottom-start'),\n placementOrderPreference: PropTypes.arrayOf(PropTypes.string)\n .description('Placement priorities for the dropdown menu')\n .defaultValue(['bottom-start', 'top-start', 'right-start', 'right-end', 'left-start', 'left-end']),\n customOffset: PropTypes.arrayOf(PropTypes.number)\n .description('Custom offset for the dropdown menu')\n .defaultValue([0, 4]),\n wrapperStyles: PropTypes.object.description('Styling for the dropdown menu wrapper').defaultValue({}),\n isLoading: PropTypes.bool\n .description('Whether the dropdown menu should render the loading indicator')\n .defaultValue(false),\n zIndex: PropTypes.number.description('ZIndex for the popper').defaultValue(10),\n HeaderComp: PropTypes.func\n .description('Component to render as a header for the dropdown menu')\n .defaultValue(undefined),\n actionRef: PropTypes.object.description('Reference where all the exposed action callbacks will be exposed'),\n minWidth: PropTypes.any.description('Minimum width for the dropdown menu').defaultValue(undefined),\n maxHeight: PropTypes.any.description('Maximum height for the dropdown menu').defaultValue(undefined),\n ...globalAttributesPropTypes,\n onKeyDown: PropTypes.func.description('Callback executed when a key is pressed').defaultValue(() => null),\n onMouseEnter: PropTypes.func\n .description('Callback executed when the mouse enter the dropdown menu')\n .defaultValue(() => null),\n onMouseLeave: PropTypes.func\n .description('Callback executed when the mouse leaves the dropdown menu')\n .defaultValue(() => null),\n isSkeleton: PropTypes.bool.description('Whether the dropdown menu should render the skeleton').defaultValue(false),\n} as WeakValidationMap<unknown>;\n\nexport const defaultProps: DSDropdownMenuT.DefaultProps = {\n onClickOutside: () => null,\n onKeyDown: () => null,\n onMouseEnter: () => null,\n onMouseLeave: () => null,\n selectedOptions: {},\n onOptionClick: () => null,\n openedSubmenus: {},\n onSubmenuToggle: () => null,\n isLoading: false,\n hasInput: false,\n inputValue: '',\n inputPlaceholder: 'Hint text',\n onInputChange: () => null,\n startPlacementPreference: 'bottom-start',\n placementOrderPreference: ['bottom-start', 'top-start', 'right-start', 'right-end', 'left-start', 'left-end'],\n customOffset: [0, 4],\n wrapperStyles: {},\n actionRef: { current: {} },\n as: 'div',\n isSkeleton: false,\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACKvB;AAAA,EAEE;AAAA,EAEA;AAAA,OACK;AAwKP,MAAM,cAAc,UAAU,UAAU;AAAA,EACtC,UAAU,MAAM;AAAA,IACd,MAAM,UAAU,OAAO;AAAA,IACvB,MAAM,UAAU,MAAM,CAAC,QAAQ,CAAC;AAAA,IAChC,OAAO,UAAU,OAAO;AAAA,IACxB,gBAAgB,UAAU;AAAA,IAC1B,UAAU,UAAU;AAAA,IACpB,QAAQ,UAAU;AAAA,EACpB,CAAC;AAAA,EACD,UAAU,MAAM;AAAA,IACd,MAAM,UAAU,OAAO;AAAA,I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iBAAiB,CAAC;AAAA,EAClB,eAAe,MAAM;AAAA,EACrB,gBAAgB,CAAC;AAAA,EACjB,iBAAiB,MAAM;AAAA,EACvB,WAAW;AAAA,EACX,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,kBAAkB;AAAA,EAClB,eAAe,MAAM;AAAA,EACrB,0BAA0B;AAAA,EAC1B,0BAA0B,CAAC,gBAAgB,aAAa,eAAe,aAAa,cAAc,UAAU;AAAA,EAC5G,cAAc,CAAC,GAAG,CAAC;AAAA,EACnB,eAAe,CAAC;AAAA,EAChB,WAAW,EAAE,SAAS,CAAC,EAAE;AAAA,EACzB,IAAI;AAAA,EACJ,YAAY;AACd;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Grid } from "@elliemae/ds-legacy-grid";
|
|
3
|
+
import { styled, space, sizing, position, layout } from "@elliemae/ds-legacy-system";
|
|
4
|
+
import { DSDropdownMenuName, DSDropdownMenuSlots } from "./exported-related/index.js";
|
|
5
|
+
const StyledTriggerWrapper = styled("div", { name: DSDropdownMenuName, slot: DSDropdownMenuSlots.ROOT })`
|
|
6
|
+
width: fit-content;
|
|
7
|
+
${space}
|
|
8
|
+
${sizing}
|
|
9
|
+
${position}
|
|
10
|
+
${layout}
|
|
11
|
+
`;
|
|
12
|
+
const StyledListBoxWrapper = styled("div", {
|
|
13
|
+
name: DSDropdownMenuName,
|
|
14
|
+
slot: DSDropdownMenuSlots.LISTBOX_WRAPPER
|
|
15
|
+
})`
|
|
16
|
+
${sizing}
|
|
17
|
+
padding: ${(props) => props.hasHeader ? 0 : "4px"} 0 4px 0;
|
|
18
|
+
overflow-y: auto;
|
|
19
|
+
background-color: white;
|
|
20
|
+
outline: none;
|
|
21
|
+
list-style: none;
|
|
22
|
+
`;
|
|
23
|
+
const StyledOptionListWrapper = styled("ul", {
|
|
24
|
+
name: DSDropdownMenuName,
|
|
25
|
+
slot: DSDropdownMenuSlots.OPTION_LIST_WRAPPER
|
|
26
|
+
})`
|
|
27
|
+
position: relative;
|
|
28
|
+
margin: 0;
|
|
29
|
+
padding: 0;
|
|
30
|
+
list-style: none;
|
|
31
|
+
outline: none;
|
|
32
|
+
`;
|
|
33
|
+
const StyledLoadingWrapper = styled(Grid, {
|
|
34
|
+
name: DSDropdownMenuName,
|
|
35
|
+
slot: DSDropdownMenuSlots.LOADING_WRAPPER
|
|
36
|
+
})`
|
|
37
|
+
height: ${(props) => props.theme.space.xxl};
|
|
38
|
+
min-width: ${(props) => props.minWidth}px;
|
|
39
|
+
background-color: white;
|
|
40
|
+
outline: none;
|
|
41
|
+
`;
|
|
42
|
+
const StyledEmptyStateWrapper = styled(Grid, {
|
|
43
|
+
name: DSDropdownMenuName,
|
|
44
|
+
slot: DSDropdownMenuSlots.EMPTY_STATE_WRAPPER
|
|
45
|
+
})`
|
|
46
|
+
font-weight: ${(props) => props.theme.fontWeights.regular};
|
|
47
|
+
font-size: ${(props) => props.theme.fontSizes.value[500]};
|
|
48
|
+
color: ${(props) => props.theme.colors.neutral[500]};
|
|
49
|
+
`;
|
|
50
|
+
const StyledInputWrapper = styled(Grid)`
|
|
51
|
+
padding-top: ${(props) => props.hasHeader ? props.theme.space.xxs : 0};
|
|
52
|
+
padding-left: ${(props) => props.theme.space.xxs};
|
|
53
|
+
padding-right: ${(props) => props.theme.space.xxs};
|
|
54
|
+
padding-bottom: ${(props) => props.theme.space.xxs};
|
|
55
|
+
|
|
56
|
+
.em-ds-input {
|
|
57
|
+
:focus,
|
|
58
|
+
:hover {
|
|
59
|
+
outline: none !important;
|
|
60
|
+
border: none !important;
|
|
61
|
+
box-shadow: none !important;
|
|
62
|
+
}
|
|
63
|
+
:focus {
|
|
64
|
+
border: 1px solid ${(props) => props.theme.colors.brand[700]} !important;
|
|
65
|
+
box-shadow: inset 0 0 0 1px ${(props) => props.theme.colors.brand[700]} !important;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
`;
|
|
69
|
+
const StyledHeaderWrapper = styled(Grid, { name: DSDropdownMenuName, slot: DSDropdownMenuSlots.HEADER_WRAPPER })`
|
|
70
|
+
width: 100%;
|
|
71
|
+
border-bottom: 1px solid ${(props) => props.theme.colors.neutral[300]};
|
|
72
|
+
color: ${(props) => props.theme.colors.neutral[500]};
|
|
73
|
+
font-size: 12px;
|
|
74
|
+
padding-left: ${(props) => props.theme.space.xxxs};
|
|
75
|
+
position: sticky;
|
|
76
|
+
top: 0;
|
|
77
|
+
z-index: 20;
|
|
78
|
+
background-color: white;
|
|
79
|
+
min-height: 16px;
|
|
80
|
+
`;
|
|
81
|
+
export {
|
|
82
|
+
StyledEmptyStateWrapper,
|
|
83
|
+
StyledHeaderWrapper,
|
|
84
|
+
StyledInputWrapper,
|
|
85
|
+
StyledListBoxWrapper,
|
|
86
|
+
StyledLoadingWrapper,
|
|
87
|
+
StyledOptionListWrapper,
|
|
88
|
+
StyledTriggerWrapper
|
|
89
|
+
};
|
|
90
|
+
//# sourceMappingURL=styled.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/styled.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { Grid } from '@elliemae/ds-legacy-grid';\nimport { styled, space, sizing, position, layout } from '@elliemae/ds-legacy-system';\nimport type { LayoutProps, SpaceProps, SizingProps, PositionProps } from '@elliemae/ds-legacy-system';\nimport { DSDropdownMenuName, DSDropdownMenuSlots } from './exported-related/index.js';\n\nexport const StyledTriggerWrapper = styled('div', { name: DSDropdownMenuName, slot: DSDropdownMenuSlots.ROOT })<\n LayoutProps & SpaceProps & SizingProps & PositionProps\n>`\n width: fit-content;\n ${space}\n ${sizing}\n ${position}\n ${layout}\n`;\n\nexport const StyledListBoxWrapper = styled('div', {\n name: DSDropdownMenuName,\n slot: DSDropdownMenuSlots.LISTBOX_WRAPPER,\n})<{ minWidth: SizingProps['minWidth']; maxHeight: SizingProps['maxHeight']; hasHeader: boolean }>`\n ${sizing}\n padding: ${(props) => (props.hasHeader ? 0 : '4px')} 0 4px 0;\n overflow-y: auto;\n background-color: white;\n outline: none;\n list-style: none;\n`;\n\nexport const StyledOptionListWrapper = styled('ul', {\n name: DSDropdownMenuName,\n slot: DSDropdownMenuSlots.OPTION_LIST_WRAPPER,\n})`\n position: relative;\n margin: 0;\n padding: 0;\n list-style: none;\n outline: none;\n`;\n\nexport const StyledLoadingWrapper = styled(Grid, {\n name: DSDropdownMenuName,\n slot: DSDropdownMenuSlots.LOADING_WRAPPER,\n})<{ minWidth: number }>`\n height: ${(props) => props.theme.space.xxl};\n min-width: ${(props) => props.minWidth}px;\n background-color: white;\n outline: none;\n`;\n\nexport const StyledEmptyStateWrapper = styled(Grid, {\n name: DSDropdownMenuName,\n slot: DSDropdownMenuSlots.EMPTY_STATE_WRAPPER,\n})<{ minWidth: SizingProps['minWidth']; maxHeight: SizingProps['maxHeight'] }>`\n font-weight: ${(props) => props.theme.fontWeights.regular};\n font-size: ${(props) => props.theme.fontSizes.value[500]};\n color: ${(props) => props.theme.colors.neutral[500]};\n`;\n\nexport const StyledInputWrapper = styled(Grid)<{ hasHeader: boolean }>`\n padding-top: ${(props) => (props.hasHeader ? props.theme.space.xxs : 0)};\n padding-left: ${(props) => props.theme.space.xxs};\n padding-right: ${(props) => props.theme.space.xxs};\n padding-bottom: ${(props) => props.theme.space.xxs};\n\n .em-ds-input {\n :focus,\n :hover {\n outline: none !important;\n border: none !important;\n box-shadow: none !important;\n }\n :focus {\n border: 1px solid ${(props) => props.theme.colors.brand[700]} !important;\n box-shadow: inset 0 0 0 1px ${(props) => props.theme.colors.brand[700]} !important;\n }\n }\n`;\n\nexport const StyledHeaderWrapper = styled(Grid, { name: DSDropdownMenuName, slot: DSDropdownMenuSlots.HEADER_WRAPPER })`\n width: 100%;\n border-bottom: 1px solid ${(props) => props.theme.colors.neutral[300]};\n color: ${(props) => props.theme.colors.neutral[500]};\n font-size: 12px;\n padding-left: ${(props) => props.theme.space.xxxs};\n position: sticky;\n top: 0;\n z-index: 20;\n background-color: white;\n min-height: 16px;\n`;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,YAAY;AACrB,SAAS,QAAQ,OAAO,QAAQ,UAAU,cAAc;AAExD,SAAS,oBAAoB,2BAA2B;AAEjD,MAAM,uBAAuB,OAAO,OAAO,EAAE,MAAM,oBAAoB,MAAM,oBAAoB,KAAK,CAAC;AAAA;AAAA,IAI1G;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAGG,MAAM,uBAAuB,OAAO,OAAO;AAAA,EAChD,MAAM;AAAA,EACN,MAAM,oBAAoB;AAC5B,CAAC;AAAA,IACG;AAAA,aACS,CAAC,UAAW,MAAM,YAAY,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA;AAOxC,MAAM,0BAA0B,OAAO,MAAM;AAAA,EAClD,MAAM;AAAA,EACN,MAAM,oBAAoB;AAC5B,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQM,MAAM,uBAAuB,OAAO,MAAM;AAAA,EAC/C,MAAM;AAAA,EACN,MAAM,oBAAoB;AAC5B,CAAC;AAAA,YACW,CAAC,UAAU,MAAM,MAAM,MAAM;AAAA,eAC1B,CAAC,UAAU,MAAM;AAAA;AAAA;AAAA;AAKzB,MAAM,0BAA0B,OAAO,MAAM;AAAA,EAClD,MAAM;AAAA,EACN,MAAM,oBAAoB;AAC5B,CAAC;AAAA,iBACgB,CAAC,UAAU,MAAM,MAAM,YAAY;AAAA,eACrC,CAAC,UAAU,MAAM,MAAM,UAAU,MAAM,GAAG;AAAA,WAC9C,CAAC,UAAU,MAAM,MAAM,OAAO,QAAQ,GAAG;AAAA;AAG7C,MAAM,qBAAqB,OAAO,IAAI;AAAA,iBAC5B,CAAC,UAAW,MAAM,YAAY,MAAM,MAAM,MAAM,MAAM;AAAA,kBACrD,CAAC,UAAU,MAAM,MAAM,MAAM;AAAA,mBAC5B,CAAC,UAAU,MAAM,MAAM,MAAM;AAAA,oBAC5B,CAAC,UAAU,MAAM,MAAM,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAUvB,CAAC,UAAU,MAAM,MAAM,OAAO,MAAM,GAAG;AAAA,oCAC7B,CAAC,UAAU,MAAM,MAAM,OAAO,MAAM,GAAG;AAAA;AAAA;AAAA;AAKpE,MAAM,sBAAsB,OAAO,MAAM,EAAE,MAAM,oBAAoB,MAAM,oBAAoB,eAAe,CAAC;AAAA;AAAA,6BAEzF,CAAC,UAAU,MAAM,MAAM,OAAO,QAAQ,GAAG;AAAA,WAC3D,CAAC,UAAU,MAAM,MAAM,OAAO,QAAQ,GAAG;AAAA;AAAA,kBAElC,CAAC,UAAU,MAAM,MAAM,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
const findInCircularList = (list, from, criteria, step = 1) => {
|
|
3
|
+
for (let i = (from + step + list.length) % list.length; i !== from; i = (i + step + list.length) % list.length) {
|
|
4
|
+
if (criteria(list[i]))
|
|
5
|
+
return i;
|
|
6
|
+
}
|
|
7
|
+
return from;
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
findInCircularList
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=findInCircularList.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/utils/findInCircularList.ts"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const findInCircularList = <T>(list: T[], from: number, criteria: (item: T) => boolean, step = 1): number => {\n for (let i = (from + step + list.length) % list.length; i !== from; i = (i + step + list.length) % list.length) {\n if (criteria(list[i])) return i;\n }\n return from; // return same item\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAhB,MAAM,qBAAqB,CAAI,MAAW,MAAc,UAAgC,OAAO,MAAc;AAClH,WAAS,KAAK,OAAO,OAAO,KAAK,UAAU,KAAK,QAAQ,MAAM,MAAM,KAAK,IAAI,OAAO,KAAK,UAAU,KAAK,QAAQ;AAC9G,QAAI,SAAS,KAAK,CAAC,CAAC;AAAG,aAAO;AAAA,EAChC;AACA,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/utils/index.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export * from './findInCircularList.js';\nexport * from './isOptionFocuseable.js';\nexport * from './manageOpenedSubmenus.js';\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,cAAc;AACd,cAAc;AACd,cAAc;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/utils/isOptionFocuseable.ts"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type { DSDropdownMenuT } from '../react-desc-prop-types.js';\n\nexport const isOptionFocuseable = (opt: DSDropdownMenuT.Item): boolean =>\n !['section', 'separator'].includes(opt.type) && !('disabled' in opt && opt.disabled);\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACEhB,MAAM,qBAAqB,CAAC,QACjC,CAAC,CAAC,WAAW,WAAW,EAAE,SAAS,IAAI,IAAI,KAAK,EAAE,cAAc,OAAO,IAAI;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
const isSubmenu = (item) => item.type === "submenu" || item.type === "singleWithSubmenu";
|
|
3
|
+
const buildItemToParentObject = (options, parent = "__root") => {
|
|
4
|
+
let obj = {};
|
|
5
|
+
options?.forEach((opt) => {
|
|
6
|
+
if (isSubmenu(opt)) {
|
|
7
|
+
obj[opt.dsId] = parent;
|
|
8
|
+
if ("options" in opt) {
|
|
9
|
+
obj = { ...obj, ...buildItemToParentObject(opt.options, opt.dsId) };
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
return obj;
|
|
14
|
+
};
|
|
15
|
+
const manageOpenedSubmenus = (options, selectedOptions, clickedOption) => {
|
|
16
|
+
if (!isSubmenu(clickedOption)) {
|
|
17
|
+
return selectedOptions;
|
|
18
|
+
}
|
|
19
|
+
if (selectedOptions[clickedOption.dsId] === false) {
|
|
20
|
+
return selectedOptions;
|
|
21
|
+
}
|
|
22
|
+
const itemToParent = buildItemToParentObject(options);
|
|
23
|
+
const nextSelectedOptions = { ...selectedOptions };
|
|
24
|
+
Object.keys(itemToParent).forEach((item) => {
|
|
25
|
+
nextSelectedOptions[item] = false;
|
|
26
|
+
});
|
|
27
|
+
let currentItem = clickedOption.dsId;
|
|
28
|
+
while (currentItem !== "__root") {
|
|
29
|
+
nextSelectedOptions[currentItem] = true;
|
|
30
|
+
currentItem = itemToParent[currentItem];
|
|
31
|
+
}
|
|
32
|
+
return nextSelectedOptions;
|
|
33
|
+
};
|
|
34
|
+
export {
|
|
35
|
+
manageOpenedSubmenus
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=manageOpenedSubmenus.js.map
|