@elliemae/ds-menu 2.3.0-alpha.3 → 2.3.0-alpha.8
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 → dist/cjs}/Menu.js +5 -5
- package/dist/cjs/Menu.js.map +7 -0
- package/{cjs → dist/cjs}/MenuCombobox.js +0 -0
- package/{cjs → dist/cjs}/MenuCombobox.js.map +0 -0
- package/{cjs → dist/cjs}/MenuContext.js +0 -0
- package/{cjs → dist/cjs}/MenuContext.js.map +0 -0
- package/{cjs → dist/cjs}/MenuExports.js +9 -1
- package/dist/cjs/MenuExports.js.map +7 -0
- package/{cjs → dist/cjs}/MenuItems/CheckboxGroup.js +0 -0
- package/{cjs → dist/cjs}/MenuItems/CheckboxGroup.js.map +0 -0
- package/{cjs → dist/cjs}/MenuItems/MenuItem.js +1 -0
- package/dist/cjs/MenuItems/MenuItem.js.map +7 -0
- package/{cjs → dist/cjs}/MenuItems/MenuItemCheckable.js +0 -0
- package/{cjs → dist/cjs}/MenuItems/MenuItemCheckable.js.map +0 -0
- package/{cjs → dist/cjs}/MenuItems/MenuItemCheckbox.js +2 -2
- package/dist/cjs/MenuItems/MenuItemCheckbox.js.map +7 -0
- package/{cjs → dist/cjs}/MenuItems/MenuItemRadio.js +0 -0
- package/{cjs → dist/cjs}/MenuItems/MenuItemRadio.js.map +0 -0
- package/{cjs → dist/cjs}/MenuItems/RadioGroup.js +0 -0
- package/{cjs → dist/cjs}/MenuItems/RadioGroup.js.map +0 -0
- package/{cjs → dist/cjs}/MenuItems/SearchableGroup.js +2 -2
- package/dist/cjs/MenuItems/SearchableGroup.js.map +7 -0
- package/{cjs → dist/cjs}/MenuItems/SearchableList.js +0 -0
- package/{cjs → dist/cjs}/MenuItems/SearchableList.js.map +0 -0
- package/{cjs → dist/cjs}/MenuItems/SelectionGroup.js +0 -0
- package/{cjs → dist/cjs}/MenuItems/SelectionGroup.js.map +0 -0
- package/{cjs → dist/cjs}/MenuItems/Separator.js +0 -0
- package/{cjs → dist/cjs}/MenuItems/Separator.js.map +0 -0
- package/{cjs → dist/cjs}/MenuItems/SubMenu.js +2 -1
- package/dist/cjs/MenuItems/SubMenu.js.map +7 -0
- package/{cjs → dist/cjs}/MenuItems/menuItemFactory.js +0 -0
- package/{cjs → dist/cjs}/MenuItems/menuItemFactory.js.map +0 -0
- package/{cjs → dist/cjs}/MenuItems/renderMenuItems.js +2 -1
- package/dist/cjs/MenuItems/renderMenuItems.js.map +7 -0
- package/{cjs → dist/cjs}/VirtualMenuList.js +0 -0
- package/{cjs → dist/cjs}/VirtualMenuList.js.map +0 -0
- package/{cjs → dist/cjs}/index.js +0 -0
- package/{cjs → dist/cjs}/index.js.map +0 -0
- package/{cjs → dist/cjs}/utils/useHeightByAmountOfItems.js +0 -0
- package/{cjs → dist/cjs}/utils/useHeightByAmountOfItems.js.map +0 -0
- package/{esm → dist/esm}/Menu.js +5 -5
- package/dist/esm/Menu.js.map +7 -0
- package/{esm → dist/esm}/MenuCombobox.js +0 -0
- package/{esm → dist/esm}/MenuCombobox.js.map +0 -0
- package/{esm → dist/esm}/MenuContext.js +0 -0
- package/{esm → dist/esm}/MenuContext.js.map +0 -0
- package/dist/esm/MenuExports.js +7 -0
- package/{esm → dist/esm}/MenuExports.js.map +1 -1
- package/{esm → dist/esm}/MenuItems/CheckboxGroup.js +0 -0
- package/{esm → dist/esm}/MenuItems/CheckboxGroup.js.map +0 -0
- package/{esm → dist/esm}/MenuItems/MenuItem.js +2 -1
- package/dist/esm/MenuItems/MenuItem.js.map +7 -0
- package/{esm → dist/esm}/MenuItems/MenuItemCheckable.js +0 -0
- package/{esm → dist/esm}/MenuItems/MenuItemCheckable.js.map +0 -0
- package/{esm → dist/esm}/MenuItems/MenuItemCheckbox.js +1 -1
- package/{esm → dist/esm}/MenuItems/MenuItemCheckbox.js.map +1 -1
- package/{esm → dist/esm}/MenuItems/MenuItemRadio.js +0 -0
- package/{esm → dist/esm}/MenuItems/MenuItemRadio.js.map +0 -0
- package/{esm → dist/esm}/MenuItems/RadioGroup.js +0 -0
- package/{esm → dist/esm}/MenuItems/RadioGroup.js.map +0 -0
- package/{esm → dist/esm}/MenuItems/SearchableGroup.js +1 -1
- package/dist/esm/MenuItems/SearchableGroup.js.map +7 -0
- package/{esm → dist/esm}/MenuItems/SearchableList.js +0 -0
- package/{esm → dist/esm}/MenuItems/SearchableList.js.map +0 -0
- package/{esm → dist/esm}/MenuItems/SelectionGroup.js +0 -0
- package/{esm → dist/esm}/MenuItems/SelectionGroup.js.map +0 -0
- package/{esm → dist/esm}/MenuItems/Separator.js +0 -0
- package/{esm → dist/esm}/MenuItems/Separator.js.map +0 -0
- package/{esm → dist/esm}/MenuItems/SubMenu.js +3 -2
- package/dist/esm/MenuItems/SubMenu.js.map +7 -0
- package/{esm → dist/esm}/MenuItems/menuItemFactory.js +0 -0
- package/{esm → dist/esm}/MenuItems/menuItemFactory.js.map +0 -0
- package/{esm → dist/esm}/MenuItems/renderMenuItems.js +2 -1
- package/dist/esm/MenuItems/renderMenuItems.js.map +7 -0
- package/{esm → dist/esm}/VirtualMenuList.js +0 -0
- package/{esm → dist/esm}/VirtualMenuList.js.map +0 -0
- package/{esm → dist/esm}/index.js +0 -0
- package/{esm → dist/esm}/index.js.map +0 -0
- package/{esm → dist/esm}/utils/useHeightByAmountOfItems.js +0 -0
- package/{esm → dist/esm}/utils/useHeightByAmountOfItems.js.map +0 -0
- package/package.json +68 -66
- package/cjs/Menu.js.map +0 -7
- package/cjs/MenuExports.js.map +0 -7
- package/cjs/MenuItems/MenuItem.js.map +0 -7
- package/cjs/MenuItems/MenuItemCheckbox.js.map +0 -7
- package/cjs/MenuItems/SearchableGroup.js.map +0 -7
- package/cjs/MenuItems/SubMenu.js.map +0 -7
- package/cjs/MenuItems/renderMenuItems.js.map +0 -7
- package/esm/Menu.js.map +0 -7
- package/esm/MenuExports.js +0 -3
- package/esm/MenuItems/MenuItem.js.map +0 -7
- package/esm/MenuItems/SearchableGroup.js.map +0 -7
- package/esm/MenuItems/SubMenu.js.map +0 -7
- package/esm/MenuItems/renderMenuItems.js.map +0 -7
- package/types/Menu.d.ts +0 -12
- package/types/MenuCombobox.d.ts +0 -28
- package/types/MenuContext.d.ts +0 -4
- package/types/MenuExports.d.ts +0 -1
- package/types/MenuItems/CheckboxGroup.d.ts +0 -32
- package/types/MenuItems/MenuItem.d.ts +0 -79
- package/types/MenuItems/MenuItemCheckable.d.ts +0 -78
- package/types/MenuItems/MenuItemCheckbox.d.ts +0 -7
- package/types/MenuItems/MenuItemRadio.d.ts +0 -28
- package/types/MenuItems/RadioGroup.d.ts +0 -26
- package/types/MenuItems/SearchableGroup.d.ts +0 -10
- package/types/MenuItems/SearchableList.d.ts +0 -95
- package/types/MenuItems/SelectionGroup.d.ts +0 -87
- package/types/MenuItems/Separator.d.ts +0 -32
- package/types/MenuItems/SubMenu.d.ts +0 -109
- package/types/MenuItems/menuItemFactory.d.ts +0 -2
- package/types/MenuItems/renderMenuItems.d.ts +0 -1
- package/types/VirtualMenuList.d.ts +0 -10
- package/types/index.d.ts +0 -14
- package/types/tests/Menu.test.d.ts +0 -1
- package/types/tests/MenuItem.test.d.ts +0 -1
- package/types/utils/useHeightByAmountOfItems.d.ts +0 -7
package/{cjs → dist/cjs}/Menu.js
RENAMED
|
@@ -31,7 +31,8 @@ __export(Menu_exports, {
|
|
|
31
31
|
Menu: () => Menu,
|
|
32
32
|
default: () => Menu_default,
|
|
33
33
|
menuItemFactory: () => import_menuItemFactory.menuItemFactory,
|
|
34
|
-
renderMenuItems: () => import_renderMenuItems.renderMenuItems
|
|
34
|
+
renderMenuItems: () => import_renderMenuItems.renderMenuItems,
|
|
35
|
+
setSubMenu: () => setSubMenu
|
|
35
36
|
});
|
|
36
37
|
var React = __toESM(require("react"));
|
|
37
38
|
var import_react = __toESM(require("react"));
|
|
@@ -43,18 +44,17 @@ var import_hooks = require("@elliemae/ds-utilities/hooks");
|
|
|
43
44
|
var import_system = require("@elliemae/ds-utilities/system");
|
|
44
45
|
var import_FocusGroup = require("@elliemae/ds-shared/FocusGroup");
|
|
45
46
|
var import_ds_hidden = require("@elliemae/ds-hidden");
|
|
47
|
+
var import_MenuContext = require("./MenuContext");
|
|
46
48
|
var import_MenuItemRadio = require("./MenuItems/MenuItemRadio");
|
|
47
49
|
var import_MenuItemCheckbox = require("./MenuItems/MenuItemCheckbox");
|
|
48
50
|
var import_CheckboxGroup = require("./MenuItems/CheckboxGroup");
|
|
49
51
|
var import_RadioGroup = require("./MenuItems/RadioGroup");
|
|
50
52
|
var import_Separator = require("./MenuItems/Separator");
|
|
51
53
|
var import_MenuItem = require("./MenuItems/MenuItem");
|
|
52
|
-
var import_SubMenu = require("./MenuItems/SubMenu");
|
|
53
54
|
var import_SearchableGroup = require("./MenuItems/SearchableGroup");
|
|
54
55
|
var import_SelectionGroup = require("./MenuItems/SelectionGroup");
|
|
55
56
|
var import_menuItemFactory = require("./MenuItems/menuItemFactory");
|
|
56
57
|
var import_renderMenuItems = require("./MenuItems/renderMenuItems");
|
|
57
|
-
var import_MenuContext = require("./MenuContext");
|
|
58
58
|
const RESPONSIVE_HEIHGT_MARGIN = 120;
|
|
59
59
|
const blockName = "menu";
|
|
60
60
|
const noop = () => {
|
|
@@ -63,7 +63,7 @@ const MenuComponent = (0, import_ds_classnames.aggregatedClasses)("div")(blockNa
|
|
|
63
63
|
"menu-combo-box": menuComboBox,
|
|
64
64
|
[`type-${type}`]: type
|
|
65
65
|
}));
|
|
66
|
-
const isChildOfType = (child, type) => child.type.name === type;
|
|
66
|
+
const isChildOfType = (child, type) => child.type === type || child.type?.name === type;
|
|
67
67
|
const DSMenu = ({
|
|
68
68
|
containerProps = {},
|
|
69
69
|
innerRef,
|
|
@@ -140,12 +140,12 @@ DSMenuWithSchema.propTypes = props;
|
|
|
140
140
|
Menu.Item = import_MenuItem.MenuItem;
|
|
141
141
|
Menu.ItemCheckbox = import_MenuItemCheckbox.MenuItemCheckbox;
|
|
142
142
|
Menu.ItemRadio = import_MenuItemRadio.MenuItemRadio;
|
|
143
|
-
Menu.SubMenu = import_SubMenu.SubMenu;
|
|
144
143
|
Menu.Separator = import_Separator.MenuSeparator;
|
|
145
144
|
Menu.CheckboxGroup = import_CheckboxGroup.CheckboxGroup;
|
|
146
145
|
Menu.RadioGroup = import_RadioGroup.RadioGroup;
|
|
147
146
|
Menu.SearchableGroup = import_SearchableGroup.SearchableGroup;
|
|
148
147
|
Menu.SelectionGroup = import_SelectionGroup.SelectionGroup;
|
|
148
|
+
const setSubMenu = (SubMenu) => Menu.SubMenu = SubMenu;
|
|
149
149
|
var Menu_default = Menu;
|
|
150
150
|
module.exports = __toCommonJS(Menu_exports);
|
|
151
151
|
//# sourceMappingURL=Menu.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Menu.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React, { useContext, useEffect, useMemo, useRef } from 'react';\nimport { PropTypes, describe } from 'react-desc';\nimport { omit } from 'lodash';\nimport { aggregatedClasses } from '@elliemae/ds-classnames';\nimport { animated } from 'react-spring/web';\nimport { useOnClickOutside } from '@elliemae/ds-utilities/hooks';\nimport { mergeRefs } from '@elliemae/ds-utilities/system';\nimport { focusGroupManagerHoc, FocusGroupContext } from '@elliemae/ds-shared/FocusGroup';\nimport { useHiddenTransition } from '@elliemae/ds-hidden';\nimport { MenuContext } from './MenuContext';\nimport { MenuItemRadio } from './MenuItems/MenuItemRadio';\nimport { MenuItemCheckbox } from './MenuItems/MenuItemCheckbox';\nimport { CheckboxGroup } from './MenuItems/CheckboxGroup';\nimport { RadioGroup } from './MenuItems/RadioGroup';\nimport { MenuSeparator } from './MenuItems/Separator';\nimport { MenuItem } from './MenuItems/MenuItem';\nimport { SearchableGroup } from './MenuItems/SearchableGroup';\nimport { SelectionGroup } from './MenuItems/SelectionGroup';\nimport { menuItemFactory } from './MenuItems/menuItemFactory';\nimport { renderMenuItems } from './MenuItems/renderMenuItems';\n\nconst RESPONSIVE_HEIHGT_MARGIN = 120;\n\nconst blockName = 'menu';\n\nconst noop = () => {};\n\nconst MenuComponent = aggregatedClasses('div')(blockName, '', ({ menuComboBox, type }) => ({\n 'menu-combo-box': menuComboBox,\n [`type-${type}`]: type,\n}));\n\n/**\n * todo: -- IDEA -- each menu could have an overlay based on an overlay stack context so we can\n * capture the context of the clicks on very nested components\n */\n\nconst isChildOfType = (child, type) => (child.type === type || child.type?.name === type);\n\nconst DSMenu = ({\n containerProps = {},\n innerRef,\n as: MenuTag = animated.ul,\n children = undefined,\n onClickOutside = noop,\n // handlers from hidden\n visible = undefined,\n focusOnOpen = false,\n maxOption = 0,\n style = {},\n minWidth = undefined,\n maxWidth = undefined,\n closeMenu,\n responsiveHeight = false,\n ...otherProps\n}) => {\n const menuRef = useRef(null);\n const { focusFirst } = useContext(FocusGroupContext);\n const { destroyed, ...hiddenProps } = useHiddenTransition({ visible, style });\n\n // force no addon to the children if the menu doesn't have any item with leftAddon like SelectionGroup\n const nextChildren = useMemo(() => {\n const forceLeftAddon = React.Children.toArray(children).some(\n (child) =>\n isChildOfType(child, 'SelectionGroup') ||\n isChildOfType(child, 'MenuItemCheckbox') ||\n isChildOfType(child, 'MenuItemRadio') ||\n child.props.leftAddon,\n );\n\n return React.Children.map(\n children,\n (child) =>\n child &&\n React.cloneElement(child, {\n ...child.props,\n noAddon: !forceLeftAddon ? true : undefined,\n maxOption,\n closeMenu,\n }),\n );\n }, [children]);\n\n useOnClickOutside(menuRef, onClickOutside);\n\n useEffect(() => {\n if (focusOnOpen && visible) {\n setTimeout(() => {\n focusFirst();\n }, 0);\n }\n }, [visible, focusOnOpen]);\n // todo: find out a better approach to this\n return !hiddenProps.destroyed ? (\n <MenuContext.Provider value={{ visible, closeMenu }}>\n <MenuComponent\n data-testid={containerProps?.['data-testid'] ? containerProps['data-testid'] : 'em-ds-menu'}\n {...containerProps}\n as={MenuTag}\n classProps={{ ...(otherProps.classProps || {}), type: otherProps.type }}\n innerRef={mergeRefs(innerRef, menuRef)}\n role=\"menu\"\n {...omit(otherProps, ['scheduleUpdate'])}\n {...hiddenProps}\n >\n {/* eslint-disable indent */}\n <div\n className=\"menu-component-internal-wrapper\"\n style={{\n ...style,\n minWidth,\n maxWidth,\n ...(responsiveHeight\n ? {\n overflowY: 'scroll',\n maxHeight: responsiveHeight ? `${window.innerHeight - RESPONSIVE_HEIHGT_MARGIN}px` : undefined,\n }\n : {}),\n }}\n >\n {/* eslint-enable indent */}\n {nextChildren}\n </div>\n </MenuComponent>\n </MenuContext.Provider>\n ) : null;\n};\n\nconst Menu = focusGroupManagerHoc(DSMenu, { loop: true });\n\nconst props = {\n /** Injected props to wrapper element of component */\n containerProps: PropTypes.object.description('Injected props to wrapper element of component'),\n /** Renders the menu with a specific html element */\n as: PropTypes.element.description('Renders the menu with a specific html element'),\n /** Handler when a user clicks outside the menu */\n onClickOutside: PropTypes.func.description('Handler when a user clicks outside the menu'),\n /** Whether the menu is visible or not */\n visible: PropTypes.bool.description('Whether the menu is visible or not'),\n /** When set to true, it's going to focus the first item */\n focusOnOpen: PropTypes.bool.description(\"When set to true, it's going to focus the first item\"),\n /** Customize menu minWidth. Can be undefined or 'number' */\n minWidth: PropTypes.number.description(\"Customize menu minWidth. Can be undefined or 'number'\"),\n /** Customize menu maxWidth. Can be undefined or 'number' */\n maxWidth: PropTypes.number.description(\"Customize menu maxWidth. Can be undefined or 'number'\"),\n};\n\nDSMenu.propTypes = props;\n\nconst DSMenuWithSchema = describe(DSMenu);\n\nDSMenuWithSchema.propTypes = props;\n\nMenu.Item = MenuItem;\nMenu.ItemCheckbox = MenuItemCheckbox;\nMenu.ItemRadio = MenuItemRadio;\nMenu.Separator = MenuSeparator;\nMenu.CheckboxGroup = CheckboxGroup;\nMenu.RadioGroup = RadioGroup;\nMenu.SearchableGroup = SearchableGroup;\nMenu.SelectionGroup = SelectionGroup;\n\nconst setSubMenu = (SubMenu) => Menu.SubMenu = SubMenu;\n\nexport { menuItemFactory, renderMenuItems, DSMenuWithSchema, Menu, setSubMenu };\nexport default Menu;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA8D;AAC9D,wBAAoC;AACpC,oBAAqB;AACrB,2BAAkC;AAClC,iBAAyB;AACzB,mBAAkC;AAClC,oBAA0B;AAC1B,wBAAwD;AACxD,uBAAoC;AACpC,yBAA4B;AAC5B,2BAA8B;AAC9B,8BAAiC;AACjC,2BAA8B;AAC9B,wBAA2B;AAC3B,uBAA8B;AAC9B,sBAAyB;AACzB,6BAAgC;AAChC,4BAA+B;AAC/B,6BAAgC;AAChC,6BAAgC;AAEhC,MAAM,2BAA2B;AAEjC,MAAM,YAAY;AAElB,MAAM,OAAO,MAAM;AAAA;AAEnB,MAAM,gBAAgB,4CAAkB,OAAO,WAAW,IAAI,CAAC,EAAE,cAAc,WAAY;AAAA,EACzF,kBAAkB;AAAA,GACjB,QAAQ,SAAS;AAAA;AAQpB,MAAM,gBAAgB,CAAC,OAAO,SAAU,MAAM,SAAS,QAAQ,MAAM,MAAM,SAAS;AAEpF,MAAM,SAAS,CAAC;AAAA,EACd,iBAAiB;AAAA,EACjB;AAAA,EACA,IAAI,UAAU,oBAAS;AAAA,EACvB,WAAW;AAAA,EACX,iBAAiB;AAAA,EAEjB,UAAU;AAAA,EACV,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,WAAW;AAAA,EACX;AAAA,EACA,mBAAmB;AAAA,KAChB;AAAA,MACC;AACJ,QAAM,UAAU,yBAAO;AACvB,QAAM,EAAE,eAAe,6BAAW;AAClC,QAAM,EAAE,cAAc,gBAAgB,0CAAoB,EAAE,SAAS;AAGrE,QAA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AAK,YAAY;AAAA,EAEpC,aAAa,4BAAU,KAAK,YAAY;AAAA,EAExC,UAAU,4BAAU,OAAO,YAAY;AAAA,EAEvC,UAAU,4BAAU,OAAO,YAAY;AAAA;AAGzC,OAAO,YAAY;AAEnB,MAAM,mBAAmB,gCAAS;AAElC,iBAAiB,YAAY;AAE7B,KAAK,OAAO;AACZ,KAAK,eAAe;AACpB,KAAK,YAAY;AACjB,KAAK,YAAY;AACjB,KAAK,gBAAgB;AACrB,KAAK,aAAa;AAClB,KAAK,kBAAkB;AACvB,KAAK,iBAAiB;AAEtB,MAAM,aAAa,CAAC,YAAY,KAAK,UAAU;AAG/C,IAAO,eAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -5,6 +5,10 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
8
12
|
var __reExport = (target, module2, copyDefault, desc) => {
|
|
9
13
|
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
10
14
|
for (let key of __getOwnPropNames(module2))
|
|
@@ -22,7 +26,11 @@ var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
|
22
26
|
};
|
|
23
27
|
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
24
28
|
var MenuExports_exports = {};
|
|
29
|
+
__export(MenuExports_exports, {
|
|
30
|
+
DSMenuWithSchema: () => import_Menu.DSMenuWithSchema,
|
|
31
|
+
Menu: () => import_Menu.Menu
|
|
32
|
+
});
|
|
25
33
|
var React = __toESM(require("react"));
|
|
26
|
-
|
|
34
|
+
var import_Menu = require("./Menu");
|
|
27
35
|
module.exports = __toCommonJS(MenuExports_exports);
|
|
28
36
|
//# sourceMappingURL=MenuExports.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/MenuExports.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["export { DSMenuWithSchema, Menu } from './Menu';", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,kBAAuC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
File without changes
|
|
File without changes
|
|
@@ -88,6 +88,7 @@ const MenuItem = (props2) => {
|
|
|
88
88
|
const ref = (0, import_react.useRef)(null);
|
|
89
89
|
(0, import_FocusGroup.useFocusGroupItem)(ref);
|
|
90
90
|
if (otherProps.subItems) {
|
|
91
|
+
const SubMenu = (0, import_menuItemFactory.menuItemFactory)("submenu");
|
|
91
92
|
return /* @__PURE__ */ import_react.default.createElement(SubMenu, {
|
|
92
93
|
...props2,
|
|
93
94
|
closeMenu: menuCxt.closeMenu
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/MenuItems/MenuItem.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-lines */\n/* eslint-disable import/no-cycle */\nimport React, { useRef, useMemo, useContext } from 'react';\nimport { PropTypes, describe } from 'react-desc';\nimport { omit } from 'lodash';\nimport { aggregatedClasses } from '@elliemae/ds-classnames';\nimport { mergeRefs, runAll } from '@elliemae/ds-utilities';\nimport { useFocusGroupItem } from '@elliemae/ds-shared/FocusGroup';\nimport { DSTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';\nimport { MenuContext } from '../MenuContext';\nimport { registerMenuItem, menuItemFactory } from './menuItemFactory';\nimport { renderMenuItems } from './renderMenuItems';\n\nconst noop = () => null;\n\nconst blockName = 'menu-item';\n\nconst Content = aggregatedClasses('div')(blockName, 'content');\nconst Addon = aggregatedClasses('div')(blockName, 'addon', ({ empty, fixedItem }) => ({ empty, fixedItem }));\n\nconst renderAddon = (addon, fixedItem, addonId) => (\n <Addon key={addonId} classProps={{ fixedItem }}>\n {addon}\n </Addon>\n);\n\nconst renderAddons = (addons, fixedItem) =>\n Array.isArray(addons) ? addons.map(renderAddon) : renderAddon(addons, fixedItem);\n\nconst Wrapper = aggregatedClasses('li')(\n blockName,\n null,\n ({ disabled, disabledAddonInactive, customRenderer, fixedItem, type }) => ({\n disabled,\n disabledAddonInactive,\n customRenderer,\n fixedItem,\n [`menu-type-${type}`]: type,\n }),\n);\nconst calculateSize = (length = 0) => {\n if (length > 45) return 45 * 7;\n return length * 7;\n};\n\nconst MenuItem = (props) => {\n const {\n innerRef,\n as = 'li',\n role = 'menuitem',\n leftAddon = null,\n rightAddon = undefined,\n disabledAddonInactive = undefined,\n label = undefined,\n children,\n tabIndex = -1,\n onKeyDown = noop,\n fixedItem = false,\n noAddon,\n disabled = false,\n customRenderer,\n maxOption,\n closeMenu,\n style,\n ...otherProps\n } = props;\n\n const menuCxt = useContext(MenuContext);\n const ref = useRef(null);\n useFocusGroupItem(ref);\n if (otherProps.subItems) {\n const SubMenu = menuItemFactory('submenu');\n return (\n <SubMenu {...props} closeMenu={menuCxt.closeMenu}>\n {renderMenuItems(otherProps.subItems)}\n </SubMenu>\n );\n }\n\n const wrapperProps = useMemo(() => omit(otherProps, ['icon']), [otherProps]);\n\n const onClick = (...args) => {\n if (wrapperProps.onClick) wrapperProps.onClick(...args);\n if (wrapperProps.closeOnClick && menuCxt.closeMenu) {\n menuCxt.closeMenu(...args);\n }\n };\n\n return (\n <Wrapper\n as={as}\n classProps={{\n disabled,\n disabledAddonInactive,\n customRenderer,\n fixedItem,\n type: otherProps.type,\n }}\n id={otherProps.id}\n innerRef={otherProps.type !== 'disabled' ? mergeRefs(innerRef, ref) : innerRef}\n onKeyDown={\n !fixedItem &&\n runAll((e) => {\n if (e.key === ' ' || e.key === 'Enter') {\n e.preventDefault();\n e.target.dispatchEvent(\n new MouseEvent('click', {\n view: window,\n bubbles: true,\n cancelable: false,\n }),\n );\n }\n }, onKeyDown)\n }\n role={role}\n style={style}\n tabIndex={tabIndex}\n {...wrapperProps}\n onClick={onClick}\n >\n {!noAddon && renderAddons(leftAddon, fixedItem)}\n {label && (\n <Content\n style={\n maxOption > 0\n ? {\n width: `${calculateSize(maxOption)}px`,\n maxWidth: `${calculateSize(maxOption)}px`,\n }\n : undefined\n }\n >\n <DSTruncatedTooltipText value={label} />\n </Content>\n )}\n {customRenderer}\n {rightAddon && renderAddons(rightAddon)}\n {children}\n </Wrapper>\n );\n};\n\nconst props = {\n /** Renders the MenuItem with a specific html element */\n as: PropTypes.element.description('Renders the MenuItem with a specific html element'),\n /**\n * reference to the component\n */\n innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({ current: PropTypes.any })]).description(\n 'reference to the component',\n ),\n /** Renders the passed element to the left */\n leftAddon: PropTypes.element.description('Renders the passed element to the left'),\n /** Renders the passed element to the right */\n rightAddon: PropTypes.element.description('Renders the passed element to the right'),\n /** Label for the menu item */\n label: PropTypes.string.description('Label for the menu item'),\n /** style object for menu item wrapper */\n style: PropTypes.object.description('style object for menu item wrapper'),\n /** disable menu item */\n disabled: PropTypes.bool.description('disable menu item'),\n /** HTML tabindex to manage focus order */\n tabindex: PropTypes.number.description('HTML tabindex to manage focus order'),\n /** a11y role */\n role: PropTypes.string.description('a11y role'),\n};\n\nMenuItem.propTypes = props;\nregisterMenuItem('menuitem', MenuItem);\n\nconst DSMenuItemWithSchema = describe(MenuItem);\nDSMenuItemWithSchema.propTypes = props;\n\nexport { DSMenuItemWithSchema, MenuItem };\nexport default MenuItem;\n", "import * as React from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BAAU,UAAU,CAAC,4BAAU,MAAM,4BAAU,MAAM,EAAE,SAAS,4BAAU,SAAS,YAC3F;AAAA,EAGF,WAAW,4BAAU,QAAQ,YAAY;AAAA,EAEzC,YAAY,4BAAU,QAAQ,YAAY;AAAA,EAE1C,OAAO,4BAAU,OAAO,YAAY;AAAA,EAEpC,OAAO,4BAAU,OAAO,YAAY;AAAA,EAEpC,UAAU,4BAAU,KAAK,YAAY;AAAA,EAErC,UAAU,4BAAU,OAAO,YAAY;AAAA,EAEvC,MAAM,4BAAU,OAAO,YAAY;AAAA;AAGrC,SAAS,YAAY;AACrB,6CAAiB,YAAY;AAE7B,MAAM,uBAAuB,gCAAS;AACtC,qBAAqB,YAAY;AAGjC,IAAO,mBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
File without changes
|
|
File without changes
|
|
@@ -32,12 +32,12 @@ __export(MenuItemCheckbox_exports, {
|
|
|
32
32
|
});
|
|
33
33
|
var React = __toESM(require("react"));
|
|
34
34
|
var import_react = __toESM(require("react"));
|
|
35
|
-
var
|
|
35
|
+
var import_Checkbox = require("@elliemae/ds-form/Checkbox");
|
|
36
36
|
var import_MenuItemCheckable = require("./MenuItemCheckable");
|
|
37
37
|
var import_menuItemFactory = require("./menuItemFactory");
|
|
38
38
|
const MenuItemCheckbox = ({ checked, ...rest }) => /* @__PURE__ */ import_react.default.createElement(import_MenuItemCheckable.MenuItemCheckable, {
|
|
39
39
|
...rest,
|
|
40
|
-
leftAddon: /* @__PURE__ */ import_react.default.createElement(
|
|
40
|
+
leftAddon: /* @__PURE__ */ import_react.default.createElement(import_Checkbox.DSCheckbox, {
|
|
41
41
|
checked
|
|
42
42
|
}),
|
|
43
43
|
role: "menuitemcheckbox"
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/MenuItems/MenuItemCheckbox.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { DSCheckbox } from '@elliemae/ds-form/Checkbox';\nimport { MenuItemCheckable } from './MenuItemCheckable';\nimport { registerMenuItem } from './menuItemFactory';\n\nconst MenuItemCheckbox = ({ checked, ...rest }) => (\n <MenuItemCheckable {...rest} leftAddon={<DSCheckbox checked={checked} />} role=\"menuitemcheckbox\" />\n);\n\nregisterMenuItem('checkbox', MenuItemCheckbox);\nexport { MenuItemCheckbox };\nexport default MenuItemCheckbox;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkB;AAClB,sBAA2B;AAC3B,+BAAkC;AAClC,6BAAiC;AAEjC,MAAM,mBAAmB,CAAC,EAAE,YAAY,WACtC,mDAAC,4CAAD;AAAA,KAAuB;AAAA,EAAM,WAAW,mDAAC,4BAAD;AAAA,IAAY;AAAA;AAAA,EAAsB,MAAK;AAAA;AAGjF,6CAAiB,YAAY;AAE7B,IAAO,2BAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -35,7 +35,7 @@ var React = __toESM(require("react"));
|
|
|
35
35
|
var import_react = __toESM(require("react"));
|
|
36
36
|
var import_ds_classnames = require("@elliemae/ds-classnames");
|
|
37
37
|
var import_FocusGroup = require("@elliemae/ds-shared/FocusGroup");
|
|
38
|
-
var
|
|
38
|
+
var import_SearchBox = require("@elliemae/ds-form/SearchBox");
|
|
39
39
|
var import_react_desc = require("react-desc");
|
|
40
40
|
var import_VirtualMenuList = require("../VirtualMenuList");
|
|
41
41
|
var import_MenuContext = require("../MenuContext");
|
|
@@ -66,7 +66,7 @@ const SearchableGroup = ({
|
|
|
66
66
|
}
|
|
67
67
|
}, [focusOnOpen, visible]);
|
|
68
68
|
const filteredChildren = (0, import_react.useMemo)(() => children.filter((child) => !searchTerm || child.props.label.toLowerCase().startsWith(searchTerm.toLowerCase())), [children, searchTerm]);
|
|
69
|
-
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(SearchBoxWrapper, null, /* @__PURE__ */ import_react.default.createElement(
|
|
69
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(SearchBoxWrapper, null, /* @__PURE__ */ import_react.default.createElement(import_SearchBox.DSSearchBox, {
|
|
70
70
|
innerRef: searchRef,
|
|
71
71
|
onSearch: ({ value }) => setSearchTerm(value),
|
|
72
72
|
searchOnEnter: false,
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/MenuItems/SearchableGroup.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React, { useEffect, useMemo, useState, useRef, useContext } from 'react';\nimport { aggregatedClasses } from '@elliemae/ds-classnames';\nimport { focusGroupManagerHoc } from '@elliemae/ds-shared/FocusGroup';\nimport { DSSearchBox } from '@elliemae/ds-form/SearchBox';\nimport { PropTypes, describe } from 'react-desc';\nimport { VirtualMenuList } from '../VirtualMenuList';\nimport { MenuContext } from '../MenuContext';\n\nconst SearchBoxWrapper = aggregatedClasses('div')(\n 'menu-search-group',\n 'search-wrapper',\n);\nconst NoOptionsWrapper = aggregatedClasses('div')(\n 'menu-search-group',\n 'no-options',\n);\n\nconst SearchableGroup = ({\n children,\n amountItemsInWindow = 5,\n searchTerm: searchTermProp = '',\n noOptionsText = 'No options',\n height,\n width,\n focusOnOpen = false,\n}) => {\n const searchRef = useRef(null);\n const [searchTerm, setSearchTerm] = useState(searchTermProp);\n\n useEffect(() => {\n if (searchRef.current) searchRef.current.focus();\n }, []);\n\n const { visible } = useContext(MenuContext) || {};\n\n useEffect(() => {\n if (focusOnOpen && visible) {\n setTimeout(() => {\n if (searchRef.current) searchRef.current.focus();\n }, 0);\n }\n }, [focusOnOpen, visible]);\n\n const filteredChildren = useMemo(\n () =>\n children.filter(\n (child) =>\n !searchTerm ||\n child.props.label.toLowerCase().startsWith(searchTerm.toLowerCase()),\n ),\n [children, searchTerm],\n );\n\n return (\n <>\n <SearchBoxWrapper>\n <DSSearchBox\n innerRef={searchRef}\n onSearch={({ value }) => setSearchTerm(value)}\n searchOnEnter={false}\n showIcon={false}\n value={searchTerm}\n />\n </SearchBoxWrapper>\n {!filteredChildren.length && (\n <NoOptionsWrapper>{noOptionsText}</NoOptionsWrapper>\n )}\n <VirtualMenuList\n amountItemsInWindow={amountItemsInWindow}\n height={height}\n items={filteredChildren}\n width={width}\n />\n </>\n );\n};\n\nconst props = {\n /** The amount of items that are going to be rendered in the group */\n amountItemsInWindow: PropTypes.number.description(\n 'The amount of items that are going to be rendered in the group',\n ),\n /** A search term */\n searchTerm: PropTypes.string.description('A search term'),\n /** Text to show when there's no options to show */\n noOptionsText: PropTypes.string.description(\n \"Text to show when there's no options to show\",\n ),\n /** array of children for search list */\n children: PropTypes.array.description('array of children for search list'),\n /** height for virtual list wrapper */\n height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).description(\n 'height for virtual list wrapper',\n ),\n /** width for virtual list wrapper */\n width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).description(\n 'width for virtual list wrapper',\n ),\n /** weather to focus on searchable group on open */\n focusOnOpen: PropTypes.bool.description(\n 'weather to focus on searchable group on open',\n ),\n};\n\nSearchableGroup.propTypes = props;\n\nconst DSMenuSearchableGroupWithSchema = describe(SearchableGroup);\nDSMenuSearchableGroupWithSchema.propTypes = props;\n\nconst SearchableGroupHOC = focusGroupManagerHoc(SearchableGroup);\n\nexport { DSMenuSearchableGroupWithSchema, SearchableGroupHOC as SearchableGroup };\nexport default SearchableGroupHOC;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA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AAe,4BAAU,OAAO,YAC9B;AAAA,EAGF,UAAU,4BAAU,MAAM,YAAY;AAAA,EAEtC,QAAQ,4BAAU,UAAU,CAAC,4BAAU,QAAQ,4BAAU,SAAS,YAChE;AAAA,EAGF,OAAO,4BAAU,UAAU,CAAC,4BAAU,QAAQ,4BAAU,SAAS,YAC/D;AAAA,EAGF,aAAa,4BAAU,KAAK,YAC1B;AAAA;AAIJ,gBAAgB,YAAY;AAE5B,MAAM,kCAAkC,gCAAS;AACjD,gCAAgC,YAAY;AAE5C,MAAM,qBAAqB,4CAAqB;AAGhD,IAAO,0BAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -34,12 +34,12 @@ __export(SubMenu_exports, {
|
|
|
34
34
|
var React = __toESM(require("react"));
|
|
35
35
|
var import_react = __toESM(require("react"));
|
|
36
36
|
var import_react_desc = require("react-desc");
|
|
37
|
+
var import_styled_components = __toESM(require("styled-components"));
|
|
37
38
|
var import_ds_icons = require("@elliemae/ds-icons");
|
|
38
39
|
var import_FocusGroup = require("@elliemae/ds-shared/FocusGroup");
|
|
39
40
|
var import_ds_hidden = require("@elliemae/ds-hidden");
|
|
40
41
|
var import_ds_button = require("@elliemae/ds-button");
|
|
41
42
|
var import_ds_popper = require("@elliemae/ds-popper");
|
|
42
|
-
var import_styled_components = __toESM(require("styled-components"));
|
|
43
43
|
var import_Menu = require("../Menu");
|
|
44
44
|
var import_MenuItem = require("./MenuItem");
|
|
45
45
|
var import_menuItemFactory = require("./menuItemFactory");
|
|
@@ -179,6 +179,7 @@ const props = {
|
|
|
179
179
|
};
|
|
180
180
|
SubMenu.propTypes = props;
|
|
181
181
|
(0, import_menuItemFactory.registerMenuItem)("submenu", SubMenu);
|
|
182
|
+
(0, import_Menu.setSubMenu)(SubMenu);
|
|
182
183
|
const DSSubMenuWithSchema = (0, import_react_desc.describe)(SubMenu);
|
|
183
184
|
DSSubMenuWithSchema.propTypes = props;
|
|
184
185
|
var SubMenu_default = SubMenu;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/MenuItems/SubMenu.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable indent */\n/* eslint-disable max-lines */\nimport React, { useCallback, useRef, useState } from 'react';\nimport { PropTypes, describe } from 'react-desc';\nimport styled from 'styled-components';\nimport { ChevronSmallRight, MoreOptionsVert } from '@elliemae/ds-icons';\nimport { useFocusGroupItem } from '@elliemae/ds-shared/FocusGroup';\nimport { useHiddenController } from '@elliemae/ds-hidden';\nimport { DSButton, BUTTON_VARIANT } from '@elliemae/ds-button';\nimport { DSPopper, interactions } from '@elliemae/ds-popper';\nimport { Menu, setSubMenu } from '../Menu';\nimport { MenuItem } from './MenuItem';\nimport { registerMenuItem } from './menuItemFactory';\n\nconst ChevronRightComp = styled.div`\n display: flex;\n justify-content: center;\n align-items: center;\n width: 28px; // same width as the ellipsis button\n`;\n\nconst SubMenu = ({\n noAddon,\n leftAddon = undefined,\n label = undefined,\n interactionType = 'hover',\n children: subitems,\n rightAddonType,\n disabledAddonInactive,\n checkableProps = {},\n customRenderer,\n onClick,\n closeMenu,\n id,\n}) => {\n const itemRef = useRef(null);\n const focusOnOpen = useRef(false);\n const [isAddonHovered, setIsAddonHovered] = useState<boolean>(false);\n const {\n visible = false,\n onShow,\n onHide,\n } = useHiddenController(undefined, {\n interaction: 'click',\n });\n\n const interaction = rightAddonType === 'elipsis' ? 'click' : 'hover';\n\n const { focusItemByNode } = useFocusGroupItem();\n // todo: create a menu state to handle all related menu things\n const handleShowSubItemsWithMouse = (e) => {\n e.stopPropagation();\n onShow();\n focusOnOpen.current = true;\n };\n const handleShowWithMouse = (e) => {\n if (onClick) onClick(e);\n };\n const handleShowWithMouseHover = () => {\n setIsAddonHovered(true);\n onShow();\n focusOnOpen.current = false;\n };\n\n const handleShowWithKeyboard = () => {\n onShow();\n focusOnOpen.current = true;\n };\n\n const handleOnMouseEnter = useCallback(() => {\n setIsAddonHovered(true);\n }, []);\n\n const handleOnMouseLeave = useCallback(() => {\n setIsAddonHovered(false);\n }, []);\n\n const hoverHandlers =\n interaction === 'hover'\n ? {\n onMouseEnter: handleShowWithMouseHover,\n onMouseLeave: () => {\n onHide();\n setIsAddonHovered(false);\n },\n }\n : { onClick: handleShowWithMouse };\n\n const rightAddon =\n rightAddonType === 'elipsis' ? (\n <DSButton\n aria-label=\"vertical-elipsis\"\n data-testid=\"vertical-elipsis\"\n buttonType=\"text\"\n leftIcon={\n <MoreOptionsVert\n className=\"submenu-arrow\"\n color={visible || isAddonHovered ? ['brand-primary', 800] : ['neutral', 500]}\n size=\"s\"\n />\n }\n onClick={(e) => handleShowSubItemsWithMouse(e)}\n size=\"m\"\n variant={BUTTON_VARIANT.DEFAULT}\n />\n ) : (\n <ChevronRightComp>\n <ChevronSmallRight\n data-testid=\"chevron-right\"\n className=\"submenu-arrow\"\n color={visible || isAddonHovered ? ['brand-primary', 800] : ['neutral', 500]}\n size=\"sm\"\n />\n </ChevronRightComp>\n );\n\n return (\n <>\n <DSPopper\n contentComponent={\n <Menu\n focusKeyBindings={{\n ArrowLeft: [() => focusItemByNode(itemRef.current), 'exit'],\n }}\n focusOnOpen={focusOnOpen.current}\n onExitFocusGroup={onHide}\n {...hoverHandlers}\n closeMenu={closeMenu}\n visible={visible}\n >\n {subitems}\n </Menu>\n }\n interactionType={interactionType}\n isOpen={visible}\n onOpen={(opening) => (opening ? onShow() : onHide())}\n placement=\"right-start\"\n showArrow={false}\n triggerComponent={\n <MenuItem\n customRenderer={customRenderer}\n disabledAddonInactive={disabledAddonInactive}\n id={id}\n innerRef={itemRef}\n label={label}\n leftAddon={leftAddon}\n noAddon={noAddon}\n onFocus={handleOnMouseEnter}\n onBlur={handleOnMouseLeave}\n onMouseEnter={handleOnMouseEnter}\n onMouseLeave={handleOnMouseLeave}\n {...hoverHandlers}\n onKeyDown={(e) => {\n if (e.key === 'ArrowRight' || e.key === 'Enter' || e.keyCode === 32) {\n handleShowWithKeyboard();\n }\n }}\n rightAddon={rightAddon}\n {...checkableProps}\n />\n }\n />\n </>\n );\n};\n\nconst props = {\n /** dont show addon for submenu */\n noAddon: PropTypes.bool.description('dont show addon for submenu'),\n /** left addon */\n leftAddon: PropTypes.node.description('left addon'),\n /** submenu label */\n label: PropTypes.string.description('submenu label'),\n /** A type indicating how to open/close the tooltip */\n interactionType: PropTypes.oneOf(interactions).description('A type indicating how to open/close the tooltip'),\n /** sub menu items */\n children: PropTypes.oneOfType([PropTypes.array, PropTypes.node]).description('sub menu items'),\n /** right addon, ellipsis or undefined */\n rightAddonType: PropTypes.oneOf(['ellipsis']).description('right addon, ellipsis or undefined'),\n disabledAddonInactive: PropTypes.bool.description(''),\n /** props passed to MenuItem component */\n checkableProps: PropTypes.object.description('props passed to MenuItem component'),\n /** custom renderer for menu item */\n customRenderer: PropTypes.func.description('custom renderer for menu item'),\n /** on click handler */\n onClick: PropTypes.func.description('on click handler'),\n closeMenu: PropTypes.any.description(''),\n /** component id */\n id: PropTypes.string.description('component id'),\n};\n\nSubMenu.propTypes = props;\nregisterMenuItem('submenu', SubMenu);\nsetSubMenu(SubMenu);\nconst DSSubMenuWithSchema = describe(SubMenu);\n\nDSSubMenuWithSchema.propTypes = props;\n\nexport { DSSubMenuWithSchema, SubMenu };\nexport default SubMenu;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,mBAAqD;AACrD,wBAAoC;AACpC,+BAAmB;AACnB,sBAAmD;AACnD,wBAAkC;AAClC,uBAAoC;AACpC,uBAAyC;AACzC,uBAAuC;AACvC,kBAAiC;AACjC,sBAAyB;AACzB,6BAAiC;AAEjC,MAAM,mBA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AA,EAE7E,gBAAgB,4BAAU,MAAM,CAAC,aAAa,YAAY;AAAA,EAC1D,uBAAuB,4BAAU,KAAK,YAAY;AAAA,EAElD,gBAAgB,4BAAU,OAAO,YAAY;AAAA,EAE7C,gBAAgB,4BAAU,KAAK,YAAY;AAAA,EAE3C,SAAS,4BAAU,KAAK,YAAY;AAAA,EACpC,WAAW,4BAAU,IAAI,YAAY;AAAA,EAErC,IAAI,4BAAU,OAAO,YAAY;AAAA;AAGnC,QAAQ,YAAY;AACpB,6CAAiB,WAAW;AAC5B,4BAAW;AACX,MAAM,sBAAsB,gCAAS;AAErC,oBAAoB,YAAY;AAGhC,IAAO,kBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
File without changes
|
|
File without changes
|
|
@@ -32,7 +32,8 @@ __export(renderMenuItems_exports, {
|
|
|
32
32
|
var React = __toESM(require("react"));
|
|
33
33
|
var import_react = __toESM(require("react"));
|
|
34
34
|
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
35
|
-
|
|
35
|
+
var import_menuItemFactory = require("./menuItemFactory");
|
|
36
|
+
const renderMenuItems = (options, factory = import_menuItemFactory.menuItemFactory) => options.map((option, index) => {
|
|
36
37
|
if ((0, import_ds_utilities.isFunction)(option.renderer)) {
|
|
37
38
|
return option.renderer({
|
|
38
39
|
key: option.id,
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/MenuItems/renderMenuItems.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable import/no-cycle */\nimport React from 'react';\nimport { isFunction } from '@elliemae/ds-utilities';\nimport { menuItemFactory } from './menuItemFactory';\n\nexport const renderMenuItems = (options, factory = menuItemFactory) =>\n options.map((option, index) => {\n if (isFunction(option.renderer)) {\n return option.renderer({\n key: option.id,\n item: option,\n });\n }\n const ItemComponent = factory(option.type);\n const children = option.subItems && renderMenuItems(option.subItems, factory);\n return (\n <ItemComponent\n {...option}\n key={option.id || index}\n item={option}\n onClick={null}\n onMouseDown={option.onClick}\n // onClick callback called in onMouseDown due to events order issue\n >\n {children}\n </ItemComponent>\n );\n });\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAAkB;AAClB,0BAA2B;AAC3B,6BAAgC;AAEzB,MAAM,kBAAkB,CAAC,SAAS,UAAU,2CACjD,QAAQ,IAAI,CAAC,QAAQ,UAAU;AAC7B,MAAI,oCAAW,OAAO,WAAW;AAC/B,WAAO,OAAO,SAAS;AAAA,MACrB,KAAK,OAAO;AAAA,MACZ,MAAM;AAAA;AAAA;AAGV,QAAM,gBAAgB,QAAQ,OAAO;AACrC,QAAM,WAAW,OAAO,YAAY,gBAAgB,OAAO,UAAU;AACrE,SACE,mDAAC,eAAD;AAAA,OACM;AAAA,IACJ,KAAK,OAAO,MAAM;AAAA,IAClB,MAAM;AAAA,IACN,SAAS;AAAA,IACT,aAAa,OAAO;AAAA,KAGnB;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/{esm → dist/esm}/Menu.js
RENAMED
|
@@ -8,18 +8,17 @@ import { useOnClickOutside } from "@elliemae/ds-utilities/hooks";
|
|
|
8
8
|
import { mergeRefs } from "@elliemae/ds-utilities/system";
|
|
9
9
|
import { focusGroupManagerHoc, FocusGroupContext } from "@elliemae/ds-shared/FocusGroup";
|
|
10
10
|
import { useHiddenTransition } from "@elliemae/ds-hidden";
|
|
11
|
+
import { MenuContext } from "./MenuContext";
|
|
11
12
|
import { MenuItemRadio } from "./MenuItems/MenuItemRadio";
|
|
12
13
|
import { MenuItemCheckbox } from "./MenuItems/MenuItemCheckbox";
|
|
13
14
|
import { CheckboxGroup } from "./MenuItems/CheckboxGroup";
|
|
14
15
|
import { RadioGroup } from "./MenuItems/RadioGroup";
|
|
15
16
|
import { MenuSeparator } from "./MenuItems/Separator";
|
|
16
17
|
import { MenuItem } from "./MenuItems/MenuItem";
|
|
17
|
-
import { SubMenu } from "./MenuItems/SubMenu";
|
|
18
18
|
import { SearchableGroup } from "./MenuItems/SearchableGroup";
|
|
19
19
|
import { SelectionGroup } from "./MenuItems/SelectionGroup";
|
|
20
20
|
import { menuItemFactory } from "./MenuItems/menuItemFactory";
|
|
21
21
|
import { renderMenuItems } from "./MenuItems/renderMenuItems";
|
|
22
|
-
import { MenuContext } from "./MenuContext";
|
|
23
22
|
const RESPONSIVE_HEIHGT_MARGIN = 120;
|
|
24
23
|
const blockName = "menu";
|
|
25
24
|
const noop = () => {
|
|
@@ -28,7 +27,7 @@ const MenuComponent = aggregatedClasses("div")(blockName, "", ({ menuComboBox, t
|
|
|
28
27
|
"menu-combo-box": menuComboBox,
|
|
29
28
|
[`type-${type}`]: type
|
|
30
29
|
}));
|
|
31
|
-
const isChildOfType = (child, type) => child.type.name === type;
|
|
30
|
+
const isChildOfType = (child, type) => child.type === type || child.type?.name === type;
|
|
32
31
|
const DSMenu = ({
|
|
33
32
|
containerProps = {},
|
|
34
33
|
innerRef,
|
|
@@ -105,18 +104,19 @@ DSMenuWithSchema.propTypes = props;
|
|
|
105
104
|
Menu.Item = MenuItem;
|
|
106
105
|
Menu.ItemCheckbox = MenuItemCheckbox;
|
|
107
106
|
Menu.ItemRadio = MenuItemRadio;
|
|
108
|
-
Menu.SubMenu = SubMenu;
|
|
109
107
|
Menu.Separator = MenuSeparator;
|
|
110
108
|
Menu.CheckboxGroup = CheckboxGroup;
|
|
111
109
|
Menu.RadioGroup = RadioGroup;
|
|
112
110
|
Menu.SearchableGroup = SearchableGroup;
|
|
113
111
|
Menu.SelectionGroup = SelectionGroup;
|
|
112
|
+
const setSubMenu = (SubMenu) => Menu.SubMenu = SubMenu;
|
|
114
113
|
var Menu_default = Menu;
|
|
115
114
|
export {
|
|
116
115
|
DSMenuWithSchema,
|
|
117
116
|
Menu,
|
|
118
117
|
Menu_default as default,
|
|
119
118
|
menuItemFactory,
|
|
120
|
-
renderMenuItems
|
|
119
|
+
renderMenuItems,
|
|
120
|
+
setSubMenu
|
|
121
121
|
};
|
|
122
122
|
//# sourceMappingURL=Menu.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/Menu.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext, useEffect, useMemo, useRef } from 'react';\nimport { PropTypes, describe } from 'react-desc';\nimport { omit } from 'lodash';\nimport { aggregatedClasses } from '@elliemae/ds-classnames';\nimport { animated } from 'react-spring/web';\nimport { useOnClickOutside } from '@elliemae/ds-utilities/hooks';\nimport { mergeRefs } from '@elliemae/ds-utilities/system';\nimport { focusGroupManagerHoc, FocusGroupContext } from '@elliemae/ds-shared/FocusGroup';\nimport { useHiddenTransition } from '@elliemae/ds-hidden';\nimport { MenuContext } from './MenuContext';\nimport { MenuItemRadio } from './MenuItems/MenuItemRadio';\nimport { MenuItemCheckbox } from './MenuItems/MenuItemCheckbox';\nimport { CheckboxGroup } from './MenuItems/CheckboxGroup';\nimport { RadioGroup } from './MenuItems/RadioGroup';\nimport { MenuSeparator } from './MenuItems/Separator';\nimport { MenuItem } from './MenuItems/MenuItem';\nimport { SearchableGroup } from './MenuItems/SearchableGroup';\nimport { SelectionGroup } from './MenuItems/SelectionGroup';\nimport { menuItemFactory } from './MenuItems/menuItemFactory';\nimport { renderMenuItems } from './MenuItems/renderMenuItems';\n\nconst RESPONSIVE_HEIHGT_MARGIN = 120;\n\nconst blockName = 'menu';\n\nconst noop = () => {};\n\nconst MenuComponent = aggregatedClasses('div')(blockName, '', ({ menuComboBox, type }) => ({\n 'menu-combo-box': menuComboBox,\n [`type-${type}`]: type,\n}));\n\n/**\n * todo: -- IDEA -- each menu could have an overlay based on an overlay stack context so we can\n * capture the context of the clicks on very nested components\n */\n\nconst isChildOfType = (child, type) => (child.type === type || child.type?.name === type);\n\nconst DSMenu = ({\n containerProps = {},\n innerRef,\n as: MenuTag = animated.ul,\n children = undefined,\n onClickOutside = noop,\n // handlers from hidden\n visible = undefined,\n focusOnOpen = false,\n maxOption = 0,\n style = {},\n minWidth = undefined,\n maxWidth = undefined,\n closeMenu,\n responsiveHeight = false,\n ...otherProps\n}) => {\n const menuRef = useRef(null);\n const { focusFirst } = useContext(FocusGroupContext);\n const { destroyed, ...hiddenProps } = useHiddenTransition({ visible, style });\n\n // force no addon to the children if the menu doesn't have any item with leftAddon like SelectionGroup\n const nextChildren = useMemo(() => {\n const forceLeftAddon = React.Children.toArray(children).some(\n (child) =>\n isChildOfType(child, 'SelectionGroup') ||\n isChildOfType(child, 'MenuItemCheckbox') ||\n isChildOfType(child, 'MenuItemRadio') ||\n child.props.leftAddon,\n );\n\n return React.Children.map(\n children,\n (child) =>\n child &&\n React.cloneElement(child, {\n ...child.props,\n noAddon: !forceLeftAddon ? true : undefined,\n maxOption,\n closeMenu,\n }),\n );\n }, [children]);\n\n useOnClickOutside(menuRef, onClickOutside);\n\n useEffect(() => {\n if (focusOnOpen && visible) {\n setTimeout(() => {\n focusFirst();\n }, 0);\n }\n }, [visible, focusOnOpen]);\n // todo: find out a better approach to this\n return !hiddenProps.destroyed ? (\n <MenuContext.Provider value={{ visible, closeMenu }}>\n <MenuComponent\n data-testid={containerProps?.['data-testid'] ? containerProps['data-testid'] : 'em-ds-menu'}\n {...containerProps}\n as={MenuTag}\n classProps={{ ...(otherProps.classProps || {}), type: otherProps.type }}\n innerRef={mergeRefs(innerRef, menuRef)}\n role=\"menu\"\n {...omit(otherProps, ['scheduleUpdate'])}\n {...hiddenProps}\n >\n {/* eslint-disable indent */}\n <div\n className=\"menu-component-internal-wrapper\"\n style={{\n ...style,\n minWidth,\n maxWidth,\n ...(responsiveHeight\n ? {\n overflowY: 'scroll',\n maxHeight: responsiveHeight ? `${window.innerHeight - RESPONSIVE_HEIHGT_MARGIN}px` : undefined,\n }\n : {}),\n }}\n >\n {/* eslint-enable indent */}\n {nextChildren}\n </div>\n </MenuComponent>\n </MenuContext.Provider>\n ) : null;\n};\n\nconst Menu = focusGroupManagerHoc(DSMenu, { loop: true });\n\nconst props = {\n /** Injected props to wrapper element of component */\n containerProps: PropTypes.object.description('Injected props to wrapper element of component'),\n /** Renders the menu with a specific html element */\n as: PropTypes.element.description('Renders the menu with a specific html element'),\n /** Handler when a user clicks outside the menu */\n onClickOutside: PropTypes.func.description('Handler when a user clicks outside the menu'),\n /** Whether the menu is visible or not */\n visible: PropTypes.bool.description('Whether the menu is visible or not'),\n /** When set to true, it's going to focus the first item */\n focusOnOpen: PropTypes.bool.description(\"When set to true, it's going to focus the first item\"),\n /** Customize menu minWidth. Can be undefined or 'number' */\n minWidth: PropTypes.number.description(\"Customize menu minWidth. Can be undefined or 'number'\"),\n /** Customize menu maxWidth. Can be undefined or 'number' */\n maxWidth: PropTypes.number.description(\"Customize menu maxWidth. Can be undefined or 'number'\"),\n};\n\nDSMenu.propTypes = props;\n\nconst DSMenuWithSchema = describe(DSMenu);\n\nDSMenuWithSchema.propTypes = props;\n\nMenu.Item = MenuItem;\nMenu.ItemCheckbox = MenuItemCheckbox;\nMenu.ItemRadio = MenuItemRadio;\nMenu.Separator = MenuSeparator;\nMenu.CheckboxGroup = CheckboxGroup;\nMenu.RadioGroup = RadioGroup;\nMenu.SearchableGroup = SearchableGroup;\nMenu.SelectionGroup = SelectionGroup;\n\nconst setSubMenu = (SubMenu) => Menu.SubMenu = SubMenu;\n\nexport { menuItemFactory, renderMenuItems, DSMenuWithSchema, Menu, setSubMenu };\nexport default Menu;\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/MenuExports.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export { DSMenuWithSchema, Menu } from './Menu';"],
|
|
5
5
|
"mappings": "AAAA;ACAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
File without changes
|
|
File without changes
|
|
@@ -7,7 +7,7 @@ import { mergeRefs, runAll } from "@elliemae/ds-utilities";
|
|
|
7
7
|
import { useFocusGroupItem } from "@elliemae/ds-shared/FocusGroup";
|
|
8
8
|
import { DSTruncatedTooltipText } from "@elliemae/ds-truncated-tooltip-text";
|
|
9
9
|
import { MenuContext } from "../MenuContext";
|
|
10
|
-
import { registerMenuItem } from "./menuItemFactory";
|
|
10
|
+
import { registerMenuItem, menuItemFactory } from "./menuItemFactory";
|
|
11
11
|
import { renderMenuItems } from "./renderMenuItems";
|
|
12
12
|
const noop = () => null;
|
|
13
13
|
const blockName = "menu-item";
|
|
@@ -55,6 +55,7 @@ const MenuItem = (props2) => {
|
|
|
55
55
|
const ref = useRef(null);
|
|
56
56
|
useFocusGroupItem(ref);
|
|
57
57
|
if (otherProps.subItems) {
|
|
58
|
+
const SubMenu = menuItemFactory("submenu");
|
|
58
59
|
return /* @__PURE__ */ React2.createElement(SubMenu, {
|
|
59
60
|
...props2,
|
|
60
61
|
closeMenu: menuCxt.closeMenu
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/MenuItems/MenuItem.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\n/* eslint-disable import/no-cycle */\nimport React, { useRef, useMemo, useContext } from 'react';\nimport { PropTypes, describe } from 'react-desc';\nimport { omit } from 'lodash';\nimport { aggregatedClasses } from '@elliemae/ds-classnames';\nimport { mergeRefs, runAll } from '@elliemae/ds-utilities';\nimport { useFocusGroupItem } from '@elliemae/ds-shared/FocusGroup';\nimport { DSTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';\nimport { MenuContext } from '../MenuContext';\nimport { registerMenuItem, menuItemFactory } from './menuItemFactory';\nimport { renderMenuItems } from './renderMenuItems';\n\nconst noop = () => null;\n\nconst blockName = 'menu-item';\n\nconst Content = aggregatedClasses('div')(blockName, 'content');\nconst Addon = aggregatedClasses('div')(blockName, 'addon', ({ empty, fixedItem }) => ({ empty, fixedItem }));\n\nconst renderAddon = (addon, fixedItem, addonId) => (\n <Addon key={addonId} classProps={{ fixedItem }}>\n {addon}\n </Addon>\n);\n\nconst renderAddons = (addons, fixedItem) =>\n Array.isArray(addons) ? addons.map(renderAddon) : renderAddon(addons, fixedItem);\n\nconst Wrapper = aggregatedClasses('li')(\n blockName,\n null,\n ({ disabled, disabledAddonInactive, customRenderer, fixedItem, type }) => ({\n disabled,\n disabledAddonInactive,\n customRenderer,\n fixedItem,\n [`menu-type-${type}`]: type,\n }),\n);\nconst calculateSize = (length = 0) => {\n if (length > 45) return 45 * 7;\n return length * 7;\n};\n\nconst MenuItem = (props) => {\n const {\n innerRef,\n as = 'li',\n role = 'menuitem',\n leftAddon = null,\n rightAddon = undefined,\n disabledAddonInactive = undefined,\n label = undefined,\n children,\n tabIndex = -1,\n onKeyDown = noop,\n fixedItem = false,\n noAddon,\n disabled = false,\n customRenderer,\n maxOption,\n closeMenu,\n style,\n ...otherProps\n } = props;\n\n const menuCxt = useContext(MenuContext);\n const ref = useRef(null);\n useFocusGroupItem(ref);\n if (otherProps.subItems) {\n const SubMenu = menuItemFactory('submenu');\n return (\n <SubMenu {...props} closeMenu={menuCxt.closeMenu}>\n {renderMenuItems(otherProps.subItems)}\n </SubMenu>\n );\n }\n\n const wrapperProps = useMemo(() => omit(otherProps, ['icon']), [otherProps]);\n\n const onClick = (...args) => {\n if (wrapperProps.onClick) wrapperProps.onClick(...args);\n if (wrapperProps.closeOnClick && menuCxt.closeMenu) {\n menuCxt.closeMenu(...args);\n }\n };\n\n return (\n <Wrapper\n as={as}\n classProps={{\n disabled,\n disabledAddonInactive,\n customRenderer,\n fixedItem,\n type: otherProps.type,\n }}\n id={otherProps.id}\n innerRef={otherProps.type !== 'disabled' ? mergeRefs(innerRef, ref) : innerRef}\n onKeyDown={\n !fixedItem &&\n runAll((e) => {\n if (e.key === ' ' || e.key === 'Enter') {\n e.preventDefault();\n e.target.dispatchEvent(\n new MouseEvent('click', {\n view: window,\n bubbles: true,\n cancelable: false,\n }),\n );\n }\n }, onKeyDown)\n }\n role={role}\n style={style}\n tabIndex={tabIndex}\n {...wrapperProps}\n onClick={onClick}\n >\n {!noAddon && renderAddons(leftAddon, fixedItem)}\n {label && (\n <Content\n style={\n maxOption > 0\n ? {\n width: `${calculateSize(maxOption)}px`,\n maxWidth: `${calculateSize(maxOption)}px`,\n }\n : undefined\n }\n >\n <DSTruncatedTooltipText value={label} />\n </Content>\n )}\n {customRenderer}\n {rightAddon && renderAddons(rightAddon)}\n {children}\n </Wrapper>\n );\n};\n\nconst props = {\n /** Renders the MenuItem with a specific html element */\n as: PropTypes.element.description('Renders the MenuItem with a specific html element'),\n /**\n * reference to the component\n */\n innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({ current: PropTypes.any })]).description(\n 'reference to the component',\n ),\n /** Renders the passed element to the left */\n leftAddon: PropTypes.element.description('Renders the passed element to the left'),\n /** Renders the passed element to the right */\n rightAddon: PropTypes.element.description('Renders the passed element to the right'),\n /** Label for the menu item */\n label: PropTypes.string.description('Label for the menu item'),\n /** style object for menu item wrapper */\n style: PropTypes.object.description('style object for menu item wrapper'),\n /** disable menu item */\n disabled: PropTypes.bool.description('disable menu item'),\n /** HTML tabindex to manage focus order */\n tabindex: PropTypes.number.description('HTML tabindex to manage focus order'),\n /** a11y role */\n role: PropTypes.string.description('a11y role'),\n};\n\nMenuItem.propTypes = props;\nregisterMenuItem('menuitem', MenuItem);\n\nconst DSMenuItemWithSchema = describe(MenuItem);\nDSMenuItemWithSchema.propTypes = props;\n\nexport { DSMenuItemWithSchema, MenuItem };\nexport default MenuItem;\n"],
|
|
5
|
+
"mappings": "AAAA;ACEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,MAAM,OAAO,MAAM;AAEnB,MAAM,YAAY;AAElB,MAAM,UAAU,kBAAkB,OAAO,WAAW;AACpD,MAAM,QAAQ,kBAAkB,OAAO,WAAW,SAAS,CAAC,EAAE,OAAO,gBAAiB,GAAE,OAAO;AAE/F,MAAM,cAAc,CAAC,OAAO,WAAW,YACrC,qCAAC,OAAD;AAAA,EAAO,KAAK;AAAA,EAAS,YAAY,EAAE;AAAA,GAChC;AAIL,MAAM,eAAe,CAAC,QAAQ,cAC5B,MAAM,QAAQ,UAAU,OAAO,IAAI,eAAe,YAAY,QAAQ;AAExE,MAAM,UAAU,kBAAkB,MAChC,WACA,MACA,CAAC,EAAE,UAAU,uBAAuB,gBAAgB,WAAW,WAAY;AAAA,EACzE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,GACC,aAAa,SAAS;AAAA;AAG3B,MAAM,gBAAgB,CAAC,SAAS,MAAM;AACpC,MAAI,SAAS;AAAI,WAAO,KAAK;AAC7B,SAAO,SAAS;AAAA;AAGlB,MAAM,WAAW,CAAC,WAAU;AAC1B,QAAM;AAAA,IACJ;AAAA,IACA,KAAK;AAAA,IACL,OAAO;AAAA,IACP,YAAY;AAAA,IACZ,aAAa;AAAA,IACb,wBAAwB;AAAA,IACxB,QAAQ;AAAA,IACR;AAAA,IACA,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ;AAAA,IACA,WAAW;AAAA,IACX;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,OACG;AAAA,MACD;AAEJ,QAAM,UAAU,WAAW;AAC3B,QAAM,MAAM,OAAO;AACnB,oBAAkB;AACl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S,YAC3F;AAAA,EAGF,WAAW,UAAU,QAAQ,YAAY;AAAA,EAEzC,YAAY,UAAU,QAAQ,YAAY;AAAA,EAE1C,OAAO,UAAU,OAAO,YAAY;AAAA,EAEpC,OAAO,UAAU,OAAO,YAAY;AAAA,EAEpC,UAAU,UAAU,KAAK,YAAY;AAAA,EAErC,UAAU,UAAU,OAAO,YAAY;AAAA,EAEvC,MAAM,UAAU,OAAO,YAAY;AAAA;AAGrC,SAAS,YAAY;AACrB,iBAAiB,YAAY;AAE7B,MAAM,uBAAuB,SAAS;AACtC,qBAAqB,YAAY;AAGjC,IAAO,mBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
File without changes
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import React2 from "react";
|
|
3
|
-
import { DSCheckbox } from "@elliemae/ds-form";
|
|
3
|
+
import { DSCheckbox } from "@elliemae/ds-form/Checkbox";
|
|
4
4
|
import { MenuItemCheckable } from "./MenuItemCheckable";
|
|
5
5
|
import { registerMenuItem } from "./menuItemFactory";
|
|
6
6
|
const MenuItemCheckbox = ({ checked, ...rest }) => /* @__PURE__ */ React2.createElement(MenuItemCheckable, {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/MenuItems/MenuItemCheckbox.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { DSCheckbox } from '@elliemae/ds-form';\nimport { MenuItemCheckable } from './MenuItemCheckable';\nimport { registerMenuItem } from './menuItemFactory';\n\nconst MenuItemCheckbox = ({ checked, ...rest }) => (\n <MenuItemCheckable {...rest} leftAddon={<DSCheckbox checked={checked} />} role=\"menuitemcheckbox\" />\n);\n\nregisterMenuItem('checkbox', MenuItemCheckbox);\nexport { MenuItemCheckbox };\nexport default MenuItemCheckbox;\n"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { DSCheckbox } from '@elliemae/ds-form/Checkbox';\nimport { MenuItemCheckable } from './MenuItemCheckable';\nimport { registerMenuItem } from './menuItemFactory';\n\nconst MenuItemCheckbox = ({ checked, ...rest }) => (\n <MenuItemCheckable {...rest} leftAddon={<DSCheckbox checked={checked} />} role=\"menuitemcheckbox\" />\n);\n\nregisterMenuItem('checkbox', MenuItemCheckbox);\nexport { MenuItemCheckbox };\nexport default MenuItemCheckbox;\n"],
|
|
5
5
|
"mappings": "AAAA;ACAA;AACA;AACA;AACA;AAEA,MAAM,mBAAmB,CAAC,EAAE,YAAY,WACtC,qCAAC,mBAAD;AAAA,KAAuB;AAAA,EAAM,WAAW,qCAAC,YAAD;AAAA,IAAY;AAAA;AAAA,EAAsB,MAAK;AAAA;AAGjF,iBAAiB,YAAY;AAE7B,IAAO,2BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -2,7 +2,7 @@ import * as React from "react";
|
|
|
2
2
|
import React2, { useEffect, useMemo, useState, useRef, useContext } from "react";
|
|
3
3
|
import { aggregatedClasses } from "@elliemae/ds-classnames";
|
|
4
4
|
import { focusGroupManagerHoc } from "@elliemae/ds-shared/FocusGroup";
|
|
5
|
-
import { DSSearchBox } from "@elliemae/ds-form";
|
|
5
|
+
import { DSSearchBox } from "@elliemae/ds-form/SearchBox";
|
|
6
6
|
import { PropTypes, describe } from "react-desc";
|
|
7
7
|
import { VirtualMenuList } from "../VirtualMenuList";
|
|
8
8
|
import { MenuContext } from "../MenuContext";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/MenuItems/SearchableGroup.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useEffect, useMemo, useState, useRef, useContext } from 'react';\nimport { aggregatedClasses } from '@elliemae/ds-classnames';\nimport { focusGroupManagerHoc } from '@elliemae/ds-shared/FocusGroup';\nimport { DSSearchBox } from '@elliemae/ds-form/SearchBox';\nimport { PropTypes, describe } from 'react-desc';\nimport { VirtualMenuList } from '../VirtualMenuList';\nimport { MenuContext } from '../MenuContext';\n\nconst SearchBoxWrapper = aggregatedClasses('div')(\n 'menu-search-group',\n 'search-wrapper',\n);\nconst NoOptionsWrapper = aggregatedClasses('div')(\n 'menu-search-group',\n 'no-options',\n);\n\nconst SearchableGroup = ({\n children,\n amountItemsInWindow = 5,\n searchTerm: searchTermProp = '',\n noOptionsText = 'No options',\n height,\n width,\n focusOnOpen = false,\n}) => {\n const searchRef = useRef(null);\n const [searchTerm, setSearchTerm] = useState(searchTermProp);\n\n useEffect(() => {\n if (searchRef.current) searchRef.current.focus();\n }, []);\n\n const { visible } = useContext(MenuContext) || {};\n\n useEffect(() => {\n if (focusOnOpen && visible) {\n setTimeout(() => {\n if (searchRef.current) searchRef.current.focus();\n }, 0);\n }\n }, [focusOnOpen, visible]);\n\n const filteredChildren = useMemo(\n () =>\n children.filter(\n (child) =>\n !searchTerm ||\n child.props.label.toLowerCase().startsWith(searchTerm.toLowerCase()),\n ),\n [children, searchTerm],\n );\n\n return (\n <>\n <SearchBoxWrapper>\n <DSSearchBox\n innerRef={searchRef}\n onSearch={({ value }) => setSearchTerm(value)}\n searchOnEnter={false}\n showIcon={false}\n value={searchTerm}\n />\n </SearchBoxWrapper>\n {!filteredChildren.length && (\n <NoOptionsWrapper>{noOptionsText}</NoOptionsWrapper>\n )}\n <VirtualMenuList\n amountItemsInWindow={amountItemsInWindow}\n height={height}\n items={filteredChildren}\n width={width}\n />\n </>\n );\n};\n\nconst props = {\n /** The amount of items that are going to be rendered in the group */\n amountItemsInWindow: PropTypes.number.description(\n 'The amount of items that are going to be rendered in the group',\n ),\n /** A search term */\n searchTerm: PropTypes.string.description('A search term'),\n /** Text to show when there's no options to show */\n noOptionsText: PropTypes.string.description(\n \"Text to show when there's no options to show\",\n ),\n /** array of children for search list */\n children: PropTypes.array.description('array of children for search list'),\n /** height for virtual list wrapper */\n height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).description(\n 'height for virtual list wrapper',\n ),\n /** width for virtual list wrapper */\n width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).description(\n 'width for virtual list wrapper',\n ),\n /** weather to focus on searchable group on open */\n focusOnOpen: PropTypes.bool.description(\n 'weather to focus on searchable group on open',\n ),\n};\n\nSearchableGroup.propTypes = props;\n\nconst DSMenuSearchableGroupWithSchema = describe(SearchableGroup);\nDSMenuSearchableGroupWithSchema.propTypes = props;\n\nconst SearchableGroupHOC = focusGroupManagerHoc(SearchableGroup);\n\nexport { DSMenuSearchableGroupWithSchema, SearchableGroupHOC as SearchableGroup };\nexport default SearchableGroupHOC;\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,MAAM,mBAAmB,kBAAkB,OACzC,qBACA;AAEF,MAAM,mBAAmB,kBAAkB,OACzC,qBACA;AAGF,MAAM,kBAAkB,CAAC;AAAA,EACvB;AAAA,EACA,sBAAsB;AAAA,EACtB,YAAY,iBAAiB;AAAA,EAC7B,gBAAgB;AAAA,EAChB;AAAA,EACA;AAAA,EACA,cAAc;AAAA,MACV;AACJ,QAAM,YAAY,OAAO;AACzB,QAAM,CAAC,YAAY,iBAAiB,SAAS;AAE7C,YAAU,MAAM;AACd,QAAI,UAAU;AAAS,gBAAU,QAAQ;AAAA,KACxC;AAEH,QAAM,EAAE,YAAY,WAAW,gBAAgB;AAE/C,YAAU,MAAM;AACd,QAAI,eAAe,SAAS;AAC1B,iBAAW,MAAM;AACf,YAAI,UAAU;AAAS,oBAAU,QAAQ;AAAA,SACxC;AAAA;AAAA,KAEJ,CAAC,aAAa;AAEjB,QAAM,mBAAmB,QACvB,MACE,SAAS,OACP,CAAC,UACC,CAAC,cACD,MAAM,MAAM,MAAM,cAAc,WAAW,WAAW,iBAE5D,CAAC,UAAU;AAGb,SACE,4DACE,qCAAC,kBAAD,MACE,qCAAC,aAAD;AAAA,IACE,UAAU;AAAA,IACV,UAAU,CAAC,EAAE,YAAY,cAAc;AAAA,IACvC,eAAe;AAAA,IACf,UAAU;AAAA,IACV,OAAO;AAAA,OAGV,CAAC,iBAAiB,UACjB,qCAAC,kBAAD,MAAmB,gBAErB,qCAAC,iBAAD;AAAA,IACE;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP;AAAA;AAAA;AAMR,MAAM,QAAQ;AAAA,EAEZ,qBAAqB,UAAU,OAAO,YACpC;AAAA,EAGF,YAAY,UAAU,OAAO,YAAY;AAAA,EAEzC,eAAe,UAAU,OAAO,YAC9B;AAAA,EAGF,UAAU,UAAU,MAAM,YAAY;AAAA,EAEtC,QAAQ,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,SAAS,YAChE;AAAA,EAGF,OAAO,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,SAAS,YAC/D;AAAA,EAGF,aAAa,UAAU,KAAK,YAC1B;AAAA;AAIJ,gBAAgB,YAAY;AAE5B,MAAM,kCAAkC,SAAS;AACjD,gCAAgC,YAAY;AAE5C,MAAM,qBAAqB,qBAAqB;AAGhD,IAAO,0BAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|