@elliemae/ds-menu 2.2.0 → 2.3.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/cjs/Menu.js +137 -181
  2. package/cjs/Menu.js.map +7 -0
  3. package/cjs/MenuCombobox.js +67 -53
  4. package/cjs/MenuCombobox.js.map +7 -0
  5. package/cjs/MenuContext.js +38 -11
  6. package/cjs/MenuContext.js.map +7 -0
  7. package/cjs/MenuExports.js +28 -0
  8. package/cjs/MenuExports.js.map +7 -0
  9. package/cjs/MenuItems/CheckboxGroup.js +49 -42
  10. package/cjs/MenuItems/CheckboxGroup.js.map +7 -0
  11. package/cjs/MenuItems/MenuItem.js +116 -163
  12. package/cjs/MenuItems/MenuItem.js.map +7 -0
  13. package/cjs/MenuItems/MenuItemCheckable.js +77 -108
  14. package/cjs/MenuItems/MenuItemCheckable.js.map +7 -0
  15. package/cjs/MenuItems/MenuItemCheckbox.js +47 -41
  16. package/cjs/MenuItems/MenuItemCheckbox.js.map +7 -0
  17. package/cjs/MenuItems/MenuItemRadio.js +50 -38
  18. package/cjs/MenuItems/MenuItemRadio.js.map +7 -0
  19. package/cjs/MenuItems/RadioGroup.js +48 -39
  20. package/cjs/MenuItems/RadioGroup.js.map +7 -0
  21. package/cjs/MenuItems/SearchableGroup.js +88 -92
  22. package/cjs/MenuItems/SearchableGroup.js.map +7 -0
  23. package/cjs/MenuItems/SearchableList.js +92 -95
  24. package/cjs/MenuItems/SearchableList.js.map +7 -0
  25. package/cjs/MenuItems/SelectionGroup.js +85 -90
  26. package/cjs/MenuItems/SelectionGroup.js.map +7 -0
  27. package/cjs/MenuItems/Separator.js +55 -40
  28. package/cjs/MenuItems/Separator.js.map +7 -0
  29. package/cjs/MenuItems/SubMenu.js +143 -160
  30. package/cjs/MenuItems/SubMenu.js.map +7 -0
  31. package/cjs/MenuItems/menuItemFactory.js +39 -71
  32. package/cjs/MenuItems/menuItemFactory.js.map +7 -0
  33. package/cjs/MenuItems/renderMenuItems.js +53 -0
  34. package/cjs/MenuItems/renderMenuItems.js.map +7 -0
  35. package/cjs/VirtualMenuList.js +69 -39
  36. package/cjs/VirtualMenuList.js.map +7 -0
  37. package/cjs/index.js +63 -36
  38. package/cjs/index.js.map +7 -0
  39. package/cjs/utils/useHeightByAmountOfItems.js +43 -14
  40. package/cjs/utils/useHeightByAmountOfItems.js.map +7 -0
  41. package/esm/Menu.js +91 -149
  42. package/esm/Menu.js.map +7 -0
  43. package/esm/MenuCombobox.js +38 -45
  44. package/esm/MenuCombobox.js.map +7 -0
  45. package/esm/MenuContext.js +9 -5
  46. package/esm/MenuContext.js.map +7 -0
  47. package/esm/MenuExports.js +3 -0
  48. package/esm/MenuExports.js.map +7 -0
  49. package/esm/MenuItems/CheckboxGroup.js +19 -31
  50. package/esm/MenuItems/CheckboxGroup.js.map +7 -0
  51. package/esm/MenuItems/MenuItem.js +84 -148
  52. package/esm/MenuItems/MenuItem.js.map +7 -0
  53. package/esm/MenuItems/MenuItemCheckable.js +47 -96
  54. package/esm/MenuItems/MenuItemCheckable.js.map +7 -0
  55. package/esm/MenuItems/MenuItemCheckbox.js +18 -33
  56. package/esm/MenuItems/MenuItemCheckbox.js.map +7 -0
  57. package/esm/MenuItems/MenuItemRadio.js +20 -28
  58. package/esm/MenuItems/MenuItemRadio.js.map +7 -0
  59. package/esm/MenuItems/RadioGroup.js +18 -28
  60. package/esm/MenuItems/RadioGroup.js.map +7 -0
  61. package/esm/MenuItems/SearchableGroup.js +53 -76
  62. package/esm/MenuItems/SearchableGroup.js.map +7 -0
  63. package/esm/MenuItems/SearchableList.js +59 -82
  64. package/esm/MenuItems/SearchableList.js.map +7 -0
  65. package/esm/MenuItems/SelectionGroup.js +54 -78
  66. package/esm/MenuItems/SelectionGroup.js.map +7 -0
  67. package/esm/MenuItems/Separator.js +26 -29
  68. package/esm/MenuItems/Separator.js.map +7 -0
  69. package/esm/MenuItems/SubMenu.js +107 -140
  70. package/esm/MenuItems/SubMenu.js.map +7 -0
  71. package/esm/MenuItems/menuItemFactory.js +11 -63
  72. package/esm/MenuItems/menuItemFactory.js.map +7 -0
  73. package/esm/MenuItems/renderMenuItems.js +24 -0
  74. package/esm/MenuItems/renderMenuItems.js.map +7 -0
  75. package/esm/VirtualMenuList.js +39 -32
  76. package/esm/VirtualMenuList.js.map +7 -0
  77. package/esm/index.js +34 -13
  78. package/esm/index.js.map +7 -0
  79. package/esm/utils/useHeightByAmountOfItems.js +13 -11
  80. package/esm/utils/useHeightByAmountOfItems.js.map +7 -0
  81. package/package.json +19 -11
  82. package/types/Menu.d.ts +3 -2
  83. package/types/MenuContext.d.ts +3 -2
  84. package/types/MenuExports.d.ts +1 -0
  85. package/types/MenuItems/CheckboxGroup.d.ts +5 -5
  86. package/types/MenuItems/MenuItem.d.ts +5 -5
  87. package/types/MenuItems/MenuItemCheckable.d.ts +15 -14
  88. package/types/MenuItems/MenuItemCheckbox.d.ts +3 -2
  89. package/types/MenuItems/MenuItemRadio.d.ts +5 -5
  90. package/types/MenuItems/RadioGroup.d.ts +5 -5
  91. package/types/MenuItems/SearchableGroup.d.ts +3 -3
  92. package/types/MenuItems/SearchableList.d.ts +16 -16
  93. package/types/MenuItems/SelectionGroup.d.ts +16 -16
  94. package/types/MenuItems/Separator.d.ts +2 -1
  95. package/types/MenuItems/SubMenu.d.ts +18 -18
  96. package/types/MenuItems/menuItemFactory.d.ts +2 -3
  97. package/types/MenuItems/renderMenuItems.d.ts +1 -0
  98. package/types/VirtualMenuList.d.ts +3 -1
  99. package/types/index.d.ts +3 -2
  100. package/types/utils/useHeightByAmountOfItems.d.ts +3 -1
@@ -1,108 +1,59 @@
1
- import 'core-js/modules/esnext.async-iterator.filter.js';
2
- import 'core-js/modules/esnext.iterator.constructor.js';
3
- import 'core-js/modules/esnext.iterator.filter.js';
4
- import 'core-js/modules/esnext.async-iterator.for-each.js';
5
- import 'core-js/modules/esnext.iterator.for-each.js';
6
- import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
7
- import _jsx from '@babel/runtime/helpers/esm/jsx';
8
- import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
9
- import 'react';
10
- import { PropTypes, describe } from 'react-desc';
11
- import { Checkmark } from '@elliemae/ds-icons';
12
- import { runAll } from '@elliemae/ds-utilities';
13
- import MenuItem from './MenuItem.js';
14
- import { jsx } from 'react/jsx-runtime';
15
-
16
- var _div;
17
-
18
- const _excluded = ["role", "checked", "name", "checkIcon", "children", "leftAddon", "item"];
19
-
20
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
21
-
22
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
23
-
24
- function useCheckable(_ref) {
25
- let {
26
- checked
27
- } = _ref;
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 }) {
28
8
  return {
29
9
  checked,
30
- 'aria-checked': checked
10
+ "aria-checked": checked
31
11
  };
32
12
  }
33
- /**
34
- * Reuses the same props as the MenuItem
35
- *
36
- * @param root0
37
- * @param root0.role
38
- * @param root0.checked
39
- * @param root0.name
40
- * @param root0.checkIcon
41
- * @param root0.children
42
- * @param root0.leftAddon
43
- * @param root0.item
44
- */
45
-
46
-
47
- function MenuItemCheckable(_ref2) {
48
- let {
49
- role = 'menuitemcheckbox',
50
- checked = false,
51
- name = '',
52
- checkIcon = /*#__PURE__*/_jsx(Checkmark, {
53
- color: ['brand-primary', 600]
54
- }),
55
- // eslint-disable-next-line react/prop-types
56
- children,
57
- leftAddon,
58
- item = undefined
59
- } = _ref2,
60
- otherProps = _objectWithoutProperties(_ref2, _excluded);
61
-
62
- const checkableProps = useCheckable({
63
- checked,
64
- name
65
- });
66
-
67
- const handleClick = () => runAll(otherProps.onClick, checkableProps.onClick)({
68
- target: {
69
- value: name,
70
- checked
71
- }
72
- }, item);
73
-
74
- const checkAddon = leftAddon || (checkableProps.checked ? /*#__PURE__*/_jsx("div", {
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", {
75
28
  className: "checkable-mark"
76
- }, void 0, checkIcon) : _div || (_div = /*#__PURE__*/_jsx("div", {})));
77
- return /*#__PURE__*/jsx(MenuItem, _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, item), otherProps), checkableProps), {}, {
78
- customRenderer: item && item.customRenderer ? item.customRenderer : () => {},
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
+ },
79
36
  items: otherProps.subItems,
80
37
  leftAddon: checkAddon,
81
38
  onClick: handleClick,
82
- role: role
83
- }));
84
- }
85
-
39
+ role
40
+ });
41
+ };
86
42
  const props = {
87
- /** Whether the item is checked or not */
88
- checked: PropTypes.bool.description('Whether the item is checked or not'),
89
-
90
- /** A custom item when the item is checked */
91
- checkIcon: PropTypes.element.description('A custom item when the item is checked'),
92
-
93
- /** form field name */
94
- name: PropTypes.string.description('form field name'),
95
-
96
- /** menu item object props */
97
- item: PropTypes.object.description('menu item object props'),
98
-
99
- /** a11y role */
100
- role: PropTypes.string.description('a11y role'),
101
-
102
- /** left addon component */
103
- leftAddon: PropTypes.node.description('left addon component')
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")
104
49
  };
50
+ MenuItemCheckable.propTypes = props;
105
51
  const DSMenuItemCheckeableWithSchema = describe(MenuItemCheckable);
106
52
  DSMenuItemCheckeableWithSchema.propTypes = props;
107
-
108
- export { DSMenuItemCheckeableWithSchema, MenuItemCheckable as default };
53
+ var MenuItemCheckable_default = MenuItemCheckable;
54
+ export {
55
+ DSMenuItemCheckeableWithSchema,
56
+ MenuItemCheckable,
57
+ MenuItemCheckable_default as default
58
+ };
59
+ //# sourceMappingURL=MenuItemCheckable.js.map
@@ -0,0 +1,7 @@
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,34 +1,19 @@
1
- import 'core-js/modules/esnext.async-iterator.filter.js';
2
- import 'core-js/modules/esnext.iterator.constructor.js';
3
- import 'core-js/modules/esnext.iterator.filter.js';
4
- import 'core-js/modules/esnext.async-iterator.for-each.js';
5
- import 'core-js/modules/esnext.iterator.for-each.js';
6
- import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
7
- import _jsx from '@babel/runtime/helpers/esm/jsx';
8
- import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
9
- import 'react';
10
- import { DSCheckbox } from '@elliemae/ds-form';
11
- import MenuItemCheckable from './MenuItemCheckable.js';
12
- import { jsx } from 'react/jsx-runtime';
13
-
14
- const _excluded = ["checked"];
15
-
16
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
17
-
18
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
19
-
20
- function MenuItemCheckbox(_ref) {
21
- let {
1
+ import * as React from "react";
2
+ import React2 from "react";
3
+ import { DSCheckbox } from "@elliemae/ds-form";
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, {
22
9
  checked
23
- } = _ref,
24
- rest = _objectWithoutProperties(_ref, _excluded);
25
-
26
- return /*#__PURE__*/jsx(MenuItemCheckable, _objectSpread(_objectSpread({}, rest), {}, {
27
- leftAddon: /*#__PURE__*/_jsx(DSCheckbox, {
28
- checked: checked
29
- }),
30
- role: "menuitemcheckbox"
31
- }));
32
- }
33
-
34
- export { MenuItemCheckbox as default };
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
@@ -0,0 +1,7 @@
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';\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,32 +1,24 @@
1
- import 'core-js/modules/esnext.async-iterator.filter.js';
2
- import 'core-js/modules/esnext.iterator.constructor.js';
3
- import 'core-js/modules/esnext.iterator.filter.js';
4
- import 'core-js/modules/esnext.async-iterator.for-each.js';
5
- import 'core-js/modules/esnext.iterator.for-each.js';
6
- import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
7
- import 'react';
8
- import { PropTypes, describe } from 'react-desc';
9
- import MenuItemCheckable from './MenuItemCheckable.js';
10
- import { jsx } from 'react/jsx-runtime';
11
-
12
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
13
-
14
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
15
-
16
- function MenuItemRadio(props) {
17
- return /*#__PURE__*/jsx(MenuItemCheckable, _objectSpread(_objectSpread({}, props), {}, {
18
- role: "menuitemradio"
19
- }));
20
- }
21
-
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
+ });
22
10
  const props = {
23
- /** Whether the item is checked or not */
24
- checked: PropTypes.bool.description('Whether the item is checked or not'),
25
-
26
- /** A custom item when the item is checked */
27
- checkIcon: PropTypes.element.description('A custom item when the item is checked')
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")
28
13
  };
14
+ MenuItemRadio.propTypes = props;
15
+ registerMenuItem("radio", MenuItemRadio);
29
16
  const DSMenuItemRadioWithSchema = describe(MenuItemCheckable);
30
17
  DSMenuItemRadioWithSchema.propTypes = props;
31
-
32
- export { DSMenuItemRadioWithSchema, MenuItemRadio as default };
18
+ var MenuItemRadio_default = MenuItemRadio;
19
+ export {
20
+ DSMenuItemRadioWithSchema,
21
+ MenuItemRadio,
22
+ MenuItemRadio_default as default
23
+ };
24
+ //# sourceMappingURL=MenuItemRadio.js.map
@@ -0,0 +1,7 @@
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,32 +1,22 @@
1
- import 'core-js/modules/esnext.async-iterator.filter.js';
2
- import 'core-js/modules/esnext.iterator.constructor.js';
3
- import 'core-js/modules/esnext.iterator.filter.js';
4
- import 'core-js/modules/esnext.async-iterator.for-each.js';
5
- import 'core-js/modules/esnext.iterator.for-each.js';
6
- import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
7
- import 'react';
8
- import { PropTypes, describe } from 'react-desc';
9
- import CheckableGroup from '@elliemae/ds-shared/CheckableGroup';
10
- import { jsx } from 'react/jsx-runtime';
11
-
12
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
13
-
14
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
15
-
16
- function RadioGroup(props) {
17
- return /*#__PURE__*/jsx(CheckableGroup, _objectSpread(_objectSpread({}, props), {}, {
18
- multi: false
19
- }));
20
- }
21
-
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
+ });
22
9
  const props = {
23
- /* The item selected */
24
- active: PropTypes.arrayOf(PropTypes.string).description('the item selected'),
25
-
26
- /* Handler when a user checks an item */
27
- onCheck: PropTypes.func.description('Handler when a user checks an item')
10
+ active: PropTypes.arrayOf(PropTypes.string).description("the item selected"),
11
+ onCheck: PropTypes.func.description("Handler when a user checks an item")
28
12
  };
13
+ RadioGroup.propTypes = props;
29
14
  const DSMenuRadioGroupWithSchema = describe(RadioGroup);
30
15
  DSMenuRadioGroupWithSchema.propTypes = props;
31
-
32
- export { DSMenuRadioGroupWithSchema, RadioGroup as default };
16
+ var RadioGroup_default = RadioGroup;
17
+ export {
18
+ DSMenuRadioGroupWithSchema,
19
+ RadioGroup,
20
+ RadioGroup_default as default
21
+ };
22
+ //# sourceMappingURL=RadioGroup.js.map
@@ -0,0 +1,7 @@
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
+ }
@@ -1,91 +1,68 @@
1
- import _jsx from '@babel/runtime/helpers/esm/jsx';
2
- import 'core-js/modules/web.dom-collections.iterator.js';
3
- import 'core-js/modules/esnext.async-iterator.filter.js';
4
- import 'core-js/modules/esnext.iterator.constructor.js';
5
- import 'core-js/modules/esnext.iterator.filter.js';
6
- import { useRef, useState, useEffect, useContext, useMemo } from 'react';
7
- import { aggregatedClasses } from '@elliemae/ds-classnames';
8
- import { focusGroupManagerHoc } from '@elliemae/ds-shared/FocusGroup';
9
- import DSSearchBox from '@elliemae/ds-form/SearchBox';
10
- import { PropTypes, describe } from 'react-desc';
11
- import VirtualMenuList from '../VirtualMenuList.js';
12
- import MenuContext from '../MenuContext.js';
13
- import { jsxs, Fragment } from 'react/jsx-runtime';
14
-
15
- const SearchBoxWrapper = aggregatedClasses('div')('menu-search-group', 'search-wrapper');
16
- const NoOptionsWrapper = aggregatedClasses('div')('menu-search-group', 'no-options');
17
-
18
- function SearchableGroup(_ref) {
19
- let {
20
- children,
21
- amountItemsInWindow = 5,
22
- searchTerm: searchTermProp = '',
23
- noOptionsText = 'No options',
24
- height,
25
- width,
26
- focusOnOpen = false
27
- } = _ref;
1
+ import * as React from "react";
2
+ import React2, { useEffect, useMemo, useState, useRef, useContext } from "react";
3
+ import { aggregatedClasses } from "@elliemae/ds-classnames";
4
+ import { focusGroupManagerHoc } from "@elliemae/ds-shared/FocusGroup";
5
+ import { DSSearchBox } from "@elliemae/ds-form";
6
+ import { PropTypes, describe } from "react-desc";
7
+ import { VirtualMenuList } from "../VirtualMenuList";
8
+ import { MenuContext } from "../MenuContext";
9
+ const SearchBoxWrapper = aggregatedClasses("div")("menu-search-group", "search-wrapper");
10
+ const NoOptionsWrapper = aggregatedClasses("div")("menu-search-group", "no-options");
11
+ const SearchableGroup = ({
12
+ children,
13
+ amountItemsInWindow = 5,
14
+ searchTerm: searchTermProp = "",
15
+ noOptionsText = "No options",
16
+ height,
17
+ width,
18
+ focusOnOpen = false
19
+ }) => {
28
20
  const searchRef = useRef(null);
29
21
  const [searchTerm, setSearchTerm] = useState(searchTermProp);
30
22
  useEffect(() => {
31
- if (searchRef.current) searchRef.current.focus();
23
+ if (searchRef.current)
24
+ searchRef.current.focus();
32
25
  }, []);
33
- const {
34
- visible
35
- } = useContext(MenuContext) || {};
26
+ const { visible } = useContext(MenuContext) || {};
36
27
  useEffect(() => {
37
28
  if (focusOnOpen && visible) {
38
29
  setTimeout(() => {
39
- if (searchRef.current) searchRef.current.focus();
30
+ if (searchRef.current)
31
+ searchRef.current.focus();
40
32
  }, 0);
41
33
  }
42
34
  }, [focusOnOpen, visible]);
43
- const filteredChildren = useMemo(() => children.filter(child => !searchTerm || child.props.label.toLowerCase().startsWith(searchTerm.toLowerCase())), [children, searchTerm]);
44
- return /*#__PURE__*/jsxs(Fragment, {
45
- children: [/*#__PURE__*/_jsx(SearchBoxWrapper, {}, void 0, /*#__PURE__*/_jsx(DSSearchBox, {
46
- innerRef: searchRef,
47
- onSearch: _ref2 => {
48
- let {
49
- value
50
- } = _ref2;
51
- return setSearchTerm(value);
52
- },
53
- searchOnEnter: false,
54
- showIcon: false,
55
- value: searchTerm
56
- })), !filteredChildren.length && /*#__PURE__*/_jsx(NoOptionsWrapper, {}, void 0, noOptionsText), /*#__PURE__*/_jsx(VirtualMenuList, {
57
- amountItemsInWindow: amountItemsInWindow,
58
- height: height,
59
- items: filteredChildren,
60
- width: width
61
- })]
62
- });
63
- }
64
-
35
+ const filteredChildren = useMemo(() => children.filter((child) => !searchTerm || child.props.label.toLowerCase().startsWith(searchTerm.toLowerCase())), [children, searchTerm]);
36
+ return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(SearchBoxWrapper, null, /* @__PURE__ */ React2.createElement(DSSearchBox, {
37
+ innerRef: searchRef,
38
+ onSearch: ({ value }) => setSearchTerm(value),
39
+ searchOnEnter: false,
40
+ showIcon: false,
41
+ value: searchTerm
42
+ })), !filteredChildren.length && /* @__PURE__ */ React2.createElement(NoOptionsWrapper, null, noOptionsText), /* @__PURE__ */ React2.createElement(VirtualMenuList, {
43
+ amountItemsInWindow,
44
+ height,
45
+ items: filteredChildren,
46
+ width
47
+ }));
48
+ };
65
49
  const props = {
66
- /** The amount of items that are going to be rendered in the group */
67
- amountItemsInWindow: PropTypes.number.description('The amount of items that are going to be rendered in the group'),
68
-
69
- /** A search term */
70
- searchTerm: PropTypes.string.description('A search term'),
71
-
72
- /** Text to show when there's no options to show */
50
+ amountItemsInWindow: PropTypes.number.description("The amount of items that are going to be rendered in the group"),
51
+ searchTerm: PropTypes.string.description("A search term"),
73
52
  noOptionsText: PropTypes.string.description("Text to show when there's no options to show"),
74
-
75
- /** array of children for search list */
76
- children: PropTypes.array.description('array of children for search list'),
77
-
78
- /** height for virtual list wrapper */
79
- height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).description('height for virtual list wrapper'),
80
-
81
- /** width for virtual list wrapper */
82
- width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).description('width for virtual list wrapper'),
83
-
84
- /** weather to focus on searchable group on open */
85
- focusOnOpen: PropTypes.bool.description('weather to focus on searchable group on open')
53
+ children: PropTypes.array.description("array of children for search list"),
54
+ height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).description("height for virtual list wrapper"),
55
+ width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).description("width for virtual list wrapper"),
56
+ focusOnOpen: PropTypes.bool.description("weather to focus on searchable group on open")
86
57
  };
58
+ SearchableGroup.propTypes = props;
87
59
  const DSMenuSearchableGroupWithSchema = describe(SearchableGroup);
88
60
  DSMenuSearchableGroupWithSchema.propTypes = props;
89
- var SearchableGroup$1 = focusGroupManagerHoc(SearchableGroup);
90
-
91
- export { DSMenuSearchableGroupWithSchema, SearchableGroup$1 as default };
61
+ const SearchableGroupHOC = focusGroupManagerHoc(SearchableGroup);
62
+ var SearchableGroup_default = SearchableGroupHOC;
63
+ export {
64
+ DSMenuSearchableGroupWithSchema,
65
+ SearchableGroupHOC as SearchableGroup,
66
+ SearchableGroup_default as default
67
+ };
68
+ //# sourceMappingURL=SearchableGroup.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/MenuItems/SearchableGroup.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useEffect, useMemo, useState, useRef, useContext } from 'react';\nimport { aggregatedClasses } from '@elliemae/ds-classnames';\nimport { focusGroupManagerHoc } from '@elliemae/ds-shared/FocusGroup';\nimport { DSSearchBox } from '@elliemae/ds-form';\nimport { PropTypes, describe } from 'react-desc';\nimport { VirtualMenuList } from '../VirtualMenuList';\nimport { MenuContext } from '../MenuContext';\n\nconst SearchBoxWrapper = aggregatedClasses('div')(\n 'menu-search-group',\n 'search-wrapper',\n);\nconst NoOptionsWrapper = aggregatedClasses('div')(\n 'menu-search-group',\n 'no-options',\n);\n\nconst SearchableGroup = ({\n children,\n amountItemsInWindow = 5,\n searchTerm: searchTermProp = '',\n noOptionsText = 'No options',\n height,\n width,\n focusOnOpen = false,\n}) => {\n const searchRef = useRef(null);\n const [searchTerm, setSearchTerm] = useState(searchTermProp);\n\n useEffect(() => {\n if (searchRef.current) searchRef.current.focus();\n }, []);\n\n const { visible } = useContext(MenuContext) || {};\n\n useEffect(() => {\n if (focusOnOpen && visible) {\n setTimeout(() => {\n if (searchRef.current) searchRef.current.focus();\n }, 0);\n }\n }, [focusOnOpen, visible]);\n\n const filteredChildren = useMemo(\n () =>\n children.filter(\n (child) =>\n !searchTerm ||\n child.props.label.toLowerCase().startsWith(searchTerm.toLowerCase()),\n ),\n [children, searchTerm],\n );\n\n return (\n <>\n <SearchBoxWrapper>\n <DSSearchBox\n innerRef={searchRef}\n onSearch={({ value }) => setSearchTerm(value)}\n searchOnEnter={false}\n showIcon={false}\n value={searchTerm}\n />\n </SearchBoxWrapper>\n {!filteredChildren.length && (\n <NoOptionsWrapper>{noOptionsText}</NoOptionsWrapper>\n )}\n <VirtualMenuList\n amountItemsInWindow={amountItemsInWindow}\n height={height}\n items={filteredChildren}\n width={width}\n />\n </>\n );\n};\n\nconst props = {\n /** The amount of items that are going to be rendered in the group */\n amountItemsInWindow: PropTypes.number.description(\n 'The amount of items that are going to be rendered in the group',\n ),\n /** A search term */\n searchTerm: PropTypes.string.description('A search term'),\n /** Text to show when there's no options to show */\n noOptionsText: PropTypes.string.description(\n \"Text to show when there's no options to show\",\n ),\n /** array of children for search list */\n children: PropTypes.array.description('array of children for search list'),\n /** height for virtual list wrapper */\n height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).description(\n 'height for virtual list wrapper',\n ),\n /** width for virtual list wrapper */\n width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).description(\n 'width for virtual list wrapper',\n ),\n /** weather to focus on searchable group on open */\n focusOnOpen: PropTypes.bool.description(\n 'weather to focus on searchable group on open',\n ),\n};\n\nSearchableGroup.propTypes = props;\n\nconst DSMenuSearchableGroupWithSchema = describe(SearchableGroup);\nDSMenuSearchableGroupWithSchema.propTypes = props;\n\nconst SearchableGroupHOC = focusGroupManagerHoc(SearchableGroup);\n\nexport { DSMenuSearchableGroupWithSchema, SearchableGroupHOC as SearchableGroup };\nexport default SearchableGroupHOC;\n"],
5
+ "mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,MAAM,mBAAmB,kBAAkB,OACzC,qBACA;AAEF,MAAM,mBAAmB,kBAAkB,OACzC,qBACA;AAGF,MAAM,kBAAkB,CAAC;AAAA,EACvB;AAAA,EACA,sBAAsB;AAAA,EACtB,YAAY,iBAAiB;AAAA,EAC7B,gBAAgB;AAAA,EAChB;AAAA,EACA;AAAA,EACA,cAAc;AAAA,MACV;AACJ,QAAM,YAAY,OAAO;AACzB,QAAM,CAAC,YAAY,iBAAiB,SAAS;AAE7C,YAAU,MAAM;AACd,QAAI,UAAU;AAAS,gBAAU,QAAQ;AAAA,KACxC;AAEH,QAAM,EAAE,YAAY,WAAW,gBAAgB;AAE/C,YAAU,MAAM;AACd,QAAI,eAAe,SAAS;AAC1B,iBAAW,MAAM;AACf,YAAI,UAAU;AAAS,oBAAU,QAAQ;AAAA,SACxC;AAAA;AAAA,KAEJ,CAAC,aAAa;AAEjB,QAAM,mBAAmB,QACvB,MACE,SAAS,OACP,CAAC,UACC,CAAC,cACD,MAAM,MAAM,MAAM,cAAc,WAAW,WAAW,iBAE5D,CAAC,UAAU;AAGb,SACE,4DACE,qCAAC,kBAAD,MACE,qCAAC,aAAD;AAAA,IACE,UAAU;AAAA,IACV,UAAU,CAAC,EAAE,YAAY,cAAc;AAAA,IACvC,eAAe;AAAA,IACf,UAAU;AAAA,IACV,OAAO;AAAA,OAGV,CAAC,iBAAiB,UACjB,qCAAC,kBAAD,MAAmB,gBAErB,qCAAC,iBAAD;AAAA,IACE;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP;AAAA;AAAA;AAMR,MAAM,QAAQ;AAAA,EAEZ,qBAAqB,UAAU,OAAO,YACpC;AAAA,EAGF,YAAY,UAAU,OAAO,YAAY;AAAA,EAEzC,eAAe,UAAU,OAAO,YAC9B;AAAA,EAGF,UAAU,UAAU,MAAM,YAAY;AAAA,EAEtC,QAAQ,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,SAAS,YAChE;AAAA,EAGF,OAAO,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,SAAS,YAC/D;AAAA,EAGF,aAAa,UAAU,KAAK,YAC1B;AAAA;AAIJ,gBAAgB,YAAY;AAE5B,MAAM,kCAAkC,SAAS;AACjD,gCAAgC,YAAY;AAE5C,MAAM,qBAAqB,qBAAqB;AAGhD,IAAO,0BAAQ;",
6
+ "names": []
7
+ }