@elliemae/ds-menu 2.3.0-alpha.8 → 2.3.0-next.2
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 +195 -0
- package/cjs/MenuCombobox.js +56 -0
- package/cjs/MenuContext.js +11 -0
- package/cjs/MenuItems/CheckboxGroup.js +45 -0
- package/cjs/MenuItems/MenuItem.js +203 -0
- package/cjs/MenuItems/MenuItemCheckable.js +119 -0
- package/cjs/MenuItems/MenuItemCheckbox.js +42 -0
- package/cjs/MenuItems/MenuItemRadio.js +41 -0
- package/cjs/MenuItems/RadioGroup.js +42 -0
- package/cjs/MenuItems/SearchableGroup.js +101 -0
- package/cjs/MenuItems/SearchableList.js +117 -0
- package/cjs/MenuItems/SelectionGroup.js +107 -0
- package/cjs/MenuItems/Separator.js +44 -0
- package/cjs/MenuItems/SubMenu.js +203 -0
- package/cjs/MenuItems/menuItemFactory.js +73 -0
- package/cjs/VirtualMenuList.js +48 -0
- package/cjs/index.js +36 -0
- package/cjs/utils/useHeightByAmountOfItems.js +20 -0
- package/esm/Menu.js +180 -0
- package/esm/MenuCombobox.js +48 -0
- package/esm/MenuContext.js +5 -0
- package/esm/MenuItems/CheckboxGroup.js +35 -0
- package/esm/MenuItems/MenuItem.js +191 -0
- package/esm/MenuItems/MenuItemCheckable.js +108 -0
- package/esm/MenuItems/MenuItemCheckbox.js +34 -0
- package/esm/MenuItems/MenuItemRadio.js +32 -0
- package/esm/MenuItems/RadioGroup.js +32 -0
- package/esm/MenuItems/SearchableGroup.js +91 -0
- package/esm/MenuItems/SearchableList.js +108 -0
- package/esm/MenuItems/SelectionGroup.js +97 -0
- package/esm/MenuItems/Separator.js +33 -0
- package/esm/MenuItems/SubMenu.js +190 -0
- package/esm/MenuItems/menuItemFactory.js +64 -0
- package/esm/VirtualMenuList.js +42 -0
- package/esm/index.js +13 -0
- package/{dist/esm → esm}/utils/useHeightByAmountOfItems.js +11 -13
- package/package.json +62 -72
- package/types/Menu.d.ts +11 -0
- package/types/MenuCombobox.d.ts +28 -0
- package/types/MenuContext.d.ts +3 -0
- package/types/MenuItems/CheckboxGroup.d.ts +32 -0
- package/types/MenuItems/MenuItem.d.ts +79 -0
- package/types/MenuItems/MenuItemCheckable.d.ts +77 -0
- package/types/MenuItems/MenuItemCheckbox.d.ts +6 -0
- package/types/MenuItems/MenuItemRadio.d.ts +28 -0
- package/types/MenuItems/RadioGroup.d.ts +26 -0
- package/types/MenuItems/SearchableGroup.d.ts +10 -0
- package/types/MenuItems/SearchableList.d.ts +95 -0
- package/types/MenuItems/SelectionGroup.d.ts +87 -0
- package/types/MenuItems/Separator.d.ts +31 -0
- package/types/MenuItems/SubMenu.d.ts +109 -0
- package/types/MenuItems/menuItemFactory.d.ts +3 -0
- package/types/VirtualMenuList.d.ts +8 -0
- package/types/index.d.ts +13 -0
- package/types/tests/Menu.test.d.ts +1 -0
- package/types/tests/MenuItem.test.d.ts +1 -0
- package/types/utils/useHeightByAmountOfItems.d.ts +5 -0
- package/dist/cjs/Menu.js +0 -151
- package/dist/cjs/Menu.js.map +0 -7
- package/dist/cjs/MenuCombobox.js +0 -70
- package/dist/cjs/MenuCombobox.js.map +0 -7
- package/dist/cjs/MenuContext.js +0 -38
- package/dist/cjs/MenuContext.js.map +0 -7
- package/dist/cjs/MenuExports.js +0 -36
- package/dist/cjs/MenuExports.js.map +0 -7
- package/dist/cjs/MenuItems/CheckboxGroup.js +0 -52
- package/dist/cjs/MenuItems/CheckboxGroup.js.map +0 -7
- package/dist/cjs/MenuItems/MenuItem.js +0 -157
- package/dist/cjs/MenuItems/MenuItem.js.map +0 -7
- package/dist/cjs/MenuItems/MenuItemCheckable.js +0 -88
- package/dist/cjs/MenuItems/MenuItemCheckable.js.map +0 -7
- package/dist/cjs/MenuItems/MenuItemCheckbox.js +0 -48
- package/dist/cjs/MenuItems/MenuItemCheckbox.js.map +0 -7
- package/dist/cjs/MenuItems/MenuItemRadio.js +0 -53
- package/dist/cjs/MenuItems/MenuItemRadio.js.map +0 -7
- package/dist/cjs/MenuItems/RadioGroup.js +0 -51
- package/dist/cjs/MenuItems/RadioGroup.js.map +0 -7
- package/dist/cjs/MenuItems/SearchableGroup.js +0 -97
- package/dist/cjs/MenuItems/SearchableGroup.js.map +0 -7
- package/dist/cjs/MenuItems/SearchableList.js +0 -114
- package/dist/cjs/MenuItems/SearchableList.js.map +0 -7
- package/dist/cjs/MenuItems/SelectionGroup.js +0 -102
- package/dist/cjs/MenuItems/SelectionGroup.js.map +0 -7
- package/dist/cjs/MenuItems/Separator.js +0 -59
- package/dist/cjs/MenuItems/Separator.js.map +0 -7
- package/dist/cjs/MenuItems/SubMenu.js +0 -187
- package/dist/cjs/MenuItems/SubMenu.js.map +0 -7
- package/dist/cjs/MenuItems/menuItemFactory.js +0 -41
- package/dist/cjs/MenuItems/menuItemFactory.js.map +0 -7
- package/dist/cjs/MenuItems/renderMenuItems.js +0 -54
- package/dist/cjs/MenuItems/renderMenuItems.js.map +0 -7
- package/dist/cjs/VirtualMenuList.js +0 -78
- package/dist/cjs/VirtualMenuList.js.map +0 -7
- package/dist/cjs/index.js +0 -63
- package/dist/cjs/index.js.map +0 -7
- package/dist/cjs/utils/useHeightByAmountOfItems.js +0 -49
- package/dist/cjs/utils/useHeightByAmountOfItems.js.map +0 -7
- package/dist/esm/Menu.js +0 -122
- package/dist/esm/Menu.js.map +0 -7
- package/dist/esm/MenuCombobox.js +0 -41
- package/dist/esm/MenuCombobox.js.map +0 -7
- package/dist/esm/MenuContext.js +0 -9
- package/dist/esm/MenuContext.js.map +0 -7
- package/dist/esm/MenuExports.js +0 -7
- package/dist/esm/MenuExports.js.map +0 -7
- package/dist/esm/MenuItems/CheckboxGroup.js +0 -23
- package/dist/esm/MenuItems/CheckboxGroup.js.map +0 -7
- package/dist/esm/MenuItems/MenuItem.js +0 -128
- package/dist/esm/MenuItems/MenuItem.js.map +0 -7
- package/dist/esm/MenuItems/MenuItemCheckable.js +0 -59
- package/dist/esm/MenuItems/MenuItemCheckable.js.map +0 -7
- package/dist/esm/MenuItems/MenuItemCheckbox.js +0 -19
- package/dist/esm/MenuItems/MenuItemCheckbox.js.map +0 -7
- package/dist/esm/MenuItems/MenuItemRadio.js +0 -24
- package/dist/esm/MenuItems/MenuItemRadio.js.map +0 -7
- package/dist/esm/MenuItems/RadioGroup.js +0 -22
- package/dist/esm/MenuItems/RadioGroup.js.map +0 -7
- package/dist/esm/MenuItems/SearchableGroup.js +0 -68
- package/dist/esm/MenuItems/SearchableGroup.js.map +0 -7
- package/dist/esm/MenuItems/SearchableList.js +0 -85
- package/dist/esm/MenuItems/SearchableList.js.map +0 -7
- package/dist/esm/MenuItems/SelectionGroup.js +0 -73
- package/dist/esm/MenuItems/SelectionGroup.js.map +0 -7
- package/dist/esm/MenuItems/Separator.js +0 -30
- package/dist/esm/MenuItems/Separator.js.map +0 -7
- package/dist/esm/MenuItems/SubMenu.js +0 -158
- package/dist/esm/MenuItems/SubMenu.js.map +0 -7
- package/dist/esm/MenuItems/menuItemFactory.js +0 -12
- package/dist/esm/MenuItems/menuItemFactory.js.map +0 -7
- package/dist/esm/MenuItems/renderMenuItems.js +0 -25
- package/dist/esm/MenuItems/renderMenuItems.js.map +0 -7
- package/dist/esm/VirtualMenuList.js +0 -49
- package/dist/esm/VirtualMenuList.js.map +0 -7
- package/dist/esm/index.js +0 -34
- package/dist/esm/index.js.map +0 -7
- package/dist/esm/utils/useHeightByAmountOfItems.js.map +0 -7
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/utils/useHeightByAmountOfItems.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { useMemo } from 'react';\n\nconst calculateHeight = (itemHeight, amountItemsInWindow, itemsLength) => {\n const realAmountItemsInWindow =\n itemsLength < amountItemsInWindow ? itemsLength : amountItemsInWindow;\n return itemHeight * realAmountItemsInWindow;\n};\n\nfunction useHeightByAmountOfItems({\n itemHeight,\n amountItems,\n items,\n}) {\n const calculatedHeight = useMemo(\n () => calculateHeight(itemHeight, amountItems, items.length),\n [amountItems, items],\n );\n\n return calculatedHeight;\n}\n\nexport { useHeightByAmountOfItems };\nexport default useHeightByAmountOfItems;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAwB;AAExB,MAAM,kBAAkB,CAAC,YAAY,qBAAqB,gBAAgB;AACxE,QAAM,0BACJ,cAAc,sBAAsB,cAAc;AACpD,SAAO,aAAa;AAAA;AAGtB,kCAAkC;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,GACC;AACD,QAAM,mBAAmB,0BACvB,MAAM,gBAAgB,YAAY,aAAa,MAAM,SACrD,CAAC,aAAa;AAGhB,SAAO;AAAA;AAIT,IAAO,mCAAQ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/dist/esm/Menu.js
DELETED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import React2, { useContext, useEffect, useMemo, useRef } from "react";
|
|
3
|
-
import { PropTypes, describe } from "react-desc";
|
|
4
|
-
import { omit } from "lodash";
|
|
5
|
-
import { aggregatedClasses } from "@elliemae/ds-classnames";
|
|
6
|
-
import { animated } from "react-spring/web";
|
|
7
|
-
import { useOnClickOutside } from "@elliemae/ds-utilities/hooks";
|
|
8
|
-
import { mergeRefs } from "@elliemae/ds-utilities/system";
|
|
9
|
-
import { focusGroupManagerHoc, FocusGroupContext } from "@elliemae/ds-shared/FocusGroup";
|
|
10
|
-
import { useHiddenTransition } from "@elliemae/ds-hidden";
|
|
11
|
-
import { MenuContext } from "./MenuContext";
|
|
12
|
-
import { MenuItemRadio } from "./MenuItems/MenuItemRadio";
|
|
13
|
-
import { MenuItemCheckbox } from "./MenuItems/MenuItemCheckbox";
|
|
14
|
-
import { CheckboxGroup } from "./MenuItems/CheckboxGroup";
|
|
15
|
-
import { RadioGroup } from "./MenuItems/RadioGroup";
|
|
16
|
-
import { MenuSeparator } from "./MenuItems/Separator";
|
|
17
|
-
import { MenuItem } from "./MenuItems/MenuItem";
|
|
18
|
-
import { SearchableGroup } from "./MenuItems/SearchableGroup";
|
|
19
|
-
import { SelectionGroup } from "./MenuItems/SelectionGroup";
|
|
20
|
-
import { menuItemFactory } from "./MenuItems/menuItemFactory";
|
|
21
|
-
import { renderMenuItems } from "./MenuItems/renderMenuItems";
|
|
22
|
-
const RESPONSIVE_HEIHGT_MARGIN = 120;
|
|
23
|
-
const blockName = "menu";
|
|
24
|
-
const noop = () => {
|
|
25
|
-
};
|
|
26
|
-
const MenuComponent = aggregatedClasses("div")(blockName, "", ({ menuComboBox, type }) => ({
|
|
27
|
-
"menu-combo-box": menuComboBox,
|
|
28
|
-
[`type-${type}`]: type
|
|
29
|
-
}));
|
|
30
|
-
const isChildOfType = (child, type) => child.type === type || child.type?.name === type;
|
|
31
|
-
const DSMenu = ({
|
|
32
|
-
containerProps = {},
|
|
33
|
-
innerRef,
|
|
34
|
-
as: MenuTag = animated.ul,
|
|
35
|
-
children = void 0,
|
|
36
|
-
onClickOutside = noop,
|
|
37
|
-
visible = void 0,
|
|
38
|
-
focusOnOpen = false,
|
|
39
|
-
maxOption = 0,
|
|
40
|
-
style = {},
|
|
41
|
-
minWidth = void 0,
|
|
42
|
-
maxWidth = void 0,
|
|
43
|
-
closeMenu,
|
|
44
|
-
responsiveHeight = false,
|
|
45
|
-
...otherProps
|
|
46
|
-
}) => {
|
|
47
|
-
const menuRef = useRef(null);
|
|
48
|
-
const { focusFirst } = useContext(FocusGroupContext);
|
|
49
|
-
const { destroyed, ...hiddenProps } = useHiddenTransition({ visible, style });
|
|
50
|
-
const nextChildren = useMemo(() => {
|
|
51
|
-
const forceLeftAddon = React2.Children.toArray(children).some((child) => isChildOfType(child, "SelectionGroup") || isChildOfType(child, "MenuItemCheckbox") || isChildOfType(child, "MenuItemRadio") || child.props.leftAddon);
|
|
52
|
-
return React2.Children.map(children, (child) => child && React2.cloneElement(child, {
|
|
53
|
-
...child.props,
|
|
54
|
-
noAddon: !forceLeftAddon ? true : void 0,
|
|
55
|
-
maxOption,
|
|
56
|
-
closeMenu
|
|
57
|
-
}));
|
|
58
|
-
}, [children]);
|
|
59
|
-
useOnClickOutside(menuRef, onClickOutside);
|
|
60
|
-
useEffect(() => {
|
|
61
|
-
if (focusOnOpen && visible) {
|
|
62
|
-
setTimeout(() => {
|
|
63
|
-
focusFirst();
|
|
64
|
-
}, 0);
|
|
65
|
-
}
|
|
66
|
-
}, [visible, focusOnOpen]);
|
|
67
|
-
return !hiddenProps.destroyed ? /* @__PURE__ */ React2.createElement(MenuContext.Provider, {
|
|
68
|
-
value: { visible, closeMenu }
|
|
69
|
-
}, /* @__PURE__ */ React2.createElement(MenuComponent, {
|
|
70
|
-
"data-testid": containerProps?.["data-testid"] ? containerProps["data-testid"] : "em-ds-menu",
|
|
71
|
-
...containerProps,
|
|
72
|
-
as: MenuTag,
|
|
73
|
-
classProps: { ...otherProps.classProps || {}, type: otherProps.type },
|
|
74
|
-
innerRef: mergeRefs(innerRef, menuRef),
|
|
75
|
-
role: "menu",
|
|
76
|
-
...omit(otherProps, ["scheduleUpdate"]),
|
|
77
|
-
...hiddenProps
|
|
78
|
-
}, /* @__PURE__ */ React2.createElement("div", {
|
|
79
|
-
className: "menu-component-internal-wrapper",
|
|
80
|
-
style: {
|
|
81
|
-
...style,
|
|
82
|
-
minWidth,
|
|
83
|
-
maxWidth,
|
|
84
|
-
...responsiveHeight ? {
|
|
85
|
-
overflowY: "scroll",
|
|
86
|
-
maxHeight: responsiveHeight ? `${window.innerHeight - RESPONSIVE_HEIHGT_MARGIN}px` : void 0
|
|
87
|
-
} : {}
|
|
88
|
-
}
|
|
89
|
-
}, nextChildren))) : null;
|
|
90
|
-
};
|
|
91
|
-
const Menu = focusGroupManagerHoc(DSMenu, { loop: true });
|
|
92
|
-
const props = {
|
|
93
|
-
containerProps: PropTypes.object.description("Injected props to wrapper element of component"),
|
|
94
|
-
as: PropTypes.element.description("Renders the menu with a specific html element"),
|
|
95
|
-
onClickOutside: PropTypes.func.description("Handler when a user clicks outside the menu"),
|
|
96
|
-
visible: PropTypes.bool.description("Whether the menu is visible or not"),
|
|
97
|
-
focusOnOpen: PropTypes.bool.description("When set to true, it's going to focus the first item"),
|
|
98
|
-
minWidth: PropTypes.number.description("Customize menu minWidth. Can be undefined or 'number'"),
|
|
99
|
-
maxWidth: PropTypes.number.description("Customize menu maxWidth. Can be undefined or 'number'")
|
|
100
|
-
};
|
|
101
|
-
DSMenu.propTypes = props;
|
|
102
|
-
const DSMenuWithSchema = describe(DSMenu);
|
|
103
|
-
DSMenuWithSchema.propTypes = props;
|
|
104
|
-
Menu.Item = MenuItem;
|
|
105
|
-
Menu.ItemCheckbox = MenuItemCheckbox;
|
|
106
|
-
Menu.ItemRadio = MenuItemRadio;
|
|
107
|
-
Menu.Separator = MenuSeparator;
|
|
108
|
-
Menu.CheckboxGroup = CheckboxGroup;
|
|
109
|
-
Menu.RadioGroup = RadioGroup;
|
|
110
|
-
Menu.SearchableGroup = SearchableGroup;
|
|
111
|
-
Menu.SelectionGroup = SelectionGroup;
|
|
112
|
-
const setSubMenu = (SubMenu) => Menu.SubMenu = SubMenu;
|
|
113
|
-
var Menu_default = Menu;
|
|
114
|
-
export {
|
|
115
|
-
DSMenuWithSchema,
|
|
116
|
-
Menu,
|
|
117
|
-
Menu_default as default,
|
|
118
|
-
menuItemFactory,
|
|
119
|
-
renderMenuItems,
|
|
120
|
-
setSubMenu
|
|
121
|
-
};
|
|
122
|
-
//# sourceMappingURL=Menu.js.map
|
package/dist/esm/Menu.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
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": "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",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/dist/esm/MenuCombobox.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import React2 from "react";
|
|
3
|
-
import PropTypes from "prop-types";
|
|
4
|
-
import { SearchableList } from "./MenuItems/SearchableList";
|
|
5
|
-
import { Menu } from "./Menu";
|
|
6
|
-
function MenuCombobox({
|
|
7
|
-
dropdownFilterOptions = {},
|
|
8
|
-
options = [],
|
|
9
|
-
onSelectMenuItem = () => null,
|
|
10
|
-
innerRef,
|
|
11
|
-
maxOptions = 10,
|
|
12
|
-
loading = false,
|
|
13
|
-
...rest
|
|
14
|
-
}) {
|
|
15
|
-
return /* @__PURE__ */ React2.createElement(Menu, {
|
|
16
|
-
...rest,
|
|
17
|
-
classProps: { menuComboBox: true },
|
|
18
|
-
innerRef,
|
|
19
|
-
visible: true
|
|
20
|
-
}, /* @__PURE__ */ React2.createElement(SearchableList, {
|
|
21
|
-
appendTermInList: true,
|
|
22
|
-
extraListProps: dropdownFilterOptions,
|
|
23
|
-
items: options,
|
|
24
|
-
onSelectMenuItem,
|
|
25
|
-
maxOptions,
|
|
26
|
-
loading
|
|
27
|
-
}));
|
|
28
|
-
}
|
|
29
|
-
MenuCombobox.propTypes = {
|
|
30
|
-
dropdownFilterOptions: PropTypes.shape({}),
|
|
31
|
-
options: PropTypes.arrayOf(PropTypes.object),
|
|
32
|
-
onSelectMenuItem: PropTypes.func,
|
|
33
|
-
innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
34
|
-
maxOptions: PropTypes.number,
|
|
35
|
-
loading: PropTypes.bool
|
|
36
|
-
};
|
|
37
|
-
var MenuCombobox_default = MenuCombobox;
|
|
38
|
-
export {
|
|
39
|
-
MenuCombobox_default as default
|
|
40
|
-
};
|
|
41
|
-
//# sourceMappingURL=MenuCombobox.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/MenuCombobox.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport PropTypes from 'prop-types';\nimport { SearchableList } from './MenuItems/SearchableList';\nimport { Menu } from './Menu';\n\nfunction MenuCombobox({\n dropdownFilterOptions = {},\n options = [],\n onSelectMenuItem = () => null,\n innerRef,\n maxOptions = 10,\n loading = false,\n ...rest\n}) {\n return (\n <Menu\n {...rest}\n classProps={{ menuComboBox: true }}\n innerRef={innerRef}\n visible\n >\n <SearchableList\n appendTermInList\n extraListProps={dropdownFilterOptions}\n items={options}\n onSelectMenuItem={onSelectMenuItem}\n maxOptions={maxOptions}\n loading={loading}\n />\n </Menu>\n );\n}\n\nMenuCombobox.propTypes = {\n /** Options */\n dropdownFilterOptions: PropTypes.shape({}),\n /** The option or menu items to render */\n options: PropTypes.arrayOf(PropTypes.object),\n /** Handler when a menu item is selected */\n onSelectMenuItem: PropTypes.func,\n /** Internal ref */\n innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),\n /** Max options to display in the list */\n maxOptions: PropTypes.number,\n /** Is loading */\n loading: PropTypes.bool,\n};\n\nexport default MenuCombobox;\n"],
|
|
5
|
-
"mappings": "AAAA;ACAA;AACA;AACA;AACA;AAEA,sBAAsB;AAAA,EACpB,wBAAwB;AAAA,EACxB,UAAU;AAAA,EACV,mBAAmB,MAAM;AAAA,EACzB;AAAA,EACA,aAAa;AAAA,EACb,UAAU;AAAA,KACP;AAAA,GACF;AACD,SACE,qCAAC,MAAD;AAAA,OACM;AAAA,IACJ,YAAY,EAAE,cAAc;AAAA,IAC5B;AAAA,IACA,SAAO;AAAA,KAEP,qCAAC,gBAAD;AAAA,IACE,kBAAgB;AAAA,IAChB,gBAAgB;AAAA,IAChB,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA;AAAA;AAMR,aAAa,YAAY;AAAA,EAEvB,uBAAuB,UAAU,MAAM;AAAA,EAEvC,SAAS,UAAU,QAAQ,UAAU;AAAA,EAErC,kBAAkB,UAAU;AAAA,EAE5B,UAAU,UAAU,UAAU,CAAC,UAAU,MAAM,UAAU;AAAA,EAEzD,YAAY,UAAU;AAAA,EAEtB,SAAS,UAAU;AAAA;AAGrB,IAAO,uBAAQ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/dist/esm/MenuContext.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/MenuContext.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\n\nconst MenuContext = React.createContext();\nexport { MenuContext };\nexport default MenuContext;\n"],
|
|
5
|
-
"mappings": "AAAA;ACAA;AAEA,MAAM,cAAc,OAAM;AAE1B,IAAO,sBAAQ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/dist/esm/MenuExports.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/MenuExports.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export { DSMenuWithSchema, Menu } from './Menu';"],
|
|
5
|
-
"mappings": "AAAA;ACAA;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import React2 from "react";
|
|
3
|
-
import { PropTypes, describe } from "react-desc";
|
|
4
|
-
import { CheckableGroup } from "@elliemae/ds-shared/CheckableGroup";
|
|
5
|
-
const CheckboxGroup = (props2) => /* @__PURE__ */ React2.createElement(CheckableGroup, {
|
|
6
|
-
...props2,
|
|
7
|
-
multi: true
|
|
8
|
-
});
|
|
9
|
-
const props = {
|
|
10
|
-
active: PropTypes.arrayOf(PropTypes.string).description("The item (if multi false) or items (if multi true) selected"),
|
|
11
|
-
multi: PropTypes.bool.description("Whether is multi select or not"),
|
|
12
|
-
onCheck: PropTypes.func.description("Handler when a user checks an item")
|
|
13
|
-
};
|
|
14
|
-
CheckboxGroup.propTypes = props;
|
|
15
|
-
const DSMenuCheckboxGroupWithSchema = describe(CheckboxGroup);
|
|
16
|
-
DSMenuCheckboxGroupWithSchema.propTypes = props;
|
|
17
|
-
var CheckboxGroup_default = CheckboxGroup;
|
|
18
|
-
export {
|
|
19
|
-
CheckboxGroup,
|
|
20
|
-
DSMenuCheckboxGroupWithSchema,
|
|
21
|
-
CheckboxGroup_default as default
|
|
22
|
-
};
|
|
23
|
-
//# sourceMappingURL=CheckboxGroup.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/MenuItems/CheckboxGroup.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { PropTypes, describe } from 'react-desc';\nimport { CheckableGroup } from '@elliemae/ds-shared/CheckableGroup';\n\nconst CheckboxGroup = (props) => <CheckableGroup {...props} multi />;\n\nconst props = {\n /* The item (if multi false) or items (if multi true) selected */\n active: PropTypes.arrayOf(PropTypes.string).description(\n 'The item (if multi false) or items (if multi true) selected',\n ),\n /* Whether is multi select or not */\n multi: PropTypes.bool.description('Whether is multi select or not'),\n /* Handler when a user checks an item */\n onCheck: PropTypes.func.description('Handler when a user checks an item'),\n};\n\nCheckboxGroup.propTypes = props;\n\nconst DSMenuCheckboxGroupWithSchema = describe(CheckboxGroup);\nDSMenuCheckboxGroupWithSchema.propTypes = props;\n\nexport { DSMenuCheckboxGroupWithSchema, CheckboxGroup };\nexport default CheckboxGroup;\n"],
|
|
5
|
-
"mappings": "AAAA;ACAA;AACA;AACA;AAEA,MAAM,gBAAgB,CAAC,WAAU,qCAAC,gBAAD;AAAA,KAAoB;AAAA,EAAO,OAAK;AAAA;AAEjE,MAAM,QAAQ;AAAA,EAEZ,QAAQ,UAAU,QAAQ,UAAU,QAAQ,YAC1C;AAAA,EAGF,OAAO,UAAU,KAAK,YAAY;AAAA,EAElC,SAAS,UAAU,KAAK,YAAY;AAAA;AAGtC,cAAc,YAAY;AAE1B,MAAM,gCAAgC,SAAS;AAC/C,8BAA8B,YAAY;AAG1C,IAAO,wBAAQ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import React2, { useRef, useMemo, useContext } from "react";
|
|
3
|
-
import { PropTypes, describe } from "react-desc";
|
|
4
|
-
import { omit } from "lodash";
|
|
5
|
-
import { aggregatedClasses } from "@elliemae/ds-classnames";
|
|
6
|
-
import { mergeRefs, runAll } from "@elliemae/ds-utilities";
|
|
7
|
-
import { useFocusGroupItem } from "@elliemae/ds-shared/FocusGroup";
|
|
8
|
-
import { DSTruncatedTooltipText } from "@elliemae/ds-truncated-tooltip-text";
|
|
9
|
-
import { MenuContext } from "../MenuContext";
|
|
10
|
-
import { registerMenuItem, menuItemFactory } from "./menuItemFactory";
|
|
11
|
-
import { renderMenuItems } from "./renderMenuItems";
|
|
12
|
-
const noop = () => null;
|
|
13
|
-
const blockName = "menu-item";
|
|
14
|
-
const Content = aggregatedClasses("div")(blockName, "content");
|
|
15
|
-
const Addon = aggregatedClasses("div")(blockName, "addon", ({ empty, fixedItem }) => ({ empty, fixedItem }));
|
|
16
|
-
const renderAddon = (addon, fixedItem, addonId) => /* @__PURE__ */ React2.createElement(Addon, {
|
|
17
|
-
key: addonId,
|
|
18
|
-
classProps: { fixedItem }
|
|
19
|
-
}, addon);
|
|
20
|
-
const renderAddons = (addons, fixedItem) => Array.isArray(addons) ? addons.map(renderAddon) : renderAddon(addons, fixedItem);
|
|
21
|
-
const Wrapper = aggregatedClasses("li")(blockName, null, ({ disabled, disabledAddonInactive, customRenderer, fixedItem, type }) => ({
|
|
22
|
-
disabled,
|
|
23
|
-
disabledAddonInactive,
|
|
24
|
-
customRenderer,
|
|
25
|
-
fixedItem,
|
|
26
|
-
[`menu-type-${type}`]: type
|
|
27
|
-
}));
|
|
28
|
-
const calculateSize = (length = 0) => {
|
|
29
|
-
if (length > 45)
|
|
30
|
-
return 45 * 7;
|
|
31
|
-
return length * 7;
|
|
32
|
-
};
|
|
33
|
-
const MenuItem = (props2) => {
|
|
34
|
-
const {
|
|
35
|
-
innerRef,
|
|
36
|
-
as = "li",
|
|
37
|
-
role = "menuitem",
|
|
38
|
-
leftAddon = null,
|
|
39
|
-
rightAddon = void 0,
|
|
40
|
-
disabledAddonInactive = void 0,
|
|
41
|
-
label = void 0,
|
|
42
|
-
children,
|
|
43
|
-
tabIndex = -1,
|
|
44
|
-
onKeyDown = noop,
|
|
45
|
-
fixedItem = false,
|
|
46
|
-
noAddon,
|
|
47
|
-
disabled = false,
|
|
48
|
-
customRenderer,
|
|
49
|
-
maxOption,
|
|
50
|
-
closeMenu,
|
|
51
|
-
style,
|
|
52
|
-
...otherProps
|
|
53
|
-
} = props2;
|
|
54
|
-
const menuCxt = useContext(MenuContext);
|
|
55
|
-
const ref = useRef(null);
|
|
56
|
-
useFocusGroupItem(ref);
|
|
57
|
-
if (otherProps.subItems) {
|
|
58
|
-
const SubMenu = menuItemFactory("submenu");
|
|
59
|
-
return /* @__PURE__ */ React2.createElement(SubMenu, {
|
|
60
|
-
...props2,
|
|
61
|
-
closeMenu: menuCxt.closeMenu
|
|
62
|
-
}, renderMenuItems(otherProps.subItems));
|
|
63
|
-
}
|
|
64
|
-
const wrapperProps = useMemo(() => omit(otherProps, ["icon"]), [otherProps]);
|
|
65
|
-
const onClick = (...args) => {
|
|
66
|
-
if (wrapperProps.onClick)
|
|
67
|
-
wrapperProps.onClick(...args);
|
|
68
|
-
if (wrapperProps.closeOnClick && menuCxt.closeMenu) {
|
|
69
|
-
menuCxt.closeMenu(...args);
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
return /* @__PURE__ */ React2.createElement(Wrapper, {
|
|
73
|
-
as,
|
|
74
|
-
classProps: {
|
|
75
|
-
disabled,
|
|
76
|
-
disabledAddonInactive,
|
|
77
|
-
customRenderer,
|
|
78
|
-
fixedItem,
|
|
79
|
-
type: otherProps.type
|
|
80
|
-
},
|
|
81
|
-
id: otherProps.id,
|
|
82
|
-
innerRef: otherProps.type !== "disabled" ? mergeRefs(innerRef, ref) : innerRef,
|
|
83
|
-
onKeyDown: !fixedItem && runAll((e) => {
|
|
84
|
-
if (e.key === " " || e.key === "Enter") {
|
|
85
|
-
e.preventDefault();
|
|
86
|
-
e.target.dispatchEvent(new MouseEvent("click", {
|
|
87
|
-
view: window,
|
|
88
|
-
bubbles: true,
|
|
89
|
-
cancelable: false
|
|
90
|
-
}));
|
|
91
|
-
}
|
|
92
|
-
}, onKeyDown),
|
|
93
|
-
role,
|
|
94
|
-
style,
|
|
95
|
-
tabIndex,
|
|
96
|
-
...wrapperProps,
|
|
97
|
-
onClick
|
|
98
|
-
}, !noAddon && renderAddons(leftAddon, fixedItem), label && /* @__PURE__ */ React2.createElement(Content, {
|
|
99
|
-
style: maxOption > 0 ? {
|
|
100
|
-
width: `${calculateSize(maxOption)}px`,
|
|
101
|
-
maxWidth: `${calculateSize(maxOption)}px`
|
|
102
|
-
} : void 0
|
|
103
|
-
}, /* @__PURE__ */ React2.createElement(DSTruncatedTooltipText, {
|
|
104
|
-
value: label
|
|
105
|
-
})), customRenderer, rightAddon && renderAddons(rightAddon), children);
|
|
106
|
-
};
|
|
107
|
-
const props = {
|
|
108
|
-
as: PropTypes.element.description("Renders the MenuItem with a specific html element"),
|
|
109
|
-
innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({ current: PropTypes.any })]).description("reference to the component"),
|
|
110
|
-
leftAddon: PropTypes.element.description("Renders the passed element to the left"),
|
|
111
|
-
rightAddon: PropTypes.element.description("Renders the passed element to the right"),
|
|
112
|
-
label: PropTypes.string.description("Label for the menu item"),
|
|
113
|
-
style: PropTypes.object.description("style object for menu item wrapper"),
|
|
114
|
-
disabled: PropTypes.bool.description("disable menu item"),
|
|
115
|
-
tabindex: PropTypes.number.description("HTML tabindex to manage focus order"),
|
|
116
|
-
role: PropTypes.string.description("a11y role")
|
|
117
|
-
};
|
|
118
|
-
MenuItem.propTypes = props;
|
|
119
|
-
registerMenuItem("menuitem", MenuItem);
|
|
120
|
-
const DSMenuItemWithSchema = describe(MenuItem);
|
|
121
|
-
DSMenuItemWithSchema.propTypes = props;
|
|
122
|
-
var MenuItem_default = MenuItem;
|
|
123
|
-
export {
|
|
124
|
-
DSMenuItemWithSchema,
|
|
125
|
-
MenuItem,
|
|
126
|
-
MenuItem_default as default
|
|
127
|
-
};
|
|
128
|
-
//# sourceMappingURL=MenuItem.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
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": "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",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import React2 from "react";
|
|
3
|
-
import { PropTypes, describe } from "react-desc";
|
|
4
|
-
import { Checkmark } from "@elliemae/ds-icons";
|
|
5
|
-
import { runAll } from "@elliemae/ds-utilities";
|
|
6
|
-
import { MenuItem } from "./MenuItem";
|
|
7
|
-
function useCheckable({ checked }) {
|
|
8
|
-
return {
|
|
9
|
-
checked,
|
|
10
|
-
"aria-checked": checked
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
const MenuItemCheckable = ({
|
|
14
|
-
role = "menuitemcheckbox",
|
|
15
|
-
checked = false,
|
|
16
|
-
name = "",
|
|
17
|
-
checkIcon = /* @__PURE__ */ React2.createElement(Checkmark, {
|
|
18
|
-
color: ["brand-primary", 600]
|
|
19
|
-
}),
|
|
20
|
-
children,
|
|
21
|
-
leftAddon,
|
|
22
|
-
item = void 0,
|
|
23
|
-
...otherProps
|
|
24
|
-
}) => {
|
|
25
|
-
const checkableProps = useCheckable({ checked, name });
|
|
26
|
-
const handleClick = () => runAll(otherProps.onClick, checkableProps.onClick)({ target: { value: name, checked } }, item);
|
|
27
|
-
const checkAddon = leftAddon || (checkableProps.checked ? /* @__PURE__ */ React2.createElement("div", {
|
|
28
|
-
className: "checkable-mark"
|
|
29
|
-
}, checkIcon) : /* @__PURE__ */ React2.createElement("div", null));
|
|
30
|
-
return /* @__PURE__ */ React2.createElement(MenuItem, {
|
|
31
|
-
...item,
|
|
32
|
-
...otherProps,
|
|
33
|
-
...checkableProps,
|
|
34
|
-
customRenderer: item && item.customRenderer ? item.customRenderer : () => {
|
|
35
|
-
},
|
|
36
|
-
items: otherProps.subItems,
|
|
37
|
-
leftAddon: checkAddon,
|
|
38
|
-
onClick: handleClick,
|
|
39
|
-
role
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
|
-
const props = {
|
|
43
|
-
checked: PropTypes.bool.description("Whether the item is checked or not"),
|
|
44
|
-
checkIcon: PropTypes.element.description("A custom item when the item is checked"),
|
|
45
|
-
name: PropTypes.string.description("form field name"),
|
|
46
|
-
item: PropTypes.object.description("menu item object props"),
|
|
47
|
-
role: PropTypes.string.description("a11y role"),
|
|
48
|
-
leftAddon: PropTypes.node.description("left addon component")
|
|
49
|
-
};
|
|
50
|
-
MenuItemCheckable.propTypes = props;
|
|
51
|
-
const DSMenuItemCheckeableWithSchema = describe(MenuItemCheckable);
|
|
52
|
-
DSMenuItemCheckeableWithSchema.propTypes = props;
|
|
53
|
-
var MenuItemCheckable_default = MenuItemCheckable;
|
|
54
|
-
export {
|
|
55
|
-
DSMenuItemCheckeableWithSchema,
|
|
56
|
-
MenuItemCheckable,
|
|
57
|
-
MenuItemCheckable_default as default
|
|
58
|
-
};
|
|
59
|
-
//# sourceMappingURL=MenuItemCheckable.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/MenuItems/MenuItemCheckable.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable import/no-cycle */\nimport React from 'react';\nimport { PropTypes, describe } from 'react-desc';\nimport { Checkmark } from '@elliemae/ds-icons';\nimport { runAll } from '@elliemae/ds-utilities';\nimport { MenuItem } from './MenuItem';\n\n// TODO: where to move this?\nfunction useCheckable({ checked }) {\n return {\n checked,\n 'aria-checked': checked,\n };\n}\n\n/**\n * Reuses the same props as the MenuItem\n *\n * @param root0\n * @param root0.role\n * @param root0.checked\n * @param root0.name\n * @param root0.checkIcon\n * @param root0.children\n * @param root0.leftAddon\n * @param root0.item\n */\nconst MenuItemCheckable = ({\n role = 'menuitemcheckbox',\n checked = false,\n name = '',\n checkIcon = <Checkmark color={['brand-primary', 600]} />,\n // eslint-disable-next-line react/prop-types\n children,\n leftAddon,\n item = undefined,\n ...otherProps\n}) => {\n const checkableProps = useCheckable({ checked, name });\n const handleClick = () =>\n runAll(otherProps.onClick, checkableProps.onClick)({ target: { value: name, checked } }, item);\n\n const checkAddon =\n leftAddon || (checkableProps.checked ? <div className=\"checkable-mark\">{checkIcon}</div> : <div />);\n return (\n <MenuItem\n {...item}\n {...otherProps}\n {...checkableProps}\n customRenderer={item && item.customRenderer ? item.customRenderer : () => {}}\n items={otherProps.subItems}\n leftAddon={checkAddon}\n onClick={handleClick}\n role={role}\n />\n );\n};\n\nconst props = {\n /** Whether the item is checked or not */\n checked: PropTypes.bool.description('Whether the item is checked or not'),\n /** A custom item when the item is checked */\n checkIcon: PropTypes.element.description('A custom item when the item is checked'),\n /** form field name */\n name: PropTypes.string.description('form field name'),\n /** menu item object props */\n item: PropTypes.object.description('menu item object props'),\n /** a11y role */\n role: PropTypes.string.description('a11y role'),\n /** left addon component */\n leftAddon: PropTypes.node.description('left addon component'),\n};\n\nMenuItemCheckable.propTypes = props;\n\nconst DSMenuItemCheckeableWithSchema = describe(MenuItemCheckable);\nDSMenuItemCheckeableWithSchema.propTypes = props;\n\nexport { DSMenuItemCheckeableWithSchema, MenuItemCheckable };\nexport default MenuItemCheckable;\n"],
|
|
5
|
-
"mappings": "AAAA;ACCA;AACA;AACA;AACA;AACA;AAGA,sBAAsB,EAAE,WAAW;AACjC,SAAO;AAAA,IACL;AAAA,IACA,gBAAgB;AAAA;AAAA;AAgBpB,MAAM,oBAAoB,CAAC;AAAA,EACzB,OAAO;AAAA,EACP,UAAU;AAAA,EACV,OAAO;AAAA,EACP,YAAY,qCAAC,WAAD;AAAA,IAAW,OAAO,CAAC,iBAAiB;AAAA;AAAA,EAEhD;AAAA,EACA;AAAA,EACA,OAAO;AAAA,KACJ;AAAA,MACC;AACJ,QAAM,iBAAiB,aAAa,EAAE,SAAS;AAC/C,QAAM,cAAc,MAClB,OAAO,WAAW,SAAS,eAAe,SAAS,EAAE,QAAQ,EAAE,OAAO,MAAM,aAAa;AAE3F,QAAM,aACJ,aAAc,gBAAe,UAAU,qCAAC,OAAD;AAAA,IAAK,WAAU;AAAA,KAAkB,aAAmB,qCAAC,OAAD;AAC7F,SACE,qCAAC,UAAD;AAAA,OACM;AAAA,OACA;AAAA,OACA;AAAA,IACJ,gBAAgB,QAAQ,KAAK,iBAAiB,KAAK,iBAAiB,MAAM;AAAA;AAAA,IAC1E,OAAO,WAAW;AAAA,IAClB,WAAW;AAAA,IACX,SAAS;AAAA,IACT;AAAA;AAAA;AAKN,MAAM,QAAQ;AAAA,EAEZ,SAAS,UAAU,KAAK,YAAY;AAAA,EAEpC,WAAW,UAAU,QAAQ,YAAY;AAAA,EAEzC,MAAM,UAAU,OAAO,YAAY;AAAA,EAEnC,MAAM,UAAU,OAAO,YAAY;AAAA,EAEnC,MAAM,UAAU,OAAO,YAAY;AAAA,EAEnC,WAAW,UAAU,KAAK,YAAY;AAAA;AAGxC,kBAAkB,YAAY;AAE9B,MAAM,iCAAiC,SAAS;AAChD,+BAA+B,YAAY;AAG3C,IAAO,4BAAQ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import React2 from "react";
|
|
3
|
-
import { DSCheckbox } from "@elliemae/ds-form/Checkbox";
|
|
4
|
-
import { MenuItemCheckable } from "./MenuItemCheckable";
|
|
5
|
-
import { registerMenuItem } from "./menuItemFactory";
|
|
6
|
-
const MenuItemCheckbox = ({ checked, ...rest }) => /* @__PURE__ */ React2.createElement(MenuItemCheckable, {
|
|
7
|
-
...rest,
|
|
8
|
-
leftAddon: /* @__PURE__ */ React2.createElement(DSCheckbox, {
|
|
9
|
-
checked
|
|
10
|
-
}),
|
|
11
|
-
role: "menuitemcheckbox"
|
|
12
|
-
});
|
|
13
|
-
registerMenuItem("checkbox", MenuItemCheckbox);
|
|
14
|
-
var MenuItemCheckbox_default = MenuItemCheckbox;
|
|
15
|
-
export {
|
|
16
|
-
MenuItemCheckbox,
|
|
17
|
-
MenuItemCheckbox_default as default
|
|
18
|
-
};
|
|
19
|
-
//# sourceMappingURL=MenuItemCheckbox.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 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/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
|
-
"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
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import React2 from "react";
|
|
3
|
-
import { describe, PropTypes } from "react-desc";
|
|
4
|
-
import { MenuItemCheckable } from "./MenuItemCheckable";
|
|
5
|
-
import { registerMenuItem } from "./menuItemFactory";
|
|
6
|
-
const MenuItemRadio = (props2) => /* @__PURE__ */ React2.createElement(MenuItemCheckable, {
|
|
7
|
-
...props2,
|
|
8
|
-
role: "menuitemradio"
|
|
9
|
-
});
|
|
10
|
-
const props = {
|
|
11
|
-
checked: PropTypes.bool.description("Whether the item is checked or not"),
|
|
12
|
-
checkIcon: PropTypes.element.description("A custom item when the item is checked")
|
|
13
|
-
};
|
|
14
|
-
MenuItemRadio.propTypes = props;
|
|
15
|
-
registerMenuItem("radio", MenuItemRadio);
|
|
16
|
-
const DSMenuItemRadioWithSchema = describe(MenuItemCheckable);
|
|
17
|
-
DSMenuItemRadioWithSchema.propTypes = props;
|
|
18
|
-
var MenuItemRadio_default = MenuItemRadio;
|
|
19
|
-
export {
|
|
20
|
-
DSMenuItemRadioWithSchema,
|
|
21
|
-
MenuItemRadio,
|
|
22
|
-
MenuItemRadio_default as default
|
|
23
|
-
};
|
|
24
|
-
//# sourceMappingURL=MenuItemRadio.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/MenuItems/MenuItemRadio.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { describe, PropTypes } from 'react-desc';\nimport { MenuItemCheckable } from './MenuItemCheckable';\nimport { registerMenuItem } from './menuItemFactory';\n\nconst MenuItemRadio = (props) => <MenuItemCheckable {...props} role=\"menuitemradio\" />;\n\nconst props = {\n /** Whether the item is checked or not */\n checked: PropTypes.bool.description('Whether the item is checked or not'),\n /** A custom item when the item is checked */\n checkIcon: PropTypes.element.description('A custom item when the item is checked'),\n};\n\nMenuItemRadio.propTypes = props;\nregisterMenuItem('radio', MenuItemRadio);\n\nconst DSMenuItemRadioWithSchema = describe(MenuItemCheckable);\nDSMenuItemRadioWithSchema.propTypes = props;\n\nexport { DSMenuItemRadioWithSchema, MenuItemRadio };\nexport default MenuItemRadio;\n"],
|
|
5
|
-
"mappings": "AAAA;ACAA;AACA;AACA;AACA;AAEA,MAAM,gBAAgB,CAAC,WAAU,qCAAC,mBAAD;AAAA,KAAuB;AAAA,EAAO,MAAK;AAAA;AAEpE,MAAM,QAAQ;AAAA,EAEZ,SAAS,UAAU,KAAK,YAAY;AAAA,EAEpC,WAAW,UAAU,QAAQ,YAAY;AAAA;AAG3C,cAAc,YAAY;AAC1B,iBAAiB,SAAS;AAE1B,MAAM,4BAA4B,SAAS;AAC3C,0BAA0B,YAAY;AAGtC,IAAO,wBAAQ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import React2 from "react";
|
|
3
|
-
import { describe, PropTypes } from "react-desc";
|
|
4
|
-
import { CheckableGroup } from "@elliemae/ds-shared/CheckableGroup";
|
|
5
|
-
const RadioGroup = (props2) => /* @__PURE__ */ React2.createElement(CheckableGroup, {
|
|
6
|
-
...props2,
|
|
7
|
-
multi: false
|
|
8
|
-
});
|
|
9
|
-
const props = {
|
|
10
|
-
active: PropTypes.arrayOf(PropTypes.string).description("the item selected"),
|
|
11
|
-
onCheck: PropTypes.func.description("Handler when a user checks an item")
|
|
12
|
-
};
|
|
13
|
-
RadioGroup.propTypes = props;
|
|
14
|
-
const DSMenuRadioGroupWithSchema = describe(RadioGroup);
|
|
15
|
-
DSMenuRadioGroupWithSchema.propTypes = props;
|
|
16
|
-
var RadioGroup_default = RadioGroup;
|
|
17
|
-
export {
|
|
18
|
-
DSMenuRadioGroupWithSchema,
|
|
19
|
-
RadioGroup,
|
|
20
|
-
RadioGroup_default as default
|
|
21
|
-
};
|
|
22
|
-
//# sourceMappingURL=RadioGroup.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/MenuItems/RadioGroup.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { describe, PropTypes } from 'react-desc';\nimport { CheckableGroup } from '@elliemae/ds-shared/CheckableGroup';\n\nconst RadioGroup = (props) => <CheckableGroup {...props} multi={false} />;\n\nconst props = {\n /* The item selected */\n active: PropTypes.arrayOf(PropTypes.string).description('the item selected'),\n /* Handler when a user checks an item */\n onCheck: PropTypes.func.description('Handler when a user checks an item'),\n};\n\nRadioGroup.propTypes = props;\n\nconst DSMenuRadioGroupWithSchema = describe(RadioGroup);\n\nDSMenuRadioGroupWithSchema.propTypes = props;\n\nexport { DSMenuRadioGroupWithSchema, RadioGroup };\nexport default RadioGroup;\n"],
|
|
5
|
-
"mappings": "AAAA;ACAA;AACA;AACA;AAEA,MAAM,aAAa,CAAC,WAAU,qCAAC,gBAAD;AAAA,KAAoB;AAAA,EAAO,OAAO;AAAA;AAEhE,MAAM,QAAQ;AAAA,EAEZ,QAAQ,UAAU,QAAQ,UAAU,QAAQ,YAAY;AAAA,EAExD,SAAS,UAAU,KAAK,YAAY;AAAA;AAGtC,WAAW,YAAY;AAEvB,MAAM,6BAA6B,SAAS;AAE5C,2BAA2B,YAAY;AAGvC,IAAO,qBAAQ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|