@elliemae/ds-menu 2.2.2-rc.1 → 2.3.0-alpha.10
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/Menu.js +151 -0
- package/dist/cjs/Menu.js.map +7 -0
- package/dist/cjs/MenuCombobox.js +70 -0
- package/dist/cjs/MenuCombobox.js.map +7 -0
- package/dist/cjs/MenuContext.js +38 -0
- package/dist/cjs/MenuContext.js.map +7 -0
- package/dist/cjs/MenuExports.js +36 -0
- package/dist/cjs/MenuExports.js.map +7 -0
- package/dist/cjs/MenuItems/CheckboxGroup.js +52 -0
- package/dist/cjs/MenuItems/CheckboxGroup.js.map +7 -0
- package/dist/cjs/MenuItems/MenuItem.js +157 -0
- package/dist/cjs/MenuItems/MenuItem.js.map +7 -0
- package/dist/cjs/MenuItems/MenuItemCheckable.js +88 -0
- package/dist/cjs/MenuItems/MenuItemCheckable.js.map +7 -0
- package/dist/cjs/MenuItems/MenuItemCheckbox.js +48 -0
- package/dist/cjs/MenuItems/MenuItemCheckbox.js.map +7 -0
- package/dist/cjs/MenuItems/MenuItemRadio.js +53 -0
- package/dist/cjs/MenuItems/MenuItemRadio.js.map +7 -0
- package/dist/cjs/MenuItems/RadioGroup.js +51 -0
- package/dist/cjs/MenuItems/RadioGroup.js.map +7 -0
- package/dist/cjs/MenuItems/SearchableGroup.js +97 -0
- package/dist/cjs/MenuItems/SearchableGroup.js.map +7 -0
- package/dist/cjs/MenuItems/SearchableList.js +114 -0
- package/dist/cjs/MenuItems/SearchableList.js.map +7 -0
- package/dist/cjs/MenuItems/SelectionGroup.js +102 -0
- package/dist/cjs/MenuItems/SelectionGroup.js.map +7 -0
- package/dist/cjs/MenuItems/Separator.js +59 -0
- package/dist/cjs/MenuItems/Separator.js.map +7 -0
- package/dist/cjs/MenuItems/SubMenu.js +187 -0
- package/dist/cjs/MenuItems/SubMenu.js.map +7 -0
- package/dist/cjs/MenuItems/menuItemFactory.js +41 -0
- package/dist/cjs/MenuItems/menuItemFactory.js.map +7 -0
- package/dist/cjs/MenuItems/renderMenuItems.js +54 -0
- package/dist/cjs/MenuItems/renderMenuItems.js.map +7 -0
- package/dist/cjs/VirtualMenuList.js +78 -0
- package/dist/cjs/VirtualMenuList.js.map +7 -0
- package/dist/cjs/index.js +63 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/utils/useHeightByAmountOfItems.js +49 -0
- package/dist/cjs/utils/useHeightByAmountOfItems.js.map +7 -0
- package/dist/esm/Menu.js +122 -0
- package/dist/esm/Menu.js.map +7 -0
- package/dist/esm/MenuCombobox.js +41 -0
- package/dist/esm/MenuCombobox.js.map +7 -0
- package/dist/esm/MenuContext.js +9 -0
- package/dist/esm/MenuContext.js.map +7 -0
- package/dist/esm/MenuExports.js +7 -0
- package/dist/esm/MenuExports.js.map +7 -0
- package/dist/esm/MenuItems/CheckboxGroup.js +23 -0
- package/dist/esm/MenuItems/CheckboxGroup.js.map +7 -0
- package/dist/esm/MenuItems/MenuItem.js +128 -0
- package/dist/esm/MenuItems/MenuItem.js.map +7 -0
- package/dist/esm/MenuItems/MenuItemCheckable.js +59 -0
- package/dist/esm/MenuItems/MenuItemCheckable.js.map +7 -0
- package/dist/esm/MenuItems/MenuItemCheckbox.js +19 -0
- package/dist/esm/MenuItems/MenuItemCheckbox.js.map +7 -0
- package/dist/esm/MenuItems/MenuItemRadio.js +24 -0
- package/dist/esm/MenuItems/MenuItemRadio.js.map +7 -0
- package/dist/esm/MenuItems/RadioGroup.js +22 -0
- package/dist/esm/MenuItems/RadioGroup.js.map +7 -0
- package/dist/esm/MenuItems/SearchableGroup.js +68 -0
- package/dist/esm/MenuItems/SearchableGroup.js.map +7 -0
- package/dist/esm/MenuItems/SearchableList.js +85 -0
- package/dist/esm/MenuItems/SearchableList.js.map +7 -0
- package/dist/esm/MenuItems/SelectionGroup.js +73 -0
- package/dist/esm/MenuItems/SelectionGroup.js.map +7 -0
- package/dist/esm/MenuItems/Separator.js +30 -0
- package/dist/esm/MenuItems/Separator.js.map +7 -0
- package/dist/esm/MenuItems/SubMenu.js +158 -0
- package/dist/esm/MenuItems/SubMenu.js.map +7 -0
- package/dist/esm/MenuItems/menuItemFactory.js +12 -0
- package/dist/esm/MenuItems/menuItemFactory.js.map +7 -0
- package/dist/esm/MenuItems/renderMenuItems.js +25 -0
- package/dist/esm/MenuItems/renderMenuItems.js.map +7 -0
- package/dist/esm/VirtualMenuList.js +49 -0
- package/dist/esm/VirtualMenuList.js.map +7 -0
- package/dist/esm/index.js +34 -0
- package/dist/esm/index.js.map +7 -0
- package/{esm → dist/esm}/utils/useHeightByAmountOfItems.js +13 -11
- package/dist/esm/utils/useHeightByAmountOfItems.js.map +7 -0
- package/{types → dist/types}/Menu.d.ts +4 -2
- package/{types → dist/types}/MenuCombobox.d.ts +0 -0
- package/dist/types/MenuContext.d.ts +4 -0
- package/dist/types/MenuExports.d.ts +1 -0
- package/{types → dist/types}/MenuItems/CheckboxGroup.d.ts +5 -5
- package/{types → dist/types}/MenuItems/MenuItem.d.ts +5 -5
- package/{types → dist/types}/MenuItems/MenuItemCheckable.d.ts +15 -14
- package/{types → dist/types}/MenuItems/MenuItemCheckbox.d.ts +3 -2
- package/{types → dist/types}/MenuItems/MenuItemRadio.d.ts +5 -5
- package/{types → dist/types}/MenuItems/RadioGroup.d.ts +5 -5
- package/{types → dist/types}/MenuItems/SearchableGroup.d.ts +3 -3
- package/{types → dist/types}/MenuItems/SearchableList.d.ts +16 -16
- package/{types → dist/types}/MenuItems/SelectionGroup.d.ts +16 -16
- package/{types → dist/types}/MenuItems/Separator.d.ts +2 -1
- package/{types → dist/types}/MenuItems/SubMenu.d.ts +18 -18
- package/dist/types/MenuItems/menuItemFactory.d.ts +2 -0
- package/dist/types/MenuItems/renderMenuItems.d.ts +1 -0
- package/{types → dist/types}/VirtualMenuList.d.ts +3 -1
- package/{types → dist/types}/index.d.ts +3 -2
- package/{types → dist/types}/tests/Menu.test.d.ts +0 -0
- package/{types → dist/types}/tests/MenuItem.test.d.ts +0 -0
- package/dist/types/utils/useHeightByAmountOfItems.d.ts +7 -0
- package/package.json +72 -62
- package/cjs/Menu.js +0 -195
- package/cjs/MenuCombobox.js +0 -56
- package/cjs/MenuContext.js +0 -11
- package/cjs/MenuItems/CheckboxGroup.js +0 -45
- package/cjs/MenuItems/MenuItem.js +0 -203
- package/cjs/MenuItems/MenuItemCheckable.js +0 -119
- package/cjs/MenuItems/MenuItemCheckbox.js +0 -42
- package/cjs/MenuItems/MenuItemRadio.js +0 -41
- package/cjs/MenuItems/RadioGroup.js +0 -42
- package/cjs/MenuItems/SearchableGroup.js +0 -101
- package/cjs/MenuItems/SearchableList.js +0 -117
- package/cjs/MenuItems/SelectionGroup.js +0 -107
- package/cjs/MenuItems/Separator.js +0 -44
- package/cjs/MenuItems/SubMenu.js +0 -203
- package/cjs/MenuItems/menuItemFactory.js +0 -73
- package/cjs/VirtualMenuList.js +0 -48
- package/cjs/index.js +0 -36
- package/cjs/utils/useHeightByAmountOfItems.js +0 -20
- package/esm/Menu.js +0 -180
- package/esm/MenuCombobox.js +0 -48
- package/esm/MenuContext.js +0 -5
- package/esm/MenuItems/CheckboxGroup.js +0 -35
- package/esm/MenuItems/MenuItem.js +0 -191
- package/esm/MenuItems/MenuItemCheckable.js +0 -108
- package/esm/MenuItems/MenuItemCheckbox.js +0 -34
- package/esm/MenuItems/MenuItemRadio.js +0 -32
- package/esm/MenuItems/RadioGroup.js +0 -32
- package/esm/MenuItems/SearchableGroup.js +0 -91
- package/esm/MenuItems/SearchableList.js +0 -108
- package/esm/MenuItems/SelectionGroup.js +0 -97
- package/esm/MenuItems/Separator.js +0 -33
- package/esm/MenuItems/SubMenu.js +0 -190
- package/esm/MenuItems/menuItemFactory.js +0 -64
- package/esm/VirtualMenuList.js +0 -42
- package/esm/index.js +0 -13
- package/types/MenuContext.d.ts +0 -3
- package/types/MenuItems/menuItemFactory.d.ts +0 -3
- package/types/utils/useHeightByAmountOfItems.d.ts +0 -5
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/MenuItems/SelectionGroup.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React, { useMemo } from 'react';\nimport { PropTypes, describe } from 'react-desc';\nimport { useCheckableGroup } from '@elliemae/ds-shared/CheckableGroup';\nimport { SearchableGroup } from './SearchableGroup';\nimport { registerMenuItem, menuItemFactory } from './menuItemFactory';\nimport { VirtualMenuList } from '../VirtualMenuList';\n\nconst noop = () => null;\n\nconst SelectionGroup = ({\n multi = false,\n searchable = false,\n focusOnOpen = false,\n onSelect = noop,\n children,\n items = undefined,\n active = multi ? [] : '',\n width,\n height,\n maxOptions = 5,\n}) => {\n const renderedItems = useMemo(\n () =>\n items &&\n items.map((item) => {\n const Component = menuItemFactory(multi ? 'checkbox' : 'radio');\n return <Component {...item} key={item.name || item.id || item.key} item={item} name={item.id || item.name} />;\n }),\n [items],\n );\n const decoratedGroupChildren = useCheckableGroup({\n children: renderedItems || children,\n multi,\n active,\n onCheck: onSelect,\n });\n\n if (searchable) {\n return (\n <SearchableGroup focusOnOpen={focusOnOpen} height={height} items={items} width={width}>\n {decoratedGroupChildren}\n </SearchableGroup>\n );\n }\n return (\n <VirtualMenuList height={height} items={decoratedGroupChildren} width={width} amountItemsInWindow={maxOptions} />\n );\n};\n\nconst props = {\n /** toggle on multi select */\n multi: PropTypes.bool.description('toggle on multi select'),\n /** toggle on searchable behavior */\n searchable: PropTypes.bool.description('toggle on searchable behavior'),\n /** toggle to focus component on open */\n focusOnOpen: PropTypes.bool.description('toggle to focus component on open'),\n /** callback that triggers when select happens */\n onSelect: PropTypes.func.description('callback that triggers when select happens'),\n children: PropTypes.node.description(''),\n /** selection group items */\n items: PropTypes.array.description('selection group items'),\n /** array of values for multi and string for single selection */\n active: PropTypes.oneOfType([PropTypes.string, PropTypes.array]).description(\n 'array of values for multi and string for single selection',\n ),\n /** selection group width */\n width: PropTypes.number.description('selection group width'),\n /** selection group height */\n height: PropTypes.number.description('selection group height'),\n};\n\nSelectionGroup.propTypes = props;\nregisterMenuItem('selectiongroup', SelectionGroup);\nregisterMenuItem('SelectionGroup', SelectionGroup);\n\nconst DSMenuSelectionGroupWithSchema = describe(SelectionGroup);\nDSMenuSelectionGroupWithSchema.propTypes = props;\n\nexport { DSMenuSelectionGroupWithSchema, SelectionGroup };\nexport default SelectionGroup;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA+B;AAC/B,wBAAoC;AACpC,4BAAkC;AAClC,6BAAgC;AAChC,6BAAkD;AAClD,6BAAgC;AAEhC,MAAM,OAAO,MAAM;AAEnB,MAAM,iBAAiB,CAAC;AAAA,EACtB,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,cAAc;AAAA,EACd,WAAW;AAAA,EACX;AAAA,EACA,QAAQ;AAAA,EACR,SAAS,QAAQ,KAAK;AAAA,EACtB;AAAA,EACA;AAAA,EACA,aAAa;AAAA,MACT;AACJ,QAAM,gBAAgB,0BACpB,MACE,SACA,MAAM,IAAI,CAAC,SAAS;AAClB,UAAM,YAAY,4CAAgB,QAAQ,aAAa;AACvD,WAAO,mDAAC,WAAD;AAAA,SAAe;AAAA,MAAM,KAAK,KAAK,QAAQ,KAAK,MAAM,KAAK;AAAA,MAAK;AAAA,MAAY,MAAM,KAAK,MAAM,KAAK;AAAA;AAAA,MAEzG,CAAC;AAEH,QAAM,yBAAyB,6CAAkB;AAAA,IAC/C,UAAU,iBAAiB;AAAA,IAC3B;AAAA,IACA;AAAA,IACA,SAAS;AAAA;AAGX,MAAI,YAAY;AACd,WACE,mDAAC,wCAAD;AAAA,MAAiB;AAAA,MAA0B;AAAA,MAAgB;AAAA,MAAc;AAAA,OACtE;AAAA;AAIP,SACE,mDAAC,wCAAD;AAAA,IAAiB;AAAA,IAAgB,OAAO;AAAA,IAAwB;AAAA,IAAc,qBAAqB;AAAA;AAAA;AAIvG,MAAM,QAAQ;AAAA,EAEZ,OAAO,4BAAU,KAAK,YAAY;AAAA,EAElC,YAAY,4BAAU,KAAK,YAAY;AAAA,EAEvC,aAAa,4BAAU,KAAK,YAAY;AAAA,EAExC,UAAU,4BAAU,KAAK,YAAY;AAAA,EACrC,UAAU,4BAAU,KAAK,YAAY;AAAA,EAErC,OAAO,4BAAU,MAAM,YAAY;AAAA,EAEnC,QAAQ,4BAAU,UAAU,CAAC,4BAAU,QAAQ,4BAAU,QAAQ,YAC/D;AAAA,EAGF,OAAO,4BAAU,OAAO,YAAY;AAAA,EAEpC,QAAQ,4BAAU,OAAO,YAAY;AAAA;AAGvC,eAAe,YAAY;AAC3B,6CAAiB,kBAAkB;AACnC,6CAAiB,kBAAkB;AAEnC,MAAM,iCAAiC,gCAAS;AAChD,+BAA+B,YAAY;AAG3C,IAAO,yBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var Separator_exports = {};
|
|
29
|
+
__export(Separator_exports, {
|
|
30
|
+
DSMenuSeparatorWithSchema: () => DSMenuSeparatorWithSchema,
|
|
31
|
+
MenuSeparator: () => MenuSeparator,
|
|
32
|
+
default: () => Separator_default
|
|
33
|
+
});
|
|
34
|
+
var React = __toESM(require("react"));
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_react_desc = require("react-desc");
|
|
37
|
+
var import_ds_classnames = require("@elliemae/ds-classnames");
|
|
38
|
+
var import_ds_separator = require("@elliemae/ds-separator");
|
|
39
|
+
var import_styled_components = __toESM(require("styled-components"));
|
|
40
|
+
var import_menuItemFactory = require("./menuItemFactory");
|
|
41
|
+
const blockName = "menu-separator";
|
|
42
|
+
const Li = import_styled_components.default.li`
|
|
43
|
+
display: flex;
|
|
44
|
+
align-items: flex-start;
|
|
45
|
+
flex-direction: column;
|
|
46
|
+
`;
|
|
47
|
+
const Title = (0, import_ds_classnames.aggregatedClasses)("h5")(blockName, "title");
|
|
48
|
+
const MenuSeparator = ({ title, showSeparator = true }) => /* @__PURE__ */ import_react.default.createElement(Li, null, showSeparator && /* @__PURE__ */ import_react.default.createElement(import_ds_separator.DSSeparator, null), title && /* @__PURE__ */ import_react.default.createElement(Title, null, title));
|
|
49
|
+
const props = {
|
|
50
|
+
title: import_react_desc.PropTypes.string.description("menu separator h5 title"),
|
|
51
|
+
showSeparator: import_react_desc.PropTypes.bool.description("toggle separator on and off")
|
|
52
|
+
};
|
|
53
|
+
MenuSeparator.propTypes = props;
|
|
54
|
+
(0, import_menuItemFactory.registerMenuItem)("separator", MenuSeparator);
|
|
55
|
+
const DSMenuSeparatorWithSchema = (0, import_react_desc.describe)(MenuSeparator);
|
|
56
|
+
DSMenuSeparatorWithSchema.propTypes = props;
|
|
57
|
+
var Separator_default = MenuSeparator;
|
|
58
|
+
module.exports = __toCommonJS(Separator_exports);
|
|
59
|
+
//# sourceMappingURL=Separator.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/MenuItems/Separator.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { describe, PropTypes } from 'react-desc';\nimport { aggregatedClasses } from '@elliemae/ds-classnames';\nimport { DSSeparator } from '@elliemae/ds-separator';\nimport styled from 'styled-components';\nimport { registerMenuItem } from './menuItemFactory';\n\nconst blockName = 'menu-separator';\nconst Li = styled.li`\n display: flex;\n align-items: flex-start;\n flex-direction: column;\n`;\n\nconst Title = aggregatedClasses('h5')(blockName, 'title');\nconst MenuSeparator = ({ title, showSeparator = true }) => (\n <Li>\n {showSeparator && <DSSeparator />}\n {title && <Title>{title}</Title>}\n </Li>\n);\n\nconst props = {\n /** menu separator h5 title */\n title: PropTypes.string.description('menu separator h5 title'),\n /** toggle separator on and off */\n showSeparator: PropTypes.bool.description('toggle separator on and off'),\n};\n\nMenuSeparator.propTypes = props;\nregisterMenuItem('separator', MenuSeparator);\n\nconst DSMenuSeparatorWithSchema = describe(MenuSeparator);\nDSMenuSeparatorWithSchema.propTypes = props;\n\nexport { DSMenuSeparatorWithSchema, MenuSeparator };\nexport default MenuSeparator;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkB;AAClB,wBAAoC;AACpC,2BAAkC;AAClC,0BAA4B;AAC5B,+BAAmB;AACnB,6BAAiC;AAEjC,MAAM,YAAY;AAClB,MAAM,KAAK,iCAAO;AAAA;AAAA;AAAA;AAAA;AAMlB,MAAM,QAAQ,4CAAkB,MAAM,WAAW;AACjD,MAAM,gBAAgB,CAAC,EAAE,OAAO,gBAAgB,WAC9C,mDAAC,IAAD,MACG,iBAAiB,mDAAC,iCAAD,OACjB,SAAS,mDAAC,OAAD,MAAQ;AAItB,MAAM,QAAQ;AAAA,EAEZ,OAAO,4BAAU,OAAO,YAAY;AAAA,EAEpC,eAAe,4BAAU,KAAK,YAAY;AAAA;AAG5C,cAAc,YAAY;AAC1B,6CAAiB,aAAa;AAE9B,MAAM,4BAA4B,gCAAS;AAC3C,0BAA0B,YAAY;AAGtC,IAAO,oBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var SubMenu_exports = {};
|
|
29
|
+
__export(SubMenu_exports, {
|
|
30
|
+
DSSubMenuWithSchema: () => DSSubMenuWithSchema,
|
|
31
|
+
SubMenu: () => SubMenu,
|
|
32
|
+
default: () => SubMenu_default
|
|
33
|
+
});
|
|
34
|
+
var React = __toESM(require("react"));
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_react_desc = require("react-desc");
|
|
37
|
+
var import_styled_components = __toESM(require("styled-components"));
|
|
38
|
+
var import_ds_icons = require("@elliemae/ds-icons");
|
|
39
|
+
var import_FocusGroup = require("@elliemae/ds-shared/FocusGroup");
|
|
40
|
+
var import_ds_hidden = require("@elliemae/ds-hidden");
|
|
41
|
+
var import_ds_button = require("@elliemae/ds-button");
|
|
42
|
+
var import_ds_popper = require("@elliemae/ds-popper");
|
|
43
|
+
var import_Menu = require("../Menu");
|
|
44
|
+
var import_MenuItem = require("./MenuItem");
|
|
45
|
+
var import_menuItemFactory = require("./menuItemFactory");
|
|
46
|
+
const ChevronRightComp = import_styled_components.default.div`
|
|
47
|
+
display: flex;
|
|
48
|
+
justify-content: center;
|
|
49
|
+
align-items: center;
|
|
50
|
+
width: 28px; // same width as the ellipsis button
|
|
51
|
+
`;
|
|
52
|
+
const SubMenu = ({
|
|
53
|
+
noAddon,
|
|
54
|
+
leftAddon = void 0,
|
|
55
|
+
label = void 0,
|
|
56
|
+
interactionType = "hover",
|
|
57
|
+
children: subitems,
|
|
58
|
+
rightAddonType,
|
|
59
|
+
disabledAddonInactive,
|
|
60
|
+
checkableProps = {},
|
|
61
|
+
customRenderer,
|
|
62
|
+
onClick,
|
|
63
|
+
closeMenu,
|
|
64
|
+
id
|
|
65
|
+
}) => {
|
|
66
|
+
const itemRef = (0, import_react.useRef)(null);
|
|
67
|
+
const focusOnOpen = (0, import_react.useRef)(false);
|
|
68
|
+
const [isAddonHovered, setIsAddonHovered] = (0, import_react.useState)(false);
|
|
69
|
+
const {
|
|
70
|
+
visible = false,
|
|
71
|
+
onShow,
|
|
72
|
+
onHide
|
|
73
|
+
} = (0, import_ds_hidden.useHiddenController)(void 0, {
|
|
74
|
+
interaction: "click"
|
|
75
|
+
});
|
|
76
|
+
const interaction = rightAddonType === "elipsis" ? "click" : "hover";
|
|
77
|
+
const { focusItemByNode } = (0, import_FocusGroup.useFocusGroupItem)();
|
|
78
|
+
const handleShowSubItemsWithMouse = (e) => {
|
|
79
|
+
e.stopPropagation();
|
|
80
|
+
onShow();
|
|
81
|
+
focusOnOpen.current = true;
|
|
82
|
+
};
|
|
83
|
+
const handleShowWithMouse = (e) => {
|
|
84
|
+
if (onClick)
|
|
85
|
+
onClick(e);
|
|
86
|
+
};
|
|
87
|
+
const handleShowWithMouseHover = () => {
|
|
88
|
+
setIsAddonHovered(true);
|
|
89
|
+
onShow();
|
|
90
|
+
focusOnOpen.current = false;
|
|
91
|
+
};
|
|
92
|
+
const handleShowWithKeyboard = () => {
|
|
93
|
+
onShow();
|
|
94
|
+
focusOnOpen.current = true;
|
|
95
|
+
};
|
|
96
|
+
const handleOnMouseEnter = (0, import_react.useCallback)(() => {
|
|
97
|
+
setIsAddonHovered(true);
|
|
98
|
+
}, []);
|
|
99
|
+
const handleOnMouseLeave = (0, import_react.useCallback)(() => {
|
|
100
|
+
setIsAddonHovered(false);
|
|
101
|
+
}, []);
|
|
102
|
+
const hoverHandlers = interaction === "hover" ? {
|
|
103
|
+
onMouseEnter: handleShowWithMouseHover,
|
|
104
|
+
onMouseLeave: () => {
|
|
105
|
+
onHide();
|
|
106
|
+
setIsAddonHovered(false);
|
|
107
|
+
}
|
|
108
|
+
} : { onClick: handleShowWithMouse };
|
|
109
|
+
const rightAddon = rightAddonType === "elipsis" ? /* @__PURE__ */ import_react.default.createElement(import_ds_button.DSButton, {
|
|
110
|
+
"aria-label": "vertical-elipsis",
|
|
111
|
+
"data-testid": "vertical-elipsis",
|
|
112
|
+
buttonType: "text",
|
|
113
|
+
leftIcon: /* @__PURE__ */ import_react.default.createElement(import_ds_icons.MoreOptionsVert, {
|
|
114
|
+
className: "submenu-arrow",
|
|
115
|
+
color: visible || isAddonHovered ? ["brand-primary", 800] : ["neutral", 500],
|
|
116
|
+
size: "s"
|
|
117
|
+
}),
|
|
118
|
+
onClick: (e) => handleShowSubItemsWithMouse(e),
|
|
119
|
+
size: "m",
|
|
120
|
+
variant: import_ds_button.BUTTON_VARIANT.DEFAULT
|
|
121
|
+
}) : /* @__PURE__ */ import_react.default.createElement(ChevronRightComp, null, /* @__PURE__ */ import_react.default.createElement(import_ds_icons.ChevronSmallRight, {
|
|
122
|
+
"data-testid": "chevron-right",
|
|
123
|
+
className: "submenu-arrow",
|
|
124
|
+
color: visible || isAddonHovered ? ["brand-primary", 800] : ["neutral", 500],
|
|
125
|
+
size: "sm"
|
|
126
|
+
}));
|
|
127
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(import_ds_popper.DSPopper, {
|
|
128
|
+
contentComponent: /* @__PURE__ */ import_react.default.createElement(import_Menu.Menu, {
|
|
129
|
+
focusKeyBindings: {
|
|
130
|
+
ArrowLeft: [() => focusItemByNode(itemRef.current), "exit"]
|
|
131
|
+
},
|
|
132
|
+
focusOnOpen: focusOnOpen.current,
|
|
133
|
+
onExitFocusGroup: onHide,
|
|
134
|
+
...hoverHandlers,
|
|
135
|
+
closeMenu,
|
|
136
|
+
visible
|
|
137
|
+
}, subitems),
|
|
138
|
+
interactionType,
|
|
139
|
+
isOpen: visible,
|
|
140
|
+
onOpen: (opening) => opening ? onShow() : onHide(),
|
|
141
|
+
placement: "right-start",
|
|
142
|
+
showArrow: false,
|
|
143
|
+
triggerComponent: /* @__PURE__ */ import_react.default.createElement(import_MenuItem.MenuItem, {
|
|
144
|
+
customRenderer,
|
|
145
|
+
disabledAddonInactive,
|
|
146
|
+
id,
|
|
147
|
+
innerRef: itemRef,
|
|
148
|
+
label,
|
|
149
|
+
leftAddon,
|
|
150
|
+
noAddon,
|
|
151
|
+
onFocus: handleOnMouseEnter,
|
|
152
|
+
onBlur: handleOnMouseLeave,
|
|
153
|
+
onMouseEnter: handleOnMouseEnter,
|
|
154
|
+
onMouseLeave: handleOnMouseLeave,
|
|
155
|
+
...hoverHandlers,
|
|
156
|
+
onKeyDown: (e) => {
|
|
157
|
+
if (e.key === "ArrowRight" || e.key === "Enter" || e.keyCode === 32) {
|
|
158
|
+
handleShowWithKeyboard();
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
rightAddon,
|
|
162
|
+
...checkableProps
|
|
163
|
+
})
|
|
164
|
+
}));
|
|
165
|
+
};
|
|
166
|
+
const props = {
|
|
167
|
+
noAddon: import_react_desc.PropTypes.bool.description("dont show addon for submenu"),
|
|
168
|
+
leftAddon: import_react_desc.PropTypes.node.description("left addon"),
|
|
169
|
+
label: import_react_desc.PropTypes.string.description("submenu label"),
|
|
170
|
+
interactionType: import_react_desc.PropTypes.oneOf(import_ds_popper.interactions).description("A type indicating how to open/close the tooltip"),
|
|
171
|
+
children: import_react_desc.PropTypes.oneOfType([import_react_desc.PropTypes.array, import_react_desc.PropTypes.node]).description("sub menu items"),
|
|
172
|
+
rightAddonType: import_react_desc.PropTypes.oneOf(["ellipsis"]).description("right addon, ellipsis or undefined"),
|
|
173
|
+
disabledAddonInactive: import_react_desc.PropTypes.bool.description(""),
|
|
174
|
+
checkableProps: import_react_desc.PropTypes.object.description("props passed to MenuItem component"),
|
|
175
|
+
customRenderer: import_react_desc.PropTypes.func.description("custom renderer for menu item"),
|
|
176
|
+
onClick: import_react_desc.PropTypes.func.description("on click handler"),
|
|
177
|
+
closeMenu: import_react_desc.PropTypes.any.description(""),
|
|
178
|
+
id: import_react_desc.PropTypes.string.description("component id")
|
|
179
|
+
};
|
|
180
|
+
SubMenu.propTypes = props;
|
|
181
|
+
(0, import_menuItemFactory.registerMenuItem)("submenu", SubMenu);
|
|
182
|
+
(0, import_Menu.setSubMenu)(SubMenu);
|
|
183
|
+
const DSSubMenuWithSchema = (0, import_react_desc.describe)(SubMenu);
|
|
184
|
+
DSSubMenuWithSchema.propTypes = props;
|
|
185
|
+
var SubMenu_default = SubMenu;
|
|
186
|
+
module.exports = __toCommonJS(SubMenu_exports);
|
|
187
|
+
//# sourceMappingURL=SubMenu.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/MenuItems/SubMenu.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable indent */\n/* eslint-disable max-lines */\nimport React, { useCallback, useRef, useState } from 'react';\nimport { PropTypes, describe } from 'react-desc';\nimport styled from 'styled-components';\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 { Menu, setSubMenu } 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);\nsetSubMenu(SubMenu);\nconst DSSubMenuWithSchema = describe(SubMenu);\n\nDSSubMenuWithSchema.propTypes = props;\n\nexport { DSSubMenuWithSchema, SubMenu };\nexport default SubMenu;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var menuItemFactory_exports = {};
|
|
29
|
+
__export(menuItemFactory_exports, {
|
|
30
|
+
menuItemFactory: () => menuItemFactory,
|
|
31
|
+
registerMenuItem: () => registerMenuItem
|
|
32
|
+
});
|
|
33
|
+
var React = __toESM(require("react"));
|
|
34
|
+
const itemTypes = {};
|
|
35
|
+
const menuItemFactory = (type = "", items, defaultItem = itemTypes.menuitem) => {
|
|
36
|
+
const itemsObject = items || itemTypes;
|
|
37
|
+
return itemsObject[type] || itemsObject[type.toLowerCase()] || defaultItem;
|
|
38
|
+
};
|
|
39
|
+
const registerMenuItem = (type, item) => itemTypes[type] = item;
|
|
40
|
+
module.exports = __toCommonJS(menuItemFactory_exports);
|
|
41
|
+
//# sourceMappingURL=menuItemFactory.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/MenuItems/menuItemFactory.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["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", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,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,54 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var renderMenuItems_exports = {};
|
|
29
|
+
__export(renderMenuItems_exports, {
|
|
30
|
+
renderMenuItems: () => renderMenuItems
|
|
31
|
+
});
|
|
32
|
+
var React = __toESM(require("react"));
|
|
33
|
+
var import_react = __toESM(require("react"));
|
|
34
|
+
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
35
|
+
var import_menuItemFactory = require("./menuItemFactory");
|
|
36
|
+
const renderMenuItems = (options, factory = import_menuItemFactory.menuItemFactory) => options.map((option, index) => {
|
|
37
|
+
if ((0, import_ds_utilities.isFunction)(option.renderer)) {
|
|
38
|
+
return option.renderer({
|
|
39
|
+
key: option.id,
|
|
40
|
+
item: option
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
const ItemComponent = factory(option.type);
|
|
44
|
+
const children = option.subItems && renderMenuItems(option.subItems, factory);
|
|
45
|
+
return /* @__PURE__ */ import_react.default.createElement(ItemComponent, {
|
|
46
|
+
...option,
|
|
47
|
+
key: option.id || index,
|
|
48
|
+
item: option,
|
|
49
|
+
onClick: null,
|
|
50
|
+
onMouseDown: option.onClick
|
|
51
|
+
}, children);
|
|
52
|
+
});
|
|
53
|
+
module.exports = __toCommonJS(renderMenuItems_exports);
|
|
54
|
+
//# sourceMappingURL=renderMenuItems.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/MenuItems/renderMenuItems.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable import/no-cycle */\nimport React from 'react';\nimport { isFunction } from '@elliemae/ds-utilities';\nimport { menuItemFactory } from './menuItemFactory';\n\nexport const renderMenuItems = (options, factory = menuItemFactory) =>\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", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAAkB;AAClB,0BAA2B;AAC3B,6BAAgC;AAEzB,MAAM,kBAAkB,CAAC,SAAS,UAAU,2CACjD,QAAQ,IAAI,CAAC,QAAQ,UAAU;AAC7B,MAAI,oCAAW,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,mDAAC,eAAD;AAAA,OACM;AAAA,IACJ,KAAK,OAAO,MAAM;AAAA,IAClB,MAAM;AAAA,IACN,SAAS;AAAA,IACT,aAAa,OAAO;AAAA,KAGnB;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var VirtualMenuList_exports = {};
|
|
29
|
+
__export(VirtualMenuList_exports, {
|
|
30
|
+
VirtualMenuList: () => VirtualMenuList,
|
|
31
|
+
default: () => VirtualMenuList_default
|
|
32
|
+
});
|
|
33
|
+
var React = __toESM(require("react"));
|
|
34
|
+
var import_react = __toESM(require("react"));
|
|
35
|
+
var import_react_window = require("react-window");
|
|
36
|
+
var import_useHeightByAmountOfItems = require("./utils/useHeightByAmountOfItems");
|
|
37
|
+
const MenuItem = ({ data, index, style }) => /* @__PURE__ */ import_react.default.createElement("div", {
|
|
38
|
+
key: index,
|
|
39
|
+
style
|
|
40
|
+
}, data && data[index] ? data[index] : "");
|
|
41
|
+
function resolveComputation(items, cb, timeout = 1e3) {
|
|
42
|
+
return () => new Promise((resolve) => {
|
|
43
|
+
const doResolve = (result2) => {
|
|
44
|
+
cb(result2);
|
|
45
|
+
resolve(result2);
|
|
46
|
+
};
|
|
47
|
+
let result = 0;
|
|
48
|
+
const timer = setTimeout(() => doResolve(result), timeout);
|
|
49
|
+
items.forEach((option) => {
|
|
50
|
+
result = option.props.label.length > result ? option.props.label.length : result;
|
|
51
|
+
});
|
|
52
|
+
clearTimeout(timer);
|
|
53
|
+
doResolve(result);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
function VirtualMenuList({
|
|
57
|
+
items,
|
|
58
|
+
itemHeight = 32,
|
|
59
|
+
amountItemsInWindow = 5,
|
|
60
|
+
width,
|
|
61
|
+
height
|
|
62
|
+
}) {
|
|
63
|
+
const computedListHeight = (0, import_useHeightByAmountOfItems.useHeightByAmountOfItems)({
|
|
64
|
+
amountItems: amountItemsInWindow,
|
|
65
|
+
itemHeight,
|
|
66
|
+
items
|
|
67
|
+
});
|
|
68
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react_window.FixedSizeList, {
|
|
69
|
+
height: height || computedListHeight,
|
|
70
|
+
itemCount: items.length,
|
|
71
|
+
itemData: items,
|
|
72
|
+
itemSize: itemHeight,
|
|
73
|
+
width
|
|
74
|
+
}, MenuItem);
|
|
75
|
+
}
|
|
76
|
+
var VirtualMenuList_default = VirtualMenuList;
|
|
77
|
+
module.exports = __toCommonJS(VirtualMenuList_exports);
|
|
78
|
+
//# sourceMappingURL=VirtualMenuList.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/VirtualMenuList.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["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;", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkB;AAClB,0BAAsC;AACtC,sCAAyC;AAEzC,MAAM,WAAW,CAAC,EAAE,MAAM,OAAO,YAC/B,mDAAC,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,8DAAyB;AAAA,IAClD,aAAa;AAAA,IACb;AAAA,IACA;AAAA;AAGF,SACE,mDAAC,mCAAD;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
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var src_exports = {};
|
|
29
|
+
__export(src_exports, {
|
|
30
|
+
DSMenuCheckboxGroupWithSchema: () => import_CheckboxGroup.DSMenuCheckboxGroupWithSchema,
|
|
31
|
+
DSMenuItemCheckeableWithSchema: () => import_MenuItemCheckable.DSMenuItemCheckeableWithSchema,
|
|
32
|
+
DSMenuItemRadioWithSchema: () => import_MenuItemRadio.DSMenuItemRadioWithSchema,
|
|
33
|
+
DSMenuItemWithSchema: () => import_MenuItem.DSMenuItemWithSchema,
|
|
34
|
+
DSMenuRadioGroupWithSchema: () => import_RadioGroup.DSMenuRadioGroupWithSchema,
|
|
35
|
+
DSMenuSearchableGroupWithSchema: () => import_SearchableGroup.DSMenuSearchableGroupWithSchema,
|
|
36
|
+
DSMenuSearchableListWithSchema: () => import_SearchableList.DSMenuSearchableListWithSchema,
|
|
37
|
+
DSMenuSelectionGroupWithSchema: () => import_SelectionGroup.DSMenuSelectionGroupWithSchema,
|
|
38
|
+
DSMenuSeparatorWithSchema: () => import_Separator.DSMenuSeparatorWithSchema,
|
|
39
|
+
DSMenuWithSchema: () => import_Menu.DSMenuWithSchema,
|
|
40
|
+
DSSubMenuWithSchema: () => import_SubMenu.DSSubMenuWithSchema,
|
|
41
|
+
Menu: () => import_Menu.Menu,
|
|
42
|
+
MenuCombobox: () => import_MenuCombobox.default,
|
|
43
|
+
default: () => import_Menu.Menu,
|
|
44
|
+
menuItemFactory: () => import_menuItemFactory.menuItemFactory,
|
|
45
|
+
renderMenuItems: () => import_renderMenuItems.renderMenuItems
|
|
46
|
+
});
|
|
47
|
+
var React = __toESM(require("react"));
|
|
48
|
+
var import_MenuItem = require("./MenuItems/MenuItem");
|
|
49
|
+
var import_SubMenu = require("./MenuItems/SubMenu");
|
|
50
|
+
var import_CheckboxGroup = require("./MenuItems/CheckboxGroup");
|
|
51
|
+
var import_MenuItemCheckable = require("./MenuItems/MenuItemCheckable");
|
|
52
|
+
var import_MenuItemRadio = require("./MenuItems/MenuItemRadio");
|
|
53
|
+
var import_RadioGroup = require("./MenuItems/RadioGroup");
|
|
54
|
+
var import_SearchableGroup = require("./MenuItems/SearchableGroup");
|
|
55
|
+
var import_SearchableList = require("./MenuItems/SearchableList");
|
|
56
|
+
var import_Separator = require("./MenuItems/Separator");
|
|
57
|
+
var import_SelectionGroup = require("./MenuItems/SelectionGroup");
|
|
58
|
+
var import_MenuCombobox = __toESM(require("./MenuCombobox"));
|
|
59
|
+
var import_menuItemFactory = require("./MenuItems/menuItemFactory");
|
|
60
|
+
var import_renderMenuItems = require("./MenuItems/renderMenuItems");
|
|
61
|
+
var import_Menu = require("./Menu");
|
|
62
|
+
module.exports = __toCommonJS(src_exports);
|
|
63
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/index.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["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", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,sBAAqC;AACrC,qBAAoC;AACpC,2BAA8C;AAC9C,+BAA+C;AAC/C,2BAA0C;AAC1C,wBAA2C;AAC3C,6BAAgD;AAChD,4BAA+C;AAC/C,uBAA0C;AAC1C,4BAA+C;AAE/C,0BAAwC;AACxC,6BAAgC;AAChC,6BAAgC;AAChC,kBAAwD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var useHeightByAmountOfItems_exports = {};
|
|
29
|
+
__export(useHeightByAmountOfItems_exports, {
|
|
30
|
+
default: () => useHeightByAmountOfItems_default,
|
|
31
|
+
useHeightByAmountOfItems: () => useHeightByAmountOfItems
|
|
32
|
+
});
|
|
33
|
+
var React = __toESM(require("react"));
|
|
34
|
+
var import_react = require("react");
|
|
35
|
+
const calculateHeight = (itemHeight, amountItemsInWindow, itemsLength) => {
|
|
36
|
+
const realAmountItemsInWindow = itemsLength < amountItemsInWindow ? itemsLength : amountItemsInWindow;
|
|
37
|
+
return itemHeight * realAmountItemsInWindow;
|
|
38
|
+
};
|
|
39
|
+
function useHeightByAmountOfItems({
|
|
40
|
+
itemHeight,
|
|
41
|
+
amountItems,
|
|
42
|
+
items
|
|
43
|
+
}) {
|
|
44
|
+
const calculatedHeight = (0, import_react.useMemo)(() => calculateHeight(itemHeight, amountItems, items.length), [amountItems, items]);
|
|
45
|
+
return calculatedHeight;
|
|
46
|
+
}
|
|
47
|
+
var useHeightByAmountOfItems_default = useHeightByAmountOfItems;
|
|
48
|
+
module.exports = __toCommonJS(useHeightByAmountOfItems_exports);
|
|
49
|
+
//# sourceMappingURL=useHeightByAmountOfItems.js.map
|