@elliemae/ds-menu-items-single-with-submenu 3.27.0-next.11
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/DSMenuItemsSingleWithSubmenu.js +151 -0
- package/dist/cjs/DSMenuItemsSingleWithSubmenu.js.map +7 -0
- package/dist/cjs/config/useGetSubmenuHandlers.js +90 -0
- package/dist/cjs/config/useGetSubmenuHandlers.js.map +7 -0
- package/dist/cjs/config/useMenuItemsSingleWithSubmenu.js +64 -0
- package/dist/cjs/config/useMenuItemsSingleWithSubmenu.js.map +7 -0
- package/dist/cjs/config/useValidateProps.js +41 -0
- package/dist/cjs/config/useValidateProps.js.map +7 -0
- package/dist/cjs/constants/index.js +25 -0
- package/dist/cjs/constants/index.js.map +7 -0
- package/dist/cjs/index.js +38 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/package.json +7 -0
- package/dist/cjs/react-desc-prop-types.js +137 -0
- package/dist/cjs/react-desc-prop-types.js.map +7 -0
- package/dist/esm/DSMenuItemsSingleWithSubmenu.js +131 -0
- package/dist/esm/DSMenuItemsSingleWithSubmenu.js.map +7 -0
- package/dist/esm/config/useGetSubmenuHandlers.js +60 -0
- package/dist/esm/config/useGetSubmenuHandlers.js.map +7 -0
- package/dist/esm/config/useMenuItemsSingleWithSubmenu.js +37 -0
- package/dist/esm/config/useMenuItemsSingleWithSubmenu.js.map +7 -0
- package/dist/esm/config/useValidateProps.js +11 -0
- package/dist/esm/config/useValidateProps.js.map +7 -0
- package/dist/esm/constants/index.js +2 -0
- package/dist/esm/constants/index.js.map +7 -0
- package/dist/esm/index.js +11 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/package.json +7 -0
- package/dist/esm/react-desc-prop-types.js +110 -0
- package/dist/esm/react-desc-prop-types.js.map +7 -0
- package/dist/types/DSMenuItemsSingleWithSubmenu.d.ts +5 -0
- package/dist/types/config/useGetSubmenuHandlers.d.ts +7 -0
- package/dist/types/config/useMenuItemsSingleWithSubmenu.d.ts +21 -0
- package/dist/types/config/useValidateProps.d.ts +3 -0
- package/dist/types/constants/index.d.ts +0 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/react-desc-prop-types.d.ts +48 -0
- package/package.json +77 -0
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var DSMenuItemsSingleWithSubmenu_exports = {};
|
|
30
|
+
__export(DSMenuItemsSingleWithSubmenu_exports, {
|
|
31
|
+
DSMenuItemsSingleWithSubmenu: () => DSMenuItemsSingleWithSubmenu,
|
|
32
|
+
DSMenuItemsSingleWithSubmenuWithSchema: () => DSMenuItemsSingleWithSubmenuWithSchema
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(DSMenuItemsSingleWithSubmenu_exports);
|
|
35
|
+
var React = __toESM(require("react"));
|
|
36
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
37
|
+
var import_react = __toESM(require("react"));
|
|
38
|
+
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
39
|
+
var import_ds_icons = require("@elliemae/ds-icons");
|
|
40
|
+
var import_react_desc_prop_types = require("./react-desc-prop-types.js");
|
|
41
|
+
var import_ds_menu_items_commons = require("@elliemae/ds-menu-items-commons");
|
|
42
|
+
var import_useMenuItemsSingleWithSubmenu = require("./config/useMenuItemsSingleWithSubmenu.js");
|
|
43
|
+
const DSMenuItemsSingleWithSubmenu = (props) => {
|
|
44
|
+
const { propsWithDefault, globalProps, xstyledProps, eventHandlers } = (0, import_useMenuItemsSingleWithSubmenu.useMenuItemsSingleWithSubmenu)(props);
|
|
45
|
+
const { onMouseEnterHandler, onMouseLeaveHandler, onEllipsisClick } = eventHandlers;
|
|
46
|
+
const {
|
|
47
|
+
dsId,
|
|
48
|
+
label,
|
|
49
|
+
secondaryLabel,
|
|
50
|
+
isActive,
|
|
51
|
+
disabled,
|
|
52
|
+
onClick,
|
|
53
|
+
isSelected,
|
|
54
|
+
isSubmenuOpened,
|
|
55
|
+
rightAddon,
|
|
56
|
+
innerRef,
|
|
57
|
+
wrapperStyles,
|
|
58
|
+
render: Render,
|
|
59
|
+
Dropdown,
|
|
60
|
+
dropdownProps: {
|
|
61
|
+
options,
|
|
62
|
+
openedSubmenus,
|
|
63
|
+
onSubmenuToggle,
|
|
64
|
+
selectedOptions,
|
|
65
|
+
onKeyDown,
|
|
66
|
+
onOptionClick,
|
|
67
|
+
onClickOutside,
|
|
68
|
+
minWidth,
|
|
69
|
+
maxHeight
|
|
70
|
+
}
|
|
71
|
+
} = propsWithDefault;
|
|
72
|
+
const [delayedIsOpened, setDelayedIsOpened] = import_react.default.useState(false);
|
|
73
|
+
const { minWidth: _widthToRemoveFromGlobals, ...restXStyled } = xstyledProps;
|
|
74
|
+
import_react.default.useEffect(() => {
|
|
75
|
+
setTimeout(() => setDelayedIsOpened(isSubmenuOpened));
|
|
76
|
+
}, [isSubmenuOpened]);
|
|
77
|
+
const gridLayout = import_react.default.useMemo(() => {
|
|
78
|
+
const cols = ["16px", "auto"];
|
|
79
|
+
if (secondaryLabel)
|
|
80
|
+
cols.push("min-content");
|
|
81
|
+
cols.push("min-content");
|
|
82
|
+
return cols;
|
|
83
|
+
}, [secondaryLabel]);
|
|
84
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
85
|
+
Dropdown,
|
|
86
|
+
{
|
|
87
|
+
isOpened: delayedIsOpened,
|
|
88
|
+
options: options ?? [],
|
|
89
|
+
onOptionClick,
|
|
90
|
+
startPlacementPreference: "right-start",
|
|
91
|
+
placementOrderPreference: ["right-start", "right-end", "left-start", "left-end"],
|
|
92
|
+
selectedOptions,
|
|
93
|
+
openedSubmenus,
|
|
94
|
+
onSubmenuToggle,
|
|
95
|
+
onKeyDown,
|
|
96
|
+
onClickOutside,
|
|
97
|
+
customOffset: [-4, 1],
|
|
98
|
+
onMouseEnter: onMouseEnterHandler,
|
|
99
|
+
onMouseLeave: onMouseLeaveHandler,
|
|
100
|
+
wrapperStyles: { ...wrapperStyles, w: "100%" },
|
|
101
|
+
minWidth,
|
|
102
|
+
maxHeight,
|
|
103
|
+
"data-popover-label": label,
|
|
104
|
+
as: "li",
|
|
105
|
+
role: "option",
|
|
106
|
+
"aria-selected": isSubmenuOpened,
|
|
107
|
+
"aria-describedby": `dropdownmenu-submenu-${dsId}`,
|
|
108
|
+
id: dsId,
|
|
109
|
+
...globalProps,
|
|
110
|
+
...restXStyled,
|
|
111
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
112
|
+
import_ds_menu_items_commons.StyledGlobalMenuItemWrapper,
|
|
113
|
+
{
|
|
114
|
+
pr: 0,
|
|
115
|
+
onClick: !disabled ? onClick : void 0,
|
|
116
|
+
isSelected: isSubmenuOpened,
|
|
117
|
+
disabled,
|
|
118
|
+
isActive,
|
|
119
|
+
onMouseEnter: onMouseEnterHandler,
|
|
120
|
+
onMouseLeave: onMouseLeaveHandler,
|
|
121
|
+
as: "div",
|
|
122
|
+
innerRef,
|
|
123
|
+
"data-type": "single-with-submenu",
|
|
124
|
+
children: [
|
|
125
|
+
Render !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Render, { ...propsWithDefault }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ds_menu_items_commons.StyledContentWrapper, { cols: gridLayout, gutter: "xxs", alignItems: "center", children: [
|
|
126
|
+
isSelected ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_icons.Checkmark, { size: "s", color: disabled ? ["neutral", "500"] : ["brand-primary", "600"] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {}),
|
|
127
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_menu_items_commons.StyleMenuItemLabel, { children: label }),
|
|
128
|
+
secondaryLabel !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_menu_items_commons.StyleMenuItemSecondaryLabel, { children: secondaryLabel }),
|
|
129
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ds_menu_items_commons.StyledIconContainer, { children: [
|
|
130
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_menu_items_commons.StyledVerticalSeparator, {}),
|
|
131
|
+
rightAddon === "ellipsis" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_menu_items_commons.StyledEllipsisButton, { tabIndex: -1, onClick: onEllipsisClick, disabled, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
132
|
+
import_ds_icons.MoreOptionsVert,
|
|
133
|
+
{
|
|
134
|
+
className: "ds-dropdown-menu-v2-more-options",
|
|
135
|
+
color: disabled ? ["neutral", "500"] : ["brand-primary", "600"],
|
|
136
|
+
size: "s"
|
|
137
|
+
}
|
|
138
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_icons.ChevronRight, { color: disabled ? ["neutral", "500"] : ["brand-primary", "600"], size: "s" })
|
|
139
|
+
] })
|
|
140
|
+
] }),
|
|
141
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { id: `dropdownmenu-submenu-${dsId}`, style: { display: "none" }, children: "submenu, to open this submenu press the Right Arrow key" })
|
|
142
|
+
]
|
|
143
|
+
}
|
|
144
|
+
)
|
|
145
|
+
}
|
|
146
|
+
);
|
|
147
|
+
};
|
|
148
|
+
DSMenuItemsSingleWithSubmenu.displayName = `DSMenuItemSingleWithSubmenu`;
|
|
149
|
+
const DSMenuItemsSingleWithSubmenuWithSchema = (0, import_ds_props_helpers.describe)(DSMenuItemsSingleWithSubmenu);
|
|
150
|
+
DSMenuItemsSingleWithSubmenuWithSchema.propTypes = import_react_desc_prop_types.DSMenuItemsSingleWithSubmenuPropTypesSchema;
|
|
151
|
+
//# sourceMappingURL=DSMenuItemsSingleWithSubmenu.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/DSMenuItemsSingleWithSubmenu.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { describe } from '@elliemae/ds-props-helpers';\nimport { MoreOptionsVert, ChevronRight, Checkmark } from '@elliemae/ds-icons';\nimport {\n type DSMenuItemsSingleWithSubmenuT,\n DSMenuItemsSingleWithSubmenuPropTypesSchema,\n} from './react-desc-prop-types.js';\nimport {\n StyledGlobalMenuItemWrapper,\n StyledContentWrapper,\n StyleMenuItemLabel,\n StyleMenuItemSecondaryLabel,\n StyledIconContainer,\n StyledVerticalSeparator,\n StyledEllipsisButton,\n} from '@elliemae/ds-menu-items-commons';\nimport { useMenuItemsSingleWithSubmenu } from './config/useMenuItemsSingleWithSubmenu.js';\n\nconst DSMenuItemsSingleWithSubmenu: React.ComponentType<DSMenuItemsSingleWithSubmenuT.Props> = (props) => {\n const { propsWithDefault, globalProps, xstyledProps, eventHandlers } = useMenuItemsSingleWithSubmenu(props);\n const { onMouseEnterHandler, onMouseLeaveHandler, onEllipsisClick } = eventHandlers;\n const {\n dsId,\n label,\n secondaryLabel,\n isActive,\n disabled,\n onClick,\n isSelected,\n isSubmenuOpened,\n rightAddon,\n innerRef,\n wrapperStyles,\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] = React.useState(false);\n\n // eslint-disable-next-line @typescript-eslint/naming-convention, no-unused-vars\n const { minWidth: _widthToRemoveFromGlobals, ...restXStyled } = xstyledProps;\n\n React.useEffect(() => {\n setTimeout(() => setDelayedIsOpened(isSubmenuOpened));\n }, [isSubmenuOpened]);\n\n const gridLayout = React.useMemo(() => {\n const cols = ['16px', 'auto'];\n if (secondaryLabel) cols.push('min-content');\n cols.push('min-content');\n return cols;\n }, [secondaryLabel]);\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 data-popover-label={label}\n as=\"li\"\n role=\"option\"\n aria-selected={isSubmenuOpened}\n aria-describedby={`dropdownmenu-submenu-${dsId}`}\n id={dsId}\n {...globalProps}\n {...restXStyled}\n >\n <StyledGlobalMenuItemWrapper\n pr={0}\n onClick={!disabled ? onClick : undefined}\n isSelected={isSubmenuOpened}\n disabled={disabled}\n isActive={isActive}\n onMouseEnter={onMouseEnterHandler}\n onMouseLeave={onMouseLeaveHandler}\n as={'div' as keyof JSX.IntrinsicElements}\n innerRef={innerRef}\n data-type=\"single-with-submenu\"\n >\n {Render !== undefined ? (\n <Render {...propsWithDefault} />\n ) : (\n <StyledContentWrapper cols={gridLayout} gutter=\"xxs\" alignItems=\"center\">\n {isSelected ? (\n <Checkmark size=\"s\" color={disabled ? ['neutral', '500'] : ['brand-primary', '600']} />\n ) : (\n <div />\n )}\n <StyleMenuItemLabel>{label}</StyleMenuItemLabel>\n {secondaryLabel !== undefined && (\n <StyleMenuItemSecondaryLabel>{secondaryLabel}</StyleMenuItemSecondaryLabel>\n )}\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 </StyledContentWrapper>\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\n// this is `'DSMenuItemSingleWithSubmenu'` for legacy reasons, when moving to inheritance pattern this has been kept as it was to avoid complications\nDSMenuItemsSingleWithSubmenu.displayName = `DSMenuItemSingleWithSubmenu`;\nconst DSMenuItemsSingleWithSubmenuWithSchema = describe(DSMenuItemsSingleWithSubmenu);\nDSMenuItemsSingleWithSubmenuWithSchema.propTypes = DSMenuItemsSingleWithSubmenuPropTypesSchema;\n\nexport { DSMenuItemsSingleWithSubmenu, DSMenuItemsSingleWithSubmenuWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["React"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var useGetSubmenuHandlers_exports = {};
|
|
30
|
+
__export(useGetSubmenuHandlers_exports, {
|
|
31
|
+
useGetSubmenuHandlers: () => useGetSubmenuHandlers
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(useGetSubmenuHandlers_exports);
|
|
34
|
+
var React = __toESM(require("react"));
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
const useGetSubmenuHandlers = ({
|
|
37
|
+
disabled,
|
|
38
|
+
rightAddon,
|
|
39
|
+
isSubmenuOpened,
|
|
40
|
+
onMouseEnter,
|
|
41
|
+
onSubmenuOpen,
|
|
42
|
+
onSubmenuClose,
|
|
43
|
+
onMouseLeave
|
|
44
|
+
}) => {
|
|
45
|
+
const timeoutRef = import_react.default.useRef(null);
|
|
46
|
+
const onMouseEnterHandler = import_react.default.useCallback(
|
|
47
|
+
(e) => {
|
|
48
|
+
if (rightAddon !== "ellipsis") {
|
|
49
|
+
if (timeoutRef.current !== null)
|
|
50
|
+
clearTimeout(timeoutRef.current);
|
|
51
|
+
else if (!isSubmenuOpened)
|
|
52
|
+
onSubmenuOpen(e);
|
|
53
|
+
timeoutRef.current = null;
|
|
54
|
+
}
|
|
55
|
+
onMouseEnter(e);
|
|
56
|
+
},
|
|
57
|
+
[isSubmenuOpened, onMouseEnter, onSubmenuOpen, rightAddon]
|
|
58
|
+
);
|
|
59
|
+
const onMouseLeaveHandler = import_react.default.useCallback(
|
|
60
|
+
(e) => {
|
|
61
|
+
if (rightAddon !== "ellipsis") {
|
|
62
|
+
if (timeoutRef.current === null) {
|
|
63
|
+
timeoutRef.current = setTimeout(() => {
|
|
64
|
+
timeoutRef.current = null;
|
|
65
|
+
onSubmenuClose?.(e);
|
|
66
|
+
}, 300);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
onMouseLeave(e);
|
|
70
|
+
},
|
|
71
|
+
[onMouseLeave, onSubmenuClose, rightAddon]
|
|
72
|
+
);
|
|
73
|
+
const onEllipsisClick = import_react.default.useCallback(
|
|
74
|
+
(e) => {
|
|
75
|
+
if (disabled)
|
|
76
|
+
return;
|
|
77
|
+
e.stopPropagation();
|
|
78
|
+
if (isSubmenuOpened)
|
|
79
|
+
onSubmenuClose?.(e);
|
|
80
|
+
else
|
|
81
|
+
onSubmenuOpen(e);
|
|
82
|
+
},
|
|
83
|
+
[disabled, isSubmenuOpened, onSubmenuClose, onSubmenuOpen]
|
|
84
|
+
);
|
|
85
|
+
return import_react.default.useMemo(
|
|
86
|
+
() => ({ onMouseEnterHandler, onMouseLeaveHandler, onEllipsisClick }),
|
|
87
|
+
[onMouseEnterHandler, onMouseLeaveHandler, onEllipsisClick]
|
|
88
|
+
);
|
|
89
|
+
};
|
|
90
|
+
//# sourceMappingURL=useGetSubmenuHandlers.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/config/useGetSubmenuHandlers.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { type DSMenuItemsSingleWithSubmenuT } from '../react-desc-prop-types.js';\n\nexport const useGetSubmenuHandlers = ({\n disabled,\n rightAddon,\n isSubmenuOpened,\n onMouseEnter,\n onSubmenuOpen,\n onSubmenuClose,\n onMouseLeave,\n}: DSMenuItemsSingleWithSubmenuT.InternalProps) => {\n const timeoutRef = React.useRef<NodeJS.Timeout | null>(null);\n\n const onMouseEnterHandler = React.useCallback(\n (e: React.MouseEvent<Element>) => {\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 = React.useCallback(\n (e: React.MouseEvent<Element>) => {\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.useCallback<React.MouseEventHandler<Element>>(\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 React.useMemo(\n () => ({ onMouseEnterHandler, onMouseLeaveHandler, onEllipsisClick }),\n [onMouseEnterHandler, onMouseLeaveHandler, onEllipsisClick],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkB;AAGX,MAAM,wBAAwB,CAAC;AAAA,EACpC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAmD;AACjD,QAAM,aAAa,aAAAA,QAAM,OAA8B,IAAI;AAE3D,QAAM,sBAAsB,aAAAA,QAAM;AAAA,IAChC,CAAC,MAAiC;AAChC,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,aAAAA,QAAM;AAAA,IAChC,CAAC,MAAiC;AAChC,UAAI,eAAe,YAAY;AAC7B,YAAI,WAAW,YAAY,MAAM;AAC/B,qBAAW,UAAU,WAAW,MAAM;AACpC,uBAAW,UAAU;AACrB,6BAAiB,CAAC;AAAA,UACpB,GAAG,GAAG;AAAA,QACR;AAAA,MACF;AACA,mBAAa,CAAC;AAAA,IAChB;AAAA,IACA,CAAC,cAAc,gBAAgB,UAAU;AAAA,EAC3C;AAEA,QAAM,kBAAkB,aAAAA,QAAM;AAAA,IAC5B,CAAC,MAAM;AACL,UAAI;AAAU;AACd,QAAE,gBAAgB;AAClB,UAAI;AAAiB,yBAAiB,CAAC;AAAA;AAClC,sBAAc,CAAC;AAAA,IACtB;AAAA,IACA,CAAC,UAAU,iBAAiB,gBAAgB,aAAa;AAAA,EAC3D;AAEA,SAAO,aAAAA,QAAM;AAAA,IACX,OAAO,EAAE,qBAAqB,qBAAqB,gBAAgB;AAAA,IACnE,CAAC,qBAAqB,qBAAqB,eAAe;AAAA,EAC5D;AACF;",
|
|
6
|
+
"names": ["React"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var useMenuItemsSingleWithSubmenu_exports = {};
|
|
30
|
+
__export(useMenuItemsSingleWithSubmenu_exports, {
|
|
31
|
+
useMenuItemsSingleWithSubmenu: () => useMenuItemsSingleWithSubmenu
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(useMenuItemsSingleWithSubmenu_exports);
|
|
34
|
+
var React = __toESM(require("react"));
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_lodash = require("lodash");
|
|
37
|
+
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
38
|
+
var import_react_desc_prop_types = require("../react-desc-prop-types.js");
|
|
39
|
+
var import_useValidateProps = require("./useValidateProps.js");
|
|
40
|
+
var import_useGetSubmenuHandlers = require("./useGetSubmenuHandlers.js");
|
|
41
|
+
const useMenuItemsSingleWithSubmenu = (propsFromUser) => {
|
|
42
|
+
const propsWithDefault = (0, import_ds_props_helpers.useMemoMergePropsWithDefault)(
|
|
43
|
+
propsFromUser,
|
|
44
|
+
import_react_desc_prop_types.defaultProps
|
|
45
|
+
);
|
|
46
|
+
(0, import_useValidateProps.useValidateProps)(propsWithDefault, import_react_desc_prop_types.DSMenuItemsSingleWithSubmenuPropTypes);
|
|
47
|
+
const globalProps = (0, import_lodash.omit)((0, import_ds_props_helpers.useGetGlobalAttributes)(propsWithDefault), [
|
|
48
|
+
"cols",
|
|
49
|
+
"rows",
|
|
50
|
+
"wrap"
|
|
51
|
+
]);
|
|
52
|
+
const xstyledProps = (0, import_ds_props_helpers.useGetXstyledProps)(propsWithDefault);
|
|
53
|
+
const eventHandlers = (0, import_useGetSubmenuHandlers.useGetSubmenuHandlers)(propsWithDefault);
|
|
54
|
+
return import_react.default.useMemo(
|
|
55
|
+
() => ({
|
|
56
|
+
propsWithDefault,
|
|
57
|
+
globalProps,
|
|
58
|
+
xstyledProps,
|
|
59
|
+
eventHandlers
|
|
60
|
+
}),
|
|
61
|
+
[propsWithDefault, globalProps, xstyledProps, eventHandlers]
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=useMenuItemsSingleWithSubmenu.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/config/useMenuItemsSingleWithSubmenu.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { omit } from 'lodash';\nimport { useGetGlobalAttributes, useGetXstyledProps, useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';\nimport {\n type DSMenuItemsSingleWithSubmenuT,\n DSMenuItemsSingleWithSubmenuPropTypes,\n defaultProps,\n} from '../react-desc-prop-types.js';\nimport { useValidateProps } from './useValidateProps.js';\nimport { useGetSubmenuHandlers } from './useGetSubmenuHandlers.js';\n\nexport interface MenuItemsSingleWithSubmenuCTX {\n propsWithDefault: DSMenuItemsSingleWithSubmenuT.InternalProps;\n globalProps: ReturnType<typeof useGetGlobalAttributes>;\n xstyledProps: ReturnType<typeof useGetXstyledProps>;\n eventHandlers: ReturnType<typeof useGetSubmenuHandlers>;\n}\n\nexport const useMenuItemsSingleWithSubmenu = (propsFromUser: DSMenuItemsSingleWithSubmenuT.Props) => {\n // =============================================================================\n // MERGE WITH DEFAULT AND VALIDATE PROPS\n // =============================================================================\n const propsWithDefault = useMemoMergePropsWithDefault<DSMenuItemsSingleWithSubmenuT.InternalProps>(\n propsFromUser,\n defaultProps,\n );\n useValidateProps(propsWithDefault, DSMenuItemsSingleWithSubmenuPropTypes);\n // =============================================================================\n // GLOBAL ATTRIBUTES & XSTYLED PROPS\n // =============================================================================\n const globalProps = omit(useGetGlobalAttributes<DSMenuItemsSingleWithSubmenuT.InternalProps>(propsWithDefault), [\n 'cols',\n 'rows',\n 'wrap',\n ]);\n const xstyledProps = useGetXstyledProps(propsWithDefault);\n // =============================================================================\n // HELPERS HOOKS CONFIGS\n // =============================================================================\n\n const eventHandlers = useGetSubmenuHandlers(propsWithDefault);\n\n return React.useMemo(\n () => ({\n propsWithDefault,\n globalProps,\n xstyledProps,\n eventHandlers,\n }),\n [propsWithDefault, globalProps, xstyledProps, eventHandlers],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkB;AAClB,oBAAqB;AACrB,8BAAyF;AACzF,mCAIO;AACP,8BAAiC;AACjC,mCAAsC;AAS/B,MAAM,gCAAgC,CAAC,kBAAuD;AAInG,QAAM,uBAAmB;AAAA,IACvB;AAAA,IACA;AAAA,EACF;AACA,gDAAiB,kBAAkB,kEAAqC;AAIxE,QAAM,kBAAc,wBAAK,gDAAoE,gBAAgB,GAAG;AAAA,IAC9G;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACD,QAAM,mBAAe,4CAAmB,gBAAgB;AAKxD,QAAM,oBAAgB,oDAAsB,gBAAgB;AAE5D,SAAO,aAAAA,QAAM;AAAA,IACX,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,kBAAkB,aAAa,cAAc,aAAa;AAAA,EAC7D;AACF;",
|
|
6
|
+
"names": ["React"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var useValidateProps_exports = {};
|
|
30
|
+
__export(useValidateProps_exports, {
|
|
31
|
+
useValidateProps: () => useValidateProps
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(useValidateProps_exports);
|
|
34
|
+
var React = __toESM(require("react"));
|
|
35
|
+
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
36
|
+
var import_ds_menu_items_commons = require("@elliemae/ds-menu-items-commons");
|
|
37
|
+
const DSMenuItemsSingleWithSubmenuName = `${import_ds_menu_items_commons.DSMenuItemName}SingleWithSubmenu`;
|
|
38
|
+
const useValidateProps = (props, propTypes) => {
|
|
39
|
+
(0, import_ds_props_helpers.useValidateTypescriptPropTypes)(props, propTypes, DSMenuItemsSingleWithSubmenuName);
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=useValidateProps.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/config/useValidateProps.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import { useValidateTypescriptPropTypes } from '@elliemae/ds-props-helpers';\nimport { DSMenuItemName } from '@elliemae/ds-menu-items-commons';\nimport type { WeakValidationMap } from 'react';\nimport { type DSMenuItemsSingleWithSubmenuT } from '../react-desc-prop-types.js';\n\n// because this is inherited from the common props, we do not want to put this in the /constants/index.ts file\n// this is strictly defined here because this is meant to strictly influence ONLY the ERROR layer\n// this is 100% decoupled from ds-slots & data-testid\n// this constants only affect the shown error message as of 21/december/2023\nconst DSMenuItemsSingleWithSubmenuName = `${DSMenuItemName}SingleWithSubmenu`;\n\nexport const useValidateProps = (\n props: DSMenuItemsSingleWithSubmenuT.InternalProps,\n propTypes: WeakValidationMap<unknown>,\n): void => {\n // we validate the \"required if\" via 'isRequiredIf from our custom PropTypes\n useValidateTypescriptPropTypes(props, propTypes, DSMenuItemsSingleWithSubmenuName);\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,8BAA+C;AAC/C,mCAA+B;AAQ/B,MAAM,mCAAmC,GAAG;AAErC,MAAM,mBAAmB,CAC9B,OACA,cACS;AAET,8DAA+B,OAAO,WAAW,gCAAgC;AACnF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
}
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var React = __toESM(require("react"));
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var src_exports = {};
|
|
30
|
+
__export(src_exports, {
|
|
31
|
+
DSMenuItemsSingleWithSubmenu: () => import_DSMenuItemsSingleWithSubmenu.DSMenuItemsSingleWithSubmenu,
|
|
32
|
+
DSMenuItemsSingleWithSubmenuWithSchema: () => import_DSMenuItemsSingleWithSubmenu.DSMenuItemsSingleWithSubmenuWithSchema
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(src_exports);
|
|
35
|
+
var React = __toESM(require("react"));
|
|
36
|
+
var import_DSMenuItemsSingleWithSubmenu = require("./DSMenuItemsSingleWithSubmenu.js");
|
|
37
|
+
var import_react_desc_prop_types = require("./react-desc-prop-types.js");
|
|
38
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/index.ts", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["// this is a workaround to typescript error TS2742\n// https://github.com/microsoft/TypeScript/issues/47663\nimport type {} from '@xstyled/system';\nexport {\n DSMenuItemsSingleWithSubmenu,\n DSMenuItemsSingleWithSubmenuWithSchema,\n} from './DSMenuItemsSingleWithSubmenu.js';\nexport { type DSMenuItemsSingleWithSubmenuT } from './react-desc-prop-types.js';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADGvB,0CAGO;AACP,mCAAmD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var react_desc_prop_types_exports = {};
|
|
30
|
+
__export(react_desc_prop_types_exports, {
|
|
31
|
+
DSMenuItemsSingleWithSubmenuPropTypes: () => DSMenuItemsSingleWithSubmenuPropTypes,
|
|
32
|
+
DSMenuItemsSingleWithSubmenuPropTypesSchema: () => DSMenuItemsSingleWithSubmenuPropTypesSchema,
|
|
33
|
+
defaultProps: () => defaultProps
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(react_desc_prop_types_exports);
|
|
36
|
+
var React = __toESM(require("react"));
|
|
37
|
+
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
38
|
+
var import_ds_menu_items_commons = require("@elliemae/ds-menu-items-commons");
|
|
39
|
+
const defaultProps = {
|
|
40
|
+
...import_ds_menu_items_commons.DSMenuItemsCommonsDefaultProps,
|
|
41
|
+
isSelected: false,
|
|
42
|
+
onClick: () => {
|
|
43
|
+
},
|
|
44
|
+
onMouseDown: () => {
|
|
45
|
+
},
|
|
46
|
+
onMouseEnter: () => {
|
|
47
|
+
},
|
|
48
|
+
onMouseLeave: () => {
|
|
49
|
+
},
|
|
50
|
+
dataTestid: "ds-menu-item",
|
|
51
|
+
tabIndex: 0,
|
|
52
|
+
// this is a lie, the "default" label is not producing anything useful...
|
|
53
|
+
// the idea of "default" is that if the user does not provide a value, we still have a valid value to use...
|
|
54
|
+
label: "",
|
|
55
|
+
isActive: false,
|
|
56
|
+
disabled: false,
|
|
57
|
+
isSubmenuOpened: false,
|
|
58
|
+
onSubmenuOpen: () => {
|
|
59
|
+
},
|
|
60
|
+
rightAddon: "chevron",
|
|
61
|
+
optionsShouldHavePadding: false,
|
|
62
|
+
Dropdown: () => null,
|
|
63
|
+
// this is a lie, the "default" dropdownProps is not producing anything useful...
|
|
64
|
+
// the idea of "default" is that if the user does not provide a value, we still have a valid value to use...
|
|
65
|
+
dropdownProps: {
|
|
66
|
+
options: [],
|
|
67
|
+
onSubmenuToggle: () => {
|
|
68
|
+
},
|
|
69
|
+
openedSubmenus: {},
|
|
70
|
+
selectedOptions: {},
|
|
71
|
+
onKeyDown: () => {
|
|
72
|
+
},
|
|
73
|
+
onOptionClick: () => {
|
|
74
|
+
},
|
|
75
|
+
onClickOutside: () => {
|
|
76
|
+
},
|
|
77
|
+
minWidth: "auto",
|
|
78
|
+
maxHeight: "auto"
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
const { tabIndex, label, value, ...notOvverriddenCommonPropsTypes } = import_ds_props_helpers.globalAttributesPropTypes;
|
|
82
|
+
const DSMenuItemsSingleWithSubmenuPropTypes = {
|
|
83
|
+
// each single menu-item is in charge of spreading the GlobalAttributesT & XstyledProps
|
|
84
|
+
// they are NOT inherited from a common element from ds-menu-items-commons
|
|
85
|
+
...notOvverriddenCommonPropsTypes,
|
|
86
|
+
...import_ds_props_helpers.xstyledPropTypes,
|
|
87
|
+
...import_ds_menu_items_commons.DSMenuItemsCommonsPropTypes,
|
|
88
|
+
// TODO - add support to PropTypes.oneOf for typeof number
|
|
89
|
+
// currently PropTypes.oneOf([0, -1]) is not supported
|
|
90
|
+
tabIndex: import_ds_props_helpers.PropTypes.oneOfType([import_ds_props_helpers.PropTypes.number, import_ds_props_helpers.PropTypes.string]).description("The tab index of the menu item. for WCAG 2.1 AA compliance only -1 and 0 are allowed.").defaultValue(defaultProps.tabIndex),
|
|
91
|
+
label: import_ds_props_helpers.PropTypes.string.description("The label of the menu item."),
|
|
92
|
+
value: import_ds_props_helpers.PropTypes.any.description("The value of the menu item."),
|
|
93
|
+
isActive: import_ds_props_helpers.PropTypes.bool.description("Whether the menu item is active.").defaultValue(defaultProps.isActive),
|
|
94
|
+
optionsShouldHavePadding: import_ds_props_helpers.PropTypes.bool.description("Whether the menu item should have padding. This is used in the context of a menu with options.").defaultValue(defaultProps.optionsShouldHavePadding),
|
|
95
|
+
secondaryLabel: import_ds_props_helpers.PropTypes.string.description("The secondary label of the menu item."),
|
|
96
|
+
isSelected: import_ds_props_helpers.PropTypes.bool.description("Whether the menu item has to show the selected state or not.").defaultValue(defaultProps.isSelected),
|
|
97
|
+
dataTestid: import_ds_props_helpers.PropTypes.string.description("The data-testid of the menu item.").defaultValue(defaultProps.dataTestid),
|
|
98
|
+
isSubmenuOpened: import_ds_props_helpers.PropTypes.bool.description("Whether the submenu is opened or not.").defaultValue(defaultProps.isSubmenuOpened),
|
|
99
|
+
onSubmenuOpen: import_ds_props_helpers.PropTypes.func.description("Callback fired when the user tries to open the submenu."),
|
|
100
|
+
onSubmenuClose: import_ds_props_helpers.PropTypes.func.description("Callback fired when the user tries to close the submenu."),
|
|
101
|
+
rightAddon: import_ds_props_helpers.PropTypes.oneOf(["ellipsis", "chevron"]).description(
|
|
102
|
+
"The visual element to display on the right side of the menu item."
|
|
103
|
+
),
|
|
104
|
+
Dropdown: import_ds_props_helpers.PropTypes.func.description("The Dropdown component to use to render the submenu."),
|
|
105
|
+
/* TODO - the validation detects "empty" even if the object is not empty...
|
|
106
|
+
we need to fix the validator for "shape"...
|
|
107
|
+
|
|
108
|
+
.shape({
|
|
109
|
+
options: PropTypes.arrayOf(PropTypes.any).description('The options to display in the submenu.'),
|
|
110
|
+
onSubmenuToggle: PropTypes.func
|
|
111
|
+
.description(
|
|
112
|
+
'Callback fired when the user tries to toggle the submenu. It receives the next opened submenus, the submenu and the event.',
|
|
113
|
+
)
|
|
114
|
+
.signature(
|
|
115
|
+
'((nextOpenedSubmenus: Record<string, boolean>, submenu: unknown, e: React.MouseEvent | React.KeyboardEvent) => void)',
|
|
116
|
+
),
|
|
117
|
+
openedSubmenus: PropTypes.objectOf(PropTypes.bool).description('The opened submenus.'),
|
|
118
|
+
selectedOptions: PropTypes.objectOf(PropTypes.bool).description('The selected options.'),
|
|
119
|
+
onKeyDown: PropTypes.func.description('Callback fired when the user presses a key.'),
|
|
120
|
+
onOptionClick: PropTypes.func
|
|
121
|
+
.description(
|
|
122
|
+
'Callback fired when the user clicks on an option. It receives the next selected options, the clicked option and the event.',
|
|
123
|
+
)
|
|
124
|
+
.signature(
|
|
125
|
+
'((nextSelectedOptions: Record<string, boolean>, clickedOption: unknown, e: React.MouseEvent | React.KeyboardEvent) => void)',
|
|
126
|
+
),
|
|
127
|
+
onClickOutside: PropTypes.func
|
|
128
|
+
.description('Callback fired when the user clicks outside the submenu.')
|
|
129
|
+
.signature('((e: MouseEvent | React.KeyboardEvent | TouchEvent) => void)'),
|
|
130
|
+
minWidth: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('The min width of the submenu.'),
|
|
131
|
+
maxHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('The max height of the submenu.'),
|
|
132
|
+
})
|
|
133
|
+
*/
|
|
134
|
+
dropdownProps: import_ds_props_helpers.PropTypes.object.description("The props to pass to the Dropdown component.")
|
|
135
|
+
};
|
|
136
|
+
const DSMenuItemsSingleWithSubmenuPropTypesSchema = DSMenuItemsSingleWithSubmenuPropTypes;
|
|
137
|
+
//# sourceMappingURL=react-desc-prop-types.js.map
|