@elliemae/ds-menu 2.3.0-alpha.9 → 2.3.0-next.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/Menu.js +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/{dist/types → types}/Menu.d.ts +2 -4
- package/{dist/types → types}/MenuCombobox.d.ts +0 -0
- package/types/MenuContext.d.ts +3 -0
- package/{dist/types → types}/MenuItems/CheckboxGroup.d.ts +5 -5
- package/{dist/types → types}/MenuItems/MenuItem.d.ts +5 -5
- package/{dist/types → types}/MenuItems/MenuItemCheckable.d.ts +14 -15
- package/{dist/types → types}/MenuItems/MenuItemCheckbox.d.ts +2 -3
- package/{dist/types → types}/MenuItems/MenuItemRadio.d.ts +5 -5
- package/{dist/types → types}/MenuItems/RadioGroup.d.ts +5 -5
- package/{dist/types → types}/MenuItems/SearchableGroup.d.ts +3 -3
- package/{dist/types → types}/MenuItems/SearchableList.d.ts +16 -16
- package/{dist/types → types}/MenuItems/SelectionGroup.d.ts +16 -16
- package/{dist/types → types}/MenuItems/Separator.d.ts +1 -2
- package/{dist/types → types}/MenuItems/SubMenu.d.ts +18 -18
- package/types/MenuItems/menuItemFactory.d.ts +3 -0
- package/{dist/types → types}/VirtualMenuList.d.ts +1 -3
- package/{dist/types → types}/index.d.ts +2 -3
- package/{dist/types → types}/tests/Menu.test.d.ts +0 -0
- package/{dist/types → types}/tests/MenuItem.test.d.ts +0 -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
- package/dist/types/MenuContext.d.ts +0 -4
- package/dist/types/MenuExports.d.ts +0 -1
- package/dist/types/MenuItems/menuItemFactory.d.ts +0 -2
- package/dist/types/MenuItems/renderMenuItems.d.ts +0 -1
- package/dist/types/utils/useHeightByAmountOfItems.d.ts +0 -7
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
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
|
-
};
|
|
12
|
-
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(module2))
|
|
15
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var SearchableGroup_exports = {};
|
|
29
|
-
__export(SearchableGroup_exports, {
|
|
30
|
-
DSMenuSearchableGroupWithSchema: () => DSMenuSearchableGroupWithSchema,
|
|
31
|
-
SearchableGroup: () => SearchableGroupHOC,
|
|
32
|
-
default: () => SearchableGroup_default
|
|
33
|
-
});
|
|
34
|
-
var React = __toESM(require("react"));
|
|
35
|
-
var import_react = __toESM(require("react"));
|
|
36
|
-
var import_ds_classnames = require("@elliemae/ds-classnames");
|
|
37
|
-
var import_FocusGroup = require("@elliemae/ds-shared/FocusGroup");
|
|
38
|
-
var import_SearchBox = require("@elliemae/ds-form/SearchBox");
|
|
39
|
-
var import_react_desc = require("react-desc");
|
|
40
|
-
var import_VirtualMenuList = require("../VirtualMenuList");
|
|
41
|
-
var import_MenuContext = require("../MenuContext");
|
|
42
|
-
const SearchBoxWrapper = (0, import_ds_classnames.aggregatedClasses)("div")("menu-search-group", "search-wrapper");
|
|
43
|
-
const NoOptionsWrapper = (0, import_ds_classnames.aggregatedClasses)("div")("menu-search-group", "no-options");
|
|
44
|
-
const SearchableGroup = ({
|
|
45
|
-
children,
|
|
46
|
-
amountItemsInWindow = 5,
|
|
47
|
-
searchTerm: searchTermProp = "",
|
|
48
|
-
noOptionsText = "No options",
|
|
49
|
-
height,
|
|
50
|
-
width,
|
|
51
|
-
focusOnOpen = false
|
|
52
|
-
}) => {
|
|
53
|
-
const searchRef = (0, import_react.useRef)(null);
|
|
54
|
-
const [searchTerm, setSearchTerm] = (0, import_react.useState)(searchTermProp);
|
|
55
|
-
(0, import_react.useEffect)(() => {
|
|
56
|
-
if (searchRef.current)
|
|
57
|
-
searchRef.current.focus();
|
|
58
|
-
}, []);
|
|
59
|
-
const { visible } = (0, import_react.useContext)(import_MenuContext.MenuContext) || {};
|
|
60
|
-
(0, import_react.useEffect)(() => {
|
|
61
|
-
if (focusOnOpen && visible) {
|
|
62
|
-
setTimeout(() => {
|
|
63
|
-
if (searchRef.current)
|
|
64
|
-
searchRef.current.focus();
|
|
65
|
-
}, 0);
|
|
66
|
-
}
|
|
67
|
-
}, [focusOnOpen, visible]);
|
|
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(import_SearchBox.DSSearchBox, {
|
|
70
|
-
innerRef: searchRef,
|
|
71
|
-
onSearch: ({ value }) => setSearchTerm(value),
|
|
72
|
-
searchOnEnter: false,
|
|
73
|
-
showIcon: false,
|
|
74
|
-
value: searchTerm
|
|
75
|
-
})), !filteredChildren.length && /* @__PURE__ */ import_react.default.createElement(NoOptionsWrapper, null, noOptionsText), /* @__PURE__ */ import_react.default.createElement(import_VirtualMenuList.VirtualMenuList, {
|
|
76
|
-
amountItemsInWindow,
|
|
77
|
-
height,
|
|
78
|
-
items: filteredChildren,
|
|
79
|
-
width
|
|
80
|
-
}));
|
|
81
|
-
};
|
|
82
|
-
const props = {
|
|
83
|
-
amountItemsInWindow: import_react_desc.PropTypes.number.description("The amount of items that are going to be rendered in the group"),
|
|
84
|
-
searchTerm: import_react_desc.PropTypes.string.description("A search term"),
|
|
85
|
-
noOptionsText: import_react_desc.PropTypes.string.description("Text to show when there's no options to show"),
|
|
86
|
-
children: import_react_desc.PropTypes.array.description("array of children for search list"),
|
|
87
|
-
height: import_react_desc.PropTypes.oneOfType([import_react_desc.PropTypes.string, import_react_desc.PropTypes.number]).description("height for virtual list wrapper"),
|
|
88
|
-
width: import_react_desc.PropTypes.oneOfType([import_react_desc.PropTypes.string, import_react_desc.PropTypes.number]).description("width for virtual list wrapper"),
|
|
89
|
-
focusOnOpen: import_react_desc.PropTypes.bool.description("weather to focus on searchable group on open")
|
|
90
|
-
};
|
|
91
|
-
SearchableGroup.propTypes = props;
|
|
92
|
-
const DSMenuSearchableGroupWithSchema = (0, import_react_desc.describe)(SearchableGroup);
|
|
93
|
-
DSMenuSearchableGroupWithSchema.propTypes = props;
|
|
94
|
-
const SearchableGroupHOC = (0, import_FocusGroup.focusGroupManagerHoc)(SearchableGroup);
|
|
95
|
-
var SearchableGroup_default = SearchableGroupHOC;
|
|
96
|
-
module.exports = __toCommonJS(SearchableGroup_exports);
|
|
97
|
-
//# sourceMappingURL=SearchableGroup.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
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;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAwE;AACxE,2BAAkC;AAClC,wBAAqC;AACrC,uBAA4B;AAC5B,wBAAoC;AACpC,6BAAgC;AAChC,yBAA4B;AAE5B,MAAM,mBAAmB,4CAAkB,OACzC,qBACA;AAEF,MAAM,mBAAmB,4CAAkB,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,yBAAO;AACzB,QAAM,CAAC,YAAY,iBAAiB,2BAAS;AAE7C,8BAAU,MAAM;AACd,QAAI,UAAU;AAAS,gBAAU,QAAQ;AAAA,KACxC;AAEH,QAAM,EAAE,YAAY,6BAAW,mCAAgB;AAE/C,8BAAU,MAAM;AACd,QAAI,eAAe,SAAS;AAC1B,iBAAW,MAAM;AACf,YAAI,UAAU;AAAS,oBAAU,QAAQ;AAAA,SACxC;AAAA;AAAA,KAEJ,CAAC,aAAa;AAEjB,QAAM,mBAAmB,0BACvB,MACE,SAAS,OACP,CAAC,UACC,CAAC,cACD,MAAM,MAAM,MAAM,cAAc,WAAW,WAAW,iBAE5D,CAAC,UAAU;AAGb,SACE,wFACE,mDAAC,kBAAD,MACE,mDAAC,8BAAD;AAAA,IACE,UAAU;AAAA,IACV,UAAU,CAAC,EAAE,YAAY,cAAc;AAAA,IACvC,eAAe;AAAA,IACf,UAAU;AAAA,IACV,OAAO;AAAA,OAGV,CAAC,iBAAiB,UACjB,mDAAC,kBAAD,MAAmB,gBAErB,mDAAC,wCAAD;AAAA,IACE;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP;AAAA;AAAA;AAMR,MAAM,QAAQ;AAAA,EAEZ,qBAAqB,4BAAU,OAAO,YACpC;AAAA,EAGF,YAAY,4BAAU,OAAO,YAAY;AAAA,EAEzC,eAAe,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
|
-
}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
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
|
-
};
|
|
12
|
-
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(module2))
|
|
15
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var SearchableList_exports = {};
|
|
29
|
-
__export(SearchableList_exports, {
|
|
30
|
-
DSMenuSearchableListWithSchema: () => DSMenuSearchableListWithSchema,
|
|
31
|
-
SearchableList: () => SearchableList,
|
|
32
|
-
default: () => SearchableList_default
|
|
33
|
-
});
|
|
34
|
-
var React = __toESM(require("react"));
|
|
35
|
-
var import_react = __toESM(require("react"));
|
|
36
|
-
var import_react_desc = require("react-desc");
|
|
37
|
-
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
38
|
-
var import_Combobox = require("@elliemae/ds-form/ComboBox/v2/Combobox");
|
|
39
|
-
const noop = () => {
|
|
40
|
-
};
|
|
41
|
-
const SearchableList = ({
|
|
42
|
-
onSelectMenuItem = noop,
|
|
43
|
-
components = {},
|
|
44
|
-
searchTerm: searchTermProp = "",
|
|
45
|
-
items = [],
|
|
46
|
-
dropdownFilterOptions = {},
|
|
47
|
-
returnValue,
|
|
48
|
-
extraListProps = {},
|
|
49
|
-
appendTermInList = false,
|
|
50
|
-
maxOptions = 10,
|
|
51
|
-
loading = false
|
|
52
|
-
}) => {
|
|
53
|
-
const [searchTerm, setInputValue] = (0, import_react.useState)(searchTermProp);
|
|
54
|
-
const handleInputChange = (0, import_react.useCallback)((value, args) => {
|
|
55
|
-
const action = args ? args.action : null;
|
|
56
|
-
if (action === "input-blur" || action === "menu-close")
|
|
57
|
-
return;
|
|
58
|
-
setInputValue(value);
|
|
59
|
-
}, [searchTerm]);
|
|
60
|
-
const handleFilterByText = (0, import_react.useCallback)(() => {
|
|
61
|
-
if (searchTerm)
|
|
62
|
-
onSelectMenuItem(searchTerm);
|
|
63
|
-
}, [searchTerm]);
|
|
64
|
-
const handleKeyDown = (0, import_react.useCallback)((e) => {
|
|
65
|
-
if (e.key === "ArrowRight") {
|
|
66
|
-
handleFilterByText();
|
|
67
|
-
}
|
|
68
|
-
}, [searchTerm]);
|
|
69
|
-
const options = (0, import_react.useMemo)(() => searchTerm && appendTermInList ? (0, import_ds_utilities.uniqBy)([
|
|
70
|
-
{
|
|
71
|
-
id: searchTerm,
|
|
72
|
-
label: searchTerm
|
|
73
|
-
}
|
|
74
|
-
].concat(items), (item) => item.label) : items, [searchTerm, appendTermInList]);
|
|
75
|
-
return /* @__PURE__ */ import_react.default.createElement(import_Combobox.DSComboBox2, {
|
|
76
|
-
autoFocus: true,
|
|
77
|
-
components: { DropdownIndicator: null, ...components },
|
|
78
|
-
customMenuItemOptions: {
|
|
79
|
-
useTruncatedText: true
|
|
80
|
-
},
|
|
81
|
-
inlineMenu: true,
|
|
82
|
-
inputValue: searchTerm,
|
|
83
|
-
menuIsOpen: true,
|
|
84
|
-
onChange: onSelectMenuItem,
|
|
85
|
-
onFilterByInputText: handleFilterByText,
|
|
86
|
-
onInputChange: handleInputChange,
|
|
87
|
-
onKeyDown: handleKeyDown,
|
|
88
|
-
options,
|
|
89
|
-
returnValue,
|
|
90
|
-
valueProperty: "id",
|
|
91
|
-
maxOptions,
|
|
92
|
-
loading,
|
|
93
|
-
...extraListProps,
|
|
94
|
-
...dropdownFilterOptions
|
|
95
|
-
});
|
|
96
|
-
};
|
|
97
|
-
const props = {
|
|
98
|
-
onSelectMenuItem: import_react_desc.PropTypes.func.description("callback after item gets selected"),
|
|
99
|
-
components: import_react_desc.PropTypes.shape({}).description("Object with custom components for react-select"),
|
|
100
|
-
searchTerm: import_react_desc.PropTypes.string.description("search term to filter for"),
|
|
101
|
-
items: import_react_desc.PropTypes.array.description("item options"),
|
|
102
|
-
dropdownFilterOptions: import_react_desc.PropTypes.shape({}).description("options"),
|
|
103
|
-
returnValue: import_react_desc.PropTypes.bool.description("Whether the combo box is has value to return or not"),
|
|
104
|
-
extraListProps: import_react_desc.PropTypes.shape({}).description("extra props to pass down to combo"),
|
|
105
|
-
appendTermInList: import_react_desc.PropTypes.bool.description("append search term as item on the list"),
|
|
106
|
-
maxOptions: import_react_desc.PropTypes.number.description("maxoptions for combobox"),
|
|
107
|
-
loading: import_react_desc.PropTypes.bool.description("loading flag")
|
|
108
|
-
};
|
|
109
|
-
SearchableList.propTypes = props;
|
|
110
|
-
const DSMenuSearchableListWithSchema = (0, import_react_desc.describe)(SearchableList);
|
|
111
|
-
DSMenuSearchableListWithSchema.propTypes = props;
|
|
112
|
-
var SearchableList_default = SearchableList;
|
|
113
|
-
module.exports = __toCommonJS(SearchableList_exports);
|
|
114
|
-
//# sourceMappingURL=SearchableList.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/MenuItems/SearchableList.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React, { useCallback, useMemo, useState } from 'react';\nimport { PropTypes, describe } from 'react-desc';\nimport { uniqBy } from '@elliemae/ds-utilities';\nimport { DSComboBox2 as DSComboBox } from '@elliemae/ds-form/ComboBox/v2/Combobox';\n\nconst noop = () => {};\n\nconst SearchableList = ({\n onSelectMenuItem = noop,\n components = {},\n searchTerm: searchTermProp = '',\n items = [],\n dropdownFilterOptions = {},\n returnValue,\n extraListProps = {},\n appendTermInList = false,\n maxOptions = 10,\n loading = false,\n}) => {\n const [searchTerm, setInputValue] = useState(searchTermProp);\n\n const handleInputChange = useCallback(\n (value, args) => {\n const action = args ? args.action : null;\n if (action === 'input-blur' || action === 'menu-close') return;\n setInputValue(value);\n },\n [searchTerm],\n );\n\n const handleFilterByText = useCallback(() => {\n if (searchTerm) onSelectMenuItem(searchTerm);\n }, [searchTerm]);\n\n const handleKeyDown = useCallback(\n (e) => {\n if (e.key === 'ArrowRight') {\n handleFilterByText();\n }\n },\n [searchTerm],\n );\n\n const options = useMemo(\n () =>\n searchTerm && appendTermInList\n ? uniqBy(\n [\n {\n id: searchTerm,\n label: searchTerm,\n },\n ].concat(items),\n (item) => item.label,\n )\n : items,\n [searchTerm, appendTermInList],\n );\n\n return (\n <DSComboBox\n autoFocus\n components={{ DropdownIndicator: null, ...components }}\n customMenuItemOptions={{\n useTruncatedText: true,\n }}\n inlineMenu\n inputValue={searchTerm}\n menuIsOpen\n onChange={onSelectMenuItem}\n onFilterByInputText={handleFilterByText}\n onInputChange={handleInputChange}\n onKeyDown={handleKeyDown}\n options={options}\n returnValue={returnValue}\n valueProperty=\"id\"\n maxOptions={maxOptions}\n loading={loading}\n {...extraListProps}\n {...dropdownFilterOptions}\n />\n );\n};\n\nconst props = {\n /** callback after item gets selected */\n onSelectMenuItem: PropTypes.func.description('callback after item gets selected'),\n /** Object with custom components for react-select */\n components: PropTypes.shape({}).description('Object with custom components for react-select'),\n /** search term to filter for */\n searchTerm: PropTypes.string.description('search term to filter for'),\n /** item options */\n items: PropTypes.array.description('item options'),\n /** options */\n dropdownFilterOptions: PropTypes.shape({}).description('options'),\n /** Whether the combo box is has value to return or not */\n returnValue: PropTypes.bool.description('Whether the combo box is has value to return or not'),\n /** extra props to pass down to combo */\n extraListProps: PropTypes.shape({}).description('extra props to pass down to combo'),\n /** append search term as item on the list */\n appendTermInList: PropTypes.bool.description('append search term as item on the list'),\n /** maxoptions for combobox */\n maxOptions: PropTypes.number.description('maxoptions for combobox'),\n /** loading flag */\n loading: PropTypes.bool.description('loading flag'),\n};\n\nSearchableList.propTypes = props;\n\nconst DSMenuSearchableListWithSchema = describe(SearchableList);\n\nDSMenuSearchableListWithSchema.propTypes = props;\n\nexport { DSMenuSearchableListWithSchema, SearchableList };\nexport default SearchableList;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAsD;AACtD,wBAAoC;AACpC,0BAAuB;AACvB,sBAA0C;AAE1C,MAAM,OAAO,MAAM;AAAA;AAEnB,MAAM,iBAAiB,CAAC;AAAA,EACtB,mBAAmB;AAAA,EACnB,aAAa;AAAA,EACb,YAAY,iBAAiB;AAAA,EAC7B,QAAQ;AAAA,EACR,wBAAwB;AAAA,EACxB;AAAA,EACA,iBAAiB;AAAA,EACjB,mBAAmB;AAAA,EACnB,aAAa;AAAA,EACb,UAAU;AAAA,MACN;AACJ,QAAM,CAAC,YAAY,iBAAiB,2BAAS;AAE7C,QAAM,oBAAoB,8BACxB,CAAC,OAAO,SAAS;AACf,UAAM,SAAS,OAAO,KAAK,SAAS;AACpC,QAAI,WAAW,gBAAgB,WAAW;AAAc;AACxD,kBAAc;AAAA,KAEhB,CAAC;AAGH,QAAM,qBAAqB,8BAAY,MAAM;AAC3C,QAAI;AAAY,uBAAiB;AAAA,KAChC,CAAC;AAEJ,QAAM,gBAAgB,8BACpB,CAAC,MAAM;AACL,QAAI,EAAE,QAAQ,cAAc;AAC1B;AAAA;AAAA,KAGJ,CAAC;AAGH,QAAM,UAAU,0BACd,MACE,cAAc,mBACV,gCACE;AAAA,IACE;AAAA,MACE,IAAI;AAAA,MACJ,OAAO;AAAA;AAAA,IAET,OAAO,QACT,CAAC,SAAS,KAAK,SAEjB,OACN,CAAC,YAAY;AAGf,SACE,mDAAC,6BAAD;AAAA,IACE,WAAS;AAAA,IACT,YAAY,EAAE,mBAAmB,SAAS;AAAA,IAC1C,uBAAuB;AAAA,MACrB,kBAAkB;AAAA;AAAA,IAEpB,YAAU;AAAA,IACV,YAAY;AAAA,IACZ,YAAU;AAAA,IACV,UAAU;AAAA,IACV,qBAAqB;AAAA,IACrB,eAAe;AAAA,IACf,WAAW;AAAA,IACX;AAAA,IACA;AAAA,IACA,eAAc;AAAA,IACd;AAAA,IACA;AAAA,OACI;AAAA,OACA;AAAA;AAAA;AAKV,MAAM,QAAQ;AAAA,EAEZ,kBAAkB,4BAAU,KAAK,YAAY;AAAA,EAE7C,YAAY,4BAAU,MAAM,IAAI,YAAY;AAAA,EAE5C,YAAY,4BAAU,OAAO,YAAY;AAAA,EAEzC,OAAO,4BAAU,MAAM,YAAY;AAAA,EAEnC,uBAAuB,4BAAU,MAAM,IAAI,YAAY;AAAA,EAEvD,aAAa,4BAAU,KAAK,YAAY;AAAA,EAExC,gBAAgB,4BAAU,MAAM,IAAI,YAAY;AAAA,EAEhD,kBAAkB,4BAAU,KAAK,YAAY;AAAA,EAE7C,YAAY,4BAAU,OAAO,YAAY;AAAA,EAEzC,SAAS,4BAAU,KAAK,YAAY;AAAA;AAGtC,eAAe,YAAY;AAE3B,MAAM,iCAAiC,gCAAS;AAEhD,+BAA+B,YAAY;AAG3C,IAAO,yBAAQ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
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
|
-
};
|
|
12
|
-
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(module2))
|
|
15
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var SelectionGroup_exports = {};
|
|
29
|
-
__export(SelectionGroup_exports, {
|
|
30
|
-
DSMenuSelectionGroupWithSchema: () => DSMenuSelectionGroupWithSchema,
|
|
31
|
-
SelectionGroup: () => SelectionGroup,
|
|
32
|
-
default: () => SelectionGroup_default
|
|
33
|
-
});
|
|
34
|
-
var React = __toESM(require("react"));
|
|
35
|
-
var import_react = __toESM(require("react"));
|
|
36
|
-
var import_react_desc = require("react-desc");
|
|
37
|
-
var import_CheckableGroup = require("@elliemae/ds-shared/CheckableGroup");
|
|
38
|
-
var import_SearchableGroup = require("./SearchableGroup");
|
|
39
|
-
var import_menuItemFactory = require("./menuItemFactory");
|
|
40
|
-
var import_VirtualMenuList = require("../VirtualMenuList");
|
|
41
|
-
const noop = () => null;
|
|
42
|
-
const SelectionGroup = ({
|
|
43
|
-
multi = false,
|
|
44
|
-
searchable = false,
|
|
45
|
-
focusOnOpen = false,
|
|
46
|
-
onSelect = noop,
|
|
47
|
-
children,
|
|
48
|
-
items = void 0,
|
|
49
|
-
active = multi ? [] : "",
|
|
50
|
-
width,
|
|
51
|
-
height,
|
|
52
|
-
maxOptions = 5
|
|
53
|
-
}) => {
|
|
54
|
-
const renderedItems = (0, import_react.useMemo)(() => items && items.map((item) => {
|
|
55
|
-
const Component = (0, import_menuItemFactory.menuItemFactory)(multi ? "checkbox" : "radio");
|
|
56
|
-
return /* @__PURE__ */ import_react.default.createElement(Component, {
|
|
57
|
-
...item,
|
|
58
|
-
key: item.name || item.id || item.key,
|
|
59
|
-
item,
|
|
60
|
-
name: item.id || item.name
|
|
61
|
-
});
|
|
62
|
-
}), [items]);
|
|
63
|
-
const decoratedGroupChildren = (0, import_CheckableGroup.useCheckableGroup)({
|
|
64
|
-
children: renderedItems || children,
|
|
65
|
-
multi,
|
|
66
|
-
active,
|
|
67
|
-
onCheck: onSelect
|
|
68
|
-
});
|
|
69
|
-
if (searchable) {
|
|
70
|
-
return /* @__PURE__ */ import_react.default.createElement(import_SearchableGroup.SearchableGroup, {
|
|
71
|
-
focusOnOpen,
|
|
72
|
-
height,
|
|
73
|
-
items,
|
|
74
|
-
width
|
|
75
|
-
}, decoratedGroupChildren);
|
|
76
|
-
}
|
|
77
|
-
return /* @__PURE__ */ import_react.default.createElement(import_VirtualMenuList.VirtualMenuList, {
|
|
78
|
-
height,
|
|
79
|
-
items: decoratedGroupChildren,
|
|
80
|
-
width,
|
|
81
|
-
amountItemsInWindow: maxOptions
|
|
82
|
-
});
|
|
83
|
-
};
|
|
84
|
-
const props = {
|
|
85
|
-
multi: import_react_desc.PropTypes.bool.description("toggle on multi select"),
|
|
86
|
-
searchable: import_react_desc.PropTypes.bool.description("toggle on searchable behavior"),
|
|
87
|
-
focusOnOpen: import_react_desc.PropTypes.bool.description("toggle to focus component on open"),
|
|
88
|
-
onSelect: import_react_desc.PropTypes.func.description("callback that triggers when select happens"),
|
|
89
|
-
children: import_react_desc.PropTypes.node.description(""),
|
|
90
|
-
items: import_react_desc.PropTypes.array.description("selection group items"),
|
|
91
|
-
active: import_react_desc.PropTypes.oneOfType([import_react_desc.PropTypes.string, import_react_desc.PropTypes.array]).description("array of values for multi and string for single selection"),
|
|
92
|
-
width: import_react_desc.PropTypes.number.description("selection group width"),
|
|
93
|
-
height: import_react_desc.PropTypes.number.description("selection group height")
|
|
94
|
-
};
|
|
95
|
-
SelectionGroup.propTypes = props;
|
|
96
|
-
(0, import_menuItemFactory.registerMenuItem)("selectiongroup", SelectionGroup);
|
|
97
|
-
(0, import_menuItemFactory.registerMenuItem)("SelectionGroup", SelectionGroup);
|
|
98
|
-
const DSMenuSelectionGroupWithSchema = (0, import_react_desc.describe)(SelectionGroup);
|
|
99
|
-
DSMenuSelectionGroupWithSchema.propTypes = props;
|
|
100
|
-
var SelectionGroup_default = SelectionGroup;
|
|
101
|
-
module.exports = __toCommonJS(SelectionGroup_exports);
|
|
102
|
-
//# sourceMappingURL=SelectionGroup.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/MenuItems/SelectionGroup.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React, { useMemo } from 'react';\nimport { PropTypes, describe } from 'react-desc';\nimport { useCheckableGroup } from '@elliemae/ds-shared/CheckableGroup';\nimport { SearchableGroup } from './SearchableGroup';\nimport { registerMenuItem, menuItemFactory } from './menuItemFactory';\nimport { VirtualMenuList } from '../VirtualMenuList';\n\nconst noop = () => null;\n\nconst SelectionGroup = ({\n multi = false,\n searchable = false,\n focusOnOpen = false,\n onSelect = noop,\n children,\n items = undefined,\n active = multi ? [] : '',\n width,\n height,\n maxOptions = 5,\n}) => {\n const renderedItems = useMemo(\n () =>\n items &&\n items.map((item) => {\n const Component = menuItemFactory(multi ? 'checkbox' : 'radio');\n return <Component {...item} key={item.name || item.id || item.key} item={item} name={item.id || item.name} />;\n }),\n [items],\n );\n const decoratedGroupChildren = useCheckableGroup({\n children: renderedItems || children,\n multi,\n active,\n onCheck: onSelect,\n });\n\n if (searchable) {\n return (\n <SearchableGroup focusOnOpen={focusOnOpen} height={height} items={items} width={width}>\n {decoratedGroupChildren}\n </SearchableGroup>\n );\n }\n return (\n <VirtualMenuList height={height} items={decoratedGroupChildren} width={width} amountItemsInWindow={maxOptions} />\n );\n};\n\nconst props = {\n /** toggle on multi select */\n multi: PropTypes.bool.description('toggle on multi select'),\n /** toggle on searchable behavior */\n searchable: PropTypes.bool.description('toggle on searchable behavior'),\n /** toggle to focus component on open */\n focusOnOpen: PropTypes.bool.description('toggle to focus component on open'),\n /** callback that triggers when select happens */\n onSelect: PropTypes.func.description('callback that triggers when select happens'),\n children: PropTypes.node.description(''),\n /** selection group items */\n items: PropTypes.array.description('selection group items'),\n /** array of values for multi and string for single selection */\n active: PropTypes.oneOfType([PropTypes.string, PropTypes.array]).description(\n 'array of values for multi and string for single selection',\n ),\n /** selection group width */\n width: PropTypes.number.description('selection group width'),\n /** selection group height */\n height: PropTypes.number.description('selection group height'),\n};\n\nSelectionGroup.propTypes = props;\nregisterMenuItem('selectiongroup', SelectionGroup);\nregisterMenuItem('SelectionGroup', SelectionGroup);\n\nconst DSMenuSelectionGroupWithSchema = describe(SelectionGroup);\nDSMenuSelectionGroupWithSchema.propTypes = props;\n\nexport { DSMenuSelectionGroupWithSchema, SelectionGroup };\nexport default SelectionGroup;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA+B;AAC/B,wBAAoC;AACpC,4BAAkC;AAClC,6BAAgC;AAChC,6BAAkD;AAClD,6BAAgC;AAEhC,MAAM,OAAO,MAAM;AAEnB,MAAM,iBAAiB,CAAC;AAAA,EACtB,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,cAAc;AAAA,EACd,WAAW;AAAA,EACX;AAAA,EACA,QAAQ;AAAA,EACR,SAAS,QAAQ,KAAK;AAAA,EACtB;AAAA,EACA;AAAA,EACA,aAAa;AAAA,MACT;AACJ,QAAM,gBAAgB,0BACpB,MACE,SACA,MAAM,IAAI,CAAC,SAAS;AAClB,UAAM,YAAY,4CAAgB,QAAQ,aAAa;AACvD,WAAO,mDAAC,WAAD;AAAA,SAAe;AAAA,MAAM,KAAK,KAAK,QAAQ,KAAK,MAAM,KAAK;AAAA,MAAK;AAAA,MAAY,MAAM,KAAK,MAAM,KAAK;AAAA;AAAA,MAEzG,CAAC;AAEH,QAAM,yBAAyB,6CAAkB;AAAA,IAC/C,UAAU,iBAAiB;AAAA,IAC3B;AAAA,IACA;AAAA,IACA,SAAS;AAAA;AAGX,MAAI,YAAY;AACd,WACE,mDAAC,wCAAD;AAAA,MAAiB;AAAA,MAA0B;AAAA,MAAgB;AAAA,MAAc;AAAA,OACtE;AAAA;AAIP,SACE,mDAAC,wCAAD;AAAA,IAAiB;AAAA,IAAgB,OAAO;AAAA,IAAwB;AAAA,IAAc,qBAAqB;AAAA;AAAA;AAIvG,MAAM,QAAQ;AAAA,EAEZ,OAAO,4BAAU,KAAK,YAAY;AAAA,EAElC,YAAY,4BAAU,KAAK,YAAY;AAAA,EAEvC,aAAa,4BAAU,KAAK,YAAY;AAAA,EAExC,UAAU,4BAAU,KAAK,YAAY;AAAA,EACrC,UAAU,4BAAU,KAAK,YAAY;AAAA,EAErC,OAAO,4BAAU,MAAM,YAAY;AAAA,EAEnC,QAAQ,4BAAU,UAAU,CAAC,4BAAU,QAAQ,4BAAU,QAAQ,YAC/D;AAAA,EAGF,OAAO,4BAAU,OAAO,YAAY;AAAA,EAEpC,QAAQ,4BAAU,OAAO,YAAY;AAAA;AAGvC,eAAe,YAAY;AAC3B,6CAAiB,kBAAkB;AACnC,6CAAiB,kBAAkB;AAEnC,MAAM,iCAAiC,gCAAS;AAChD,+BAA+B,YAAY;AAG3C,IAAO,yBAAQ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
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
|
-
};
|
|
12
|
-
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(module2))
|
|
15
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var Separator_exports = {};
|
|
29
|
-
__export(Separator_exports, {
|
|
30
|
-
DSMenuSeparatorWithSchema: () => DSMenuSeparatorWithSchema,
|
|
31
|
-
MenuSeparator: () => MenuSeparator,
|
|
32
|
-
default: () => Separator_default
|
|
33
|
-
});
|
|
34
|
-
var React = __toESM(require("react"));
|
|
35
|
-
var import_react = __toESM(require("react"));
|
|
36
|
-
var import_react_desc = require("react-desc");
|
|
37
|
-
var import_ds_classnames = require("@elliemae/ds-classnames");
|
|
38
|
-
var import_ds_separator = require("@elliemae/ds-separator");
|
|
39
|
-
var import_styled_components = __toESM(require("styled-components"));
|
|
40
|
-
var import_menuItemFactory = require("./menuItemFactory");
|
|
41
|
-
const blockName = "menu-separator";
|
|
42
|
-
const Li = import_styled_components.default.li`
|
|
43
|
-
display: flex;
|
|
44
|
-
align-items: flex-start;
|
|
45
|
-
flex-direction: column;
|
|
46
|
-
`;
|
|
47
|
-
const Title = (0, import_ds_classnames.aggregatedClasses)("h5")(blockName, "title");
|
|
48
|
-
const MenuSeparator = ({ title, showSeparator = true }) => /* @__PURE__ */ import_react.default.createElement(Li, null, showSeparator && /* @__PURE__ */ import_react.default.createElement(import_ds_separator.DSSeparator, null), title && /* @__PURE__ */ import_react.default.createElement(Title, null, title));
|
|
49
|
-
const props = {
|
|
50
|
-
title: import_react_desc.PropTypes.string.description("menu separator h5 title"),
|
|
51
|
-
showSeparator: import_react_desc.PropTypes.bool.description("toggle separator on and off")
|
|
52
|
-
};
|
|
53
|
-
MenuSeparator.propTypes = props;
|
|
54
|
-
(0, import_menuItemFactory.registerMenuItem)("separator", MenuSeparator);
|
|
55
|
-
const DSMenuSeparatorWithSchema = (0, import_react_desc.describe)(MenuSeparator);
|
|
56
|
-
DSMenuSeparatorWithSchema.propTypes = props;
|
|
57
|
-
var Separator_default = MenuSeparator;
|
|
58
|
-
module.exports = __toCommonJS(Separator_exports);
|
|
59
|
-
//# sourceMappingURL=Separator.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/MenuItems/Separator.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React from 'react';\nimport { describe, PropTypes } from 'react-desc';\nimport { aggregatedClasses } from '@elliemae/ds-classnames';\nimport { DSSeparator } from '@elliemae/ds-separator';\nimport styled from 'styled-components';\nimport { registerMenuItem } from './menuItemFactory';\n\nconst blockName = 'menu-separator';\nconst Li = styled.li`\n display: flex;\n align-items: flex-start;\n flex-direction: column;\n`;\n\nconst Title = aggregatedClasses('h5')(blockName, 'title');\nconst MenuSeparator = ({ title, showSeparator = true }) => (\n <Li>\n {showSeparator && <DSSeparator />}\n {title && <Title>{title}</Title>}\n </Li>\n);\n\nconst props = {\n /** menu separator h5 title */\n title: PropTypes.string.description('menu separator h5 title'),\n /** toggle separator on and off */\n showSeparator: PropTypes.bool.description('toggle separator on and off'),\n};\n\nMenuSeparator.propTypes = props;\nregisterMenuItem('separator', MenuSeparator);\n\nconst DSMenuSeparatorWithSchema = describe(MenuSeparator);\nDSMenuSeparatorWithSchema.propTypes = props;\n\nexport { DSMenuSeparatorWithSchema, MenuSeparator };\nexport default MenuSeparator;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkB;AAClB,wBAAoC;AACpC,2BAAkC;AAClC,0BAA4B;AAC5B,+BAAmB;AACnB,6BAAiC;AAEjC,MAAM,YAAY;AAClB,MAAM,KAAK,iCAAO;AAAA;AAAA;AAAA;AAAA;AAMlB,MAAM,QAAQ,4CAAkB,MAAM,WAAW;AACjD,MAAM,gBAAgB,CAAC,EAAE,OAAO,gBAAgB,WAC9C,mDAAC,IAAD,MACG,iBAAiB,mDAAC,iCAAD,OACjB,SAAS,mDAAC,OAAD,MAAQ;AAItB,MAAM,QAAQ;AAAA,EAEZ,OAAO,4BAAU,OAAO,YAAY;AAAA,EAEpC,eAAe,4BAAU,KAAK,YAAY;AAAA;AAG5C,cAAc,YAAY;AAC1B,6CAAiB,aAAa;AAE9B,MAAM,4BAA4B,gCAAS;AAC3C,0BAA0B,YAAY;AAGtC,IAAO,oBAAQ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
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
|
-
};
|
|
12
|
-
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(module2))
|
|
15
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var SubMenu_exports = {};
|
|
29
|
-
__export(SubMenu_exports, {
|
|
30
|
-
DSSubMenuWithSchema: () => DSSubMenuWithSchema,
|
|
31
|
-
SubMenu: () => SubMenu,
|
|
32
|
-
default: () => SubMenu_default
|
|
33
|
-
});
|
|
34
|
-
var React = __toESM(require("react"));
|
|
35
|
-
var import_react = __toESM(require("react"));
|
|
36
|
-
var import_react_desc = require("react-desc");
|
|
37
|
-
var import_styled_components = __toESM(require("styled-components"));
|
|
38
|
-
var import_ds_icons = require("@elliemae/ds-icons");
|
|
39
|
-
var import_FocusGroup = require("@elliemae/ds-shared/FocusGroup");
|
|
40
|
-
var import_ds_hidden = require("@elliemae/ds-hidden");
|
|
41
|
-
var import_ds_button = require("@elliemae/ds-button");
|
|
42
|
-
var import_ds_popper = require("@elliemae/ds-popper");
|
|
43
|
-
var import_Menu = require("../Menu");
|
|
44
|
-
var import_MenuItem = require("./MenuItem");
|
|
45
|
-
var import_menuItemFactory = require("./menuItemFactory");
|
|
46
|
-
const ChevronRightComp = import_styled_components.default.div`
|
|
47
|
-
display: flex;
|
|
48
|
-
justify-content: center;
|
|
49
|
-
align-items: center;
|
|
50
|
-
width: 28px; // same width as the ellipsis button
|
|
51
|
-
`;
|
|
52
|
-
const SubMenu = ({
|
|
53
|
-
noAddon,
|
|
54
|
-
leftAddon = void 0,
|
|
55
|
-
label = void 0,
|
|
56
|
-
interactionType = "hover",
|
|
57
|
-
children: subitems,
|
|
58
|
-
rightAddonType,
|
|
59
|
-
disabledAddonInactive,
|
|
60
|
-
checkableProps = {},
|
|
61
|
-
customRenderer,
|
|
62
|
-
onClick,
|
|
63
|
-
closeMenu,
|
|
64
|
-
id
|
|
65
|
-
}) => {
|
|
66
|
-
const itemRef = (0, import_react.useRef)(null);
|
|
67
|
-
const focusOnOpen = (0, import_react.useRef)(false);
|
|
68
|
-
const [isAddonHovered, setIsAddonHovered] = (0, import_react.useState)(false);
|
|
69
|
-
const {
|
|
70
|
-
visible = false,
|
|
71
|
-
onShow,
|
|
72
|
-
onHide
|
|
73
|
-
} = (0, import_ds_hidden.useHiddenController)(void 0, {
|
|
74
|
-
interaction: "click"
|
|
75
|
-
});
|
|
76
|
-
const interaction = rightAddonType === "elipsis" ? "click" : "hover";
|
|
77
|
-
const { focusItemByNode } = (0, import_FocusGroup.useFocusGroupItem)();
|
|
78
|
-
const handleShowSubItemsWithMouse = (e) => {
|
|
79
|
-
e.stopPropagation();
|
|
80
|
-
onShow();
|
|
81
|
-
focusOnOpen.current = true;
|
|
82
|
-
};
|
|
83
|
-
const handleShowWithMouse = (e) => {
|
|
84
|
-
if (onClick)
|
|
85
|
-
onClick(e);
|
|
86
|
-
};
|
|
87
|
-
const handleShowWithMouseHover = () => {
|
|
88
|
-
setIsAddonHovered(true);
|
|
89
|
-
onShow();
|
|
90
|
-
focusOnOpen.current = false;
|
|
91
|
-
};
|
|
92
|
-
const handleShowWithKeyboard = () => {
|
|
93
|
-
onShow();
|
|
94
|
-
focusOnOpen.current = true;
|
|
95
|
-
};
|
|
96
|
-
const handleOnMouseEnter = (0, import_react.useCallback)(() => {
|
|
97
|
-
setIsAddonHovered(true);
|
|
98
|
-
}, []);
|
|
99
|
-
const handleOnMouseLeave = (0, import_react.useCallback)(() => {
|
|
100
|
-
setIsAddonHovered(false);
|
|
101
|
-
}, []);
|
|
102
|
-
const hoverHandlers = interaction === "hover" ? {
|
|
103
|
-
onMouseEnter: handleShowWithMouseHover,
|
|
104
|
-
onMouseLeave: () => {
|
|
105
|
-
onHide();
|
|
106
|
-
setIsAddonHovered(false);
|
|
107
|
-
}
|
|
108
|
-
} : { onClick: handleShowWithMouse };
|
|
109
|
-
const rightAddon = rightAddonType === "elipsis" ? /* @__PURE__ */ import_react.default.createElement(import_ds_button.DSButton, {
|
|
110
|
-
"aria-label": "vertical-elipsis",
|
|
111
|
-
"data-testid": "vertical-elipsis",
|
|
112
|
-
buttonType: "text",
|
|
113
|
-
leftIcon: /* @__PURE__ */ import_react.default.createElement(import_ds_icons.MoreOptionsVert, {
|
|
114
|
-
className: "submenu-arrow",
|
|
115
|
-
color: visible || isAddonHovered ? ["brand-primary", 800] : ["neutral", 500],
|
|
116
|
-
size: "s"
|
|
117
|
-
}),
|
|
118
|
-
onClick: (e) => handleShowSubItemsWithMouse(e),
|
|
119
|
-
size: "m",
|
|
120
|
-
variant: import_ds_button.BUTTON_VARIANT.DEFAULT
|
|
121
|
-
}) : /* @__PURE__ */ import_react.default.createElement(ChevronRightComp, null, /* @__PURE__ */ import_react.default.createElement(import_ds_icons.ChevronSmallRight, {
|
|
122
|
-
"data-testid": "chevron-right",
|
|
123
|
-
className: "submenu-arrow",
|
|
124
|
-
color: visible || isAddonHovered ? ["brand-primary", 800] : ["neutral", 500],
|
|
125
|
-
size: "sm"
|
|
126
|
-
}));
|
|
127
|
-
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(import_ds_popper.DSPopper, {
|
|
128
|
-
contentComponent: /* @__PURE__ */ import_react.default.createElement(import_Menu.Menu, {
|
|
129
|
-
focusKeyBindings: {
|
|
130
|
-
ArrowLeft: [() => focusItemByNode(itemRef.current), "exit"]
|
|
131
|
-
},
|
|
132
|
-
focusOnOpen: focusOnOpen.current,
|
|
133
|
-
onExitFocusGroup: onHide,
|
|
134
|
-
...hoverHandlers,
|
|
135
|
-
closeMenu,
|
|
136
|
-
visible
|
|
137
|
-
}, subitems),
|
|
138
|
-
interactionType,
|
|
139
|
-
isOpen: visible,
|
|
140
|
-
onOpen: (opening) => opening ? onShow() : onHide(),
|
|
141
|
-
placement: "right-start",
|
|
142
|
-
showArrow: false,
|
|
143
|
-
triggerComponent: /* @__PURE__ */ import_react.default.createElement(import_MenuItem.MenuItem, {
|
|
144
|
-
customRenderer,
|
|
145
|
-
disabledAddonInactive,
|
|
146
|
-
id,
|
|
147
|
-
innerRef: itemRef,
|
|
148
|
-
label,
|
|
149
|
-
leftAddon,
|
|
150
|
-
noAddon,
|
|
151
|
-
onFocus: handleOnMouseEnter,
|
|
152
|
-
onBlur: handleOnMouseLeave,
|
|
153
|
-
onMouseEnter: handleOnMouseEnter,
|
|
154
|
-
onMouseLeave: handleOnMouseLeave,
|
|
155
|
-
...hoverHandlers,
|
|
156
|
-
onKeyDown: (e) => {
|
|
157
|
-
if (e.key === "ArrowRight" || e.key === "Enter" || e.keyCode === 32) {
|
|
158
|
-
handleShowWithKeyboard();
|
|
159
|
-
}
|
|
160
|
-
},
|
|
161
|
-
rightAddon,
|
|
162
|
-
...checkableProps
|
|
163
|
-
})
|
|
164
|
-
}));
|
|
165
|
-
};
|
|
166
|
-
const props = {
|
|
167
|
-
noAddon: import_react_desc.PropTypes.bool.description("dont show addon for submenu"),
|
|
168
|
-
leftAddon: import_react_desc.PropTypes.node.description("left addon"),
|
|
169
|
-
label: import_react_desc.PropTypes.string.description("submenu label"),
|
|
170
|
-
interactionType: import_react_desc.PropTypes.oneOf(import_ds_popper.interactions).description("A type indicating how to open/close the tooltip"),
|
|
171
|
-
children: import_react_desc.PropTypes.oneOfType([import_react_desc.PropTypes.array, import_react_desc.PropTypes.node]).description("sub menu items"),
|
|
172
|
-
rightAddonType: import_react_desc.PropTypes.oneOf(["ellipsis"]).description("right addon, ellipsis or undefined"),
|
|
173
|
-
disabledAddonInactive: import_react_desc.PropTypes.bool.description(""),
|
|
174
|
-
checkableProps: import_react_desc.PropTypes.object.description("props passed to MenuItem component"),
|
|
175
|
-
customRenderer: import_react_desc.PropTypes.func.description("custom renderer for menu item"),
|
|
176
|
-
onClick: import_react_desc.PropTypes.func.description("on click handler"),
|
|
177
|
-
closeMenu: import_react_desc.PropTypes.any.description(""),
|
|
178
|
-
id: import_react_desc.PropTypes.string.description("component id")
|
|
179
|
-
};
|
|
180
|
-
SubMenu.propTypes = props;
|
|
181
|
-
(0, import_menuItemFactory.registerMenuItem)("submenu", SubMenu);
|
|
182
|
-
(0, import_Menu.setSubMenu)(SubMenu);
|
|
183
|
-
const DSSubMenuWithSchema = (0, import_react_desc.describe)(SubMenu);
|
|
184
|
-
DSSubMenuWithSchema.propTypes = props;
|
|
185
|
-
var SubMenu_default = SubMenu;
|
|
186
|
-
module.exports = __toCommonJS(SubMenu_exports);
|
|
187
|
-
//# sourceMappingURL=SubMenu.js.map
|