@elliemae/ds-menu 1.57.1-rc.0 → 2.0.0-alpha.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/cjs/Menu.js +176 -39
  2. package/cjs/MenuCombobox.js +33 -80
  3. package/cjs/MenuContext.js +1 -2
  4. package/cjs/MenuItems/CheckboxGroup.js +12 -10
  5. package/cjs/MenuItems/MenuItem.js +186 -36
  6. package/cjs/MenuItems/MenuItemCheckable.js +109 -35
  7. package/cjs/MenuItems/MenuItemCheckbox.js +35 -34
  8. package/cjs/MenuItems/MenuItemRadio.js +31 -35
  9. package/cjs/MenuItems/RadioGroup.js +12 -10
  10. package/cjs/MenuItems/SearchableGroup.js +44 -59
  11. package/cjs/MenuItems/SearchableList.js +35 -56
  12. package/cjs/MenuItems/SelectionGroup.js +93 -36
  13. package/cjs/MenuItems/Separator.js +14 -16
  14. package/cjs/MenuItems/SubMenu.js +197 -36
  15. package/cjs/MenuItems/menuItemFactory.js +56 -36
  16. package/cjs/VirtualMenuList.js +23 -26
  17. package/cjs/index.js +27 -48
  18. package/cjs/utils/useHeightByAmountOfItems.js +8 -10
  19. package/esm/Menu.js +165 -31
  20. package/esm/MenuCombobox.js +28 -74
  21. package/esm/MenuContext.js +0 -1
  22. package/esm/MenuItems/CheckboxGroup.js +10 -7
  23. package/esm/MenuItems/MenuItem.js +178 -31
  24. package/esm/MenuItems/MenuItemCheckable.js +101 -30
  25. package/esm/MenuItems/MenuItemCheckbox.js +28 -30
  26. package/esm/MenuItems/MenuItemRadio.js +26 -30
  27. package/esm/MenuItems/RadioGroup.js +10 -7
  28. package/esm/MenuItems/SearchableGroup.js +42 -56
  29. package/esm/MenuItems/SearchableList.js +32 -51
  30. package/esm/MenuItems/SelectionGroup.js +87 -31
  31. package/esm/MenuItems/Separator.js +12 -14
  32. package/esm/MenuItems/SubMenu.js +186 -31
  33. package/esm/MenuItems/menuItemFactory.js +51 -31
  34. package/esm/VirtualMenuList.js +21 -24
  35. package/esm/index.js +7 -28
  36. package/esm/utils/useHeightByAmountOfItems.js +8 -10
  37. package/package.json +106 -21
  38. package/types/Menu.d.ts +5 -0
  39. package/types/MenuCombobox.d.ts +28 -0
  40. package/types/MenuContext.d.ts +3 -0
  41. package/types/MenuItems/CheckboxGroup.d.ts +12 -0
  42. package/types/MenuItems/MenuItem.d.ts +29 -0
  43. package/types/MenuItems/MenuItemCheckable.d.ts +42 -0
  44. package/types/MenuItems/MenuItemCheckbox.d.ts +6 -0
  45. package/types/MenuItems/MenuItemRadio.d.ts +13 -0
  46. package/types/MenuItems/RadioGroup.d.ts +11 -0
  47. package/types/MenuItems/SearchableGroup.d.ts +4 -0
  48. package/types/MenuItems/SearchableList.d.ts +40 -0
  49. package/types/MenuItems/SelectionGroup.d.ts +36 -0
  50. package/types/MenuItems/Separator.d.ts +16 -0
  51. package/types/MenuItems/SubMenu.d.ts +44 -0
  52. package/types/MenuItems/menuItemFactory.d.ts +3 -0
  53. package/types/VirtualMenuList.d.ts +8 -0
  54. package/types/index.d.ts +13 -0
  55. package/types/tests/Menu.test.d.ts +1 -0
  56. package/types/tests/MenuItem.test.d.ts +1 -0
  57. package/types/utils/useHeightByAmountOfItems.d.ts +5 -0
  58. package/Menu/package.json +0 -10
  59. package/MenuCombobox/package.json +0 -10
  60. package/MenuContext/package.json +0 -10
  61. package/MenuItems/CheckboxGroup/package.json +0 -10
  62. package/MenuItems/MenuItem/package.json +0 -10
  63. package/MenuItems/MenuItemCheckable/package.json +0 -10
  64. package/MenuItems/MenuItemCheckbox/package.json +0 -10
  65. package/MenuItems/MenuItemRadio/package.json +0 -10
  66. package/MenuItems/RadioGroup/package.json +0 -10
  67. package/MenuItems/SearchableGroup/package.json +0 -10
  68. package/MenuItems/SearchableList/package.json +0 -10
  69. package/MenuItems/SelectionGroup/package.json +0 -10
  70. package/MenuItems/Separator/package.json +0 -10
  71. package/MenuItems/SubMenu/package.json +0 -10
  72. package/MenuItems/menuItemFactory/package.json +0 -10
  73. package/VirtualMenuList/package.json +0 -10
  74. package/cjs/Menu.js.map +0 -1
  75. package/cjs/MenuCombobox.js.map +0 -1
  76. package/cjs/MenuContext.js.map +0 -1
  77. package/cjs/MenuItems/CheckboxGroup.js.map +0 -1
  78. package/cjs/MenuItems/MenuItem.js.map +0 -1
  79. package/cjs/MenuItems/MenuItemCheckable.js.map +0 -1
  80. package/cjs/MenuItems/MenuItemCheckbox.js.map +0 -1
  81. package/cjs/MenuItems/MenuItemRadio.js.map +0 -1
  82. package/cjs/MenuItems/RadioGroup.js.map +0 -1
  83. package/cjs/MenuItems/SearchableGroup.js.map +0 -1
  84. package/cjs/MenuItems/SearchableList.js.map +0 -1
  85. package/cjs/MenuItems/SelectionGroup.js.map +0 -1
  86. package/cjs/MenuItems/Separator.js.map +0 -1
  87. package/cjs/MenuItems/SubMenu.js.map +0 -1
  88. package/cjs/MenuItems/menuItemFactory.js.map +0 -1
  89. package/cjs/SubMenu-22be0a18.js +0 -806
  90. package/cjs/SubMenu-22be0a18.js.map +0 -1
  91. package/cjs/VirtualMenuList.js.map +0 -1
  92. package/cjs/index.js.map +0 -1
  93. package/cjs/utils/useHeightByAmountOfItems.js.map +0 -1
  94. package/esm/Menu.js.map +0 -1
  95. package/esm/MenuCombobox.js.map +0 -1
  96. package/esm/MenuContext.js.map +0 -1
  97. package/esm/MenuItems/CheckboxGroup.js.map +0 -1
  98. package/esm/MenuItems/MenuItem.js.map +0 -1
  99. package/esm/MenuItems/MenuItemCheckable.js.map +0 -1
  100. package/esm/MenuItems/MenuItemCheckbox.js.map +0 -1
  101. package/esm/MenuItems/MenuItemRadio.js.map +0 -1
  102. package/esm/MenuItems/RadioGroup.js.map +0 -1
  103. package/esm/MenuItems/SearchableGroup.js.map +0 -1
  104. package/esm/MenuItems/SearchableList.js.map +0 -1
  105. package/esm/MenuItems/SelectionGroup.js.map +0 -1
  106. package/esm/MenuItems/Separator.js.map +0 -1
  107. package/esm/MenuItems/SubMenu.js.map +0 -1
  108. package/esm/MenuItems/menuItemFactory.js.map +0 -1
  109. package/esm/SubMenu-a25e69ec.js +0 -778
  110. package/esm/SubMenu-a25e69ec.js.map +0 -1
  111. package/esm/VirtualMenuList.js.map +0 -1
  112. package/esm/index.js.map +0 -1
  113. package/esm/utils/useHeightByAmountOfItems.js.map +0 -1
  114. package/utils/useHeightByAmountOfItems/package.json +0 -10
package/cjs/index.js CHANGED
@@ -2,56 +2,35 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var MenuItems_SelectionGroup = require('./SubMenu-22be0a18.js');
6
- var MenuItems_CheckboxGroup = require('./MenuItems/CheckboxGroup.js');
7
- var MenuItems_RadioGroup = require('./MenuItems/RadioGroup.js');
8
- var MenuItems_SearchableGroup = require('./MenuItems/SearchableGroup.js');
9
- var MenuItems_SearchableList = require('./MenuItems/SearchableList.js');
10
- var MenuItems_Separator = require('./MenuItems/Separator.js');
5
+ var Menu = require('./Menu.js');
6
+ var MenuItem = require('./MenuItems/MenuItem.js');
7
+ var SubMenu = require('./MenuItems/SubMenu.js');
8
+ var CheckboxGroup = require('./MenuItems/CheckboxGroup.js');
9
+ var MenuItemCheckable = require('./MenuItems/MenuItemCheckable.js');
10
+ var MenuItemRadio = require('./MenuItems/MenuItemRadio.js');
11
+ var RadioGroup = require('./MenuItems/RadioGroup.js');
12
+ var SearchableGroup = require('./MenuItems/SearchableGroup.js');
13
+ var SearchableList = require('./MenuItems/SearchableList.js');
14
+ var Separator = require('./MenuItems/Separator.js');
15
+ var SelectionGroup = require('./MenuItems/SelectionGroup.js');
11
16
  var MenuCombobox = require('./MenuCombobox.js');
12
- require('@babel/runtime/helpers/extends');
13
- require('@babel/runtime/helpers/slicedToArray');
14
- require('react');
15
- require('react-desc');
16
- require('@elliemae/ds-icons');
17
- require('@elliemae/ds-shared/FocusGroup');
18
- require('@elliemae/ds-hidden');
19
- require('@elliemae/ds-button');
20
- require('@elliemae/ds-popper');
21
- require('styled-components');
22
- require('@babel/runtime/helpers/objectWithoutProperties');
23
- require('@babel/runtime/helpers/defineProperty');
24
- require('lodash');
25
- require('@elliemae/ds-classnames');
26
- require('react-spring/web.cjs');
27
- require('@elliemae/ds-utilities');
28
- require('@elliemae/ds-truncated-tooltip-text');
29
- require('@elliemae/ds-shared/CheckableGroup');
30
- require('./VirtualMenuList.js');
31
- require('react-window');
32
- require('./utils/useHeightByAmountOfItems.js');
33
- require('@elliemae/ds-form');
34
- require('./MenuContext.js');
35
- require('@elliemae/ds-form/SearchBox');
36
- require('@elliemae/ds-separator');
37
- require('prop-types');
17
+ var menuItemFactory = require('./MenuItems/menuItemFactory.js');
38
18
 
39
19
 
40
20
 
41
- exports.DSMenuItemCheckeableWithSchema = MenuItems_SelectionGroup.DSMenuItemCheckeableWithSchema;
42
- exports.DSMenuItemRadioWithSchema = MenuItems_SelectionGroup.DSMenuItemRadioWithSchema;
43
- exports.DSMenuItemWithSchema = MenuItems_SelectionGroup.DSMenuItemWithSchema;
44
- exports.DSMenuSelectionGroupWithSchema = MenuItems_SelectionGroup.DSMenuSelectionGroupWithSchema;
45
- exports.DSMenuWithSchema = MenuItems_SelectionGroup.DSMenuWithSchema;
46
- exports.DSSubMenuWithSchema = MenuItems_SelectionGroup.DSSubMenuWithSchema;
47
- exports.Menu = MenuItems_SelectionGroup.Menu;
48
- exports.default = MenuItems_SelectionGroup.Menu;
49
- exports.menuItemFactory = MenuItems_SelectionGroup.menuItemFactory;
50
- exports.renderMenuItems = MenuItems_SelectionGroup.renderMenuItems;
51
- exports.DSMenuCheckboxGroupWithSchema = MenuItems_CheckboxGroup.DSMenuCheckboxGroupWithSchema;
52
- exports.DSMenuRadioGroupWithSchema = MenuItems_RadioGroup.DSMenuRadioGroupWithSchema;
53
- exports.DSMenuSearchableGroupWithSchema = MenuItems_SearchableGroup.DSMenuSearchableGroupWithSchema;
54
- exports.DSMenuSearchableListWithSchema = MenuItems_SearchableList.DSMenuSearchableListWithSchema;
55
- exports.DSMenuSeparatorWithSchema = MenuItems_Separator.DSMenuSeparatorWithSchema;
21
+ exports.DSMenuWithSchema = Menu.DSMenuWithSchema;
22
+ exports.Menu = Menu.Menu;
23
+ exports["default"] = Menu.Menu;
24
+ exports.DSMenuItemWithSchema = MenuItem.DSMenuItemWithSchema;
25
+ exports.DSSubMenuWithSchema = SubMenu.DSSubMenuWithSchema;
26
+ exports.DSMenuCheckboxGroupWithSchema = CheckboxGroup.DSMenuCheckboxGroupWithSchema;
27
+ exports.DSMenuItemCheckeableWithSchema = MenuItemCheckable.DSMenuItemCheckeableWithSchema;
28
+ exports.DSMenuItemRadioWithSchema = MenuItemRadio.DSMenuItemRadioWithSchema;
29
+ exports.DSMenuRadioGroupWithSchema = RadioGroup.DSMenuRadioGroupWithSchema;
30
+ exports.DSMenuSearchableGroupWithSchema = SearchableGroup.DSMenuSearchableGroupWithSchema;
31
+ exports.DSMenuSearchableListWithSchema = SearchableList.DSMenuSearchableListWithSchema;
32
+ exports.DSMenuSeparatorWithSchema = Separator.DSMenuSeparatorWithSchema;
33
+ exports.DSMenuSelectionGroupWithSchema = SelectionGroup.DSMenuSelectionGroupWithSchema;
56
34
  exports.MenuCombobox = MenuCombobox;
57
- //# sourceMappingURL=index.js.map
35
+ exports.menuItemFactory = menuItemFactory.menuItemFactory;
36
+ exports.renderMenuItems = menuItemFactory.renderMenuItems;
@@ -2,20 +2,18 @@
2
2
 
3
3
  var React = require('react');
4
4
 
5
- var calculateHeight = function calculateHeight(itemHeight, amountItemsInWindow, itemsLength) {
6
- var realAmountItemsInWindow = itemsLength < amountItemsInWindow ? itemsLength : amountItemsInWindow;
5
+ const calculateHeight = (itemHeight, amountItemsInWindow, itemsLength) => {
6
+ const realAmountItemsInWindow = itemsLength < amountItemsInWindow ? itemsLength : amountItemsInWindow;
7
7
  return itemHeight * realAmountItemsInWindow;
8
8
  };
9
9
 
10
- function useHeightByAmountOfItems(_ref) {
11
- var itemHeight = _ref.itemHeight,
12
- amountItems = _ref.amountItems,
13
- items = _ref.items;
14
- var calculatedHeight = React.useMemo(function () {
15
- return calculateHeight(itemHeight, amountItems, items.length);
16
- }, [amountItems, items]);
10
+ function useHeightByAmountOfItems({
11
+ itemHeight,
12
+ amountItems,
13
+ items
14
+ }) {
15
+ const calculatedHeight = React.useMemo(() => calculateHeight(itemHeight, amountItems, items.length), [amountItems, items]);
17
16
  return calculatedHeight;
18
17
  }
19
18
 
20
19
  module.exports = useHeightByAmountOfItems;
21
- //# sourceMappingURL=useHeightByAmountOfItems.js.map
package/esm/Menu.js CHANGED
@@ -1,31 +1,165 @@
1
- import '@babel/runtime/helpers/esm/extends';
2
- import '@babel/runtime/helpers/esm/objectWithoutProperties';
3
- import '@babel/runtime/helpers/esm/defineProperty';
4
- import 'react';
5
- import 'react-desc';
6
- import 'lodash';
7
- import '@elliemae/ds-classnames';
8
- import 'react-spring/web.cjs';
9
- import '@elliemae/ds-utilities';
10
- import '@elliemae/ds-shared/FocusGroup';
11
- import '@elliemae/ds-hidden';
12
- export { e as DSMenuWithSchema, M as Menu, M as default, m as menuItemFactory, r as renderMenuItems } from './SubMenu-a25e69ec.js';
13
- import './MenuItems/CheckboxGroup.js';
14
- import './MenuItems/RadioGroup.js';
15
- import './MenuItems/Separator.js';
16
- import './MenuItems/SearchableGroup.js';
17
- import './MenuContext.js';
18
- import '@babel/runtime/helpers/esm/slicedToArray';
19
- import '@elliemae/ds-icons';
20
- import '@elliemae/ds-button';
21
- import '@elliemae/ds-popper';
22
- import 'styled-components';
23
- import '@elliemae/ds-truncated-tooltip-text';
24
- import '@elliemae/ds-shared/CheckableGroup';
25
- import './VirtualMenuList.js';
26
- import 'react-window';
27
- import './utils/useHeightByAmountOfItems.js';
28
- import '@elliemae/ds-form';
29
- import '@elliemae/ds-separator';
30
- import '@elliemae/ds-form/SearchBox';
31
- //# sourceMappingURL=Menu.js.map
1
+ import _jsx from '@babel/runtime/helpers/esm/jsx';
2
+ import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
3
+ import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
4
+ import React, { useRef, useContext, useMemo, useEffect } from 'react';
5
+ import { PropTypes, describe } from 'react-desc';
6
+ import { omit } from 'lodash';
7
+ import { aggregatedClasses } from '@elliemae/ds-classnames';
8
+ import { animated } from 'react-spring/web';
9
+ import { useOnClickOutside } from '@elliemae/ds-utilities/hooks';
10
+ import { mergeRefs } from '@elliemae/ds-utilities/system';
11
+ import { focusGroupManagerHoc, FocusGroupContext } from '@elliemae/ds-shared/FocusGroup';
12
+ import { useHiddenTransition } from '@elliemae/ds-hidden';
13
+ import MenuItemRadio from './MenuItems/MenuItemRadio.js';
14
+ import MenuItemCheckbox from './MenuItems/MenuItemCheckbox.js';
15
+ import CheckboxGroup from './MenuItems/CheckboxGroup.js';
16
+ import RadioGroup from './MenuItems/RadioGroup.js';
17
+ import MenuSeparator from './MenuItems/Separator.js';
18
+ import MenuItem from './MenuItems/MenuItem.js';
19
+ import SubMenu from './MenuItems/SubMenu.js';
20
+ import SearchableGroup from './MenuItems/SearchableGroup.js';
21
+ import SelectionGroup from './MenuItems/SelectionGroup.js';
22
+ export { menuItemFactory, renderMenuItems } from './MenuItems/menuItemFactory.js';
23
+ import MenuContext from './MenuContext.js';
24
+ import { jsx } from 'react/jsx-runtime';
25
+
26
+ const _excluded = ["containerProps", "innerRef", "as", "children", "onClickOutside", "visible", "focusOnOpen", "maxOption", "style", "minWidth", "maxWidth", "closeMenu", "responsiveHeight"],
27
+ _excluded2 = ["destroyed"];
28
+
29
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
30
+
31
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
32
+ const RESPONSIVE_HEIHGT_MARGIN = 120;
33
+ const blockName = 'menu';
34
+
35
+ const noop = () => {};
36
+
37
+ const MenuComponent = aggregatedClasses('div')(blockName, '', ({
38
+ menuComboBox,
39
+ type
40
+ }) => ({
41
+ 'menu-combo-box': menuComboBox,
42
+ ["type-".concat(type)]: type
43
+ }));
44
+ /**
45
+ * todo: -- IDEA -- each menu could have an overlay based on an overlay stack context so we can
46
+ * capture the context of the clicks on very nested components
47
+ */
48
+
49
+ const isChildOfType = (child, type) => child.type.name === type;
50
+
51
+ function DSMenu(_ref) {
52
+ let {
53
+ containerProps = {},
54
+ innerRef,
55
+ as: MenuTag = animated.ul,
56
+ children = undefined,
57
+ onClickOutside = noop,
58
+ // handlers from hidden
59
+ visible = undefined,
60
+ focusOnOpen = false,
61
+ maxOption = 0,
62
+ style = {},
63
+ minWidth = undefined,
64
+ maxWidth = undefined,
65
+ closeMenu,
66
+ responsiveHeight = false
67
+ } = _ref,
68
+ otherProps = _objectWithoutProperties(_ref, _excluded);
69
+
70
+ const menuRef = useRef(null);
71
+ const {
72
+ focusFirst
73
+ } = useContext(FocusGroupContext);
74
+
75
+ const _useHiddenTransition = useHiddenTransition({
76
+ visible,
77
+ style
78
+ }),
79
+ hiddenProps = _objectWithoutProperties(_useHiddenTransition, _excluded2); // force no addon to the children if the menu doesn't have any item with leftAddon like SelectionGroup
80
+
81
+
82
+ const nextChildren = useMemo(() => {
83
+ const forceLeftAddon = React.Children.toArray(children).some(child => isChildOfType(child, 'SelectionGroup') || isChildOfType(child, 'MenuItemCheckbox') || isChildOfType(child, 'MenuItemRadio') || child.props.leftAddon);
84
+ return React.Children.map(children, child => child && /*#__PURE__*/React.cloneElement(child, _objectSpread(_objectSpread({}, child.props), {}, {
85
+ noAddon: !forceLeftAddon ? true : undefined,
86
+ maxOption,
87
+ closeMenu
88
+ })));
89
+ }, [children]);
90
+ useOnClickOutside(menuRef, onClickOutside);
91
+ useEffect(() => {
92
+ if (focusOnOpen && visible) {
93
+ setTimeout(() => {
94
+ focusFirst();
95
+ }, 0);
96
+ }
97
+ }, [visible, focusOnOpen]); // todo: find out a better approach to this
98
+
99
+ return !hiddenProps.destroyed ? /*#__PURE__*/_jsx(MenuContext.Provider, {
100
+ value: {
101
+ visible,
102
+ closeMenu
103
+ }
104
+ }, void 0, /*#__PURE__*/jsx(MenuComponent, _objectSpread(_objectSpread(_objectSpread(_objectSpread({
105
+ "data-testid": containerProps !== null && containerProps !== void 0 && containerProps['data-testid'] ? containerProps['data-testid'] : "em-ds-menu"
106
+ }, containerProps), {}, {
107
+ as: MenuTag,
108
+ classProps: _objectSpread(_objectSpread({}, otherProps.classProps || {}), {}, {
109
+ type: otherProps.type
110
+ }),
111
+ innerRef: mergeRefs(innerRef, menuRef),
112
+ role: "menu"
113
+ }, omit(otherProps, ['scheduleUpdate'])), hiddenProps), {}, {
114
+ children: /*#__PURE__*/_jsx("div", {
115
+ className: "menu-component-internal-wrapper",
116
+ style: _objectSpread(_objectSpread({}, style), {}, {
117
+ minWidth,
118
+ maxWidth
119
+ }, responsiveHeight ? {
120
+ overflowY: 'scroll',
121
+ maxHeight: responsiveHeight ? "".concat(window.innerHeight - RESPONSIVE_HEIHGT_MARGIN, "px") : undefined
122
+ } : {})
123
+ }, void 0, nextChildren)
124
+ }))) : null;
125
+ }
126
+
127
+ const Menu = focusGroupManagerHoc(DSMenu, {
128
+ loop: true
129
+ });
130
+ const props = {
131
+ /** Injected props to wrapper element of component */
132
+ containerProps: PropTypes.object.description('Injected props to wrapper element of component'),
133
+
134
+ /** Renders the menu with a specific html element */
135
+ as: PropTypes.element.description('Renders the menu with a specific html element'),
136
+
137
+ /** Handler when a user clicks outside the menu */
138
+ onClickOutside: PropTypes.func.description('Handler when a user clicks outside the menu'),
139
+
140
+ /** Whether the menu is visible or not */
141
+ visible: PropTypes.bool.description('Whether the menu is visible or not'),
142
+
143
+ /** When set to true, it's going to focus the first item */
144
+ focusOnOpen: PropTypes.bool.description("When set to true, it's going to focus the first item"),
145
+
146
+ /** Customize menu minWidth. Can be undefined or 'number' */
147
+ minWidth: PropTypes.number.description("Customize menu minWidth. Can be undefined or 'number'"),
148
+
149
+ /** Customize menu maxWidth. Can be undefined or 'number' */
150
+ maxWidth: PropTypes.number.description("Customize menu maxWidth. Can be undefined or 'number'")
151
+ };
152
+ const DSMenuWithSchema = describe(DSMenu);
153
+ DSMenuWithSchema.propTypes = props; // todo: add a handler to get this kind of exports for documentation
154
+
155
+ Menu.Item = MenuItem;
156
+ Menu.ItemCheckbox = MenuItemCheckbox;
157
+ Menu.ItemRadio = MenuItemRadio;
158
+ Menu.SubMenu = SubMenu;
159
+ Menu.Separator = MenuSeparator;
160
+ Menu.CheckboxGroup = CheckboxGroup;
161
+ Menu.RadioGroup = RadioGroup;
162
+ Menu.SearchableGroup = SearchableGroup;
163
+ Menu.SelectionGroup = SelectionGroup;
164
+
165
+ export { DSMenuWithSchema, Menu, Menu as default };
@@ -1,89 +1,43 @@
1
- import _extends from '@babel/runtime/helpers/esm/extends';
1
+ import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
2
+ import _jsx from '@babel/runtime/helpers/esm/jsx';
2
3
  import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
3
- import React from 'react';
4
- import PropTypes from 'prop-types';
4
+ import 'react';
5
5
  import SearchableList from './MenuItems/SearchableList.js';
6
- import { M as Menu } from './SubMenu-a25e69ec.js';
7
- import '@babel/runtime/helpers/esm/defineProperty';
8
- import '@babel/runtime/helpers/esm/slicedToArray';
9
- import 'react-desc';
10
- import '@elliemae/ds-utilities';
11
- import '@elliemae/ds-form';
12
- import '@elliemae/ds-icons';
13
- import '@elliemae/ds-shared/FocusGroup';
14
- import '@elliemae/ds-hidden';
15
- import '@elliemae/ds-button';
16
- import '@elliemae/ds-popper';
17
- import 'styled-components';
18
- import 'lodash';
19
- import '@elliemae/ds-classnames';
20
- import 'react-spring/web.cjs';
21
- import '@elliemae/ds-truncated-tooltip-text';
22
- import './MenuItems/Separator.js';
23
- import '@elliemae/ds-separator';
24
- import '@elliemae/ds-shared/CheckableGroup';
25
- import './MenuItems/SearchableGroup.js';
26
- import '@elliemae/ds-form/SearchBox';
27
- import './VirtualMenuList.js';
28
- import 'react-window';
29
- import './utils/useHeightByAmountOfItems.js';
30
- import './MenuContext.js';
31
- import './MenuItems/CheckboxGroup.js';
32
- import './MenuItems/RadioGroup.js';
6
+ import { Menu } from './Menu.js';
7
+ import { jsx } from 'react/jsx-runtime';
33
8
 
34
- var _excluded = ["dropdownFilterOptions", "options", "onSelectMenuItem", "innerRef", "maxOptions", "loading"];
9
+ const _excluded = ["dropdownFilterOptions", "options", "onSelectMenuItem", "innerRef", "maxOptions", "loading"];
10
+
11
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
12
+
13
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
35
14
 
36
15
  function MenuCombobox(_ref) {
37
- var _ref$dropdownFilterOp = _ref.dropdownFilterOptions,
38
- dropdownFilterOptions = _ref$dropdownFilterOp === void 0 ? {} : _ref$dropdownFilterOp,
39
- _ref$options = _ref.options,
40
- options = _ref$options === void 0 ? [] : _ref$options,
41
- _ref$onSelectMenuItem = _ref.onSelectMenuItem,
42
- onSelectMenuItem = _ref$onSelectMenuItem === void 0 ? function () {
43
- return null;
44
- } : _ref$onSelectMenuItem,
45
- innerRef = _ref.innerRef,
46
- _ref$maxOptions = _ref.maxOptions,
47
- maxOptions = _ref$maxOptions === void 0 ? 10 : _ref$maxOptions,
48
- _ref$loading = _ref.loading,
49
- loading = _ref$loading === void 0 ? false : _ref$loading,
16
+ let {
17
+ dropdownFilterOptions = {},
18
+ options = [],
19
+ onSelectMenuItem = () => null,
20
+ innerRef,
21
+ maxOptions = 10,
22
+ loading = false
23
+ } = _ref,
50
24
  rest = _objectWithoutProperties(_ref, _excluded);
51
25
 
52
- return /*#__PURE__*/React.createElement(Menu, _extends({}, rest, {
26
+ return /*#__PURE__*/jsx(Menu, _objectSpread(_objectSpread({}, rest), {}, {
53
27
  classProps: {
54
28
  menuComboBox: true
55
29
  },
56
30
  innerRef: innerRef,
57
- visible: true
58
- }), /*#__PURE__*/React.createElement(SearchableList, {
59
- appendTermInList: true,
60
- extraListProps: dropdownFilterOptions,
61
- items: options,
62
- onSelectMenuItem: onSelectMenuItem,
63
- maxOptions: maxOptions,
64
- loading: loading
31
+ visible: true,
32
+ children: /*#__PURE__*/_jsx(SearchableList, {
33
+ appendTermInList: true,
34
+ extraListProps: dropdownFilterOptions,
35
+ items: options,
36
+ onSelectMenuItem: onSelectMenuItem,
37
+ maxOptions: maxOptions,
38
+ loading: loading
39
+ })
65
40
  }));
66
41
  }
67
42
 
68
- MenuCombobox.propTypes = {
69
- /** Options */
70
- dropdownFilterOptions: PropTypes.shape({}),
71
-
72
- /** The option or menu items to render */
73
- options: PropTypes.arrayOf(PropTypes.object),
74
-
75
- /** Handler when a menu item is selected */
76
- onSelectMenuItem: PropTypes.func,
77
-
78
- /** Internal ref */
79
- innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
80
-
81
- /** Max options to display in the list */
82
- maxOptions: PropTypes.number,
83
-
84
- /** Is loading */
85
- loading: PropTypes.bool
86
- };
87
-
88
43
  export { MenuCombobox as default };
89
- //# sourceMappingURL=MenuCombobox.js.map
@@ -3,4 +3,3 @@ import React from 'react';
3
3
  var MenuContext = /*#__PURE__*/React.createContext();
4
4
 
5
5
  export { MenuContext as default };
6
- //# sourceMappingURL=MenuContext.js.map
@@ -1,15 +1,20 @@
1
- import _extends from '@babel/runtime/helpers/esm/extends';
2
- import React from 'react';
1
+ import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
2
+ import 'react';
3
3
  import { PropTypes, describe } from 'react-desc';
4
4
  import CheckableGroup from '@elliemae/ds-shared/CheckableGroup';
5
+ import { jsx } from 'react/jsx-runtime';
6
+
7
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
8
+
9
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
5
10
 
6
11
  function CheckboxGroup(props) {
7
- return /*#__PURE__*/React.createElement(CheckableGroup, _extends({}, props, {
12
+ return /*#__PURE__*/jsx(CheckableGroup, _objectSpread(_objectSpread({}, props), {}, {
8
13
  multi: true
9
14
  }));
10
15
  }
11
16
 
12
- var props = {
17
+ const props = {
13
18
  /* The item (if multi false) or items (if multi true) selected */
14
19
  active: PropTypes.arrayOf(PropTypes.string).description('The item (if multi false) or items (if multi true) selected'),
15
20
 
@@ -19,9 +24,7 @@ var props = {
19
24
  /* Handler when a user checks an item */
20
25
  onCheck: PropTypes.func.description('Handler when a user checks an item')
21
26
  };
22
- CheckboxGroup.propTypes = props;
23
- var DSMenuCheckboxGroupWithSchema = describe(CheckboxGroup);
27
+ const DSMenuCheckboxGroupWithSchema = describe(CheckboxGroup);
24
28
  DSMenuCheckboxGroupWithSchema.propTypes = props;
25
29
 
26
30
  export { DSMenuCheckboxGroupWithSchema, CheckboxGroup as default };
27
- //# sourceMappingURL=CheckboxGroup.js.map