@elliemae/ds-menu 2.0.0-next.8 → 2.0.0-rc.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/Menu.js +25 -10
- package/cjs/MenuCombobox.js +5 -0
- package/cjs/MenuItems/CheckboxGroup.js +5 -0
- package/cjs/MenuItems/MenuItem.js +42 -29
- package/cjs/MenuItems/MenuItemCheckable.js +16 -11
- package/cjs/MenuItems/MenuItemCheckbox.js +7 -3
- package/cjs/MenuItems/MenuItemRadio.js +5 -0
- package/cjs/MenuItems/RadioGroup.js +5 -0
- package/cjs/MenuItems/SearchableGroup.js +19 -12
- package/cjs/MenuItems/SearchableList.js +22 -17
- package/cjs/MenuItems/SelectionGroup.js +22 -12
- package/cjs/MenuItems/Separator.js +7 -4
- package/cjs/MenuItems/SubMenu.js +24 -22
- package/cjs/MenuItems/menuItemFactory.js +15 -4
- package/cjs/VirtualMenuList.js +21 -14
- package/cjs/utils/useHeightByAmountOfItems.js +6 -5
- package/esm/Menu.js +25 -10
- package/esm/MenuCombobox.js +5 -0
- package/esm/MenuItems/CheckboxGroup.js +5 -0
- package/esm/MenuItems/MenuItem.js +40 -27
- package/esm/MenuItems/MenuItemCheckable.js +14 -8
- package/esm/MenuItems/MenuItemCheckbox.js +6 -1
- package/esm/MenuItems/MenuItemRadio.js +5 -0
- package/esm/MenuItems/RadioGroup.js +5 -0
- package/esm/MenuItems/SearchableGroup.js +19 -12
- package/esm/MenuItems/SearchableList.js +20 -14
- package/esm/MenuItems/SelectionGroup.js +22 -12
- package/esm/MenuItems/Separator.js +7 -4
- package/esm/MenuItems/SubMenu.js +24 -20
- package/esm/MenuItems/menuItemFactory.js +14 -3
- package/esm/VirtualMenuList.js +21 -14
- package/esm/utils/useHeightByAmountOfItems.js +6 -5
- package/package.json +16 -13
- package/types/Menu.d.ts +24 -1
- package/types/MenuItems/CheckboxGroup.d.ts +24 -4
- package/types/MenuItems/MenuItem.d.ts +60 -10
- package/types/MenuItems/MenuItemCheckable.d.ts +51 -7
- package/types/MenuItems/MenuItemRadio.d.ts +27 -3
- package/types/MenuItems/RadioGroup.d.ts +18 -3
- package/types/MenuItems/SearchableGroup.d.ts +15 -1
- package/types/MenuItems/SearchableList.d.ts +77 -11
- package/types/MenuItems/SelectionGroup.d.ts +73 -11
- package/types/MenuItems/Separator.d.ts +21 -3
- package/types/MenuItems/SubMenu.d.ts +91 -13
|
@@ -3,8 +3,15 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
|
+
require('core-js/modules/esnext.async-iterator.map.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.map.js');
|
|
8
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
10
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
11
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
12
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
6
13
|
var React = require('react');
|
|
7
|
-
var
|
|
14
|
+
var dsUtilities = require('@elliemae/ds-utilities');
|
|
8
15
|
var Separator = require('./Separator.js');
|
|
9
16
|
var MenuItem = require('./MenuItem.js');
|
|
10
17
|
var SubMenu = require('./SubMenu.js');
|
|
@@ -30,14 +37,18 @@ const itemTypes = {
|
|
|
30
37
|
const fallback = {
|
|
31
38
|
SelectionGroup: 'selection-group'
|
|
32
39
|
};
|
|
33
|
-
function menuItemFactory(
|
|
40
|
+
function menuItemFactory() {
|
|
41
|
+
let type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
42
|
+
let items = arguments.length > 1 ? arguments[1] : undefined;
|
|
43
|
+
let defaultItem = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : itemTypes.menuitem;
|
|
34
44
|
const itemsObject = items || itemTypes;
|
|
35
45
|
const parsedType = fallback[type] || type.toLowerCase();
|
|
36
46
|
return itemsObject[parsedType] || defaultItem;
|
|
37
47
|
}
|
|
38
|
-
function renderMenuItems(options
|
|
48
|
+
function renderMenuItems(options) {
|
|
49
|
+
let factory = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : menuItemFactory;
|
|
39
50
|
return options.map((option, index) => {
|
|
40
|
-
if (
|
|
51
|
+
if (dsUtilities.isFunction(option.renderer)) {
|
|
41
52
|
return option.renderer({
|
|
42
53
|
key: option.id,
|
|
43
54
|
item: option
|
package/cjs/VirtualMenuList.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
4
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
5
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
6
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
4
7
|
require('react');
|
|
5
8
|
var reactWindow = require('react-window');
|
|
6
9
|
var useHeightByAmountOfItems = require('./utils/useHeightByAmountOfItems.js');
|
|
@@ -9,21 +12,25 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
9
12
|
|
|
10
13
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
11
14
|
|
|
12
|
-
const MenuItem =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
const MenuItem = _ref => {
|
|
16
|
+
let {
|
|
17
|
+
data,
|
|
18
|
+
index,
|
|
19
|
+
style
|
|
20
|
+
} = _ref;
|
|
21
|
+
return /*#__PURE__*/_jsx__default["default"]("div", {
|
|
22
|
+
style: style
|
|
23
|
+
}, index, data && data[index] ? data[index] : '');
|
|
24
|
+
}; // eslint-disable-next-line no-unused-vars
|
|
19
25
|
|
|
20
|
-
function VirtualMenuList({
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
function VirtualMenuList(_ref2) {
|
|
27
|
+
let {
|
|
28
|
+
items,
|
|
29
|
+
itemHeight = 32,
|
|
30
|
+
amountItemsInWindow = 5,
|
|
31
|
+
width,
|
|
32
|
+
height
|
|
33
|
+
} = _ref2;
|
|
27
34
|
const computedListHeight = useHeightByAmountOfItems({
|
|
28
35
|
amountItems: amountItemsInWindow,
|
|
29
36
|
itemHeight,
|
|
@@ -7,11 +7,12 @@ const calculateHeight = (itemHeight, amountItemsInWindow, itemsLength) => {
|
|
|
7
7
|
return itemHeight * realAmountItemsInWindow;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
-
function useHeightByAmountOfItems({
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
function useHeightByAmountOfItems(_ref) {
|
|
11
|
+
let {
|
|
12
|
+
itemHeight,
|
|
13
|
+
amountItems,
|
|
14
|
+
items
|
|
15
|
+
} = _ref;
|
|
15
16
|
const calculatedHeight = React.useMemo(() => calculateHeight(itemHeight, amountItems, items.length), [amountItems, items]);
|
|
16
17
|
return calculatedHeight;
|
|
17
18
|
}
|
package/esm/Menu.js
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
2
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
3
3
|
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.some.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
6
|
+
import 'core-js/modules/esnext.iterator.some.js';
|
|
7
|
+
import 'core-js/modules/esnext.async-iterator.constructor.js';
|
|
8
|
+
import 'core-js/modules/esnext.async-iterator.to-array.js';
|
|
9
|
+
import 'core-js/modules/esnext.iterator.to-array.js';
|
|
10
|
+
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
11
|
+
import 'core-js/modules/esnext.iterator.map.js';
|
|
12
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
13
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
14
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
15
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
4
16
|
import React, { useRef, useContext, useMemo, useEffect } from 'react';
|
|
5
17
|
import { PropTypes, describe } from 'react-desc';
|
|
6
18
|
import { omit } from 'lodash';
|
|
@@ -34,13 +46,16 @@ const blockName = 'menu';
|
|
|
34
46
|
|
|
35
47
|
const noop = () => {};
|
|
36
48
|
|
|
37
|
-
const MenuComponent = aggregatedClasses('div')(blockName, '',
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
49
|
+
const MenuComponent = aggregatedClasses('div')(blockName, '', _ref => {
|
|
50
|
+
let {
|
|
51
|
+
menuComboBox,
|
|
52
|
+
type
|
|
53
|
+
} = _ref;
|
|
54
|
+
return {
|
|
55
|
+
'menu-combo-box': menuComboBox,
|
|
56
|
+
["type-".concat(type)]: type
|
|
57
|
+
};
|
|
58
|
+
});
|
|
44
59
|
/**
|
|
45
60
|
* todo: -- IDEA -- each menu could have an overlay based on an overlay stack context so we can
|
|
46
61
|
* capture the context of the clicks on very nested components
|
|
@@ -48,7 +63,7 @@ const MenuComponent = aggregatedClasses('div')(blockName, '', ({
|
|
|
48
63
|
|
|
49
64
|
const isChildOfType = (child, type) => child.type.name === type;
|
|
50
65
|
|
|
51
|
-
function DSMenu(
|
|
66
|
+
function DSMenu(_ref2) {
|
|
52
67
|
let {
|
|
53
68
|
containerProps = {},
|
|
54
69
|
innerRef,
|
|
@@ -64,8 +79,8 @@ function DSMenu(_ref) {
|
|
|
64
79
|
maxWidth = undefined,
|
|
65
80
|
closeMenu,
|
|
66
81
|
responsiveHeight = false
|
|
67
|
-
} =
|
|
68
|
-
otherProps = _objectWithoutProperties(
|
|
82
|
+
} = _ref2,
|
|
83
|
+
otherProps = _objectWithoutProperties(_ref2, _excluded);
|
|
69
84
|
|
|
70
85
|
const menuRef = useRef(null);
|
|
71
86
|
const {
|
package/esm/MenuCombobox.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
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';
|
|
1
6
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
7
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
3
8
|
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
@@ -1,3 +1,8 @@
|
|
|
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';
|
|
1
6
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
7
|
import 'react';
|
|
3
8
|
import { PropTypes, describe } from 'react-desc';
|
|
@@ -1,14 +1,20 @@
|
|
|
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';
|
|
1
6
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
7
|
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
3
8
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
9
|
+
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
10
|
+
import 'core-js/modules/esnext.iterator.map.js';
|
|
4
11
|
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
5
12
|
import { useContext, useRef, useMemo } from 'react';
|
|
6
13
|
import { PropTypes, describe } from 'react-desc';
|
|
7
14
|
import { omit } from 'lodash';
|
|
8
15
|
import { aggregatedClasses } from '@elliemae/ds-classnames';
|
|
9
|
-
import { mergeRefs } from '@elliemae/ds-utilities
|
|
16
|
+
import { mergeRefs, runAll } from '@elliemae/ds-utilities';
|
|
10
17
|
import { useFocusGroupItem } from '@elliemae/ds-shared/FocusGroup';
|
|
11
|
-
import { runAll } from '@elliemae/ds-utilities/utils';
|
|
12
18
|
import DSTruncatedTooltipText from '@elliemae/ds-truncated-tooltip-text';
|
|
13
19
|
import { renderMenuItems } from './menuItemFactory.js';
|
|
14
20
|
import SubMenu from './SubMenu.js';
|
|
@@ -25,13 +31,16 @@ const noop = () => null;
|
|
|
25
31
|
|
|
26
32
|
const blockName = 'menu-item';
|
|
27
33
|
const Content = aggregatedClasses('div')(blockName, 'content');
|
|
28
|
-
const Addon = aggregatedClasses('div')(blockName, 'addon',
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
const Addon = aggregatedClasses('div')(blockName, 'addon', _ref => {
|
|
35
|
+
let {
|
|
36
|
+
empty,
|
|
37
|
+
fixedItem
|
|
38
|
+
} = _ref;
|
|
39
|
+
return {
|
|
40
|
+
empty,
|
|
41
|
+
fixedItem
|
|
42
|
+
};
|
|
43
|
+
});
|
|
35
44
|
|
|
36
45
|
const renderAddon = (addon, fixedItem, addonId) => /*#__PURE__*/_jsx(Addon, {
|
|
37
46
|
classProps: {
|
|
@@ -41,21 +50,25 @@ const renderAddon = (addon, fixedItem, addonId) => /*#__PURE__*/_jsx(Addon, {
|
|
|
41
50
|
|
|
42
51
|
const renderAddons = (addons, fixedItem) => Array.isArray(addons) ? addons.map(renderAddon) : renderAddon(addons, fixedItem);
|
|
43
52
|
|
|
44
|
-
const Wrapper = aggregatedClasses('li')(blockName, null,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
53
|
+
const Wrapper = aggregatedClasses('li')(blockName, null, _ref2 => {
|
|
54
|
+
let {
|
|
55
|
+
disabled,
|
|
56
|
+
disabledAddonInactive,
|
|
57
|
+
customRenderer,
|
|
58
|
+
fixedItem,
|
|
59
|
+
type
|
|
60
|
+
} = _ref2;
|
|
61
|
+
return {
|
|
62
|
+
disabled,
|
|
63
|
+
disabledAddonInactive,
|
|
64
|
+
customRenderer,
|
|
65
|
+
fixedItem,
|
|
66
|
+
["menu-type-".concat(type)]: type
|
|
67
|
+
};
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
const calculateSize = function () {
|
|
71
|
+
let length = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
59
72
|
if (length > 45) return 45 * 7;
|
|
60
73
|
return length * 7;
|
|
61
74
|
};
|
|
@@ -95,11 +108,11 @@ function MenuItem(props) {
|
|
|
95
108
|
|
|
96
109
|
const wrapperProps = useMemo(() => omit(otherProps, ['icon']), [otherProps]);
|
|
97
110
|
|
|
98
|
-
const onClick = (
|
|
99
|
-
if (wrapperProps.onClick) wrapperProps.onClick(...
|
|
111
|
+
const onClick = function () {
|
|
112
|
+
if (wrapperProps.onClick) wrapperProps.onClick(...arguments);
|
|
100
113
|
|
|
101
114
|
if (wrapperProps.closeOnClick && menuCxt.closeMenu) {
|
|
102
|
-
menuCxt.closeMenu(...
|
|
115
|
+
menuCxt.closeMenu(...arguments);
|
|
103
116
|
}
|
|
104
117
|
};
|
|
105
118
|
|
|
@@ -1,10 +1,15 @@
|
|
|
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';
|
|
1
6
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
7
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
3
8
|
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
4
9
|
import 'react';
|
|
5
10
|
import { PropTypes, describe } from 'react-desc';
|
|
6
|
-
import Checkmark from '@elliemae/ds-icons
|
|
7
|
-
import { runAll } from '@elliemae/ds-utilities
|
|
11
|
+
import { Checkmark } from '@elliemae/ds-icons';
|
|
12
|
+
import { runAll } from '@elliemae/ds-utilities';
|
|
8
13
|
import MenuItem from './MenuItem.js';
|
|
9
14
|
import { jsx } from 'react/jsx-runtime';
|
|
10
15
|
|
|
@@ -16,9 +21,10 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
16
21
|
|
|
17
22
|
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; }
|
|
18
23
|
|
|
19
|
-
function useCheckable({
|
|
20
|
-
|
|
21
|
-
|
|
24
|
+
function useCheckable(_ref) {
|
|
25
|
+
let {
|
|
26
|
+
checked
|
|
27
|
+
} = _ref;
|
|
22
28
|
return {
|
|
23
29
|
checked,
|
|
24
30
|
'aria-checked': checked
|
|
@@ -38,7 +44,7 @@ function useCheckable({
|
|
|
38
44
|
*/
|
|
39
45
|
|
|
40
46
|
|
|
41
|
-
function MenuItemCheckable(
|
|
47
|
+
function MenuItemCheckable(_ref2) {
|
|
42
48
|
let {
|
|
43
49
|
role = 'menuitemcheckbox',
|
|
44
50
|
checked = false,
|
|
@@ -50,8 +56,8 @@ function MenuItemCheckable(_ref) {
|
|
|
50
56
|
children,
|
|
51
57
|
leftAddon,
|
|
52
58
|
item = undefined
|
|
53
|
-
} =
|
|
54
|
-
otherProps = _objectWithoutProperties(
|
|
59
|
+
} = _ref2,
|
|
60
|
+
otherProps = _objectWithoutProperties(_ref2, _excluded);
|
|
55
61
|
|
|
56
62
|
const checkableProps = useCheckable({
|
|
57
63
|
checked,
|
|
@@ -1,8 +1,13 @@
|
|
|
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';
|
|
1
6
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
7
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
3
8
|
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
4
9
|
import 'react';
|
|
5
|
-
import DSCheckbox from '@elliemae/ds-form
|
|
10
|
+
import { DSCheckbox } from '@elliemae/ds-form';
|
|
6
11
|
import MenuItemCheckable from './MenuItemCheckable.js';
|
|
7
12
|
import { jsx } from 'react/jsx-runtime';
|
|
8
13
|
|
|
@@ -1,3 +1,8 @@
|
|
|
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';
|
|
1
6
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
7
|
import 'react';
|
|
3
8
|
import { PropTypes, describe } from 'react-desc';
|
|
@@ -1,3 +1,8 @@
|
|
|
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';
|
|
1
6
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
7
|
import 'react';
|
|
3
8
|
import { PropTypes, describe } from 'react-desc';
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
2
|
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
3
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
4
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
3
6
|
import { useRef, useState, useEffect, useContext, useMemo } from 'react';
|
|
4
7
|
import { aggregatedClasses } from '@elliemae/ds-classnames';
|
|
5
8
|
import { focusGroupManagerHoc } from '@elliemae/ds-shared/FocusGroup';
|
|
@@ -12,15 +15,16 @@ import { jsxs, Fragment } from 'react/jsx-runtime';
|
|
|
12
15
|
const SearchBoxWrapper = aggregatedClasses('div')('menu-search-group', 'search-wrapper');
|
|
13
16
|
const NoOptionsWrapper = aggregatedClasses('div')('menu-search-group', 'no-options');
|
|
14
17
|
|
|
15
|
-
function SearchableGroup({
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
function SearchableGroup(_ref) {
|
|
19
|
+
let {
|
|
20
|
+
children,
|
|
21
|
+
amountItemsInWindow = 5,
|
|
22
|
+
searchTerm: searchTermProp = '',
|
|
23
|
+
noOptionsText = 'No options',
|
|
24
|
+
height,
|
|
25
|
+
width,
|
|
26
|
+
focusOnOpen = false
|
|
27
|
+
} = _ref;
|
|
24
28
|
const searchRef = useRef(null);
|
|
25
29
|
const [searchTerm, setSearchTerm] = useState(searchTermProp);
|
|
26
30
|
useEffect(() => {
|
|
@@ -40,9 +44,12 @@ function SearchableGroup({
|
|
|
40
44
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
41
45
|
children: [/*#__PURE__*/_jsx(SearchBoxWrapper, {}, void 0, /*#__PURE__*/_jsx(DSSearchBox, {
|
|
42
46
|
innerRef: searchRef,
|
|
43
|
-
onSearch:
|
|
44
|
-
|
|
45
|
-
|
|
47
|
+
onSearch: _ref2 => {
|
|
48
|
+
let {
|
|
49
|
+
value
|
|
50
|
+
} = _ref2;
|
|
51
|
+
return setSearchTerm(value);
|
|
52
|
+
},
|
|
46
53
|
searchOnEnter: false,
|
|
47
54
|
showIcon: false,
|
|
48
55
|
value: searchTerm
|
|
@@ -1,9 +1,14 @@
|
|
|
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';
|
|
1
6
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
7
|
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
3
8
|
import { useState, useCallback, useMemo } from 'react';
|
|
4
9
|
import { PropTypes, describe } from 'react-desc';
|
|
5
|
-
import { uniqBy } from '@elliemae/ds-utilities
|
|
6
|
-
import DSComboBox from '@elliemae/ds-form
|
|
10
|
+
import { uniqBy } from '@elliemae/ds-utilities';
|
|
11
|
+
import { DSComboBox } from '@elliemae/ds-form';
|
|
7
12
|
import { jsx } from 'react/jsx-runtime';
|
|
8
13
|
|
|
9
14
|
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,18 +17,19 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
12
17
|
|
|
13
18
|
const noop = () => {};
|
|
14
19
|
|
|
15
|
-
function SearchableList({
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
function SearchableList(_ref) {
|
|
21
|
+
let {
|
|
22
|
+
onSelectMenuItem = noop,
|
|
23
|
+
components = {},
|
|
24
|
+
searchTerm: searchTermProp = '',
|
|
25
|
+
items = [],
|
|
26
|
+
dropdownFilterOptions = {},
|
|
27
|
+
returnValue,
|
|
28
|
+
extraListProps = {},
|
|
29
|
+
appendTermInList = false,
|
|
30
|
+
maxOptions = 10,
|
|
31
|
+
loading = false
|
|
32
|
+
} = _ref;
|
|
27
33
|
const [searchTerm, setInputValue] = useState(searchTermProp);
|
|
28
34
|
const handleInputChange = useCallback((value, args) => {
|
|
29
35
|
const action = args ? args.action : null;
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
2
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
3
|
+
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
4
|
+
import 'core-js/modules/esnext.iterator.map.js';
|
|
5
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
6
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
7
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
8
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
9
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
3
10
|
import { useMemo, createElement } from 'react';
|
|
4
11
|
import { PropTypes, describe } from 'react-desc';
|
|
5
12
|
import { useCheckableGroup } from '@elliemae/ds-shared/CheckableGroup';
|
|
@@ -13,17 +20,19 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
13
20
|
|
|
14
21
|
const noop = () => null;
|
|
15
22
|
|
|
16
|
-
function SelectionGroup({
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
function SelectionGroup(_ref) {
|
|
24
|
+
let {
|
|
25
|
+
multi = false,
|
|
26
|
+
searchable = false,
|
|
27
|
+
focusOnOpen = false,
|
|
28
|
+
onSelect = noop,
|
|
29
|
+
children,
|
|
30
|
+
items = undefined,
|
|
31
|
+
active = multi ? [] : '',
|
|
32
|
+
width,
|
|
33
|
+
height,
|
|
34
|
+
maxOptions = 5
|
|
35
|
+
} = _ref;
|
|
27
36
|
const renderedItems = useMemo(() => items && items.map(item => {
|
|
28
37
|
const Component = menuItemFactory(multi ? 'checkbox' : 'radio');
|
|
29
38
|
return /*#__PURE__*/createElement(Component, _objectSpread(_objectSpread({}, item), {}, {
|
|
@@ -51,7 +60,8 @@ function SelectionGroup({
|
|
|
51
60
|
return /*#__PURE__*/_jsx(VirtualMenuList, {
|
|
52
61
|
height: height,
|
|
53
62
|
items: decoratedGroupChildren,
|
|
54
|
-
width: width
|
|
63
|
+
width: width,
|
|
64
|
+
amountItemsInWindow: maxOptions
|
|
55
65
|
});
|
|
56
66
|
}
|
|
57
67
|
|
|
@@ -12,10 +12,13 @@ const Li = /*#__PURE__*/styled.li.withConfig({
|
|
|
12
12
|
})(["display:flex;align-items:flex-start;flex-direction:column;"]);
|
|
13
13
|
const Title = aggregatedClasses('h5')(blockName, 'title');
|
|
14
14
|
|
|
15
|
-
const MenuSeparator =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
const MenuSeparator = _ref => {
|
|
16
|
+
let {
|
|
17
|
+
title,
|
|
18
|
+
showSeparator = true
|
|
19
|
+
} = _ref;
|
|
20
|
+
return /*#__PURE__*/_jsx(Li, {}, void 0, showSeparator && (_DSSeparator || (_DSSeparator = /*#__PURE__*/_jsx(DSSeparator, {}))), title && /*#__PURE__*/_jsx(Title, {}, void 0, title));
|
|
21
|
+
};
|
|
19
22
|
|
|
20
23
|
const props = {
|
|
21
24
|
/** menu separator h5 title */
|
package/esm/MenuItems/SubMenu.js
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
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';
|
|
1
6
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
7
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
3
8
|
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
4
9
|
import { useRef, useState, useCallback } from 'react';
|
|
5
10
|
import { PropTypes, describe } from 'react-desc';
|
|
6
|
-
import
|
|
7
|
-
import VerticalElipsis from '@elliemae/ds-icons/MoreOptionsVert';
|
|
11
|
+
import { MoreOptionsVert, ChevronSmallRight } from '@elliemae/ds-icons';
|
|
8
12
|
import { useFocusGroupItem } from '@elliemae/ds-shared/FocusGroup';
|
|
9
13
|
import { useHiddenController } from '@elliemae/ds-hidden';
|
|
10
14
|
import DSButton, { BUTTON_VARIANT } from '@elliemae/ds-button';
|
|
11
|
-
import DSPopper from '@elliemae/ds-popper';
|
|
12
|
-
import { interactions } from '@elliemae/ds-popper/interaction';
|
|
15
|
+
import DSPopper, { interactions } from '@elliemae/ds-popper';
|
|
13
16
|
import styled from 'styled-components';
|
|
14
17
|
import { Menu } from '../Menu.js';
|
|
15
18
|
import MenuItem from './MenuItem.js';
|
|
@@ -22,20 +25,21 @@ const ChevronRightComp = /*#__PURE__*/styled.div.withConfig({
|
|
|
22
25
|
componentId: "sc-1qhp1z-0"
|
|
23
26
|
})(["display:flex;justify-content:center;align-items:center;width:28px;"]);
|
|
24
27
|
|
|
25
|
-
function SubMenu({
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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;
|
|
39
43
|
const itemRef = useRef(null);
|
|
40
44
|
const focusOnOpen = useRef(false);
|
|
41
45
|
const [isAddonHovered, setIsAddonHovered] = useState(false);
|
|
@@ -91,7 +95,7 @@ function SubMenu({
|
|
|
91
95
|
"aria-label": "vertical-elipsis",
|
|
92
96
|
"data-testid": "vertical-elipsis",
|
|
93
97
|
buttonType: "text",
|
|
94
|
-
leftIcon: /*#__PURE__*/_jsx(
|
|
98
|
+
leftIcon: /*#__PURE__*/_jsx(MoreOptionsVert, {
|
|
95
99
|
className: "submenu-arrow",
|
|
96
100
|
color: visible || isAddonHovered ? ['brand-primary', 800] : ['neutral', 500],
|
|
97
101
|
size: "s"
|
|
@@ -99,7 +103,7 @@ function SubMenu({
|
|
|
99
103
|
onClick: e => handleShowSubItemsWithMouse(e),
|
|
100
104
|
size: "m",
|
|
101
105
|
variant: BUTTON_VARIANT.DEFAULT
|
|
102
|
-
}) : /*#__PURE__*/_jsx(ChevronRightComp, {}, void 0, /*#__PURE__*/_jsx(
|
|
106
|
+
}) : /*#__PURE__*/_jsx(ChevronRightComp, {}, void 0, /*#__PURE__*/_jsx(ChevronSmallRight, {
|
|
103
107
|
"data-testid": "chevron-right",
|
|
104
108
|
className: "submenu-arrow",
|
|
105
109
|
color: visible || isAddonHovered ? ['brand-primary', 800] : ['neutral', 500],
|