@elliemae/ds-menu 2.2.0 → 2.3.0-alpha.3
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/cjs/Menu.js +137 -181
- package/cjs/Menu.js.map +7 -0
- package/cjs/MenuCombobox.js +67 -53
- package/cjs/MenuCombobox.js.map +7 -0
- package/cjs/MenuContext.js +38 -11
- package/cjs/MenuContext.js.map +7 -0
- package/cjs/MenuExports.js +28 -0
- package/cjs/MenuExports.js.map +7 -0
- package/cjs/MenuItems/CheckboxGroup.js +49 -42
- package/cjs/MenuItems/CheckboxGroup.js.map +7 -0
- package/cjs/MenuItems/MenuItem.js +116 -163
- package/cjs/MenuItems/MenuItem.js.map +7 -0
- package/cjs/MenuItems/MenuItemCheckable.js +77 -108
- package/cjs/MenuItems/MenuItemCheckable.js.map +7 -0
- package/cjs/MenuItems/MenuItemCheckbox.js +47 -41
- package/cjs/MenuItems/MenuItemCheckbox.js.map +7 -0
- package/cjs/MenuItems/MenuItemRadio.js +50 -38
- package/cjs/MenuItems/MenuItemRadio.js.map +7 -0
- package/cjs/MenuItems/RadioGroup.js +48 -39
- package/cjs/MenuItems/RadioGroup.js.map +7 -0
- package/cjs/MenuItems/SearchableGroup.js +88 -92
- package/cjs/MenuItems/SearchableGroup.js.map +7 -0
- package/cjs/MenuItems/SearchableList.js +92 -95
- package/cjs/MenuItems/SearchableList.js.map +7 -0
- package/cjs/MenuItems/SelectionGroup.js +85 -90
- package/cjs/MenuItems/SelectionGroup.js.map +7 -0
- package/cjs/MenuItems/Separator.js +55 -40
- package/cjs/MenuItems/Separator.js.map +7 -0
- package/cjs/MenuItems/SubMenu.js +143 -160
- package/cjs/MenuItems/SubMenu.js.map +7 -0
- package/cjs/MenuItems/menuItemFactory.js +39 -71
- package/cjs/MenuItems/menuItemFactory.js.map +7 -0
- package/cjs/MenuItems/renderMenuItems.js +53 -0
- package/cjs/MenuItems/renderMenuItems.js.map +7 -0
- package/cjs/VirtualMenuList.js +69 -39
- package/cjs/VirtualMenuList.js.map +7 -0
- package/cjs/index.js +63 -36
- package/cjs/index.js.map +7 -0
- package/cjs/utils/useHeightByAmountOfItems.js +43 -14
- package/cjs/utils/useHeightByAmountOfItems.js.map +7 -0
- package/esm/Menu.js +91 -149
- package/esm/Menu.js.map +7 -0
- package/esm/MenuCombobox.js +38 -45
- package/esm/MenuCombobox.js.map +7 -0
- package/esm/MenuContext.js +9 -5
- package/esm/MenuContext.js.map +7 -0
- package/esm/MenuExports.js +3 -0
- package/esm/MenuExports.js.map +7 -0
- package/esm/MenuItems/CheckboxGroup.js +19 -31
- package/esm/MenuItems/CheckboxGroup.js.map +7 -0
- package/esm/MenuItems/MenuItem.js +84 -148
- package/esm/MenuItems/MenuItem.js.map +7 -0
- package/esm/MenuItems/MenuItemCheckable.js +47 -96
- package/esm/MenuItems/MenuItemCheckable.js.map +7 -0
- package/esm/MenuItems/MenuItemCheckbox.js +18 -33
- package/esm/MenuItems/MenuItemCheckbox.js.map +7 -0
- package/esm/MenuItems/MenuItemRadio.js +20 -28
- package/esm/MenuItems/MenuItemRadio.js.map +7 -0
- package/esm/MenuItems/RadioGroup.js +18 -28
- package/esm/MenuItems/RadioGroup.js.map +7 -0
- package/esm/MenuItems/SearchableGroup.js +53 -76
- package/esm/MenuItems/SearchableGroup.js.map +7 -0
- package/esm/MenuItems/SearchableList.js +59 -82
- package/esm/MenuItems/SearchableList.js.map +7 -0
- package/esm/MenuItems/SelectionGroup.js +54 -78
- package/esm/MenuItems/SelectionGroup.js.map +7 -0
- package/esm/MenuItems/Separator.js +26 -29
- package/esm/MenuItems/Separator.js.map +7 -0
- package/esm/MenuItems/SubMenu.js +107 -140
- package/esm/MenuItems/SubMenu.js.map +7 -0
- package/esm/MenuItems/menuItemFactory.js +11 -63
- package/esm/MenuItems/menuItemFactory.js.map +7 -0
- package/esm/MenuItems/renderMenuItems.js +24 -0
- package/esm/MenuItems/renderMenuItems.js.map +7 -0
- package/esm/VirtualMenuList.js +39 -32
- package/esm/VirtualMenuList.js.map +7 -0
- package/esm/index.js +34 -13
- package/esm/index.js.map +7 -0
- package/esm/utils/useHeightByAmountOfItems.js +13 -11
- package/esm/utils/useHeightByAmountOfItems.js.map +7 -0
- package/package.json +19 -11
- package/types/Menu.d.ts +3 -2
- package/types/MenuContext.d.ts +3 -2
- package/types/MenuExports.d.ts +1 -0
- package/types/MenuItems/CheckboxGroup.d.ts +5 -5
- package/types/MenuItems/MenuItem.d.ts +5 -5
- package/types/MenuItems/MenuItemCheckable.d.ts +15 -14
- package/types/MenuItems/MenuItemCheckbox.d.ts +3 -2
- package/types/MenuItems/MenuItemRadio.d.ts +5 -5
- package/types/MenuItems/RadioGroup.d.ts +5 -5
- package/types/MenuItems/SearchableGroup.d.ts +3 -3
- package/types/MenuItems/SearchableList.d.ts +16 -16
- package/types/MenuItems/SelectionGroup.d.ts +16 -16
- package/types/MenuItems/Separator.d.ts +2 -1
- package/types/MenuItems/SubMenu.d.ts +18 -18
- package/types/MenuItems/menuItemFactory.d.ts +2 -3
- package/types/MenuItems/renderMenuItems.d.ts +1 -0
- package/types/VirtualMenuList.d.ts +3 -1
- package/types/index.d.ts +3 -2
- package/types/utils/useHeightByAmountOfItems.d.ts +3 -1
package/esm/MenuItems/SubMenu.js
CHANGED
|
@@ -1,45 +1,35 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
interactionType = 'hover',
|
|
34
|
-
children: subitems,
|
|
35
|
-
rightAddonType,
|
|
36
|
-
disabledAddonInactive,
|
|
37
|
-
checkableProps = {},
|
|
38
|
-
customRenderer,
|
|
39
|
-
onClick,
|
|
40
|
-
closeMenu,
|
|
41
|
-
id
|
|
42
|
-
} = _ref;
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import React2, { useCallback, useRef, useState } from "react";
|
|
3
|
+
import { PropTypes, describe } from "react-desc";
|
|
4
|
+
import { ChevronSmallRight, MoreOptionsVert } from "@elliemae/ds-icons";
|
|
5
|
+
import { useFocusGroupItem } from "@elliemae/ds-shared/FocusGroup";
|
|
6
|
+
import { useHiddenController } from "@elliemae/ds-hidden";
|
|
7
|
+
import { DSButton, BUTTON_VARIANT } from "@elliemae/ds-button";
|
|
8
|
+
import { DSPopper, interactions } from "@elliemae/ds-popper";
|
|
9
|
+
import styled from "styled-components";
|
|
10
|
+
import { Menu } from "../Menu";
|
|
11
|
+
import { MenuItem } from "./MenuItem";
|
|
12
|
+
import { registerMenuItem } from "./menuItemFactory";
|
|
13
|
+
const ChevronRightComp = styled.div`
|
|
14
|
+
display: flex;
|
|
15
|
+
justify-content: center;
|
|
16
|
+
align-items: center;
|
|
17
|
+
width: 28px; // same width as the ellipsis button
|
|
18
|
+
`;
|
|
19
|
+
const SubMenu = ({
|
|
20
|
+
noAddon,
|
|
21
|
+
leftAddon = void 0,
|
|
22
|
+
label = void 0,
|
|
23
|
+
interactionType = "hover",
|
|
24
|
+
children: subitems,
|
|
25
|
+
rightAddonType,
|
|
26
|
+
disabledAddonInactive,
|
|
27
|
+
checkableProps = {},
|
|
28
|
+
customRenderer,
|
|
29
|
+
onClick,
|
|
30
|
+
closeMenu,
|
|
31
|
+
id
|
|
32
|
+
}) => {
|
|
43
33
|
const itemRef = useRef(null);
|
|
44
34
|
const focusOnOpen = useRef(false);
|
|
45
35
|
const [isAddonHovered, setIsAddonHovered] = useState(false);
|
|
@@ -47,144 +37,121 @@ function SubMenu(_ref) {
|
|
|
47
37
|
visible = false,
|
|
48
38
|
onShow,
|
|
49
39
|
onHide
|
|
50
|
-
} = useHiddenController(
|
|
51
|
-
interaction:
|
|
40
|
+
} = useHiddenController(void 0, {
|
|
41
|
+
interaction: "click"
|
|
52
42
|
});
|
|
53
|
-
const interaction = rightAddonType ===
|
|
54
|
-
const {
|
|
55
|
-
|
|
56
|
-
} = useFocusGroupItem(); // todo: create a menu state to handle all related menu things
|
|
57
|
-
|
|
58
|
-
const handleShowSubItemsWithMouse = e => {
|
|
43
|
+
const interaction = rightAddonType === "elipsis" ? "click" : "hover";
|
|
44
|
+
const { focusItemByNode } = useFocusGroupItem();
|
|
45
|
+
const handleShowSubItemsWithMouse = (e) => {
|
|
59
46
|
e.stopPropagation();
|
|
60
47
|
onShow();
|
|
61
48
|
focusOnOpen.current = true;
|
|
62
49
|
};
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
50
|
+
const handleShowWithMouse = (e) => {
|
|
51
|
+
if (onClick)
|
|
52
|
+
onClick(e);
|
|
66
53
|
};
|
|
67
|
-
|
|
68
54
|
const handleShowWithMouseHover = () => {
|
|
69
55
|
setIsAddonHovered(true);
|
|
70
56
|
onShow();
|
|
71
57
|
focusOnOpen.current = false;
|
|
72
58
|
};
|
|
73
|
-
|
|
74
59
|
const handleShowWithKeyboard = () => {
|
|
75
60
|
onShow();
|
|
76
61
|
focusOnOpen.current = true;
|
|
77
62
|
};
|
|
78
|
-
|
|
79
63
|
const handleOnMouseEnter = useCallback(() => {
|
|
80
64
|
setIsAddonHovered(true);
|
|
81
65
|
}, []);
|
|
82
66
|
const handleOnMouseLeave = useCallback(() => {
|
|
83
67
|
setIsAddonHovered(false);
|
|
84
68
|
}, []);
|
|
85
|
-
const hoverHandlers = interaction ===
|
|
69
|
+
const hoverHandlers = interaction === "hover" ? {
|
|
86
70
|
onMouseEnter: handleShowWithMouseHover,
|
|
87
71
|
onMouseLeave: () => {
|
|
88
72
|
onHide();
|
|
89
73
|
setIsAddonHovered(false);
|
|
90
74
|
}
|
|
91
|
-
} : {
|
|
92
|
-
|
|
93
|
-
};
|
|
94
|
-
const rightAddon = rightAddonType === 'elipsis' ? /*#__PURE__*/_jsx(DSButton, {
|
|
75
|
+
} : { onClick: handleShowWithMouse };
|
|
76
|
+
const rightAddon = rightAddonType === "elipsis" ? /* @__PURE__ */ React2.createElement(DSButton, {
|
|
95
77
|
"aria-label": "vertical-elipsis",
|
|
96
78
|
"data-testid": "vertical-elipsis",
|
|
97
79
|
buttonType: "text",
|
|
98
|
-
leftIcon:
|
|
80
|
+
leftIcon: /* @__PURE__ */ React2.createElement(MoreOptionsVert, {
|
|
99
81
|
className: "submenu-arrow",
|
|
100
|
-
color: visible || isAddonHovered ? [
|
|
82
|
+
color: visible || isAddonHovered ? ["brand-primary", 800] : ["neutral", 500],
|
|
101
83
|
size: "s"
|
|
102
84
|
}),
|
|
103
|
-
onClick: e => handleShowSubItemsWithMouse(e),
|
|
85
|
+
onClick: (e) => handleShowSubItemsWithMouse(e),
|
|
104
86
|
size: "m",
|
|
105
87
|
variant: BUTTON_VARIANT.DEFAULT
|
|
106
|
-
}) :
|
|
88
|
+
}) : /* @__PURE__ */ React2.createElement(ChevronRightComp, null, /* @__PURE__ */ React2.createElement(ChevronSmallRight, {
|
|
107
89
|
"data-testid": "chevron-right",
|
|
108
90
|
className: "submenu-arrow",
|
|
109
|
-
color: visible || isAddonHovered ? [
|
|
91
|
+
color: visible || isAddonHovered ? ["brand-primary", 800] : ["neutral", 500],
|
|
110
92
|
size: "sm"
|
|
111
93
|
}));
|
|
112
|
-
return
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
rightAddon: rightAddon
|
|
149
|
-
}, checkableProps))
|
|
94
|
+
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(DSPopper, {
|
|
95
|
+
contentComponent: /* @__PURE__ */ React2.createElement(Menu, {
|
|
96
|
+
focusKeyBindings: {
|
|
97
|
+
ArrowLeft: [() => focusItemByNode(itemRef.current), "exit"]
|
|
98
|
+
},
|
|
99
|
+
focusOnOpen: focusOnOpen.current,
|
|
100
|
+
onExitFocusGroup: onHide,
|
|
101
|
+
...hoverHandlers,
|
|
102
|
+
closeMenu,
|
|
103
|
+
visible
|
|
104
|
+
}, subitems),
|
|
105
|
+
interactionType,
|
|
106
|
+
isOpen: visible,
|
|
107
|
+
onOpen: (opening) => opening ? onShow() : onHide(),
|
|
108
|
+
placement: "right-start",
|
|
109
|
+
showArrow: false,
|
|
110
|
+
triggerComponent: /* @__PURE__ */ React2.createElement(MenuItem, {
|
|
111
|
+
customRenderer,
|
|
112
|
+
disabledAddonInactive,
|
|
113
|
+
id,
|
|
114
|
+
innerRef: itemRef,
|
|
115
|
+
label,
|
|
116
|
+
leftAddon,
|
|
117
|
+
noAddon,
|
|
118
|
+
onFocus: handleOnMouseEnter,
|
|
119
|
+
onBlur: handleOnMouseLeave,
|
|
120
|
+
onMouseEnter: handleOnMouseEnter,
|
|
121
|
+
onMouseLeave: handleOnMouseLeave,
|
|
122
|
+
...hoverHandlers,
|
|
123
|
+
onKeyDown: (e) => {
|
|
124
|
+
if (e.key === "ArrowRight" || e.key === "Enter" || e.keyCode === 32) {
|
|
125
|
+
handleShowWithKeyboard();
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
rightAddon,
|
|
129
|
+
...checkableProps
|
|
150
130
|
})
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
|
|
131
|
+
}));
|
|
132
|
+
};
|
|
154
133
|
const props = {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
/** sub menu items */
|
|
168
|
-
children: PropTypes.oneOfType([PropTypes.array, PropTypes.node]).description('sub menu items'),
|
|
169
|
-
|
|
170
|
-
/** right addon, ellipsis or undefined */
|
|
171
|
-
rightAddonType: PropTypes.oneOf(['ellipsis']).description('right addon, ellipsis or undefined'),
|
|
172
|
-
disabledAddonInactive: PropTypes.bool.description(''),
|
|
173
|
-
|
|
174
|
-
/** props passed to MenuItem component */
|
|
175
|
-
checkableProps: PropTypes.object.description('props passed to MenuItem component'),
|
|
176
|
-
|
|
177
|
-
/** custom renderer for menu item */
|
|
178
|
-
customRenderer: PropTypes.func.description('custom renderer for menu item'),
|
|
179
|
-
|
|
180
|
-
/** on click handler */
|
|
181
|
-
onClick: PropTypes.func.description('on click handler'),
|
|
182
|
-
closeMenu: PropTypes.any.description(''),
|
|
183
|
-
|
|
184
|
-
/** component id */
|
|
185
|
-
id: PropTypes.string.description('component id')
|
|
134
|
+
noAddon: PropTypes.bool.description("dont show addon for submenu"),
|
|
135
|
+
leftAddon: PropTypes.node.description("left addon"),
|
|
136
|
+
label: PropTypes.string.description("submenu label"),
|
|
137
|
+
interactionType: PropTypes.oneOf(interactions).description("A type indicating how to open/close the tooltip"),
|
|
138
|
+
children: PropTypes.oneOfType([PropTypes.array, PropTypes.node]).description("sub menu items"),
|
|
139
|
+
rightAddonType: PropTypes.oneOf(["ellipsis"]).description("right addon, ellipsis or undefined"),
|
|
140
|
+
disabledAddonInactive: PropTypes.bool.description(""),
|
|
141
|
+
checkableProps: PropTypes.object.description("props passed to MenuItem component"),
|
|
142
|
+
customRenderer: PropTypes.func.description("custom renderer for menu item"),
|
|
143
|
+
onClick: PropTypes.func.description("on click handler"),
|
|
144
|
+
closeMenu: PropTypes.any.description(""),
|
|
145
|
+
id: PropTypes.string.description("component id")
|
|
186
146
|
};
|
|
147
|
+
SubMenu.propTypes = props;
|
|
148
|
+
registerMenuItem("submenu", SubMenu);
|
|
187
149
|
const DSSubMenuWithSchema = describe(SubMenu);
|
|
188
150
|
DSSubMenuWithSchema.propTypes = props;
|
|
189
|
-
|
|
190
|
-
export {
|
|
151
|
+
var SubMenu_default = SubMenu;
|
|
152
|
+
export {
|
|
153
|
+
DSSubMenuWithSchema,
|
|
154
|
+
SubMenu,
|
|
155
|
+
SubMenu_default as default
|
|
156
|
+
};
|
|
157
|
+
//# sourceMappingURL=SubMenu.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/MenuItems/SubMenu.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable indent */\n/* eslint-disable max-lines */\n/* eslint-disable import/no-cycle */\nimport React, { useCallback, useRef, useState } from 'react';\nimport { PropTypes, describe } from 'react-desc';\nimport { ChevronSmallRight, MoreOptionsVert } from '@elliemae/ds-icons';\nimport { useFocusGroupItem } from '@elliemae/ds-shared/FocusGroup';\nimport { useHiddenController } from '@elliemae/ds-hidden';\nimport { DSButton, BUTTON_VARIANT } from '@elliemae/ds-button';\nimport { DSPopper, interactions } from '@elliemae/ds-popper';\nimport styled from 'styled-components';\nimport { Menu } from '../Menu';\nimport { MenuItem } from './MenuItem';\nimport { registerMenuItem } from './menuItemFactory';\n\nconst ChevronRightComp = styled.div`\n display: flex;\n justify-content: center;\n align-items: center;\n width: 28px; // same width as the ellipsis button\n`;\n\nconst SubMenu = ({\n noAddon,\n leftAddon = undefined,\n label = undefined,\n interactionType = 'hover',\n children: subitems,\n rightAddonType,\n disabledAddonInactive,\n checkableProps = {},\n customRenderer,\n onClick,\n closeMenu,\n id,\n}) => {\n const itemRef = useRef(null);\n const focusOnOpen = useRef(false);\n const [isAddonHovered, setIsAddonHovered] = useState<boolean>(false);\n const {\n visible = false,\n onShow,\n onHide,\n } = useHiddenController(undefined, {\n interaction: 'click',\n });\n\n const interaction = rightAddonType === 'elipsis' ? 'click' : 'hover';\n\n const { focusItemByNode } = useFocusGroupItem();\n // todo: create a menu state to handle all related menu things\n const handleShowSubItemsWithMouse = (e) => {\n e.stopPropagation();\n onShow();\n focusOnOpen.current = true;\n };\n const handleShowWithMouse = (e) => {\n if (onClick) onClick(e);\n };\n const handleShowWithMouseHover = () => {\n setIsAddonHovered(true);\n onShow();\n focusOnOpen.current = false;\n };\n\n const handleShowWithKeyboard = () => {\n onShow();\n focusOnOpen.current = true;\n };\n\n const handleOnMouseEnter = useCallback(() => {\n setIsAddonHovered(true);\n }, []);\n\n const handleOnMouseLeave = useCallback(() => {\n setIsAddonHovered(false);\n }, []);\n\n const hoverHandlers =\n interaction === 'hover'\n ? {\n onMouseEnter: handleShowWithMouseHover,\n onMouseLeave: () => {\n onHide();\n setIsAddonHovered(false);\n },\n }\n : { onClick: handleShowWithMouse };\n\n const rightAddon =\n rightAddonType === 'elipsis' ? (\n <DSButton\n aria-label=\"vertical-elipsis\"\n data-testid=\"vertical-elipsis\"\n buttonType=\"text\"\n leftIcon={\n <MoreOptionsVert\n className=\"submenu-arrow\"\n color={visible || isAddonHovered ? ['brand-primary', 800] : ['neutral', 500]}\n size=\"s\"\n />\n }\n onClick={(e) => handleShowSubItemsWithMouse(e)}\n size=\"m\"\n variant={BUTTON_VARIANT.DEFAULT}\n />\n ) : (\n <ChevronRightComp>\n <ChevronSmallRight\n data-testid=\"chevron-right\"\n className=\"submenu-arrow\"\n color={visible || isAddonHovered ? ['brand-primary', 800] : ['neutral', 500]}\n size=\"sm\"\n />\n </ChevronRightComp>\n );\n\n return (\n <>\n <DSPopper\n contentComponent={\n <Menu\n focusKeyBindings={{\n ArrowLeft: [() => focusItemByNode(itemRef.current), 'exit'],\n }}\n focusOnOpen={focusOnOpen.current}\n onExitFocusGroup={onHide}\n {...hoverHandlers}\n closeMenu={closeMenu}\n visible={visible}\n >\n {subitems}\n </Menu>\n }\n interactionType={interactionType}\n isOpen={visible}\n onOpen={(opening) => (opening ? onShow() : onHide())}\n placement=\"right-start\"\n showArrow={false}\n triggerComponent={\n <MenuItem\n customRenderer={customRenderer}\n disabledAddonInactive={disabledAddonInactive}\n id={id}\n innerRef={itemRef}\n label={label}\n leftAddon={leftAddon}\n noAddon={noAddon}\n onFocus={handleOnMouseEnter}\n onBlur={handleOnMouseLeave}\n onMouseEnter={handleOnMouseEnter}\n onMouseLeave={handleOnMouseLeave}\n {...hoverHandlers}\n onKeyDown={(e) => {\n if (e.key === 'ArrowRight' || e.key === 'Enter' || e.keyCode === 32) {\n handleShowWithKeyboard();\n }\n }}\n rightAddon={rightAddon}\n {...checkableProps}\n />\n }\n />\n </>\n );\n};\n\nconst props = {\n /** dont show addon for submenu */\n noAddon: PropTypes.bool.description('dont show addon for submenu'),\n /** left addon */\n leftAddon: PropTypes.node.description('left addon'),\n /** submenu label */\n label: PropTypes.string.description('submenu label'),\n /** A type indicating how to open/close the tooltip */\n interactionType: PropTypes.oneOf(interactions).description('A type indicating how to open/close the tooltip'),\n /** sub menu items */\n children: PropTypes.oneOfType([PropTypes.array, PropTypes.node]).description('sub menu items'),\n /** right addon, ellipsis or undefined */\n rightAddonType: PropTypes.oneOf(['ellipsis']).description('right addon, ellipsis or undefined'),\n disabledAddonInactive: PropTypes.bool.description(''),\n /** props passed to MenuItem component */\n checkableProps: PropTypes.object.description('props passed to MenuItem component'),\n /** custom renderer for menu item */\n customRenderer: PropTypes.func.description('custom renderer for menu item'),\n /** on click handler */\n onClick: PropTypes.func.description('on click handler'),\n closeMenu: PropTypes.any.description(''),\n /** component id */\n id: PropTypes.string.description('component id'),\n};\n\nSubMenu.propTypes = props;\nregisterMenuItem('submenu', SubMenu);\n\nconst DSSubMenuWithSchema = describe(SubMenu);\n\nDSSubMenuWithSchema.propTypes = props;\n\nexport { DSSubMenuWithSchema, SubMenu };\nexport default SubMenu;\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,64 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import 'core-js/modules/esnext.iterator.filter.js';
|
|
7
|
-
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
8
|
-
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
9
|
-
import { createElement } from 'react';
|
|
10
|
-
import { isFunction } from '@elliemae/ds-utilities';
|
|
11
|
-
import MenuSeparator from './Separator.js';
|
|
12
|
-
import MenuItem from './MenuItem.js';
|
|
13
|
-
import SubMenu from './SubMenu.js';
|
|
14
|
-
import SelectionGroup from './SelectionGroup.js';
|
|
15
|
-
import MenuItemCheckbox from './MenuItemCheckbox.js';
|
|
16
|
-
import MenuItemRadio from './MenuItemRadio.js';
|
|
17
|
-
|
|
18
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
19
|
-
|
|
20
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
21
|
-
|
|
22
|
-
const itemTypes = () => ({
|
|
23
|
-
separator: MenuSeparator,
|
|
24
|
-
menuitem: MenuItem,
|
|
25
|
-
radio: MenuItemRadio,
|
|
26
|
-
checkbox: MenuItemCheckbox,
|
|
27
|
-
submenu: SubMenu,
|
|
28
|
-
'selection-group': SelectionGroup
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
const fallback = {
|
|
32
|
-
SelectionGroup: 'selection-group'
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
const itemTypes = {};
|
|
3
|
+
const menuItemFactory = (type = "", items, defaultItem = itemTypes.menuitem) => {
|
|
4
|
+
const itemsObject = items || itemTypes;
|
|
5
|
+
return itemsObject[type] || itemsObject[type.toLowerCase()] || defaultItem;
|
|
33
6
|
};
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
return itemsObject[parsedType] || defaultItem;
|
|
41
|
-
}
|
|
42
|
-
function renderMenuItems(options) {
|
|
43
|
-
let factory = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : menuItemFactory;
|
|
44
|
-
return options.map((option, index) => {
|
|
45
|
-
if (isFunction(option.renderer)) {
|
|
46
|
-
return option.renderer({
|
|
47
|
-
key: option.id,
|
|
48
|
-
item: option
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const ItemComponent = factory(option.type);
|
|
53
|
-
const children = option.subItems && renderMenuItems(option.subItems, factory);
|
|
54
|
-
return /*#__PURE__*/createElement(ItemComponent, _objectSpread(_objectSpread({}, option), {}, {
|
|
55
|
-
key: option.id || index,
|
|
56
|
-
item: option,
|
|
57
|
-
onClick: null,
|
|
58
|
-
onMouseDown: option.onClick // onClick callback called in onMouseDown due to events order issue
|
|
59
|
-
|
|
60
|
-
}), children);
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export { menuItemFactory, renderMenuItems };
|
|
7
|
+
const registerMenuItem = (type, item) => itemTypes[type] = item;
|
|
8
|
+
export {
|
|
9
|
+
menuItemFactory,
|
|
10
|
+
registerMenuItem
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=menuItemFactory.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/MenuItems/menuItemFactory.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\n\nconst itemTypes = {};\n\nexport const menuItemFactory = (type = '', items, defaultItem = itemTypes.menuitem) => {\n const itemsObject = items || itemTypes;\n return itemsObject[type] || itemsObject[type.toLowerCase()] || defaultItem;\n};\n\nexport const registerMenuItem = (type, item) => (itemTypes[type] = item);\n"],
|
|
5
|
+
"mappings": "AAAA;ACEA,MAAM,YAAY;AAEX,MAAM,kBAAkB,CAAC,OAAO,IAAI,OAAO,cAAc,UAAU,aAAa;AACrF,QAAM,cAAc,SAAS;AAC7B,SAAO,YAAY,SAAS,YAAY,KAAK,kBAAkB;AAAA;AAG1D,MAAM,mBAAmB,CAAC,MAAM,SAAU,UAAU,QAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import React2 from "react";
|
|
3
|
+
import { isFunction } from "@elliemae/ds-utilities";
|
|
4
|
+
const renderMenuItems = (options, factory) => options.map((option, index) => {
|
|
5
|
+
if (isFunction(option.renderer)) {
|
|
6
|
+
return option.renderer({
|
|
7
|
+
key: option.id,
|
|
8
|
+
item: option
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
const ItemComponent = factory(option.type);
|
|
12
|
+
const children = option.subItems && renderMenuItems(option.subItems, factory);
|
|
13
|
+
return /* @__PURE__ */ React2.createElement(ItemComponent, {
|
|
14
|
+
...option,
|
|
15
|
+
key: option.id || index,
|
|
16
|
+
item: option,
|
|
17
|
+
onClick: null,
|
|
18
|
+
onMouseDown: option.onClick
|
|
19
|
+
}, children);
|
|
20
|
+
});
|
|
21
|
+
export {
|
|
22
|
+
renderMenuItems
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=renderMenuItems.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/MenuItems/renderMenuItems.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable import/no-cycle */\nimport React from 'react';\nimport { isFunction } from '@elliemae/ds-utilities';\n\nexport const renderMenuItems = (options, factory) =>\n options.map((option, index) => {\n if (isFunction(option.renderer)) {\n return option.renderer({\n key: option.id,\n item: option,\n });\n }\n const ItemComponent = factory(option.type);\n const children = option.subItems && renderMenuItems(option.subItems, factory);\n return (\n <ItemComponent\n {...option}\n key={option.id || index}\n item={option}\n onClick={null}\n onMouseDown={option.onClick}\n // onClick callback called in onMouseDown due to events order issue\n >\n {children}\n </ItemComponent>\n );\n });\n"],
|
|
5
|
+
"mappings": "AAAA;ACCA;AACA;AAEO,MAAM,kBAAkB,CAAC,SAAS,YACvC,QAAQ,IAAI,CAAC,QAAQ,UAAU;AAC7B,MAAI,WAAW,OAAO,WAAW;AAC/B,WAAO,OAAO,SAAS;AAAA,MACrB,KAAK,OAAO;AAAA,MACZ,MAAM;AAAA;AAAA;AAGV,QAAM,gBAAgB,QAAQ,OAAO;AACrC,QAAM,WAAW,OAAO,YAAY,gBAAgB,OAAO,UAAU;AACrE,SACE,qCAAC,eAAD;AAAA,OACM;AAAA,IACJ,KAAK,OAAO,MAAM;AAAA,IAClB,MAAM;AAAA,IACN,SAAS;AAAA,IACT,aAAa,OAAO;AAAA,KAGnB;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/esm/VirtualMenuList.js
CHANGED
|
@@ -1,42 +1,49 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import React2 from "react";
|
|
3
|
+
import { FixedSizeList as List } from "react-window";
|
|
4
|
+
import { useHeightByAmountOfItems } from "./utils/useHeightByAmountOfItems";
|
|
5
|
+
const MenuItem = ({ data, index, style }) => /* @__PURE__ */ React2.createElement("div", {
|
|
6
|
+
key: index,
|
|
7
|
+
style
|
|
8
|
+
}, data && data[index] ? data[index] : "");
|
|
9
|
+
function resolveComputation(items, cb, timeout = 1e3) {
|
|
10
|
+
return () => new Promise((resolve) => {
|
|
11
|
+
const doResolve = (result2) => {
|
|
12
|
+
cb(result2);
|
|
13
|
+
resolve(result2);
|
|
14
|
+
};
|
|
15
|
+
let result = 0;
|
|
16
|
+
const timer = setTimeout(() => doResolve(result), timeout);
|
|
17
|
+
items.forEach((option) => {
|
|
18
|
+
result = option.props.label.length > result ? option.props.label.length : result;
|
|
19
|
+
});
|
|
20
|
+
clearTimeout(timer);
|
|
21
|
+
doResolve(result);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function VirtualMenuList({
|
|
25
|
+
items,
|
|
26
|
+
itemHeight = 32,
|
|
27
|
+
amountItemsInWindow = 5,
|
|
28
|
+
width,
|
|
29
|
+
height
|
|
30
|
+
}) {
|
|
28
31
|
const computedListHeight = useHeightByAmountOfItems({
|
|
29
32
|
amountItems: amountItemsInWindow,
|
|
30
33
|
itemHeight,
|
|
31
34
|
items
|
|
32
35
|
});
|
|
33
|
-
return
|
|
36
|
+
return /* @__PURE__ */ React2.createElement(List, {
|
|
34
37
|
height: height || computedListHeight,
|
|
35
38
|
itemCount: items.length,
|
|
36
39
|
itemData: items,
|
|
37
40
|
itemSize: itemHeight,
|
|
38
|
-
width
|
|
39
|
-
},
|
|
41
|
+
width
|
|
42
|
+
}, MenuItem);
|
|
40
43
|
}
|
|
41
|
-
|
|
42
|
-
export {
|
|
44
|
+
var VirtualMenuList_default = VirtualMenuList;
|
|
45
|
+
export {
|
|
46
|
+
VirtualMenuList,
|
|
47
|
+
VirtualMenuList_default as default
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=VirtualMenuList.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/VirtualMenuList.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { FixedSizeList as List } from 'react-window';\nimport { useHeightByAmountOfItems } from './utils/useHeightByAmountOfItems';\n\nconst MenuItem = ({ data, index, style }) => (\n <div key={index} style={style}>\n {data && data[index] ? data[index] : ''}\n </div>\n);\n\n// eslint-disable-next-line no-unused-vars\nfunction resolveComputation(items, cb, timeout = 1000) {\n return () =>\n new Promise(resolve => {\n const doResolve = result => {\n cb(result);\n resolve(result);\n };\n let result = 0;\n const timer = setTimeout(() => doResolve(result), timeout);\n items.forEach(option => {\n result =\n option.props.label.length > result\n ? option.props.label.length\n : result;\n });\n\n clearTimeout(timer);\n doResolve(result);\n });\n}\n\nfunction VirtualMenuList({\n items,\n itemHeight = 32,\n amountItemsInWindow = 5,\n width,\n height,\n}) {\n const computedListHeight = useHeightByAmountOfItems({\n amountItems: amountItemsInWindow,\n itemHeight,\n items,\n });\n\n return (\n <List\n height={height || computedListHeight}\n itemCount={items.length}\n itemData={items}\n itemSize={itemHeight}\n width={width}\n >\n {MenuItem}\n </List>\n );\n}\n\nexport { VirtualMenuList };\nexport default VirtualMenuList;"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AACA;AACA;AAEA,MAAM,WAAW,CAAC,EAAE,MAAM,OAAO,YAC/B,qCAAC,OAAD;AAAA,EAAK,KAAK;AAAA,EAAO;AAAA,GACd,QAAQ,KAAK,SAAS,KAAK,SAAS;AAKzC,4BAA4B,OAAO,IAAI,UAAU,KAAM;AACrD,SAAO,MACL,IAAI,QAAQ,aAAW;AACrB,UAAM,YAAY,aAAU;AAC1B,SAAG;AACH,cAAQ;AAAA;AAEV,QAAI,SAAS;AACb,UAAM,QAAQ,WAAW,MAAM,UAAU,SAAS;AAClD,UAAM,QAAQ,YAAU;AACtB,eACE,OAAO,MAAM,MAAM,SAAS,SACxB,OAAO,MAAM,MAAM,SACnB;AAAA;AAGR,iBAAa;AACb,cAAU;AAAA;AAAA;AAIhB,yBAAyB;AAAA,EACvB;AAAA,EACA,aAAa;AAAA,EACb,sBAAsB;AAAA,EACtB;AAAA,EACA;AAAA,GACC;AACD,QAAM,qBAAqB,yBAAyB;AAAA,IAClD,aAAa;AAAA,IACb;AAAA,IACA;AAAA;AAGF,SACE,qCAAC,MAAD;AAAA,IACE,QAAQ,UAAU;AAAA,IAClB,WAAW,MAAM;AAAA,IACjB,UAAU;AAAA,IACV,UAAU;AAAA,IACV;AAAA,KAEC;AAAA;AAMP,IAAO,0BAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/esm/index.js
CHANGED
|
@@ -1,13 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { DSMenuItemWithSchema } from "./MenuItems/MenuItem";
|
|
3
|
+
import { DSSubMenuWithSchema } from "./MenuItems/SubMenu";
|
|
4
|
+
import { DSMenuCheckboxGroupWithSchema } from "./MenuItems/CheckboxGroup";
|
|
5
|
+
import { DSMenuItemCheckeableWithSchema } from "./MenuItems/MenuItemCheckable";
|
|
6
|
+
import { DSMenuItemRadioWithSchema } from "./MenuItems/MenuItemRadio";
|
|
7
|
+
import { DSMenuRadioGroupWithSchema } from "./MenuItems/RadioGroup";
|
|
8
|
+
import { DSMenuSearchableGroupWithSchema } from "./MenuItems/SearchableGroup";
|
|
9
|
+
import { DSMenuSearchableListWithSchema } from "./MenuItems/SearchableList";
|
|
10
|
+
import { DSMenuSeparatorWithSchema } from "./MenuItems/Separator";
|
|
11
|
+
import { DSMenuSelectionGroupWithSchema } from "./MenuItems/SelectionGroup";
|
|
12
|
+
import { default as default2 } from "./MenuCombobox";
|
|
13
|
+
import { menuItemFactory } from "./MenuItems/menuItemFactory";
|
|
14
|
+
import { renderMenuItems } from "./MenuItems/renderMenuItems";
|
|
15
|
+
import { DSMenuWithSchema, Menu, Menu as Menu2 } from "./Menu";
|
|
16
|
+
export {
|
|
17
|
+
DSMenuCheckboxGroupWithSchema,
|
|
18
|
+
DSMenuItemCheckeableWithSchema,
|
|
19
|
+
DSMenuItemRadioWithSchema,
|
|
20
|
+
DSMenuItemWithSchema,
|
|
21
|
+
DSMenuRadioGroupWithSchema,
|
|
22
|
+
DSMenuSearchableGroupWithSchema,
|
|
23
|
+
DSMenuSearchableListWithSchema,
|
|
24
|
+
DSMenuSelectionGroupWithSchema,
|
|
25
|
+
DSMenuSeparatorWithSchema,
|
|
26
|
+
DSMenuWithSchema,
|
|
27
|
+
DSSubMenuWithSchema,
|
|
28
|
+
Menu,
|
|
29
|
+
default2 as MenuCombobox,
|
|
30
|
+
Menu2 as default,
|
|
31
|
+
menuItemFactory,
|
|
32
|
+
renderMenuItems
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=index.js.map
|
package/esm/index.js.map
ADDED
|
@@ -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 { DSMenuItemWithSchema } from './MenuItems/MenuItem';\nexport { DSSubMenuWithSchema } from './MenuItems/SubMenu';\nexport { DSMenuCheckboxGroupWithSchema } from './MenuItems/CheckboxGroup';\nexport { DSMenuItemCheckeableWithSchema } from './MenuItems/MenuItemCheckable';\nexport { DSMenuItemRadioWithSchema } from './MenuItems/MenuItemRadio';\nexport { DSMenuRadioGroupWithSchema } from './MenuItems/RadioGroup';\nexport { DSMenuSearchableGroupWithSchema } from './MenuItems/SearchableGroup';\nexport { DSMenuSearchableListWithSchema } from './MenuItems/SearchableList';\nexport { DSMenuSeparatorWithSchema } from './MenuItems/Separator';\nexport { DSMenuSelectionGroupWithSchema } from './MenuItems/SelectionGroup';\n\nexport { default as MenuCombobox } from './MenuCombobox';\nexport { menuItemFactory } from './MenuItems/menuItemFactory';\nexport { renderMenuItems } from './MenuItems/renderMenuItems';\nexport { DSMenuWithSchema, Menu, Menu as default } from './Menu';\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
3
|
const calculateHeight = (itemHeight, amountItemsInWindow, itemsLength) => {
|
|
4
4
|
const realAmountItemsInWindow = itemsLength < amountItemsInWindow ? itemsLength : amountItemsInWindow;
|
|
5
5
|
return itemHeight * realAmountItemsInWindow;
|
|
6
6
|
};
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
items
|
|
13
|
-
} = _ref;
|
|
7
|
+
function useHeightByAmountOfItems({
|
|
8
|
+
itemHeight,
|
|
9
|
+
amountItems,
|
|
10
|
+
items
|
|
11
|
+
}) {
|
|
14
12
|
const calculatedHeight = useMemo(() => calculateHeight(itemHeight, amountItems, items.length), [amountItems, items]);
|
|
15
13
|
return calculatedHeight;
|
|
16
14
|
}
|
|
17
|
-
|
|
18
|
-
export {
|
|
15
|
+
var useHeightByAmountOfItems_default = useHeightByAmountOfItems;
|
|
16
|
+
export {
|
|
17
|
+
useHeightByAmountOfItems_default as default,
|
|
18
|
+
useHeightByAmountOfItems
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=useHeightByAmountOfItems.js.map
|