@elliemae/ds-menu-items 3.9.0-next.5
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/components/ActionMenuItem/index.js +70 -0
- package/dist/cjs/components/ActionMenuItem/index.js.map +7 -0
- package/dist/cjs/components/MultiMenuItem/index.js +92 -0
- package/dist/cjs/components/MultiMenuItem/index.js.map +7 -0
- package/dist/cjs/components/Section/index.js +58 -0
- package/dist/cjs/components/Section/index.js.map +7 -0
- package/dist/cjs/components/Separator/index.js +53 -0
- package/dist/cjs/components/Separator/index.js.map +7 -0
- package/dist/cjs/components/SingleMenuItem/index.js +95 -0
- package/dist/cjs/components/SingleMenuItem/index.js.map +7 -0
- package/dist/cjs/components/SingleWithSubmenuItem/index.js +158 -0
- package/dist/cjs/components/SingleWithSubmenuItem/index.js.map +7 -0
- package/dist/cjs/components/SingleWithSubmenuItem/useGetSubmenuHandlers.js +83 -0
- package/dist/cjs/components/SingleWithSubmenuItem/useGetSubmenuHandlers.js.map +7 -0
- package/dist/cjs/components/SubmenuItem/index.js +147 -0
- package/dist/cjs/components/SubmenuItem/index.js.map +7 -0
- package/dist/cjs/components/SubmenuItem/useGetSubmenuHandlers.js +83 -0
- package/dist/cjs/components/SubmenuItem/useGetSubmenuHandlers.js.map +7 -0
- package/dist/cjs/components/index.js +32 -0
- package/dist/cjs/components/index.js.map +7 -0
- package/dist/cjs/components/styled.js +159 -0
- package/dist/cjs/components/styled.js.map +7 -0
- package/dist/cjs/index.js +26 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/react-desc-prop-types.js +118 -0
- package/dist/cjs/react-desc-prop-types.js.map +7 -0
- package/dist/esm/components/ActionMenuItem/index.js +44 -0
- package/dist/esm/components/ActionMenuItem/index.js.map +7 -0
- package/dist/esm/components/MultiMenuItem/index.js +66 -0
- package/dist/esm/components/MultiMenuItem/index.js.map +7 -0
- package/dist/esm/components/Section/index.js +32 -0
- package/dist/esm/components/Section/index.js.map +7 -0
- package/dist/esm/components/Separator/index.js +27 -0
- package/dist/esm/components/Separator/index.js.map +7 -0
- package/dist/esm/components/SingleMenuItem/index.js +69 -0
- package/dist/esm/components/SingleMenuItem/index.js.map +7 -0
- package/dist/esm/components/SingleWithSubmenuItem/index.js +138 -0
- package/dist/esm/components/SingleWithSubmenuItem/index.js.map +7 -0
- package/dist/esm/components/SingleWithSubmenuItem/useGetSubmenuHandlers.js +57 -0
- package/dist/esm/components/SingleWithSubmenuItem/useGetSubmenuHandlers.js.map +7 -0
- package/dist/esm/components/SubmenuItem/index.js +127 -0
- package/dist/esm/components/SubmenuItem/index.js.map +7 -0
- package/dist/esm/components/SubmenuItem/useGetSubmenuHandlers.js +57 -0
- package/dist/esm/components/SubmenuItem/useGetSubmenuHandlers.js.map +7 -0
- package/dist/esm/components/index.js +9 -0
- package/dist/esm/components/index.js.map +7 -0
- package/dist/esm/components/styled.js +140 -0
- package/dist/esm/components/styled.js.map +7 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/react-desc-prop-types.js +92 -0
- package/dist/esm/react-desc-prop-types.js.map +7 -0
- package/package.json +62 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { useRef, useCallback } from "react";
|
|
3
|
+
const useGetSubmenuHandlers = ({
|
|
4
|
+
disabled,
|
|
5
|
+
rightAddon,
|
|
6
|
+
isSubmenuOpened,
|
|
7
|
+
onMouseEnter,
|
|
8
|
+
onSubmenuOpen,
|
|
9
|
+
onSubmenuClose,
|
|
10
|
+
onMouseLeave
|
|
11
|
+
}) => {
|
|
12
|
+
const timeoutRef = useRef(null);
|
|
13
|
+
const onMouseEnterHandler = useCallback(
|
|
14
|
+
(e) => {
|
|
15
|
+
if (rightAddon !== "ellipsis") {
|
|
16
|
+
if (timeoutRef.current !== null)
|
|
17
|
+
clearTimeout(timeoutRef.current);
|
|
18
|
+
else if (!isSubmenuOpened)
|
|
19
|
+
onSubmenuOpen(e);
|
|
20
|
+
timeoutRef.current = null;
|
|
21
|
+
}
|
|
22
|
+
onMouseEnter(e);
|
|
23
|
+
},
|
|
24
|
+
[isSubmenuOpened, onMouseEnter, onSubmenuOpen, rightAddon]
|
|
25
|
+
);
|
|
26
|
+
const onMouseLeaveHandler = useCallback(
|
|
27
|
+
(e) => {
|
|
28
|
+
if (rightAddon !== "ellipsis") {
|
|
29
|
+
if (timeoutRef.current === null) {
|
|
30
|
+
timeoutRef.current = setTimeout(() => {
|
|
31
|
+
timeoutRef.current = null;
|
|
32
|
+
onSubmenuClose(e);
|
|
33
|
+
}, 300);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
onMouseLeave(e);
|
|
37
|
+
},
|
|
38
|
+
[onMouseLeave, onSubmenuClose, rightAddon]
|
|
39
|
+
);
|
|
40
|
+
const onEllipsisClick = useCallback(
|
|
41
|
+
(e) => {
|
|
42
|
+
if (disabled)
|
|
43
|
+
return;
|
|
44
|
+
e.stopPropagation();
|
|
45
|
+
if (isSubmenuOpened)
|
|
46
|
+
onSubmenuClose(e);
|
|
47
|
+
else
|
|
48
|
+
onSubmenuOpen(e);
|
|
49
|
+
},
|
|
50
|
+
[disabled, isSubmenuOpened, onSubmenuClose, onSubmenuOpen]
|
|
51
|
+
);
|
|
52
|
+
return { onMouseEnterHandler, onMouseLeaveHandler, onEllipsisClick };
|
|
53
|
+
};
|
|
54
|
+
export {
|
|
55
|
+
useGetSubmenuHandlers
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=useGetSubmenuHandlers.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/components/SingleWithSubmenuItem/useGetSubmenuHandlers.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useRef, useCallback } from 'react';\nimport { DSMenuItemT } from '../../react-desc-prop-types';\n\nexport const useGetSubmenuHandlers = ({\n disabled,\n rightAddon,\n isSubmenuOpened,\n onMouseEnter,\n onSubmenuOpen,\n onSubmenuClose,\n onMouseLeave,\n}: Required<DSMenuItemT.SingleWithSubmenuProps>) => {\n const timeoutRef = useRef<NodeJS.Timeout | null>(null);\n\n const onMouseEnterHandler = useCallback(\n (e: React.MouseEvent) => {\n if (rightAddon !== 'ellipsis') {\n if (timeoutRef.current !== null) clearTimeout(timeoutRef.current);\n else if (!isSubmenuOpened) onSubmenuOpen(e);\n timeoutRef.current = null;\n }\n onMouseEnter(e);\n },\n [isSubmenuOpened, onMouseEnter, onSubmenuOpen, rightAddon],\n );\n\n const onMouseLeaveHandler = useCallback(\n (e: React.MouseEvent) => {\n if (rightAddon !== 'ellipsis') {\n if (timeoutRef.current === null) {\n timeoutRef.current = setTimeout(() => {\n timeoutRef.current = null;\n onSubmenuClose(e);\n }, 300);\n }\n }\n onMouseLeave(e);\n },\n [onMouseLeave, onSubmenuClose, rightAddon],\n );\n\n const onEllipsisClick: React.MouseEventHandler = useCallback(\n (e) => {\n if (disabled) return;\n e.stopPropagation();\n if (isSubmenuOpened) onSubmenuClose(e);\n else onSubmenuOpen(e);\n },\n [disabled, isSubmenuOpened, onSubmenuClose, onSubmenuOpen],\n );\n\n return { onMouseEnterHandler, onMouseLeaveHandler, onEllipsisClick };\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,QAAQ,mBAAmB;AAG7B,MAAM,wBAAwB,CAAC;AAAA,EACpC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAoD;AAClD,QAAM,aAAa,OAA8B,IAAI;AAErD,QAAM,sBAAsB;AAAA,IAC1B,CAAC,MAAwB;AACvB,UAAI,eAAe,YAAY;AAC7B,YAAI,WAAW,YAAY;AAAM,uBAAa,WAAW,OAAO;AAAA,iBACvD,CAAC;AAAiB,wBAAc,CAAC;AAC1C,mBAAW,UAAU;AAAA,MACvB;AACA,mBAAa,CAAC;AAAA,IAChB;AAAA,IACA,CAAC,iBAAiB,cAAc,eAAe,UAAU;AAAA,EAC3D;AAEA,QAAM,sBAAsB;AAAA,IAC1B,CAAC,MAAwB;AACvB,UAAI,eAAe,YAAY;AAC7B,YAAI,WAAW,YAAY,MAAM;AAC/B,qBAAW,UAAU,WAAW,MAAM;AACpC,uBAAW,UAAU;AACrB,2BAAe,CAAC;AAAA,UAClB,GAAG,GAAG;AAAA,QACR;AAAA,MACF;AACA,mBAAa,CAAC;AAAA,IAChB;AAAA,IACA,CAAC,cAAc,gBAAgB,UAAU;AAAA,EAC3C;AAEA,QAAM,kBAA2C;AAAA,IAC/C,CAAC,MAAM;AACL,UAAI;AAAU;AACd,QAAE,gBAAgB;AAClB,UAAI;AAAiB,uBAAe,CAAC;AAAA;AAChC,sBAAc,CAAC;AAAA,IACtB;AAAA,IACA,CAAC,UAAU,iBAAiB,gBAAgB,aAAa;AAAA,EAC3D;AAEA,SAAO,EAAE,qBAAqB,qBAAqB,gBAAgB;AACrE;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
|
+
import { Grid } from "@elliemae/ds-grid";
|
|
5
|
+
import { MoreOptionsVert, ChevronRight } from "@elliemae/ds-icons";
|
|
6
|
+
import { describe, useMemoMergePropsWithDefault, useValidateTypescriptPropTypes } from "@elliemae/ds-utilities";
|
|
7
|
+
import { defaultSubmenuProps, itemProps } from "../../react-desc-prop-types";
|
|
8
|
+
import {
|
|
9
|
+
StyledItemLabel,
|
|
10
|
+
StyledIconContainer,
|
|
11
|
+
StyledEllipsisButton,
|
|
12
|
+
StyledGlobalMenuItemWrapper,
|
|
13
|
+
StyledVerticalSeparator
|
|
14
|
+
} from "../styled";
|
|
15
|
+
import { useGetSubmenuHandlers } from "./useGetSubmenuHandlers";
|
|
16
|
+
const SubmenuItem = (props) => {
|
|
17
|
+
const propsWithDefault = useMemoMergePropsWithDefault(props, defaultSubmenuProps);
|
|
18
|
+
useValidateTypescriptPropTypes(propsWithDefault, itemProps);
|
|
19
|
+
const {
|
|
20
|
+
dsId,
|
|
21
|
+
label,
|
|
22
|
+
isActive,
|
|
23
|
+
disabled,
|
|
24
|
+
isSubmenuOpened,
|
|
25
|
+
rightAddon,
|
|
26
|
+
innerRef,
|
|
27
|
+
wrapperStyles,
|
|
28
|
+
optionsShouldHavePadding,
|
|
29
|
+
render: Render,
|
|
30
|
+
Dropdown,
|
|
31
|
+
dropdownProps: {
|
|
32
|
+
options,
|
|
33
|
+
openedSubmenus,
|
|
34
|
+
onSubmenuToggle,
|
|
35
|
+
selectedOptions,
|
|
36
|
+
onKeyDown,
|
|
37
|
+
onOptionClick,
|
|
38
|
+
onClickOutside,
|
|
39
|
+
minWidth,
|
|
40
|
+
maxHeight
|
|
41
|
+
}
|
|
42
|
+
} = propsWithDefault;
|
|
43
|
+
const [delayedIsOpened, setDelayedIsOpened] = useState(false);
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
setTimeout(() => setDelayedIsOpened(isSubmenuOpened));
|
|
46
|
+
}, [isSubmenuOpened]);
|
|
47
|
+
const { onMouseEnterHandler, onMouseLeaveHandler, onEllipsisClick } = useGetSubmenuHandlers(propsWithDefault);
|
|
48
|
+
return /* @__PURE__ */ jsx(Dropdown, {
|
|
49
|
+
isOpened: delayedIsOpened,
|
|
50
|
+
options: options ?? [],
|
|
51
|
+
onOptionClick,
|
|
52
|
+
startPlacementPreference: "right-start",
|
|
53
|
+
placementOrderPreference: ["right-start", "right-end", "left-start", "left-end"],
|
|
54
|
+
selectedOptions,
|
|
55
|
+
openedSubmenus,
|
|
56
|
+
onSubmenuToggle,
|
|
57
|
+
onKeyDown,
|
|
58
|
+
onClickOutside,
|
|
59
|
+
customOffset: [-4, 1],
|
|
60
|
+
onMouseEnter: onMouseEnterHandler,
|
|
61
|
+
onMouseLeave: onMouseLeaveHandler,
|
|
62
|
+
wrapperStyles: { ...wrapperStyles, w: "100%" },
|
|
63
|
+
minWidth,
|
|
64
|
+
maxHeight,
|
|
65
|
+
as: "li",
|
|
66
|
+
role: "option",
|
|
67
|
+
"aria-selected": isSubmenuOpened,
|
|
68
|
+
"aria-describedby": `dropdownmenu-submenu-${dsId}`,
|
|
69
|
+
id: dsId,
|
|
70
|
+
children: /* @__PURE__ */ jsxs(StyledGlobalMenuItemWrapper, {
|
|
71
|
+
pr: 0,
|
|
72
|
+
isSelected: isSubmenuOpened,
|
|
73
|
+
isActive,
|
|
74
|
+
onMouseEnter: onMouseEnterHandler,
|
|
75
|
+
onMouseLeave: onMouseLeaveHandler,
|
|
76
|
+
ref: innerRef,
|
|
77
|
+
disabled,
|
|
78
|
+
pl: optionsShouldHavePadding ? 40 : 0,
|
|
79
|
+
as: "div",
|
|
80
|
+
children: [
|
|
81
|
+
Render !== void 0 ? /* @__PURE__ */ jsx(Render, {
|
|
82
|
+
...propsWithDefault
|
|
83
|
+
}) : /* @__PURE__ */ jsxs(Grid, {
|
|
84
|
+
cols: ["auto", "min-content"],
|
|
85
|
+
alignItems: "center",
|
|
86
|
+
children: [
|
|
87
|
+
/* @__PURE__ */ jsx(StyledItemLabel, {
|
|
88
|
+
children: label
|
|
89
|
+
}),
|
|
90
|
+
/* @__PURE__ */ jsxs(StyledIconContainer, {
|
|
91
|
+
children: [
|
|
92
|
+
/* @__PURE__ */ jsx(StyledVerticalSeparator, {}),
|
|
93
|
+
rightAddon === "ellipsis" ? /* @__PURE__ */ jsx(StyledEllipsisButton, {
|
|
94
|
+
tabIndex: -1,
|
|
95
|
+
onClick: onEllipsisClick,
|
|
96
|
+
disabled,
|
|
97
|
+
children: /* @__PURE__ */ jsx(MoreOptionsVert, {
|
|
98
|
+
className: "ds-dropdown-menu-v2-more-options",
|
|
99
|
+
color: disabled ? ["neutral", "500"] : ["brand-primary", "600"],
|
|
100
|
+
size: "s"
|
|
101
|
+
})
|
|
102
|
+
}) : /* @__PURE__ */ jsx(ChevronRight, {
|
|
103
|
+
color: disabled ? ["neutral", "500"] : ["brand-primary", "600"],
|
|
104
|
+
size: "s"
|
|
105
|
+
})
|
|
106
|
+
]
|
|
107
|
+
})
|
|
108
|
+
]
|
|
109
|
+
}),
|
|
110
|
+
/* @__PURE__ */ jsx("span", {
|
|
111
|
+
id: `dropdownmenu-submenu-${dsId}`,
|
|
112
|
+
style: { display: "none" },
|
|
113
|
+
children: "submenu, to open this submenu press the Right Arrow key"
|
|
114
|
+
})
|
|
115
|
+
]
|
|
116
|
+
})
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
SubmenuItem.propTypes = itemProps;
|
|
120
|
+
SubmenuItem.displayName = "SubmenuItem";
|
|
121
|
+
const SubmenuItemWithSchema = describe(SubmenuItem);
|
|
122
|
+
SubmenuItemWithSchema.propTypes = itemProps;
|
|
123
|
+
export {
|
|
124
|
+
SubmenuItem,
|
|
125
|
+
SubmenuItemWithSchema
|
|
126
|
+
};
|
|
127
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/components/SubmenuItem/index.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport React, { useEffect, useState } from 'react';\nimport { Grid } from '@elliemae/ds-grid';\nimport { MoreOptionsVert, ChevronRight } from '@elliemae/ds-icons';\nimport { describe, useMemoMergePropsWithDefault, useValidateTypescriptPropTypes } from '@elliemae/ds-utilities';\nimport { DSMenuItemT, defaultSubmenuProps, itemProps } from '../../react-desc-prop-types';\nimport {\n StyledItemLabel,\n StyledIconContainer,\n StyledEllipsisButton,\n StyledGlobalMenuItemWrapper,\n StyledVerticalSeparator,\n} from '../styled';\nimport { useGetSubmenuHandlers } from './useGetSubmenuHandlers';\n\nconst SubmenuItem: React.ComponentType<DSMenuItemT.SubmenuProps> = (props) => {\n const propsWithDefault = useMemoMergePropsWithDefault<Required<DSMenuItemT.SubmenuProps>>(props, defaultSubmenuProps);\n\n useValidateTypescriptPropTypes(propsWithDefault, itemProps);\n\n const {\n dsId,\n label,\n isActive,\n disabled,\n isSubmenuOpened,\n rightAddon,\n innerRef,\n wrapperStyles,\n optionsShouldHavePadding,\n render: Render,\n Dropdown,\n dropdownProps: {\n options,\n openedSubmenus,\n onSubmenuToggle,\n selectedOptions,\n onKeyDown,\n onOptionClick,\n onClickOutside,\n minWidth,\n maxHeight,\n },\n } = propsWithDefault;\n\n // If we don't delay the opening of the poppers, the position will not be placed correctly\n // That why we delay it for the next render using the useEffect hook\n // TODO -- @carusox move this to utilities as a hook\n const [delayedIsOpened, setDelayedIsOpened] = useState(false);\n\n useEffect(() => {\n setTimeout(() => setDelayedIsOpened(isSubmenuOpened));\n }, [isSubmenuOpened]);\n\n const { onMouseEnterHandler, onMouseLeaveHandler, onEllipsisClick } = useGetSubmenuHandlers(propsWithDefault);\n\n return (\n <Dropdown\n isOpened={delayedIsOpened}\n options={options ?? []}\n onOptionClick={onOptionClick}\n startPlacementPreference=\"right-start\"\n placementOrderPreference={['right-start', 'right-end', 'left-start', 'left-end']}\n selectedOptions={selectedOptions}\n openedSubmenus={openedSubmenus}\n onSubmenuToggle={onSubmenuToggle}\n onKeyDown={onKeyDown}\n onClickOutside={onClickOutside}\n customOffset={[-4, 1]}\n onMouseEnter={onMouseEnterHandler}\n onMouseLeave={onMouseLeaveHandler}\n wrapperStyles={{ ...wrapperStyles, w: '100%' }}\n minWidth={minWidth}\n maxHeight={maxHeight}\n as=\"li\"\n role=\"option\"\n aria-selected={isSubmenuOpened}\n aria-describedby={`dropdownmenu-submenu-${dsId}`}\n id={dsId}\n >\n <StyledGlobalMenuItemWrapper\n pr={0}\n isSelected={isSubmenuOpened}\n isActive={isActive}\n onMouseEnter={onMouseEnterHandler}\n onMouseLeave={onMouseLeaveHandler}\n ref={innerRef}\n disabled={disabled}\n pl={optionsShouldHavePadding ? 40 : 0}\n as=\"div\"\n >\n {Render !== undefined ? (\n <Render {...propsWithDefault} />\n ) : (\n <Grid cols={['auto', 'min-content']} alignItems=\"center\">\n <StyledItemLabel>{label}</StyledItemLabel>\n <StyledIconContainer>\n <StyledVerticalSeparator />\n {rightAddon === 'ellipsis' ? (\n <StyledEllipsisButton tabIndex={-1} onClick={onEllipsisClick} disabled={disabled}>\n <MoreOptionsVert\n className=\"ds-dropdown-menu-v2-more-options\"\n color={disabled ? ['neutral', '500'] : ['brand-primary', '600']}\n size=\"s\"\n />\n </StyledEllipsisButton>\n ) : (\n <ChevronRight color={disabled ? ['neutral', '500'] : ['brand-primary', '600']} size=\"s\" />\n )}\n </StyledIconContainer>\n </Grid>\n )}\n <span id={`dropdownmenu-submenu-${dsId}`} style={{ display: 'none' }}>\n submenu, to open this submenu press the Right Arrow key\n </span>\n </StyledGlobalMenuItemWrapper>\n </Dropdown>\n );\n};\n\nSubmenuItem.propTypes = itemProps;\nSubmenuItem.displayName = 'SubmenuItem';\nconst SubmenuItemWithSchema = describe(SubmenuItem);\nSubmenuItemWithSchema.propTypes = itemProps;\n\nexport { SubmenuItem, SubmenuItemWithSchema };\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AACA,SAAgB,WAAW,gBAAgB;AAC3C,SAAS,YAAY;AACrB,SAAS,iBAAiB,oBAAoB;AAC9C,SAAS,UAAU,8BAA8B,sCAAsC;AACvF,SAAsB,qBAAqB,iBAAiB;AAC5D;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,6BAA6B;AAEtC,MAAM,cAA6D,CAAC,UAAU;AAC5E,QAAM,mBAAmB,6BAAiE,OAAO,mBAAmB;AAEpH,iCAA+B,kBAAkB,SAAS;AAE1D,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,IACR;AAAA,IACA,eAAe;AAAA,MACb;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF,IAAI;AAKJ,QAAM,CAAC,iBAAiB,kBAAkB,IAAI,SAAS,KAAK;AAE5D,YAAU,MAAM;AACd,eAAW,MAAM,mBAAmB,eAAe,CAAC;AAAA,EACtD,GAAG,CAAC,eAAe,CAAC;AAEpB,QAAM,EAAE,qBAAqB,qBAAqB,gBAAgB,IAAI,sBAAsB,gBAAgB;AAE5G,SACE,oBAAC;AAAA,IACC,UAAU;AAAA,IACV,SAAS,WAAW,CAAC;AAAA,IACrB;AAAA,IACA,0BAAyB;AAAA,IACzB,0BAA0B,CAAC,eAAe,aAAa,cAAc,UAAU;AAAA,IAC/E;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,cAAc,CAAC,IAAI,CAAC;AAAA,IACpB,cAAc;AAAA,IACd,cAAc;AAAA,IACd,eAAe,EAAE,GAAG,eAAe,GAAG,OAAO;AAAA,IAC7C;AAAA,IACA;AAAA,IACA,IAAG;AAAA,IACH,MAAK;AAAA,IACL,iBAAe;AAAA,IACf,oBAAkB,wBAAwB;AAAA,IAC1C,IAAI;AAAA,IAEJ,+BAAC;AAAA,MACC,IAAI;AAAA,MACJ,YAAY;AAAA,MACZ;AAAA,MACA,cAAc;AAAA,MACd,cAAc;AAAA,MACd,KAAK;AAAA,MACL;AAAA,MACA,IAAI,2BAA2B,KAAK;AAAA,MACpC,IAAG;AAAA,MAEF;AAAA,mBAAW,SACV,oBAAC;AAAA,UAAQ,GAAG;AAAA,SAAkB,IAE9B,qBAAC;AAAA,UAAK,MAAM,CAAC,QAAQ,aAAa;AAAA,UAAG,YAAW;AAAA,UAC9C;AAAA,gCAAC;AAAA,cAAiB;AAAA,aAAM;AAAA,YACxB,qBAAC;AAAA,cACC;AAAA,oCAAC,2BAAwB;AAAA,gBACxB,eAAe,aACd,oBAAC;AAAA,kBAAqB,UAAU;AAAA,kBAAI,SAAS;AAAA,kBAAiB;AAAA,kBAC5D,8BAAC;AAAA,oBACC,WAAU;AAAA,oBACV,OAAO,WAAW,CAAC,WAAW,KAAK,IAAI,CAAC,iBAAiB,KAAK;AAAA,oBAC9D,MAAK;AAAA,mBACP;AAAA,iBACF,IAEA,oBAAC;AAAA,kBAAa,OAAO,WAAW,CAAC,WAAW,KAAK,IAAI,CAAC,iBAAiB,KAAK;AAAA,kBAAG,MAAK;AAAA,iBAAI;AAAA;AAAA,aAE5F;AAAA;AAAA,SACF;AAAA,QAEF,oBAAC;AAAA,UAAK,IAAI,wBAAwB;AAAA,UAAQ,OAAO,EAAE,SAAS,OAAO;AAAA,UAAG;AAAA,SAEtE;AAAA;AAAA,KACF;AAAA,GACF;AAEJ;AAEA,YAAY,YAAY;AACxB,YAAY,cAAc;AAC1B,MAAM,wBAAwB,SAAS,WAAW;AAClD,sBAAsB,YAAY;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { useRef, useCallback } from "react";
|
|
3
|
+
const useGetSubmenuHandlers = ({
|
|
4
|
+
disabled,
|
|
5
|
+
rightAddon,
|
|
6
|
+
isSubmenuOpened,
|
|
7
|
+
onMouseEnter,
|
|
8
|
+
onSubmenuOpen,
|
|
9
|
+
onSubmenuClose,
|
|
10
|
+
onMouseLeave
|
|
11
|
+
}) => {
|
|
12
|
+
const timeoutRef = useRef(null);
|
|
13
|
+
const onMouseEnterHandler = useCallback(
|
|
14
|
+
(e) => {
|
|
15
|
+
if (rightAddon !== "ellipsis") {
|
|
16
|
+
if (timeoutRef.current !== null)
|
|
17
|
+
clearTimeout(timeoutRef.current);
|
|
18
|
+
else if (!isSubmenuOpened)
|
|
19
|
+
onSubmenuOpen(e);
|
|
20
|
+
timeoutRef.current = null;
|
|
21
|
+
}
|
|
22
|
+
onMouseEnter(e);
|
|
23
|
+
},
|
|
24
|
+
[isSubmenuOpened, onMouseEnter, onSubmenuOpen, rightAddon]
|
|
25
|
+
);
|
|
26
|
+
const onMouseLeaveHandler = useCallback(
|
|
27
|
+
(e) => {
|
|
28
|
+
if (rightAddon !== "ellipsis") {
|
|
29
|
+
if (timeoutRef.current === null) {
|
|
30
|
+
timeoutRef.current = setTimeout(() => {
|
|
31
|
+
timeoutRef.current = null;
|
|
32
|
+
onSubmenuClose(e);
|
|
33
|
+
}, 300);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
onMouseLeave(e);
|
|
37
|
+
},
|
|
38
|
+
[onMouseLeave, onSubmenuClose, rightAddon]
|
|
39
|
+
);
|
|
40
|
+
const onEllipsisClick = useCallback(
|
|
41
|
+
(e) => {
|
|
42
|
+
if (disabled)
|
|
43
|
+
return;
|
|
44
|
+
e.stopPropagation();
|
|
45
|
+
if (isSubmenuOpened)
|
|
46
|
+
onSubmenuClose(e);
|
|
47
|
+
else
|
|
48
|
+
onSubmenuOpen(e);
|
|
49
|
+
},
|
|
50
|
+
[disabled, isSubmenuOpened, onSubmenuClose, onSubmenuOpen]
|
|
51
|
+
);
|
|
52
|
+
return { onMouseEnterHandler, onMouseLeaveHandler, onEllipsisClick };
|
|
53
|
+
};
|
|
54
|
+
export {
|
|
55
|
+
useGetSubmenuHandlers
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=useGetSubmenuHandlers.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/components/SubmenuItem/useGetSubmenuHandlers.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useRef, useCallback } from 'react';\nimport { DSMenuItemT } from '../../react-desc-prop-types';\n\nexport const useGetSubmenuHandlers = ({\n disabled,\n rightAddon,\n isSubmenuOpened,\n onMouseEnter,\n onSubmenuOpen,\n onSubmenuClose,\n onMouseLeave,\n}: Required<DSMenuItemT.SubmenuProps>) => {\n const timeoutRef = useRef<NodeJS.Timeout | null>(null);\n\n const onMouseEnterHandler = useCallback(\n (e: React.MouseEvent) => {\n if (rightAddon !== 'ellipsis') {\n if (timeoutRef.current !== null) clearTimeout(timeoutRef.current);\n else if (!isSubmenuOpened) onSubmenuOpen(e);\n timeoutRef.current = null;\n }\n onMouseEnter(e);\n },\n [isSubmenuOpened, onMouseEnter, onSubmenuOpen, rightAddon],\n );\n\n const onMouseLeaveHandler = useCallback(\n (e: React.MouseEvent) => {\n if (rightAddon !== 'ellipsis') {\n if (timeoutRef.current === null) {\n timeoutRef.current = setTimeout(() => {\n timeoutRef.current = null;\n onSubmenuClose(e);\n }, 300);\n }\n }\n onMouseLeave(e);\n },\n [onMouseLeave, onSubmenuClose, rightAddon],\n );\n\n const onEllipsisClick: React.MouseEventHandler = useCallback(\n (e) => {\n if (disabled) return;\n e.stopPropagation();\n if (isSubmenuOpened) onSubmenuClose(e);\n else onSubmenuOpen(e);\n },\n [disabled, isSubmenuOpened, onSubmenuClose, onSubmenuOpen],\n );\n\n return { onMouseEnterHandler, onMouseLeaveHandler, onEllipsisClick };\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,QAAQ,mBAAmB;AAG7B,MAAM,wBAAwB,CAAC;AAAA,EACpC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAA0C;AACxC,QAAM,aAAa,OAA8B,IAAI;AAErD,QAAM,sBAAsB;AAAA,IAC1B,CAAC,MAAwB;AACvB,UAAI,eAAe,YAAY;AAC7B,YAAI,WAAW,YAAY;AAAM,uBAAa,WAAW,OAAO;AAAA,iBACvD,CAAC;AAAiB,wBAAc,CAAC;AAC1C,mBAAW,UAAU;AAAA,MACvB;AACA,mBAAa,CAAC;AAAA,IAChB;AAAA,IACA,CAAC,iBAAiB,cAAc,eAAe,UAAU;AAAA,EAC3D;AAEA,QAAM,sBAAsB;AAAA,IAC1B,CAAC,MAAwB;AACvB,UAAI,eAAe,YAAY;AAC7B,YAAI,WAAW,YAAY,MAAM;AAC/B,qBAAW,UAAU,WAAW,MAAM;AACpC,uBAAW,UAAU;AACrB,2BAAe,CAAC;AAAA,UAClB,GAAG,GAAG;AAAA,QACR;AAAA,MACF;AACA,mBAAa,CAAC;AAAA,IAChB;AAAA,IACA,CAAC,cAAc,gBAAgB,UAAU;AAAA,EAC3C;AAEA,QAAM,kBAA2C;AAAA,IAC/C,CAAC,MAAM;AACL,UAAI;AAAU;AACd,QAAE,gBAAgB;AAClB,UAAI;AAAiB,uBAAe,CAAC;AAAA;AAChC,sBAAc,CAAC;AAAA,IACtB;AAAA,IACA,CAAC,UAAU,iBAAiB,gBAAgB,aAAa;AAAA,EAC3D;AAEA,SAAO,EAAE,qBAAqB,qBAAqB,gBAAgB;AACrE;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export * from "./ActionMenuItem";
|
|
3
|
+
export * from "./MultiMenuItem";
|
|
4
|
+
export * from "./Section";
|
|
5
|
+
export * from "./Separator";
|
|
6
|
+
export * from "./SingleMenuItem";
|
|
7
|
+
export * from "./SingleWithSubmenuItem";
|
|
8
|
+
export * from "./SubmenuItem";
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/components/index.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export * from './ActionMenuItem';\nexport * from './MultiMenuItem';\nexport * from './Section';\nexport * from './Separator';\nexport * from './SingleMenuItem';\nexport * from './SingleWithSubmenuItem';\nexport * from './SubmenuItem';\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import {
|
|
3
|
+
styled,
|
|
4
|
+
css,
|
|
5
|
+
layout,
|
|
6
|
+
position,
|
|
7
|
+
space,
|
|
8
|
+
sizing
|
|
9
|
+
} from "@elliemae/ds-system";
|
|
10
|
+
const borderOutside = () => css`
|
|
11
|
+
:after {
|
|
12
|
+
display: block;
|
|
13
|
+
content: ' ';
|
|
14
|
+
position: absolute;
|
|
15
|
+
top: 0;
|
|
16
|
+
left: 0;
|
|
17
|
+
right: 0;
|
|
18
|
+
bottom: 0;
|
|
19
|
+
border: 1px solid ${({ theme }) => theme.colors.brand[500]};
|
|
20
|
+
pointer-events: none;
|
|
21
|
+
z-index: 7;
|
|
22
|
+
}
|
|
23
|
+
`;
|
|
24
|
+
const disabledOption = () => css`
|
|
25
|
+
color: ${({ theme }) => theme.colors.neutral[500]};
|
|
26
|
+
|
|
27
|
+
cursor: not-allowed;
|
|
28
|
+
* {
|
|
29
|
+
cursor: not-allowed;
|
|
30
|
+
}
|
|
31
|
+
`;
|
|
32
|
+
const StyledGlobalMenuItemWrapper = styled.li`
|
|
33
|
+
cursor: pointer;
|
|
34
|
+
min-height: 32px;
|
|
35
|
+
|
|
36
|
+
padding-left: 16px;
|
|
37
|
+
padding-right: 16px;
|
|
38
|
+
display: grid;
|
|
39
|
+
align-items: center;
|
|
40
|
+
list-style: none;
|
|
41
|
+
position: relative;
|
|
42
|
+
${position}
|
|
43
|
+
${layout}
|
|
44
|
+
${sizing}
|
|
45
|
+
${space}
|
|
46
|
+
|
|
47
|
+
${(props) => {
|
|
48
|
+
if (props.disabled)
|
|
49
|
+
return disabledOption();
|
|
50
|
+
if (props.isActive)
|
|
51
|
+
return borderOutside();
|
|
52
|
+
return "";
|
|
53
|
+
}};
|
|
54
|
+
|
|
55
|
+
background-color: ${(props) => props.isActive ? props.theme.colors.brand[200] : "white"};
|
|
56
|
+
|
|
57
|
+
&:hover {
|
|
58
|
+
background-color: ${(props) => !props.disabled && props.theme.colors.brand[200]};
|
|
59
|
+
}
|
|
60
|
+
`;
|
|
61
|
+
const StyleMenuItemLabel = styled.span`
|
|
62
|
+
padding: 8px 0;
|
|
63
|
+
font-size: 13px;
|
|
64
|
+
`;
|
|
65
|
+
const StyledItemLabel = styled.div`
|
|
66
|
+
display: grid;
|
|
67
|
+
align-items: center;
|
|
68
|
+
white-space: nowrap;
|
|
69
|
+
text-overflow: ellipsis;
|
|
70
|
+
overflow: hidden;
|
|
71
|
+
width: 100%;
|
|
72
|
+
`;
|
|
73
|
+
const StyledIconContainer = styled.div`
|
|
74
|
+
width: 29px;
|
|
75
|
+
height: 28px;
|
|
76
|
+
display: grid;
|
|
77
|
+
grid-template-columns: min-content auto;
|
|
78
|
+
place-items: center;
|
|
79
|
+
`;
|
|
80
|
+
const StyledEllipsisButton = styled.div`
|
|
81
|
+
position: relative;
|
|
82
|
+
width: 100%;
|
|
83
|
+
height: 100%;
|
|
84
|
+
display: grid;
|
|
85
|
+
place-items: center;
|
|
86
|
+
background: transparent;
|
|
87
|
+
:active {
|
|
88
|
+
${(props) => props.disabled ? "" : borderOutside()}
|
|
89
|
+
}
|
|
90
|
+
`;
|
|
91
|
+
const StyledItemContent = styled.div`
|
|
92
|
+
display: flex;
|
|
93
|
+
width: 100%;
|
|
94
|
+
`;
|
|
95
|
+
const StyledSeparator = styled.hr`
|
|
96
|
+
border: 0;
|
|
97
|
+
border-top: 1px solid #697489;
|
|
98
|
+
margin: 4px 0px;
|
|
99
|
+
padding: 0;
|
|
100
|
+
`;
|
|
101
|
+
const StyledSeparatorWrapper = styled.li`
|
|
102
|
+
list-style: none;
|
|
103
|
+
padding: 0px 16px;
|
|
104
|
+
${position}
|
|
105
|
+
${layout}
|
|
106
|
+
${sizing}
|
|
107
|
+
`;
|
|
108
|
+
const StyledGroupLabel = styled.span`
|
|
109
|
+
font-size: 13px;
|
|
110
|
+
color: neutral-500;
|
|
111
|
+
`;
|
|
112
|
+
const StyledSectionWrapper = styled.li`
|
|
113
|
+
${position}
|
|
114
|
+
${layout}
|
|
115
|
+
${sizing}
|
|
116
|
+
list-style: none;
|
|
117
|
+
padding: 0px 16px;
|
|
118
|
+
height: 24px;
|
|
119
|
+
display: flex;
|
|
120
|
+
align-items: center;
|
|
121
|
+
`;
|
|
122
|
+
const StyledVerticalSeparator = styled.div`
|
|
123
|
+
width: 1px;
|
|
124
|
+
height: 18px;
|
|
125
|
+
background-color: neutral-300;
|
|
126
|
+
`;
|
|
127
|
+
export {
|
|
128
|
+
StyleMenuItemLabel,
|
|
129
|
+
StyledEllipsisButton,
|
|
130
|
+
StyledGlobalMenuItemWrapper,
|
|
131
|
+
StyledGroupLabel,
|
|
132
|
+
StyledIconContainer,
|
|
133
|
+
StyledItemContent,
|
|
134
|
+
StyledItemLabel,
|
|
135
|
+
StyledSectionWrapper,
|
|
136
|
+
StyledSeparator,
|
|
137
|
+
StyledSeparatorWrapper,
|
|
138
|
+
StyledVerticalSeparator
|
|
139
|
+
};
|
|
140
|
+
//# sourceMappingURL=styled.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/components/styled.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import {\n styled,\n css,\n layout,\n position,\n space,\n sizing,\n LayoutProps,\n SizingProps,\n PositionProps,\n SpaceProps,\n} from '@elliemae/ds-system';\n\nconst borderOutside = () => css`\n :after {\n display: block;\n content: ' ';\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n border: 1px solid ${({ theme }) => theme.colors.brand[500]};\n pointer-events: none;\n z-index: 7;\n }\n`;\n\nconst disabledOption = () => css`\n color: ${({ theme }) => theme.colors.neutral[500]};\n\n cursor: not-allowed;\n * {\n cursor: not-allowed;\n }\n`;\n\nexport const StyledGlobalMenuItemWrapper = styled.li<\n { isSelected: boolean; isActive: boolean } & LayoutProps & SizingProps & PositionProps & SpaceProps\n>`\n cursor: pointer;\n min-height: 32px;\n\n padding-left: 16px;\n padding-right: 16px;\n display: grid;\n align-items: center;\n list-style: none;\n position: relative;\n ${position}\n ${layout}\n ${sizing}\n ${space}\n\n ${(props) => {\n if (props.disabled) return disabledOption();\n if (props.isActive) return borderOutside();\n return '';\n }};\n\n background-color: ${(props) => (props.isActive ? props.theme.colors.brand[200] : 'white')};\n\n &:hover {\n background-color: ${(props) => !props.disabled && props.theme.colors.brand[200]};\n }\n`;\n\nexport const StyleMenuItemLabel = styled.span`\n padding: 8px 0;\n font-size: 13px;\n`;\n\nexport const StyledItemLabel = styled.div`\n display: grid;\n align-items: center;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n width: 100%;\n`;\n\nexport const StyledIconContainer = styled.div`\n width: 29px;\n height: 28px;\n display: grid;\n grid-template-columns: min-content auto;\n place-items: center;\n`;\n\nexport const StyledEllipsisButton = styled.div`\n position: relative;\n width: 100%;\n height: 100%;\n display: grid;\n place-items: center;\n background: transparent;\n :active {\n ${(props) => (props.disabled ? '' : borderOutside())}\n }\n`;\n\nexport const StyledItemContent = styled.div`\n display: flex;\n width: 100%;\n`;\n\nexport const StyledSeparator = styled.hr`\n border: 0;\n border-top: 1px solid #697489;\n margin: 4px 0px;\n padding: 0;\n`;\n\nexport const StyledSeparatorWrapper = styled.li`\n list-style: none;\n padding: 0px 16px;\n ${position}\n ${layout}\n ${sizing}\n`;\n\nexport const StyledGroupLabel = styled.span`\n font-size: 13px;\n color: neutral-500;\n`;\n\nexport const StyledSectionWrapper = styled.li`\n ${position}\n ${layout}\n ${sizing}\n list-style: none;\n padding: 0px 16px;\n height: 24px;\n display: flex;\n align-items: center;\n`;\n\nexport const StyledVerticalSeparator = styled.div`\n width: 1px;\n height: 18px;\n background-color: neutral-300;\n`;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAKK;AAEP,MAAM,gBAAgB,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBASJ,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,MAAM;AAAA;AAAA;AAAA;AAAA;AAM1D,MAAM,iBAAiB,MAAM;AAAA,WAClB,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQxC,MAAM,8BAA8B,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAY9C;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAAA,IAEA,CAAC,UAAU;AACX,MAAI,MAAM;AAAU,WAAO,eAAe;AAC1C,MAAI,MAAM;AAAU,WAAO,cAAc;AACzC,SAAO;AACT;AAAA;AAAA,sBAEoB,CAAC,UAAW,MAAM,WAAW,MAAM,MAAM,OAAO,MAAM,OAAO;AAAA;AAAA;AAAA,wBAG3D,CAAC,UAAU,CAAC,MAAM,YAAY,MAAM,MAAM,OAAO,MAAM;AAAA;AAAA;AAIxE,MAAM,qBAAqB,OAAO;AAAA;AAAA;AAAA;AAKlC,MAAM,kBAAkB,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAS/B,MAAM,sBAAsB,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQnC,MAAM,uBAAuB,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAQrC,CAAC,UAAW,MAAM,WAAW,KAAK,cAAc;AAAA;AAAA;AAI/C,MAAM,oBAAoB,OAAO;AAAA;AAAA;AAAA;AAKjC,MAAM,kBAAkB,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAO/B,MAAM,yBAAyB,OAAO;AAAA;AAAA;AAAA,IAGzC;AAAA,IACA;AAAA,IACA;AAAA;AAGG,MAAM,mBAAmB,OAAO;AAAA;AAAA;AAAA;AAKhC,MAAM,uBAAuB,OAAO;AAAA,IACvC;AAAA,IACA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQG,MAAM,0BAA0B,OAAO;AAAA;AAAA;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/index.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export * from './components';\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,cAAc;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { PropTypes } from "@elliemae/ds-utilities";
|
|
3
|
+
const noop = () => null;
|
|
4
|
+
const defaultCommonProps = {
|
|
5
|
+
innerRef: noop,
|
|
6
|
+
wrapperStyles: {}
|
|
7
|
+
};
|
|
8
|
+
const defaultActionProps = {
|
|
9
|
+
...defaultCommonProps,
|
|
10
|
+
label: "",
|
|
11
|
+
value: void 0,
|
|
12
|
+
disabled: false,
|
|
13
|
+
isActive: false,
|
|
14
|
+
onClick: noop,
|
|
15
|
+
optionsShouldHavePadding: false
|
|
16
|
+
};
|
|
17
|
+
const defaultMultiProps = {
|
|
18
|
+
...defaultCommonProps,
|
|
19
|
+
label: "",
|
|
20
|
+
isActive: false,
|
|
21
|
+
disabled: false,
|
|
22
|
+
isSelected: false,
|
|
23
|
+
onClick: noop,
|
|
24
|
+
onMouseDown: noop,
|
|
25
|
+
onMouseEnter: noop,
|
|
26
|
+
onMouseLeave: noop,
|
|
27
|
+
tabIndex: 0
|
|
28
|
+
};
|
|
29
|
+
const defaultSingleProps = {
|
|
30
|
+
...defaultCommonProps,
|
|
31
|
+
label: "",
|
|
32
|
+
isActive: false,
|
|
33
|
+
disabled: false,
|
|
34
|
+
isSelected: false,
|
|
35
|
+
onClick: noop,
|
|
36
|
+
onMouseDown: noop,
|
|
37
|
+
onMouseEnter: noop,
|
|
38
|
+
onMouseLeave: noop,
|
|
39
|
+
dataTestid: "",
|
|
40
|
+
tabIndex: 0
|
|
41
|
+
};
|
|
42
|
+
const defaultSubmenuProps = {
|
|
43
|
+
...defaultCommonProps,
|
|
44
|
+
label: "",
|
|
45
|
+
isActive: false,
|
|
46
|
+
disabled: false,
|
|
47
|
+
isSubmenuOpened: false,
|
|
48
|
+
onSubmenuOpen: noop,
|
|
49
|
+
rightAddon: "chevron",
|
|
50
|
+
optionsShouldHavePadding: false,
|
|
51
|
+
Dropdown: noop,
|
|
52
|
+
dropdownProps: {
|
|
53
|
+
options: [],
|
|
54
|
+
onSubmenuToggle: noop,
|
|
55
|
+
openedSubmenus: {},
|
|
56
|
+
selectedOptions: {},
|
|
57
|
+
onKeyDown: noop,
|
|
58
|
+
onOptionClick: noop,
|
|
59
|
+
onClickOutside: noop,
|
|
60
|
+
minWidth: "auto",
|
|
61
|
+
maxHeight: "auto"
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
const defaultSectionProps = {
|
|
65
|
+
...defaultCommonProps,
|
|
66
|
+
label: ""
|
|
67
|
+
};
|
|
68
|
+
const defaultSeparatorProps = {
|
|
69
|
+
...defaultCommonProps
|
|
70
|
+
};
|
|
71
|
+
const defaultSingleWithSubmenuProps = {
|
|
72
|
+
...defaultSingleProps,
|
|
73
|
+
...defaultSubmenuProps
|
|
74
|
+
};
|
|
75
|
+
const itemProps = {
|
|
76
|
+
dsId: PropTypes.string,
|
|
77
|
+
innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({ current: PropTypes.any })]),
|
|
78
|
+
wrapperStyles: PropTypes.object,
|
|
79
|
+
render: PropTypes.func
|
|
80
|
+
};
|
|
81
|
+
export {
|
|
82
|
+
defaultActionProps,
|
|
83
|
+
defaultCommonProps,
|
|
84
|
+
defaultMultiProps,
|
|
85
|
+
defaultSectionProps,
|
|
86
|
+
defaultSeparatorProps,
|
|
87
|
+
defaultSingleProps,
|
|
88
|
+
defaultSingleWithSubmenuProps,
|
|
89
|
+
defaultSubmenuProps,
|
|
90
|
+
itemProps
|
|
91
|
+
};
|
|
92
|
+
//# 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 @typescript-eslint/no-explicit-any */\nimport React, { PropsWithChildren, WeakValidationMap } from 'react';\nimport { SizingProps } from '@elliemae/ds-system';\nimport { PropTypes } from '@elliemae/ds-utilities';\n\nexport namespace DSMenuItemT {\n export interface CommonProps<T = Record<string, unknown>> {\n dsId: string;\n innerRef?: React.RefObject<HTMLLIElement> | ((_ref: HTMLLIElement) => void);\n wrapperStyles?: Record<string, unknown>;\n render?: React.ComponentType<T>;\n }\n\n export interface ActionProps extends CommonProps<ActionProps> {\n label?: string;\n value?: unknown;\n disabled?: boolean;\n isActive?: boolean;\n onClick?: React.MouseEventHandler;\n optionsShouldHavePadding?: boolean;\n }\n\n export interface MultiProps extends CommonProps<MultiProps> {\n label?: string;\n isActive?: boolean;\n disabled?: boolean;\n isSelected?: boolean;\n onClick?: React.MouseEventHandler;\n onMouseDown?: React.MouseEventHandler;\n onMouseEnter?: React.MouseEventHandler;\n onMouseLeave?: React.MouseEventHandler;\n tabIndex?: number;\n }\n\n export interface SingleProps extends CommonProps<SingleProps> {\n label?: string;\n isActive?: boolean;\n disabled?: boolean;\n isSelected?: boolean;\n onClick?: React.MouseEventHandler;\n onMouseDown?: React.MouseEventHandler;\n onMouseEnter?: React.MouseEventHandler;\n onMouseLeave?: React.MouseEventHandler;\n dataTestid?: string;\n tabIndex?: number;\n }\n\n export interface SubmenuProps extends CommonProps<SubmenuProps> {\n label?: string;\n isActive?: boolean;\n disabled?: boolean;\n isSubmenuOpened?: boolean;\n onSubmenuOpen?: React.MouseEventHandler;\n onSubmenuClose?: React.MouseEventHandler;\n rightAddon?: 'ellipsis' | 'chevron';\n optionsShouldHavePadding?: boolean;\n onMouseEnter?: React.MouseEventHandler;\n onMouseLeave?: React.MouseEventHandler;\n Dropdown: React.ComponentType<PropsWithChildren<SubmenuProps['dropdownProps']>>;\n dropdownProps?: {\n options: any[];\n onSubmenuToggle?: (\n nextOpenedSubmenus: Record<string, boolean>,\n submenu: any,\n e: React.MouseEvent | React.KeyboardEvent,\n ) => void;\n openedSubmenus?: Record<string, boolean>;\n selectedOptions?: Record<string, boolean>;\n onKeyDown?: React.KeyboardEventHandler;\n onOptionClick?: (\n nextSelectedOptions: Record<string, boolean>,\n clickedOption: any,\n e: React.MouseEvent | React.KeyboardEvent,\n ) => void;\n onClickOutside?: (e: React.MouseEvent | React.KeyboardEvent | React.TouchEvent) => void;\n minWidth?: SizingProps['minWidth'];\n maxHeight?: SizingProps['maxHeight'];\n [key: string]: unknown;\n };\n }\n\n export interface SectionProps extends CommonProps<SectionProps> {\n label?: string;\n }\n\n export type SeparatorProps = CommonProps<SeparatorProps>;\n\n export interface SingleWithSubmenuProps extends Omit<SingleProps, 'render'>, Omit<SubmenuProps, 'render'> {\n render?: React.ComponentType<SingleWithSubmenuProps>;\n }\n}\n\nconst noop = () => null;\n\nexport const defaultCommonProps: Partial<Omit<DSMenuItemT.CommonProps, 'render'>> = {\n innerRef: noop,\n wrapperStyles: {},\n};\n\nexport const defaultActionProps: Partial<DSMenuItemT.ActionProps> = {\n ...defaultCommonProps,\n label: '',\n value: undefined,\n disabled: false,\n isActive: false,\n onClick: noop,\n optionsShouldHavePadding: false,\n};\n\nexport const defaultMultiProps: Partial<DSMenuItemT.MultiProps> = {\n ...defaultCommonProps,\n label: '',\n isActive: false,\n disabled: false,\n isSelected: false,\n onClick: noop,\n onMouseDown: noop,\n onMouseEnter: noop,\n onMouseLeave: noop,\n tabIndex: 0,\n};\n\nexport const defaultSingleProps: Partial<DSMenuItemT.SingleProps> = {\n ...defaultCommonProps,\n label: '',\n isActive: false,\n disabled: false,\n isSelected: false,\n onClick: noop,\n onMouseDown: noop,\n onMouseEnter: noop,\n onMouseLeave: noop,\n dataTestid: '',\n tabIndex: 0,\n};\n\nexport const defaultSubmenuProps: Partial<DSMenuItemT.SubmenuProps> = {\n ...defaultCommonProps,\n label: '',\n isActive: false,\n disabled: false,\n isSubmenuOpened: false,\n onSubmenuOpen: noop,\n rightAddon: 'chevron',\n optionsShouldHavePadding: false,\n Dropdown: noop,\n dropdownProps: {\n options: [],\n onSubmenuToggle: noop,\n openedSubmenus: {},\n selectedOptions: {},\n onKeyDown: noop,\n onOptionClick: noop,\n onClickOutside: noop,\n minWidth: 'auto',\n maxHeight: 'auto',\n },\n};\n\nexport const defaultSectionProps: Partial<DSMenuItemT.SectionProps> = {\n ...defaultCommonProps,\n label: '',\n};\n\nexport const defaultSeparatorProps: Partial<DSMenuItemT.SeparatorProps> = {\n ...defaultCommonProps,\n};\n\nexport const defaultSingleWithSubmenuProps: Partial<Omit<DSMenuItemT.SingleWithSubmenuProps, 'render'>> = {\n ...defaultSingleProps,\n ...defaultSubmenuProps,\n};\n\nexport const itemProps = {\n dsId: PropTypes.string,\n innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({ current: PropTypes.any })]),\n wrapperStyles: PropTypes.object,\n render: PropTypes.func,\n} as WeakValidationMap<unknown>;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACGvB,SAAS,iBAAiB;AAyF1B,MAAM,OAAO,MAAM;AAEZ,MAAM,qBAAuE;AAAA,EAClF,UAAU;AAAA,EACV,eAAe,CAAC;AAClB;AAEO,MAAM,qBAAuD;AAAA,EAClE,GAAG;AAAA,EACH,OAAO;AAAA,EACP,OAAO;AAAA,EACP,UAAU;AAAA,EACV,UAAU;AAAA,EACV,SAAS;AAAA,EACT,0BAA0B;AAC5B;AAEO,MAAM,oBAAqD;AAAA,EAChE,GAAG;AAAA,EACH,OAAO;AAAA,EACP,UAAU;AAAA,EACV,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,SAAS;AAAA,EACT,aAAa;AAAA,EACb,cAAc;AAAA,EACd,cAAc;AAAA,EACd,UAAU;AACZ;AAEO,MAAM,qBAAuD;AAAA,EAClE,GAAG;AAAA,EACH,OAAO;AAAA,EACP,UAAU;AAAA,EACV,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,SAAS;AAAA,EACT,aAAa;AAAA,EACb,cAAc;AAAA,EACd,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,UAAU;AACZ;AAEO,MAAM,sBAAyD;AAAA,EACpE,GAAG;AAAA,EACH,OAAO;AAAA,EACP,UAAU;AAAA,EACV,UAAU;AAAA,EACV,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,YAAY;AAAA,EACZ,0BAA0B;AAAA,EAC1B,UAAU;AAAA,EACV,eAAe;AAAA,IACb,SAAS,CAAC;AAAA,IACV,iBAAiB;AAAA,IACjB,gBAAgB,CAAC;AAAA,IACjB,iBAAiB,CAAC;AAAA,IAClB,WAAW;AAAA,IACX,eAAe;AAAA,IACf,gBAAgB;AAAA,IAChB,UAAU;AAAA,IACV,WAAW;AAAA,EACb;AACF;AAEO,MAAM,sBAAyD;AAAA,EACpE,GAAG;AAAA,EACH,OAAO;AACT;AAEO,MAAM,wBAA6D;AAAA,EACxE,GAAG;AACL;AAEO,MAAM,gCAA6F;AAAA,EACxG,GAAG;AAAA,EACH,GAAG;AACL;AAEO,MAAM,YAAY;AAAA,EACvB,MAAM,UAAU;AAAA,EAChB,UAAU,UAAU,UAAU,CAAC,UAAU,MAAM,UAAU,MAAM,EAAE,SAAS,UAAU,IAAI,CAAC,CAAC,CAAC;AAAA,EAC3F,eAAe,UAAU;AAAA,EACzB,QAAQ,UAAU;AACpB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@elliemae/ds-menu-items",
|
|
3
|
+
"version": "3.9.0-next.5",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"description": "ICE MT - Dimsum - Menu Items",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
9
|
+
"module": "./dist/esm/index.js",
|
|
10
|
+
"main": "./dist/cjs/index.js",
|
|
11
|
+
"types": "./dist/types/index.d.ts",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"import": "./dist/esm/index.js",
|
|
15
|
+
"require": "./dist/cjs/index.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"sideEffects": [
|
|
19
|
+
"*.css",
|
|
20
|
+
"*.scss"
|
|
21
|
+
],
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "https://git.elliemae.io/platform-ui/dimsum.git"
|
|
25
|
+
},
|
|
26
|
+
"engines": {
|
|
27
|
+
"pnpm": ">=6",
|
|
28
|
+
"node": ">=16"
|
|
29
|
+
},
|
|
30
|
+
"author": "ICE MT",
|
|
31
|
+
"jestSonar": {
|
|
32
|
+
"sonar56x": true,
|
|
33
|
+
"reportPath": "reports",
|
|
34
|
+
"reportFile": "tests.xml",
|
|
35
|
+
"indent": 4
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@elliemae/ds-form-checkbox": "3.9.0-next.5",
|
|
39
|
+
"@elliemae/ds-grid": "3.9.0-next.5",
|
|
40
|
+
"@elliemae/ds-icons": "3.9.0-next.5",
|
|
41
|
+
"@elliemae/ds-system": "3.9.0-next.5",
|
|
42
|
+
"@elliemae/ds-utilities": "3.9.0-next.5"
|
|
43
|
+
},
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"lodash": "^4.17.21",
|
|
46
|
+
"react": "^17.0.2",
|
|
47
|
+
"react-dom": "^17.0.2",
|
|
48
|
+
"styled-components": "^5.3.5"
|
|
49
|
+
},
|
|
50
|
+
"publishConfig": {
|
|
51
|
+
"access": "public",
|
|
52
|
+
"typeSafety": false
|
|
53
|
+
},
|
|
54
|
+
"scripts": {
|
|
55
|
+
"dev": "cross-env NODE_ENV=development node ../../scripts/build/build.mjs --watch",
|
|
56
|
+
"test": "node ../../scripts/testing/test.mjs",
|
|
57
|
+
"lint": "node ../../scripts/lint.mjs",
|
|
58
|
+
"dts": "node ../../scripts/dts.mjs",
|
|
59
|
+
"build": "cross-env NODE_ENV=production node ../../scripts/build/build.mjs",
|
|
60
|
+
"checkDeps": "npx -yes ../ds-codemods check-missing-packages --projectFolderPath=\"./\" --ignorePackagesGlobPattern=\"\" --ignoreFilesGlobPattern=\"**/test-ables/*,**/tests/*\""
|
|
61
|
+
}
|
|
62
|
+
}
|