@elliemae/ds-menu 2.2.0-alpha.1 → 2.2.0-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/cjs/Menu.js +137 -181
  2. package/cjs/Menu.js.map +7 -0
  3. package/cjs/MenuCombobox.js +67 -53
  4. package/cjs/MenuCombobox.js.map +7 -0
  5. package/cjs/MenuContext.js +38 -11
  6. package/cjs/MenuContext.js.map +7 -0
  7. package/cjs/MenuExports.js +28 -0
  8. package/cjs/MenuExports.js.map +7 -0
  9. package/cjs/MenuItems/CheckboxGroup.js +49 -42
  10. package/cjs/MenuItems/CheckboxGroup.js.map +7 -0
  11. package/cjs/MenuItems/MenuItem.js +116 -163
  12. package/cjs/MenuItems/MenuItem.js.map +7 -0
  13. package/cjs/MenuItems/MenuItemCheckable.js +77 -108
  14. package/cjs/MenuItems/MenuItemCheckable.js.map +7 -0
  15. package/cjs/MenuItems/MenuItemCheckbox.js +47 -41
  16. package/cjs/MenuItems/MenuItemCheckbox.js.map +7 -0
  17. package/cjs/MenuItems/MenuItemRadio.js +50 -38
  18. package/cjs/MenuItems/MenuItemRadio.js.map +7 -0
  19. package/cjs/MenuItems/RadioGroup.js +48 -39
  20. package/cjs/MenuItems/RadioGroup.js.map +7 -0
  21. package/cjs/MenuItems/SearchableGroup.js +88 -92
  22. package/cjs/MenuItems/SearchableGroup.js.map +7 -0
  23. package/cjs/MenuItems/SearchableList.js +92 -95
  24. package/cjs/MenuItems/SearchableList.js.map +7 -0
  25. package/cjs/MenuItems/SelectionGroup.js +85 -90
  26. package/cjs/MenuItems/SelectionGroup.js.map +7 -0
  27. package/cjs/MenuItems/Separator.js +55 -40
  28. package/cjs/MenuItems/Separator.js.map +7 -0
  29. package/cjs/MenuItems/SubMenu.js +143 -160
  30. package/cjs/MenuItems/SubMenu.js.map +7 -0
  31. package/cjs/MenuItems/menuItemFactory.js +38 -68
  32. package/cjs/MenuItems/menuItemFactory.js.map +7 -0
  33. package/cjs/MenuItems/renderMenuItems.js +53 -0
  34. package/cjs/MenuItems/renderMenuItems.js.map +7 -0
  35. package/cjs/VirtualMenuList.js +69 -39
  36. package/cjs/VirtualMenuList.js.map +7 -0
  37. package/cjs/index.js +63 -36
  38. package/cjs/index.js.map +7 -0
  39. package/cjs/utils/useHeightByAmountOfItems.js +43 -14
  40. package/cjs/utils/useHeightByAmountOfItems.js.map +7 -0
  41. package/esm/Menu.js +91 -149
  42. package/esm/Menu.js.map +7 -0
  43. package/esm/MenuCombobox.js +38 -45
  44. package/esm/MenuCombobox.js.map +7 -0
  45. package/esm/MenuContext.js +9 -5
  46. package/esm/MenuContext.js.map +7 -0
  47. package/esm/MenuExports.js +3 -0
  48. package/esm/MenuExports.js.map +7 -0
  49. package/esm/MenuItems/CheckboxGroup.js +19 -31
  50. package/esm/MenuItems/CheckboxGroup.js.map +7 -0
  51. package/esm/MenuItems/MenuItem.js +84 -148
  52. package/esm/MenuItems/MenuItem.js.map +7 -0
  53. package/esm/MenuItems/MenuItemCheckable.js +47 -96
  54. package/esm/MenuItems/MenuItemCheckable.js.map +7 -0
  55. package/esm/MenuItems/MenuItemCheckbox.js +18 -33
  56. package/esm/MenuItems/MenuItemCheckbox.js.map +7 -0
  57. package/esm/MenuItems/MenuItemRadio.js +20 -28
  58. package/esm/MenuItems/MenuItemRadio.js.map +7 -0
  59. package/esm/MenuItems/RadioGroup.js +18 -28
  60. package/esm/MenuItems/RadioGroup.js.map +7 -0
  61. package/esm/MenuItems/SearchableGroup.js +53 -76
  62. package/esm/MenuItems/SearchableGroup.js.map +7 -0
  63. package/esm/MenuItems/SearchableList.js +59 -82
  64. package/esm/MenuItems/SearchableList.js.map +7 -0
  65. package/esm/MenuItems/SelectionGroup.js +54 -78
  66. package/esm/MenuItems/SelectionGroup.js.map +7 -0
  67. package/esm/MenuItems/Separator.js +26 -29
  68. package/esm/MenuItems/Separator.js.map +7 -0
  69. package/esm/MenuItems/SubMenu.js +107 -140
  70. package/esm/MenuItems/SubMenu.js.map +7 -0
  71. package/esm/MenuItems/menuItemFactory.js +10 -60
  72. package/esm/MenuItems/menuItemFactory.js.map +7 -0
  73. package/esm/MenuItems/renderMenuItems.js +24 -0
  74. package/esm/MenuItems/renderMenuItems.js.map +7 -0
  75. package/esm/VirtualMenuList.js +39 -32
  76. package/esm/VirtualMenuList.js.map +7 -0
  77. package/esm/index.js +34 -13
  78. package/esm/index.js.map +7 -0
  79. package/esm/utils/useHeightByAmountOfItems.js +13 -11
  80. package/esm/utils/useHeightByAmountOfItems.js.map +7 -0
  81. package/package.json +19 -11
  82. package/types/Menu.d.ts +3 -2
  83. package/types/MenuContext.d.ts +3 -2
  84. package/types/MenuExports.d.ts +1 -0
  85. package/types/MenuItems/CheckboxGroup.d.ts +5 -5
  86. package/types/MenuItems/MenuItem.d.ts +5 -5
  87. package/types/MenuItems/MenuItemCheckable.d.ts +15 -15
  88. package/types/MenuItems/MenuItemCheckbox.d.ts +3 -2
  89. package/types/MenuItems/MenuItemRadio.d.ts +5 -5
  90. package/types/MenuItems/RadioGroup.d.ts +5 -5
  91. package/types/MenuItems/SearchableGroup.d.ts +3 -3
  92. package/types/MenuItems/SearchableList.d.ts +16 -16
  93. package/types/MenuItems/SelectionGroup.d.ts +16 -16
  94. package/types/MenuItems/Separator.d.ts +2 -1
  95. package/types/MenuItems/SubMenu.d.ts +18 -18
  96. package/types/MenuItems/menuItemFactory.d.ts +2 -3
  97. package/types/MenuItems/renderMenuItems.d.ts +1 -0
  98. package/types/VirtualMenuList.d.ts +3 -1
  99. package/types/index.d.ts +3 -2
  100. package/types/utils/useHeightByAmountOfItems.d.ts +3 -1
@@ -1,45 +1,35 @@
1
- import 'core-js/modules/esnext.async-iterator.filter.js';
2
- import 'core-js/modules/esnext.iterator.constructor.js';
3
- import 'core-js/modules/esnext.iterator.filter.js';
4
- import 'core-js/modules/esnext.async-iterator.for-each.js';
5
- import 'core-js/modules/esnext.iterator.for-each.js';
6
- import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
7
- import _jsx from '@babel/runtime/helpers/esm/jsx';
8
- import 'core-js/modules/web.dom-collections.iterator.js';
9
- import { useRef, useState, useCallback } from 'react';
10
- import { PropTypes, describe } from 'react-desc';
11
- import { MoreOptionsVert, ChevronSmallRight } from '@elliemae/ds-icons';
12
- import { useFocusGroupItem } from '@elliemae/ds-shared/FocusGroup';
13
- import { useHiddenController } from '@elliemae/ds-hidden';
14
- import DSButton, { BUTTON_VARIANT } from '@elliemae/ds-button';
15
- import DSPopper, { interactions } from '@elliemae/ds-popper';
16
- import styled from 'styled-components';
17
- import { Menu } from '../Menu.js';
18
- import MenuItem from './MenuItem.js';
19
- import { jsx, Fragment } from 'react/jsx-runtime';
20
-
21
- 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; }
22
-
23
- 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; }
24
- const ChevronRightComp = /*#__PURE__*/styled.div.withConfig({
25
- componentId: "sc-1qhp1z-0"
26
- })(["display:flex;justify-content:center;align-items:center;width:28px;"]);
27
-
28
- function SubMenu(_ref) {
29
- let {
30
- noAddon,
31
- leftAddon = undefined,
32
- label = undefined,
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(undefined, {
51
- interaction: 'click'
40
+ } = useHiddenController(void 0, {
41
+ interaction: "click"
52
42
  });
53
- const interaction = rightAddonType === 'elipsis' ? 'click' : 'hover';
54
- const {
55
- focusItemByNode
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
- const handleShowWithMouse = e => {
65
- if (onClick) onClick(e);
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 === 'hover' ? {
69
+ const hoverHandlers = interaction === "hover" ? {
86
70
  onMouseEnter: handleShowWithMouseHover,
87
71
  onMouseLeave: () => {
88
72
  onHide();
89
73
  setIsAddonHovered(false);
90
74
  }
91
- } : {
92
- onClick: handleShowWithMouse
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: /*#__PURE__*/_jsx(MoreOptionsVert, {
80
+ leftIcon: /* @__PURE__ */ React2.createElement(MoreOptionsVert, {
99
81
  className: "submenu-arrow",
100
- color: visible || isAddonHovered ? ['brand-primary', 800] : ['neutral', 500],
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
- }) : /*#__PURE__*/_jsx(ChevronRightComp, {}, void 0, /*#__PURE__*/_jsx(ChevronSmallRight, {
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 ? ['brand-primary', 800] : ['neutral', 500],
91
+ color: visible || isAddonHovered ? ["brand-primary", 800] : ["neutral", 500],
110
92
  size: "sm"
111
93
  }));
112
- return /*#__PURE__*/jsx(Fragment, {
113
- children: /*#__PURE__*/_jsx(DSPopper, {
114
- contentComponent: /*#__PURE__*/jsx(Menu, _objectSpread(_objectSpread({
115
- focusKeyBindings: {
116
- ArrowLeft: [() => focusItemByNode(itemRef.current), 'exit']
117
- },
118
- focusOnOpen: focusOnOpen.current,
119
- onExitFocusGroup: onHide
120
- }, hoverHandlers), {}, {
121
- closeMenu: closeMenu,
122
- visible: visible,
123
- children: subitems
124
- })),
125
- interactionType: interactionType,
126
- isOpen: visible,
127
- onOpen: opening => opening ? onShow() : onHide(),
128
- placement: "right-start",
129
- showArrow: false,
130
- triggerComponent: /*#__PURE__*/jsx(MenuItem, _objectSpread(_objectSpread({
131
- customRenderer: customRenderer,
132
- disabledAddonInactive: disabledAddonInactive,
133
- id: id,
134
- innerRef: itemRef,
135
- label: label,
136
- leftAddon: leftAddon,
137
- noAddon: noAddon,
138
- onFocus: handleOnMouseEnter,
139
- onBlur: handleOnMouseLeave,
140
- onMouseEnter: handleOnMouseEnter,
141
- onMouseLeave: handleOnMouseLeave
142
- }, hoverHandlers), {}, {
143
- onKeyDown: e => {
144
- if (e.key === 'ArrowRight' || e.key === 'Enter' || e.keyCode === 32) {
145
- handleShowWithKeyboard();
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
- /** dont show addon for submenu */
156
- noAddon: PropTypes.bool.description('dont show addon for submenu'),
157
-
158
- /** left addon */
159
- leftAddon: PropTypes.node.description('left addon'),
160
-
161
- /** submenu label */
162
- label: PropTypes.string.description('submenu label'),
163
-
164
- /** A type indicating how to open/close the tooltip */
165
- interactionType: PropTypes.oneOf(interactions).description('A type indicating how to open/close the tooltip'),
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 { DSSubMenuWithSchema, SubMenu as default };
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,62 +1,12 @@
1
- import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
2
- import 'core-js/modules/esnext.async-iterator.map.js';
3
- import 'core-js/modules/esnext.iterator.map.js';
4
- import 'core-js/modules/esnext.async-iterator.filter.js';
5
- import 'core-js/modules/esnext.iterator.constructor.js';
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
- const itemTypes = {
22
- separator: MenuSeparator,
23
- menuitem: MenuItem,
24
- radio: MenuItemRadio,
25
- checkbox: MenuItemCheckbox,
26
- submenu: SubMenu,
27
- 'selection-group': SelectionGroup
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;
28
6
  };
29
- const fallback = {
30
- SelectionGroup: 'selection-group'
7
+ const registerMenuItem = (type, item) => itemTypes[type] = item;
8
+ export {
9
+ menuItemFactory,
10
+ registerMenuItem
31
11
  };
32
- function menuItemFactory() {
33
- let type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
34
- let items = arguments.length > 1 ? arguments[1] : undefined;
35
- let defaultItem = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : itemTypes.menuitem;
36
- const itemsObject = items || itemTypes;
37
- const parsedType = fallback[type] || type.toLowerCase();
38
- return itemsObject[parsedType] || defaultItem;
39
- }
40
- function renderMenuItems(options) {
41
- let factory = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : menuItemFactory;
42
- return options.map((option, index) => {
43
- if (isFunction(option.renderer)) {
44
- return option.renderer({
45
- key: option.id,
46
- item: option
47
- });
48
- }
49
-
50
- const ItemComponent = factory(option.type);
51
- const children = option.subItems && renderMenuItems(option.subItems, factory);
52
- return /*#__PURE__*/createElement(ItemComponent, _objectSpread(_objectSpread({}, option), {}, {
53
- key: option.id || index,
54
- item: option,
55
- onClick: null,
56
- onMouseDown: option.onClick // onClick callback called in onMouseDown due to events order issue
57
-
58
- }), children);
59
- });
60
- }
61
-
62
- export { menuItemFactory, renderMenuItems };
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
+ }
@@ -1,42 +1,49 @@
1
- import _jsx from '@babel/runtime/helpers/esm/jsx';
2
- import 'core-js/modules/esnext.async-iterator.for-each.js';
3
- import 'core-js/modules/esnext.iterator.constructor.js';
4
- import 'core-js/modules/esnext.iterator.for-each.js';
5
- import 'react';
6
- import { FixedSizeList } from 'react-window';
7
- import useHeightByAmountOfItems from './utils/useHeightByAmountOfItems.js';
8
-
9
- const MenuItem = _ref => {
10
- let {
11
- data,
12
- index,
13
- style
14
- } = _ref;
15
- return /*#__PURE__*/_jsx("div", {
16
- style: style
17
- }, index, data && data[index] ? data[index] : '');
18
- }; // eslint-disable-next-line no-unused-vars
19
-
20
- function VirtualMenuList(_ref2) {
21
- let {
22
- items,
23
- itemHeight = 32,
24
- amountItemsInWindow = 5,
25
- width,
26
- height
27
- } = _ref2;
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 /*#__PURE__*/_jsx(FixedSizeList, {
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: width
39
- }, void 0, MenuItem);
41
+ width
42
+ }, MenuItem);
40
43
  }
41
-
42
- export { VirtualMenuList as default };
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
- export { DSMenuWithSchema, Menu, Menu as default } from './Menu.js';
2
- export { DSMenuItemWithSchema } from './MenuItems/MenuItem.js';
3
- export { DSSubMenuWithSchema } from './MenuItems/SubMenu.js';
4
- export { DSMenuCheckboxGroupWithSchema } from './MenuItems/CheckboxGroup.js';
5
- export { DSMenuItemCheckeableWithSchema } from './MenuItems/MenuItemCheckable.js';
6
- export { DSMenuItemRadioWithSchema } from './MenuItems/MenuItemRadio.js';
7
- export { DSMenuRadioGroupWithSchema } from './MenuItems/RadioGroup.js';
8
- export { DSMenuSearchableGroupWithSchema } from './MenuItems/SearchableGroup.js';
9
- export { DSMenuSearchableListWithSchema } from './MenuItems/SearchableList.js';
10
- export { DSMenuSeparatorWithSchema } from './MenuItems/Separator.js';
11
- export { DSMenuSelectionGroupWithSchema } from './MenuItems/SelectionGroup.js';
12
- export { default as MenuCombobox } from './MenuCombobox.js';
13
- export { menuItemFactory, renderMenuItems } from './MenuItems/menuItemFactory.js';
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
@@ -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 { useMemo } from 'react';
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
- function useHeightByAmountOfItems(_ref) {
9
- let {
10
- itemHeight,
11
- amountItems,
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 { useHeightByAmountOfItems as default };
15
+ var useHeightByAmountOfItems_default = useHeightByAmountOfItems;
16
+ export {
17
+ useHeightByAmountOfItems_default as default,
18
+ useHeightByAmountOfItems
19
+ };
20
+ //# sourceMappingURL=useHeightByAmountOfItems.js.map