@linzjs/step-ag-grid 1.4.5 → 1.4.7

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 (85) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.js +284 -232
  3. package/dist/index.js.map +1 -1
  4. package/dist/src/components/GridCell.d.ts +4 -3
  5. package/dist/src/components/gridRender/GridRenderGenericCell.d.ts +8 -5
  6. package/dist/src/react-menu3/components/ControlledMenu.d.ts +8 -2
  7. package/dist/src/react-menu3/components/FocusableItem.d.ts +8 -0
  8. package/dist/src/react-menu3/components/Menu.d.ts +16 -2
  9. package/dist/src/react-menu3/components/MenuButton.d.ts +8 -1
  10. package/dist/src/react-menu3/components/MenuDivider.d.ts +2 -1
  11. package/dist/src/react-menu3/components/MenuGroup.d.ts +12 -2
  12. package/dist/src/react-menu3/components/MenuHeader.d.ts +4 -2
  13. package/dist/src/react-menu3/components/MenuItem.d.ts +56 -0
  14. package/dist/src/react-menu3/components/MenuList.d.ts +2 -29
  15. package/dist/src/react-menu3/components/MenuRadioGroup.d.ts +44 -2
  16. package/dist/src/react-menu3/components/SubMenu.d.ts +109 -0
  17. package/dist/src/react-menu3/hooks/useBEM.d.ts +4 -3
  18. package/dist/src/react-menu3/hooks/useCombinedRef.d.ts +2 -2
  19. package/dist/src/react-menu3/hooks/useItemEffect.d.ts +1 -1
  20. package/dist/src/react-menu3/hooks/useItemState.d.ts +4 -3
  21. package/dist/src/react-menu3/hooks/useItems.d.ts +6 -4
  22. package/dist/src/react-menu3/hooks/useMenuChange.d.ts +2 -1
  23. package/dist/src/react-menu3/hooks/useMenuState.d.ts +13 -10
  24. package/dist/src/react-menu3/hooks/useMenuStateAndFocus.d.ts +2 -10
  25. package/dist/src/react-menu3/index.d.ts +1 -0
  26. package/dist/src/react-menu3/positionUtils/getPositionHelpers.d.ts +10 -9
  27. package/dist/src/react-menu3/positionUtils/placeArrowHorizontal.d.ts +7 -6
  28. package/dist/src/react-menu3/positionUtils/placeArrowVertical.d.ts +7 -6
  29. package/dist/src/react-menu3/positionUtils/placeLeftorRight.d.ts +17 -19
  30. package/dist/src/react-menu3/positionUtils/placeToporBottom.d.ts +18 -20
  31. package/dist/src/react-menu3/positionUtils/positionContextMenu.d.ts +11 -6
  32. package/dist/src/react-menu3/positionUtils/positionMenu.d.ts +23 -18
  33. package/dist/src/react-menu3/types.d.ts +389 -0
  34. package/dist/src/react-menu3/utils/constants.d.ts +58 -9
  35. package/dist/src/react-menu3/utils/index.d.ts +0 -1
  36. package/dist/src/react-menu3/utils/{propTypes.d.ts → propTypes2.d.ts} +1 -0
  37. package/dist/src/react-menu3/utils/utils.d.ts +20 -11
  38. package/dist/src/react-menu3/utils/withHovering.d.ts +7 -1
  39. package/dist/src/stories/components/ReactMenu.stories.d.ts +8 -0
  40. package/dist/step-ag-grid.esm.js +276 -235
  41. package/dist/step-ag-grid.esm.js.map +1 -1
  42. package/package.json +11 -11
  43. package/src/components/GridCell.tsx +6 -3
  44. package/src/components/GridPopoverHook.tsx +1 -1
  45. package/src/components/gridForm/GridFormDropDown.tsx +1 -1
  46. package/src/components/gridForm/GridFormMultiSelect.tsx +36 -17
  47. package/src/components/gridRender/GridRenderGenericCell.tsx +11 -7
  48. package/src/components/gridRender/GridRenderPopoutMenuCell.tsx +14 -2
  49. package/src/contexts/GridContextProvider.tsx +3 -2
  50. package/src/react-menu3/components/ControlledMenu.tsx +40 -45
  51. package/src/react-menu3/components/FocusableItem.tsx +58 -53
  52. package/src/react-menu3/components/Menu.tsx +40 -28
  53. package/src/react-menu3/components/MenuButton.tsx +30 -29
  54. package/src/react-menu3/components/MenuDivider.tsx +14 -18
  55. package/src/react-menu3/components/MenuGroup.tsx +25 -16
  56. package/src/react-menu3/components/MenuHeader.tsx +14 -18
  57. package/src/react-menu3/components/MenuItem.tsx +158 -106
  58. package/src/react-menu3/components/MenuList.tsx +61 -36
  59. package/src/react-menu3/components/MenuRadioGroup.tsx +54 -15
  60. package/src/react-menu3/components/SubMenu.tsx +317 -202
  61. package/src/react-menu3/hooks/useBEM.ts +4 -3
  62. package/src/react-menu3/hooks/useCombinedRef.ts +6 -12
  63. package/src/react-menu3/hooks/useItemEffect.ts +6 -5
  64. package/src/react-menu3/hooks/useItemState.ts +16 -12
  65. package/src/react-menu3/hooks/useItems.ts +11 -10
  66. package/src/react-menu3/hooks/useMenuChange.ts +3 -3
  67. package/src/react-menu3/hooks/useMenuState.ts +25 -7
  68. package/src/react-menu3/hooks/useMenuStateAndFocus.ts +6 -4
  69. package/src/react-menu3/index.ts +1 -0
  70. package/src/react-menu3/positionUtils/getPositionHelpers.ts +19 -12
  71. package/src/react-menu3/positionUtils/placeArrowHorizontal.ts +12 -5
  72. package/src/react-menu3/positionUtils/placeArrowVertical.ts +12 -5
  73. package/src/react-menu3/positionUtils/placeLeftorRight.ts +33 -17
  74. package/src/react-menu3/positionUtils/placeToporBottom.ts +34 -18
  75. package/src/react-menu3/positionUtils/positionContextMenu.ts +15 -3
  76. package/src/react-menu3/positionUtils/positionMenu.ts +21 -14
  77. package/src/react-menu3/style-utils/index.ts +10 -7
  78. package/src/react-menu3/{index.d.ts → types.ts} +106 -358
  79. package/src/react-menu3/utils/constants.ts +82 -10
  80. package/src/react-menu3/utils/index.ts +1 -1
  81. package/src/react-menu3/utils/{propTypes.ts → propTypes2.ts} +3 -1
  82. package/src/react-menu3/utils/utils.ts +41 -24
  83. package/src/react-menu3/utils/withHovering.tsx +11 -6
  84. package/src/stories/components/GridReadOnly.stories.tsx +3 -4
  85. package/src/stories/components/ReactMenu.stories.tsx +37 -0
package/dist/index.js CHANGED
@@ -8,7 +8,6 @@ var lodashEs = require('lodash-es');
8
8
  var agGridReact = require('ag-grid-react');
9
9
  var lui = require('@linzjs/lui');
10
10
  var reactDom = require('react-dom');
11
- var propTypes = require('prop-types');
12
11
  var reactTransitionState = require('react-transition-state');
13
12
  var debounce = require('debounce-promise');
14
13
  var uuid = require('uuid');
@@ -476,9 +475,11 @@ var GridContextProvider = function (props) {
476
475
  }
477
476
  // This is needed to trigger postSortRowsHook
478
477
  gridApi.refreshClientSideRowModel();
479
- stopEditing();
480
478
  }
481
- setSaving && setSaving(false);
479
+ else {
480
+ // Don't set saving if ok as the form has already closed
481
+ setSaving && setSaving(false);
482
+ }
482
483
  return [2 /*return*/, ok];
483
484
  }
484
485
  });
@@ -909,7 +910,7 @@ var GridCell = function (props) {
909
910
  cellEditor: GenericCellEditorComponent
910
911
  })), props), { cellRendererParams: __assign({ originalCellRender: props.cellRenderer }, props.cellRendererParams) });
911
912
  };
912
- var GenericCellEditorComponent = function (props) {
913
+ var GenericCellEditorComponentFr = function (props, _) {
913
914
  var _a, _b, _c;
914
915
  var _d = react.useContext(GridContext), updatingCells = _d.updatingCells, getSelectedRows = _d.getSelectedRows;
915
916
  var colDef = props.colDef, data = props.data;
@@ -938,7 +939,8 @@ var GenericCellEditorComponent = function (props) {
938
939
  if (cellEditorParams == null)
939
940
  return jsxRuntime.jsx(jsxRuntime.Fragment, {});
940
941
  return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { children: colDef.cellRenderer ? jsxRuntime.jsx(colDef.cellRenderer, __assign({}, props, { saving: saving })) : props.value }), (cellEditorParams === null || cellEditorParams === void 0 ? void 0 : cellEditorParams.form) && (jsxRuntime.jsx(cellEditorParams.form, { cellEditorParams: props, updateValue: updateValue, saving: saving, formProps: formProps, value: value, field: field, selectedRows: selectedRows }))] }));
941
- };
942
+ };
943
+ var GenericCellEditorComponent = react.forwardRef(GenericCellEditorComponentFr);
942
944
 
943
945
  /**
944
946
  * If loading is true this returns a loading spinner, otherwise it returns its children.
@@ -991,10 +993,6 @@ var setRef = function (ref, instance) {
991
993
  };
992
994
  var useCombinedRef = function (refA, refB) {
993
995
  return react.useMemo(function () {
994
- if (!refA)
995
- return refB;
996
- if (!refB)
997
- return refA;
998
996
  return function (instance) {
999
997
  setRef(refA, instance);
1000
998
  setRef(refB, instance);
@@ -1012,7 +1010,6 @@ var useIsomorphicLayoutEffect = typeof window !== "undefined" &&
1012
1010
  ? react.useLayoutEffect
1013
1011
  : react.useEffect;
1014
1012
 
1015
- // @ts-nocheck
1016
1013
  var menuContainerClass = "szh-menu-container";
1017
1014
  var menuClass = "szh-menu";
1018
1015
  var menuButtonClass = "szh-menu-button";
@@ -1023,13 +1020,23 @@ var menuHeaderClass = "header";
1023
1020
  var menuGroupClass = "group";
1024
1021
  var subMenuClass = "submenu";
1025
1022
  var radioGroupClass = "radio-group";
1026
- var HoverItemContext = react.createContext();
1027
- var MenuListItemContext = react.createContext({});
1023
+ var HoverItemContext = react.createContext(undefined);
1024
+ var MenuListItemContext = react.createContext({
1025
+ dispatch: function () { },
1026
+ updateItems: function () { },
1027
+ setOpenSubmenuCount: function () { return 0; }
1028
+ });
1028
1029
  var MenuListContext = react.createContext({});
1029
- var EventHandlersContext = react.createContext({});
1030
+ var EventHandlersContext = react.createContext({
1031
+ handleClick: function () { }
1032
+ });
1030
1033
  var RadioGroupContext = react.createContext({});
1034
+ // FIXME hacking a default context in here is probably bad
1031
1035
  var SettingsContext = react.createContext({});
1032
- var ItemSettingsContext = react.createContext({});
1036
+ var ItemSettingsContext = react.createContext({
1037
+ submenuOpenDelay: 0,
1038
+ submenuCloseDelay: 0
1039
+ });
1033
1040
  var Keys = Object.freeze({
1034
1041
  ENTER: "Enter",
1035
1042
  ESC: "Escape",
@@ -1068,10 +1075,8 @@ var MenuStateMap = Object.freeze({
1068
1075
  exited: "closed"
1069
1076
  });
1070
1077
 
1071
- // @ts-nocheck
1072
1078
  var isMenuOpen = function (state) { return !!state && state[0] === "o"; };
1073
1079
  var batchedUpdates = reactDom.unstable_batchedUpdates || (function (callback) { return callback(); });
1074
- var values = Object.values || (function (obj) { return Object.keys(obj).map(function (key) { return obj[key]; }); });
1075
1080
  var floatEqual = function (a, b, diff) {
1076
1081
  if (diff === void 0) { diff = 0.0001; }
1077
1082
  return Math.abs(a - b) < diff;
@@ -1079,10 +1084,11 @@ var floatEqual = function (a, b, diff) {
1079
1084
  var getTransition = function (transition, name) {
1080
1085
  return transition === true || !!(transition && transition[name]);
1081
1086
  };
1082
- var safeCall = function (fn, arg) { return (typeof fn === "function" ? fn(arg) : fn); };
1087
+ function safeCall(fn, arg) {
1088
+ return typeof fn === "function" ? fn(arg) : fn;
1089
+ }
1083
1090
  var internalKey = "_szhsinMenu";
1084
1091
  var getName = function (component) { return component[internalKey]; };
1085
- var defineName = function (name, component) { return Object.defineProperty(component, internalKey, { value: name }); };
1086
1092
  var mergeProps = function (target, source) {
1087
1093
  source &&
1088
1094
  Object.keys(source).forEach(function (key) {
@@ -1105,7 +1111,7 @@ var mergeProps = function (target, source) {
1105
1111
  return target;
1106
1112
  };
1107
1113
  var parsePadding = function (paddingStr) {
1108
- if (typeof paddingStr !== "string")
1114
+ if (paddingStr == null)
1109
1115
  return { top: 0, right: 0, bottom: 0, left: 0 };
1110
1116
  var padding = paddingStr.trim().split(/\s+/, 4).map(parseFloat);
1111
1117
  var top = !isNaN(padding[0]) ? padding[0] : 0;
@@ -1119,15 +1125,19 @@ var parsePadding = function (paddingStr) {
1119
1125
  };
1120
1126
  // Adapted from https://github.com/popperjs/popper-core/tree/v2.9.1/src/dom-utils
1121
1127
  var getScrollAncestor = function (node) {
1122
- var thisWindow = node.ownerDocument.defaultView;
1128
+ var _a, _b, _c;
1129
+ var thisWindow = (_b = ((_a = node === null || node === void 0 ? void 0 : node.ownerDocument) !== null && _a !== void 0 ? _a : document).defaultView) !== null && _b !== void 0 ? _b : window;
1123
1130
  while (node) {
1124
1131
  node = node.parentNode;
1125
- if (!node || node === thisWindow.document.body)
1126
- return;
1127
- var _a = thisWindow.getComputedStyle(node), overflow = _a.overflow, overflowX = _a.overflowX, overflowY = _a.overflowY;
1128
- if (/auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX))
1129
- return node;
1132
+ if (!node || node === ((_c = thisWindow === null || thisWindow === void 0 ? void 0 : thisWindow.document) === null || _c === void 0 ? void 0 : _c.body))
1133
+ return null;
1134
+ if (node instanceof Element) {
1135
+ var _d = thisWindow.getComputedStyle(node), overflow = _d.overflow, overflowX = _d.overflowX, overflowY = _d.overflowY;
1136
+ if (/auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX))
1137
+ return node;
1138
+ }
1130
1139
  }
1140
+ return null;
1131
1141
  };
1132
1142
  function commonProps(isDisabled, isHovering) {
1133
1143
  return {
@@ -1135,54 +1145,18 @@ function commonProps(isDisabled, isHovering) {
1135
1145
  tabIndex: isHovering ? 0 : -1
1136
1146
  };
1137
1147
  }
1138
- function indexOfNode(nodeList, node) {
1139
- for (var i = 0; i < nodeList.length; i++) {
1140
- if (nodeList[i] === node)
1141
- return i;
1142
- }
1143
- return -1;
1144
- }
1145
-
1146
- var stylePropTypes = function (name) {
1147
- var _a;
1148
- return (_a = {},
1149
- _a[name ? "".concat(name, "ClassName") : "className"] = propTypes.oneOfType([propTypes.string, propTypes.func]),
1150
- _a);
1151
- };
1152
- // Menu, SubMenu and ControlledMenu
1153
- var menuPropTypes = __assign(__assign(__assign({ className: propTypes.string }, stylePropTypes("menu")), stylePropTypes("arrow")), { menuStyle: propTypes.object, arrowStyle: propTypes.object, arrow: propTypes.bool, setDownOverflow: propTypes.bool, offsetX: propTypes.number, offsetY: propTypes.number, align: propTypes.oneOf(["start", "center", "end"]), direction: propTypes.oneOf(["left", "right", "top", "bottom"]), position: propTypes.oneOf(["auto", "anchor", "initial"]), overflow: propTypes.oneOf(["auto", "visible", "hidden"]) });
1154
- // Menu and ControlledMenu
1155
- var rootMenuPropTypes = __assign(__assign({}, menuPropTypes), { containerProps: propTypes.object, initialMounted: propTypes.bool, unmountOnClose: propTypes.bool, transition: propTypes.oneOfType([
1156
- propTypes.bool,
1157
- propTypes.exact({
1158
- open: propTypes.bool,
1159
- close: propTypes.bool,
1160
- item: propTypes.bool
1161
- }),
1162
- ]), transitionTimeout: propTypes.number, boundingBoxRef: propTypes.object, boundingBoxPadding: propTypes.string, reposition: propTypes.oneOf(["auto", "initial"]), repositionFlag: propTypes.oneOfType([propTypes.string, propTypes.number]), viewScroll: propTypes.oneOf(["auto", "close", "initial"]), submenuOpenDelay: propTypes.number, submenuCloseDelay: propTypes.number, portal: propTypes.oneOfType([
1163
- propTypes.bool,
1164
- propTypes.exact({
1165
- target: propTypes.object,
1166
- stablePosition: propTypes.bool
1167
- }),
1168
- ]), theming: propTypes.string, onItemClick: propTypes.func });
1169
- // Menu and SubMenu
1170
- var uncontrolledMenuPropTypes = {
1171
- instanceRef: propTypes.oneOfType([propTypes.object, propTypes.func]),
1172
- onMenuChange: propTypes.func
1173
- };
1148
+ var indexOfNode = function (nodeList, node) { return lodashEs.findIndex(nodeList, node); };
1174
1149
 
1175
1150
  var withHovering = function (name, WrappedComponent) {
1176
1151
  var Component = react.memo(WrappedComponent);
1177
1152
  var WithHovering = react.forwardRef(function (props, ref) {
1178
- var itemRef = react.useRef(null);
1179
- return (jsxRuntime.jsx(Component, __assign({}, props, { itemRef: itemRef, externalRef: ref, isHovering: react.useContext(HoverItemContext) === itemRef.current })));
1153
+ var menuItemRef = react.useRef(null);
1154
+ return (jsxRuntime.jsx(Component, __assign({}, props, { menuItemRef: menuItemRef, externalRef: ref, isHovering: react.useContext(HoverItemContext) === menuItemRef.current })));
1180
1155
  });
1181
1156
  WithHovering.displayName = "WithHovering(".concat(name, ")");
1182
1157
  return WithHovering;
1183
1158
  };
1184
1159
 
1185
- // @ts-nocheck
1186
1160
  var useItems = function (menuRef, focusRef) {
1187
1161
  var _a = react.useState(), hoverItem = _a[0], setHoverItem = _a[1];
1188
1162
  var stateRef = react.useRef({
@@ -1192,6 +1166,7 @@ var useItems = function (menuRef, focusRef) {
1192
1166
  });
1193
1167
  var mutableState = stateRef.current;
1194
1168
  var updateItems = react.useCallback(function (item, isMounted) {
1169
+ var _a;
1195
1170
  var items = mutableState.items;
1196
1171
  if (!item) {
1197
1172
  mutableState.items = [];
@@ -1204,8 +1179,8 @@ var useItems = function (menuRef, focusRef) {
1204
1179
  if (index > -1) {
1205
1180
  items.splice(index, 1);
1206
1181
  if (item.contains(document.activeElement)) {
1207
- focusRef.current.focus();
1208
- setHoverItem();
1182
+ (_a = focusRef === null || focusRef === void 0 ? void 0 : focusRef.current) === null || _a === void 0 ? void 0 : _a.focus();
1183
+ setHoverItem(undefined);
1209
1184
  }
1210
1185
  }
1211
1186
  }
@@ -1242,6 +1217,8 @@ var useItems = function (menuRef, focusRef) {
1242
1217
  newItem = items[index];
1243
1218
  break;
1244
1219
  case HoverActionTypes.SET_INDEX:
1220
+ if (typeof nextIndex !== "number")
1221
+ break;
1245
1222
  sortItems();
1246
1223
  index = nextIndex;
1247
1224
  newItem = items[index];
@@ -1278,32 +1255,33 @@ var useItems = function (menuRef, focusRef) {
1278
1255
  return { hoverItem: hoverItem, dispatch: dispatch, updateItems: updateItems };
1279
1256
  };
1280
1257
 
1281
- var useItemEffect = function (isDisabled, itemRef, updateItems) {
1258
+ var useItemEffect = function (isDisabled, menuItemRef, updateItems) {
1282
1259
  useIsomorphicLayoutEffect(function () {
1260
+ if (!menuItemRef)
1261
+ return;
1283
1262
  if (process.env.NODE_ENV !== "production" && !updateItems) {
1284
- throw new Error("[React-Menu] This menu item or submenu should be rendered under a menu: ".concat(itemRef.current.outerHTML));
1263
+ throw new Error("[React-Menu] This menu item or submenu should be rendered under a menu: ".concat(menuItemRef.current.outerHTML));
1285
1264
  }
1286
1265
  if (isDisabled)
1287
1266
  return;
1288
- var item = itemRef.current;
1267
+ var item = menuItemRef.current;
1289
1268
  updateItems(item, true);
1290
1269
  return function () {
1291
1270
  updateItems(item);
1292
1271
  };
1293
- }, [isDisabled, itemRef, updateItems]);
1272
+ }, [isDisabled, menuItemRef, updateItems]);
1294
1273
  };
1295
1274
 
1296
- // @ts-nocheck
1297
1275
  // This hook includes some common stateful logic in MenuItem and FocusableItem
1298
- var useItemState = function (itemRef, focusRef, isHovering, isDisabled) {
1276
+ var useItemState = function (menuItemRef, focusRef, isHovering, isDisabled) {
1299
1277
  var submenuCloseDelay = react.useContext(ItemSettingsContext).submenuCloseDelay;
1300
1278
  var _a = react.useContext(MenuListItemContext), isParentOpen = _a.isParentOpen, isSubmenuOpen = _a.isSubmenuOpen, dispatch = _a.dispatch, updateItems = _a.updateItems;
1301
- var timeoutId = react.useRef(0);
1279
+ var timeoutId = react.useRef();
1302
1280
  var setHover = function () {
1303
- !isHovering && !isDisabled && dispatch(HoverActionTypes.SET, itemRef.current);
1281
+ !isHovering && !isDisabled && dispatch(HoverActionTypes.SET, menuItemRef === null || menuItemRef === void 0 ? void 0 : menuItemRef.current, 0);
1304
1282
  };
1305
1283
  var unsetHover = function () {
1306
- !isDisabled && dispatch(HoverActionTypes.UNSET, itemRef.current);
1284
+ !isDisabled && dispatch(HoverActionTypes.UNSET, menuItemRef === null || menuItemRef === void 0 ? void 0 : menuItemRef.current, 0);
1307
1285
  };
1308
1286
  var onBlur = function (e) {
1309
1287
  // Focus has moved out of the entire item
@@ -1315,7 +1293,7 @@ var useItemState = function (itemRef, focusRef, isHovering, isDisabled) {
1315
1293
  if (isSubmenuOpen) {
1316
1294
  if (!timeoutId.current)
1317
1295
  timeoutId.current = setTimeout(function () {
1318
- timeoutId.current = 0;
1296
+ timeoutId.current = undefined;
1319
1297
  setHover();
1320
1298
  }, submenuCloseDelay);
1321
1299
  }
@@ -1326,17 +1304,17 @@ var useItemState = function (itemRef, focusRef, isHovering, isDisabled) {
1326
1304
  var onPointerLeave = function (_, keepHover) {
1327
1305
  if (timeoutId.current) {
1328
1306
  clearTimeout(timeoutId.current);
1329
- timeoutId.current = 0;
1307
+ timeoutId.current = undefined;
1330
1308
  }
1331
1309
  !keepHover && unsetHover();
1332
1310
  };
1333
- useItemEffect(isDisabled, itemRef, updateItems);
1311
+ useItemEffect(isDisabled, menuItemRef, updateItems);
1334
1312
  react.useEffect(function () { return function () { return clearTimeout(timeoutId.current); }; }, []);
1335
1313
  react.useEffect(function () {
1336
1314
  // Don't set focus when parent menu is closed, otherwise focus will be lost
1337
1315
  // and onBlur event will be fired with relatedTarget setting as null.
1338
1316
  if (isHovering && isParentOpen) {
1339
- focusRef.current && focusRef.current.focus();
1317
+ (focusRef === null || focusRef === void 0 ? void 0 : focusRef.current) && focusRef.current.focus();
1340
1318
  }
1341
1319
  }, [focusRef, isHovering, isParentOpen]);
1342
1320
  return {
@@ -1347,16 +1325,18 @@ var useItemState = function (itemRef, focusRef, isHovering, isDisabled) {
1347
1325
  };
1348
1326
  };
1349
1327
 
1350
- // @ts-nocheck
1351
1328
  var useMenuChange = function (onMenuChange, isOpen) {
1352
1329
  var prevOpen = react.useRef(isOpen);
1353
1330
  react.useEffect(function () {
1354
- if (prevOpen.current !== isOpen)
1355
- safeCall(onMenuChange, { open: isOpen });
1331
+ if (onMenuChange && prevOpen.current !== isOpen)
1332
+ safeCall(onMenuChange, { open: !!isOpen });
1356
1333
  prevOpen.current = isOpen;
1357
1334
  }, [onMenuChange, isOpen]);
1358
1335
  };
1359
1336
 
1337
+ /**
1338
+ * A custom Hook which helps manage the states of `ControlledMenu`.
1339
+ */
1360
1340
  var useMenuState = function (props) {
1361
1341
  var _a = props !== null && props !== void 0 ? props : {
1362
1342
  transition: false
@@ -1381,18 +1361,17 @@ var useMenuStateAndFocus = function (options) {
1381
1361
  return [__assign({ menuItemFocus: menuItemFocus }, menuProps), toggleMenu, openMenu];
1382
1362
  };
1383
1363
 
1384
- var MenuButton = defineName("MenuButton", react.forwardRef(function MenuButton(_a, ref) {
1364
+ var MenuButton = react.forwardRef(function MenuButton(_a, ref) {
1385
1365
  var className = _a.className, isOpen = _a.isOpen, disabled = _a.disabled, children = _a.children, restProps = __rest(_a, ["className", "isOpen", "disabled", "children"]);
1386
1366
  var modifiers = react.useMemo(function () { return ({ open: isOpen }); }, [isOpen]);
1387
1367
  return (jsxRuntime.jsx("button", __assign({ "aria-haspopup": true, "aria-expanded": isOpen, "aria-disabled": disabled || undefined, type: "button", disabled: disabled }, restProps, { ref: ref, className: useBEM({ block: menuButtonClass, modifiers: modifiers, className: className }) }, { children: children })));
1388
- }));
1389
- MenuButton.propTypes = __assign(__assign({}, stylePropTypes()), { isOpen: propTypes.bool, disabled: propTypes.bool });
1368
+ });
1390
1369
 
1391
- // @ts-nocheck
1392
1370
  var getPositionHelpers = function (containerRef, menuRef, menuScroll, boundingBoxPadding) {
1371
+ var _a, _b, _c;
1393
1372
  var menuRect = menuRef.current.getBoundingClientRect();
1394
- var containerRect = containerRef.current.getBoundingClientRect();
1395
- var thisWindow = containerRef.current.ownerDocument.defaultView;
1373
+ var thisWindow = (_b = (_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.ownerDocument.defaultView) !== null && _b !== void 0 ? _b : window;
1374
+ var containerRect = ((_c = containerRef.current) !== null && _c !== void 0 ? _c : thisWindow.document.body).getBoundingClientRect();
1396
1375
  var boundingRect = menuScroll === window || menuScroll === thisWindow
1397
1376
  ? {
1398
1377
  left: 0,
@@ -1407,7 +1386,9 @@ var getPositionHelpers = function (containerRef, menuRef, menuScroll, boundingBo
1407
1386
  var getLeftOverflow = function (x) { return x + containerRect.left - boundingRect.left - padding.left; };
1408
1387
  var getRightOverflow = function (x) { return x + containerRect.left + menuRect.width - boundingRect.right + padding.right; };
1409
1388
  var getTopOverflow = function (y) { return y + containerRect.top - boundingRect.top - padding.top; };
1410
- var getBottomOverflow = function (y) { return y + containerRect.top + menuRect.height - boundingRect.bottom + padding.bottom; };
1389
+ var getBottomOverflow = function (y) {
1390
+ return y + containerRect.top + menuRect.height - boundingRect.bottom + padding.bottom;
1391
+ };
1411
1392
  var confineHorizontally = function (x) {
1412
1393
  // If menu overflows to the left side, adjust x to have the menu contained within the viewport
1413
1394
  // and there is no need to check the right side;
@@ -1421,7 +1402,7 @@ var getPositionHelpers = function (containerRef, menuRef, menuScroll, boundingBo
1421
1402
  if (rightOverflow > 0) {
1422
1403
  x -= rightOverflow;
1423
1404
  // Check again to make sure menu doesn't overflow to the left
1424
- // because it may go off screen and cannot be scroll into view.
1405
+ // because it may go off-screen and cannot be scrolled into view.
1425
1406
  leftOverflow = getLeftOverflow(x);
1426
1407
  if (leftOverflow < 0)
1427
1408
  x -= leftOverflow;
@@ -1460,7 +1441,6 @@ var getPositionHelpers = function (containerRef, menuRef, menuScroll, boundingBo
1460
1441
  };
1461
1442
  };
1462
1443
 
1463
- // @ts-nocheck
1464
1444
  var positionContextMenu = function (_a) {
1465
1445
  var positionHelpers = _a.positionHelpers, anchorPoint = _a.anchorPoint;
1466
1446
  var menuRect = positionHelpers.menuRect, containerRect = positionHelpers.containerRect, getLeftOverflow = positionHelpers.getLeftOverflow, getRightOverflow = positionHelpers.getRightOverflow, getTopOverflow = positionHelpers.getTopOverflow, getBottomOverflow = positionHelpers.getBottomOverflow, confineHorizontally = positionHelpers.confineHorizontally, confineVertically = positionHelpers.confineVertically;
@@ -1497,19 +1477,16 @@ var positionContextMenu = function (_a) {
1497
1477
  return { x: x, y: y, computedDirection: computedDirection };
1498
1478
  };
1499
1479
 
1500
- // @ts-nocheck
1501
- var placeArrowVertical = function (_a) {
1502
- var arrowRef = _a.arrowRef, menuY = _a.menuY, anchorRect = _a.anchorRect, containerRect = _a.containerRect, menuRect = _a.menuRect;
1503
- var y = anchorRect.top - containerRect.top - menuY + anchorRect.height / 2;
1504
- var offset = arrowRef.current.offsetHeight * 1.25;
1480
+ var placeArrowVertical = function (p) {
1481
+ var y = p.anchorRect.top - p.containerRect.top - p.menuY + p.anchorRect.height / 2;
1482
+ var offset = p.arrowRef.current ? p.arrowRef.current.offsetHeight * 1.25 : 0;
1505
1483
  y = Math.max(offset, y);
1506
- y = Math.min(y, menuRect.height - offset);
1484
+ y = Math.min(y, p.menuRect.height - offset);
1507
1485
  return y;
1508
1486
  };
1509
1487
 
1510
- // @ts-nocheck
1511
- var placeLeftorRight = function (_a) {
1512
- var anchorRect = _a.anchorRect, containerRect = _a.containerRect, menuRect = _a.menuRect, placeLeftorRightY = _a.placeLeftorRightY, placeLeftX = _a.placeLeftX, placeRightX = _a.placeRightX, getLeftOverflow = _a.getLeftOverflow, getRightOverflow = _a.getRightOverflow, confineHorizontally = _a.confineHorizontally, confineVertically = _a.confineVertically, arrowRef = _a.arrowRef, arrow = _a.arrow, direction = _a.direction, position = _a.position;
1488
+ var placeLeftorRight = function (props) {
1489
+ var anchorRect = props.anchorRect, containerRect = props.containerRect, menuRect = props.menuRect, placeLeftorRightY = props.placeLeftorRightY, placeLeftX = props.placeLeftX, placeRightX = props.placeRightX, getLeftOverflow = props.getLeftOverflow, getRightOverflow = props.getRightOverflow, confineHorizontally = props.confineHorizontally, confineVertically = props.confineVertically, arrowRef = props.arrowRef, arrow = props.arrow, direction = props.direction, position = props.position;
1513
1490
  var computedDirection = direction;
1514
1491
  var y = placeLeftorRightY;
1515
1492
  if (position !== "initial") {
@@ -1566,19 +1543,16 @@ var placeLeftorRight = function (_a) {
1566
1543
  return { arrowY: arrowY, x: x, y: y, computedDirection: computedDirection };
1567
1544
  };
1568
1545
 
1569
- // @ts-nocheck
1570
- var placeArrowHorizontal = function (_a) {
1571
- var arrowRef = _a.arrowRef, menuX = _a.menuX, anchorRect = _a.anchorRect, containerRect = _a.containerRect, menuRect = _a.menuRect;
1572
- var x = anchorRect.left - containerRect.left - menuX + anchorRect.width / 2;
1573
- var offset = arrowRef.current.offsetWidth * 1.25;
1546
+ var placeArrowHorizontal = function (p) {
1547
+ var x = p.anchorRect.left - p.containerRect.left - p.menuX + p.anchorRect.width / 2;
1548
+ var offset = p.arrowRef.current ? p.arrowRef.current.offsetWidth * 1.25 : 0;
1574
1549
  x = Math.max(offset, x);
1575
- x = Math.min(x, menuRect.width - offset);
1550
+ x = Math.min(x, p.menuRect.width - offset);
1576
1551
  return x;
1577
1552
  };
1578
1553
 
1579
- // @ts-nocheck
1580
- var placeToporBottom = function (_a) {
1581
- var anchorRect = _a.anchorRect, containerRect = _a.containerRect, menuRect = _a.menuRect, placeToporBottomX = _a.placeToporBottomX, placeTopY = _a.placeTopY, placeBottomY = _a.placeBottomY, getTopOverflow = _a.getTopOverflow, getBottomOverflow = _a.getBottomOverflow, confineHorizontally = _a.confineHorizontally, confineVertically = _a.confineVertically, arrowRef = _a.arrowRef, arrow = _a.arrow, direction = _a.direction, position = _a.position;
1554
+ var placeToporBottom = function (props) {
1555
+ var anchorRect = props.anchorRect, containerRect = props.containerRect, menuRect = props.menuRect, placeToporBottomX = props.placeToporBottomX, placeTopY = props.placeTopY, placeBottomY = props.placeBottomY, getTopOverflow = props.getTopOverflow, getBottomOverflow = props.getBottomOverflow, confineHorizontally = props.confineHorizontally, confineVertically = props.confineVertically, arrowRef = props.arrowRef, arrow = props.arrow, direction = props.direction, position = props.position;
1582
1556
  // make sure invalid direction is treated as 'bottom'
1583
1557
  var computedDirection = direction === "top" ? "top" : "bottom";
1584
1558
  var x = placeToporBottomX;
@@ -1636,12 +1610,12 @@ var placeToporBottom = function (_a) {
1636
1610
  return { arrowX: arrowX, x: x, y: y, computedDirection: computedDirection };
1637
1611
  };
1638
1612
 
1639
- var positionMenu = function (_a) {
1640
- var arrow = _a.arrow, align = _a.align, direction = _a.direction, offsetX = _a.offsetX, offsetY = _a.offsetY, position = _a.position, anchorRef = _a.anchorRef, arrowRef = _a.arrowRef, positionHelpers = _a.positionHelpers;
1613
+ var positionMenu = function (props) {
1614
+ var arrow = props.arrow, align = props.align, direction = props.direction, offsetX = props.offsetX, offsetY = props.offsetY, position = props.position, anchorRef = props.anchorRef, arrowRef = props.arrowRef, positionHelpers = props.positionHelpers;
1641
1615
  var menuRect = positionHelpers.menuRect, containerRect = positionHelpers.containerRect;
1642
1616
  var horizontalOffset = offsetX;
1643
1617
  var verticalOffset = offsetY;
1644
- if (arrow) {
1618
+ if (arrow && arrowRef.current) {
1645
1619
  if (direction === "left" || direction === "right") {
1646
1620
  horizontalOffset += arrowRef.current.offsetWidth;
1647
1621
  }
@@ -1649,7 +1623,9 @@ var positionMenu = function (_a) {
1649
1623
  verticalOffset += arrowRef.current.offsetHeight;
1650
1624
  }
1651
1625
  }
1652
- var anchorRect = anchorRef.current.getBoundingClientRect();
1626
+ var anchorRect = anchorRef.current
1627
+ ? anchorRef.current.getBoundingClientRect()
1628
+ : { left: 0, right: 0, top: 200, bottom: 200, width: 200, height: 200 };
1653
1629
  var placeLeftX = anchorRect.left - containerRect.left - menuRect.width - horizontalOffset;
1654
1630
  var placeRightX = anchorRect.right - containerRect.left + horizontalOffset;
1655
1631
  var placeTopY = anchorRect.top - containerRect.top - menuRect.height - verticalOffset;
@@ -1684,16 +1660,16 @@ var positionMenu = function (_a) {
1684
1660
  var MenuList = function (_a) {
1685
1661
  var ariaLabel = _a.ariaLabel, menuClassName = _a.menuClassName, menuStyle = _a.menuStyle, arrowClassName = _a.arrowClassName, arrowStyle = _a.arrowStyle, anchorPoint = _a.anchorPoint, anchorRef = _a.anchorRef, containerRef = _a.containerRef, externalRef = _a.externalRef, parentScrollingRef = _a.parentScrollingRef, arrow = _a.arrow, _b = _a.align, align = _b === void 0 ? "start" : _b, _c = _a.direction, direction = _c === void 0 ? "bottom" : _c, _d = _a.position, position = _d === void 0 ? "auto" : _d, _e = _a.overflow, overflow = _e === void 0 ? "visible" : _e, setDownOverflow = _a.setDownOverflow, repositionFlag = _a.repositionFlag, _f = _a.captureFocus, captureFocus = _f === void 0 ? true : _f, state = _a.state, endTransition = _a.endTransition, isDisabled = _a.isDisabled, menuItemFocus = _a.menuItemFocus, _g = _a.offsetX, offsetX = _g === void 0 ? 0 : _g, _h = _a.offsetY, offsetY = _h === void 0 ? 0 : _h, children = _a.children, onClose = _a.onClose, restProps = __rest(_a, ["ariaLabel", "menuClassName", "menuStyle", "arrowClassName", "arrowStyle", "anchorPoint", "anchorRef", "containerRef", "externalRef", "parentScrollingRef", "arrow", "align", "direction", "position", "overflow", "setDownOverflow", "repositionFlag", "captureFocus", "state", "endTransition", "isDisabled", "menuItemFocus", "offsetX", "offsetY", "children", "onClose"]);
1686
1662
  var _j = react.useState({ x: 0, y: 0 }), menuPosition = _j[0], setMenuPosition = _j[1];
1687
- var _k = react.useState({}), arrowPosition = _k[0], setArrowPosition = _k[1];
1663
+ var _k = react.useState({ x: 0, y: 0 }), arrowPosition = _k[0], setArrowPosition = _k[1];
1688
1664
  var _l = react.useState(), overflowData = _l[0], setOverflowData = _l[1];
1689
1665
  var _m = react.useState(direction), expandedDirection = _m[0], setExpandedDirection = _m[1];
1690
1666
  var _o = react.useState(0), openSubmenuCount = _o[0], setOpenSubmenuCount = _o[1];
1691
1667
  var _p = react.useReducer(function (c) { return c + 1; }, 1), reposSubmenu = _p[0], forceReposSubmenu = _p[1];
1692
1668
  var _q = react.useContext(SettingsContext), transition = _q.transition, boundingBoxRef = _q.boundingBoxRef, boundingBoxPadding = _q.boundingBoxPadding, rootMenuRef = _q.rootMenuRef, rootAnchorRef = _q.rootAnchorRef, scrollNodesRef = _q.scrollNodesRef, reposition = _q.reposition, viewScroll = _q.viewScroll;
1693
1669
  var reposFlag = react.useContext(MenuListContext).reposSubmenu || repositionFlag;
1694
- var menuRef = react.useRef(null);
1695
- var focusRef = react.useRef();
1696
- var arrowRef = react.useRef();
1670
+ var menuRef = react.useRef({});
1671
+ var focusRef = react.useRef(null);
1672
+ var arrowRef = react.useRef(null);
1697
1673
  var prevOpen = react.useRef(false);
1698
1674
  var latestMenuSize = react.useRef({ width: 0, height: 0 });
1699
1675
  var latestHandlePosition = react.useRef(function () { });
@@ -1703,30 +1679,33 @@ var MenuList = function (_a) {
1703
1679
  var closeTransition = getTransition(transition, "close");
1704
1680
  var scrollNodes = scrollNodesRef.current;
1705
1681
  var onKeyDown = function (e) {
1706
- var isTextInputTarget = e.target.nodeName === "TEXTAREA" || (e.target.nodeName === "INPUT" && e.target.getAttribute("type") === "text");
1682
+ var elementTarget = e.target instanceof HTMLElement ? e.target : null;
1683
+ var isTextInputTarget = elementTarget &&
1684
+ (elementTarget.nodeName === "TEXTAREA" ||
1685
+ (elementTarget.nodeName === "INPUT" && elementTarget.getAttribute("type") === "text"));
1707
1686
  switch (e.key) {
1708
1687
  case Keys.HOME:
1709
1688
  // Don't eat home/end events on inputs
1710
1689
  if (isTextInputTarget)
1711
1690
  return;
1712
- dispatch(HoverActionTypes.FIRST);
1691
+ dispatch(HoverActionTypes.FIRST, null, 0);
1713
1692
  break;
1714
1693
  case Keys.END:
1715
1694
  // Don't eat home/end events on inputs
1716
1695
  if (isTextInputTarget)
1717
1696
  return;
1718
- dispatch(HoverActionTypes.LAST);
1697
+ dispatch(HoverActionTypes.LAST, null, 0);
1719
1698
  break;
1720
1699
  case Keys.UP:
1721
- dispatch(HoverActionTypes.DECREASE, hoverItem);
1700
+ dispatch(HoverActionTypes.DECREASE, hoverItem, 0);
1722
1701
  break;
1723
1702
  case Keys.DOWN:
1724
- dispatch(HoverActionTypes.INCREASE, hoverItem);
1703
+ dispatch(HoverActionTypes.INCREASE, hoverItem, 0);
1725
1704
  break;
1726
1705
  // prevent browser from scrolling the page when SPACE is pressed
1727
1706
  case Keys.SPACE:
1728
1707
  // Don't preventDefault on children of FocusableItem
1729
- if (e.target && e.target.className.indexOf(menuClass) !== -1) {
1708
+ if (elementTarget && elementTarget.className.includes(menuClass)) {
1730
1709
  e.preventDefault();
1731
1710
  }
1732
1711
  return;
@@ -1738,12 +1717,12 @@ var MenuList = function (_a) {
1738
1717
  };
1739
1718
  var onAnimationEnd = function () {
1740
1719
  if (state === "closing") {
1741
- setOverflowData(); // reset overflowData after closing
1720
+ setOverflowData(undefined); // reset overflowData after closing
1742
1721
  }
1743
- safeCall(endTransition);
1722
+ endTransition && safeCall(endTransition);
1744
1723
  };
1745
1724
  var handlePosition = react.useCallback(function (noOverflowCheck) {
1746
- if (!containerRef.current) {
1725
+ if (!(containerRef === null || containerRef === void 0 ? void 0 : containerRef.current)) {
1747
1726
  if (process.env.NODE_ENV !== "production") {
1748
1727
  console.error('[React-Menu] Menu cannot be positioned properly as container ref is null. If you need to initialise `state` prop to "open" for ControlledMenu, please see this solution: https://codesandbox.io/s/initial-open-sp10wn');
1749
1728
  }
@@ -1753,11 +1732,15 @@ var MenuList = function (_a) {
1753
1732
  scrollNodes.menu =
1754
1733
  (boundingBoxRef
1755
1734
  ? boundingBoxRef.current // user explicitly sets boundingBoxRef
1756
- : getScrollAncestor(rootMenuRef.current)) || window; // try to discover bounding box automatically
1735
+ : getScrollAncestor(rootMenuRef === null || rootMenuRef === void 0 ? void 0 : rootMenuRef.current)) || window; // try to discover bounding box automatically
1757
1736
  }
1758
1737
  var positionHelpers = getPositionHelpers(containerRef, menuRef, scrollNodes.menu, boundingBoxPadding);
1759
1738
  var menuRect = positionHelpers.menuRect;
1760
- var results = { computedDirection: "bottom" };
1739
+ var results = {
1740
+ computedDirection: "bottom",
1741
+ x: 0,
1742
+ y: 0
1743
+ };
1761
1744
  if (anchorPoint) {
1762
1745
  results = positionContextMenu({ positionHelpers: positionHelpers, anchorPoint: anchorPoint });
1763
1746
  }
@@ -1774,7 +1757,8 @@ var MenuList = function (_a) {
1774
1757
  positionHelpers: positionHelpers
1775
1758
  });
1776
1759
  }
1777
- var arrowX = results.arrowX, arrowY = results.arrowY, x = results.x, y = results.y, computedDirection = results.computedDirection;
1760
+ var y = results.y;
1761
+ var x = results.x, arrowX = results.arrowX, arrowY = results.arrowY, computedDirection = results.computedDirection;
1778
1762
  var menuHeight = menuRect.height;
1779
1763
  if (!noOverflowCheck && overflow !== "visible") {
1780
1764
  var getTopOverflow = positionHelpers.getTopOverflow, getBottomOverflow = positionHelpers.getBottomOverflow;
@@ -1798,17 +1782,17 @@ var MenuList = function (_a) {
1798
1782
  y -= topOverflow;
1799
1783
  }
1800
1784
  }
1801
- if (height >= 0) {
1785
+ if (height != null && height >= 0) {
1802
1786
  // To avoid triggering reposition in the next ResizeObserver callback
1803
1787
  menuHeight = height;
1804
1788
  setOverflowData({ height: height, overflowAmt: overflowAmt_1 });
1805
1789
  }
1806
1790
  else {
1807
- setOverflowData();
1791
+ setOverflowData(undefined);
1808
1792
  }
1809
1793
  }
1810
1794
  if (arrow)
1811
- setArrowPosition({ x: arrowX, y: arrowY });
1795
+ setArrowPosition({ x: arrowX !== null && arrowX !== void 0 ? arrowX : 0, y: arrowY !== null && arrowY !== void 0 ? arrowY : 0 });
1812
1796
  setMenuPosition({ x: x, y: y });
1813
1797
  setExpandedDirection(computedDirection);
1814
1798
  latestMenuSize.current = { width: menuRect.width, height: menuHeight };
@@ -1873,7 +1857,7 @@ var MenuList = function (_a) {
1873
1857
  scrollObservers.forEach(function (o) { return o.addEventListener("scroll", handleScroll); });
1874
1858
  return function () { return scrollObservers.forEach(function (o) { return o.removeEventListener("scroll", handleScroll); }); };
1875
1859
  }, [rootAnchorRef, scrollNodes, isOpen, onClose, viewScroll, handlePosition]);
1876
- var hasOverflow = !!overflowData && overflowData.overflowAmt > 0;
1860
+ var hasOverflow = !!overflowData && overflowData.overflowAmt != null && overflowData.overflowAmt > 0;
1877
1861
  react.useEffect(function () {
1878
1862
  if (hasOverflow || !isOpen || !parentScrollingRef)
1879
1863
  return;
@@ -1914,20 +1898,20 @@ var MenuList = function (_a) {
1914
1898
  }, [reposition]);
1915
1899
  react.useEffect(function () {
1916
1900
  if (!isOpen) {
1917
- dispatch(HoverActionTypes.RESET);
1901
+ dispatch(HoverActionTypes.RESET, undefined, 0);
1918
1902
  if (!closeTransition)
1919
- setOverflowData();
1920
- return;
1903
+ setOverflowData(undefined);
1904
+ return function () { };
1921
1905
  }
1922
1906
  var _a = menuItemFocus || {}, position = _a.position, alwaysUpdate = _a.alwaysUpdate;
1923
1907
  var setItemFocus = function () {
1924
1908
  if (position === FocusPositions.FIRST) {
1925
- dispatch(HoverActionTypes.FIRST);
1909
+ dispatch(HoverActionTypes.FIRST, undefined, 0);
1926
1910
  }
1927
1911
  else if (position === FocusPositions.LAST) {
1928
- dispatch(HoverActionTypes.LAST);
1912
+ dispatch(HoverActionTypes.LAST, undefined, 0);
1929
1913
  }
1930
- else if (position >= -1) {
1914
+ else if (typeof position === "number" && position >= -1) {
1931
1915
  dispatch(HoverActionTypes.SET_INDEX, undefined, position);
1932
1916
  }
1933
1917
  };
@@ -1937,14 +1921,33 @@ var MenuList = function (_a) {
1937
1921
  else if (captureFocus) {
1938
1922
  // Use a timeout here because if set focus immediately, page might scroll unexpectedly.
1939
1923
  var id_1 = setTimeout(function () {
1924
+ var _a, _b, _c;
1940
1925
  // If focus has already been set to a children element, don't set focus on menu or item
1941
1926
  if (!menuRef.current.contains(document.activeElement)) {
1942
- focusRef.current.focus();
1927
+ // Handle popover portal focus
1928
+ var popupElement = (_a = focusRef.current) === null || _a === void 0 ? void 0 : _a.nextSibling;
1929
+ if (popupElement instanceof Element) {
1930
+ var input = popupElement.querySelectorAll("input,textarea")[0];
1931
+ if (input) {
1932
+ input.focus();
1933
+ // Text areas should start at end
1934
+ if (input instanceof HTMLTextAreaElement) {
1935
+ input.selectionStart = input.value.length;
1936
+ }
1937
+ }
1938
+ else {
1939
+ (_b = focusRef.current) === null || _b === void 0 ? void 0 : _b.focus();
1940
+ }
1941
+ }
1942
+ else {
1943
+ (_c = focusRef.current) === null || _c === void 0 ? void 0 : _c.focus();
1944
+ }
1943
1945
  setItemFocus();
1944
1946
  }
1945
1947
  }, openTransition ? 170 : 100);
1946
1948
  return function () { return clearTimeout(id_1); };
1947
1949
  }
1950
+ return function () { };
1948
1951
  }, [isOpen, openTransition, closeTransition, captureFocus, menuItemFocus, dispatch]);
1949
1952
  var isSubmenuOpen = openSubmenuCount > 0;
1950
1953
  var itemContext = react.useMemo(function () { return ({
@@ -1954,7 +1957,8 @@ var MenuList = function (_a) {
1954
1957
  dispatch: dispatch,
1955
1958
  updateItems: updateItems
1956
1959
  }); }, [isOpen, isSubmenuOpen, dispatch, updateItems]);
1957
- var maxHeight, overflowAmt;
1960
+ var maxHeight;
1961
+ var overflowAmt;
1958
1962
  if (overflowData) {
1959
1963
  setDownOverflow ? (overflowAmt = overflowData.overflowAmt) : (maxHeight = overflowData.height);
1960
1964
  }
@@ -1965,7 +1969,7 @@ var MenuList = function (_a) {
1965
1969
  parentMenuRef: menuRef,
1966
1970
  parentDir: expandedDirection
1967
1971
  }); }, [reposSubmenu, overflow, overflowAmt, expandedDirection]);
1968
- var overflowStyle = maxHeight >= 0 ? { maxHeight: maxHeight, overflow: overflow } : undefined;
1972
+ var overflowStyle = maxHeight != null && maxHeight >= 0 ? { maxHeight: maxHeight, overflow: overflow } : undefined;
1969
1973
  var modifiers = react.useMemo(function () { return ({
1970
1974
  state: state,
1971
1975
  dir: expandedDirection
@@ -1980,9 +1984,9 @@ var MenuList = function (_a) {
1980
1984
  return (jsxRuntime.jsxs("ul", __assign({ role: "menu", "aria-label": ariaLabel }, mergeProps({ onKeyDown: onKeyDown, onAnimationEnd: onAnimationEnd }, restProps), commonProps(isDisabled), { ref: useCombinedRef(externalRef, menuRef), className: useBEM({ block: menuClass, modifiers: modifiers, className: menuClassName }), style: __assign(__assign(__assign({}, menuStyle), overflowStyle), { margin: 0, display: state === "closed" ? "none" : undefined, position: "absolute", left: menuPosition.x, top: menuPosition.y }) }, { children: [jsxRuntime.jsx("div", { ref: focusRef, tabIndex: -1, style: { position: "absolute", left: 0, top: 0 } }), arrow && (jsxRuntime.jsx("div", { className: _arrowClass, style: __assign(__assign({}, arrowStyle), { position: "absolute", left: arrowPosition.x, top: arrowPosition.y }), ref: arrowRef })), jsxRuntime.jsx(MenuListContext.Provider, __assign({ value: listContext }, { children: jsxRuntime.jsx(MenuListItemContext.Provider, __assign({ value: itemContext }, { children: jsxRuntime.jsx(HoverItemContext.Provider, __assign({ value: hoverItem }, { children: children })) })) }))] })));
1981
1985
  };
1982
1986
 
1983
- var ControlledMenu = react.forwardRef(function ControlledMenu(_a, externalRef) {
1987
+ var ControlledMenuFr = function (_a, externalRef) {
1984
1988
  var ariaLabel = _a["aria-label"], className = _a.className, containerProps = _a.containerProps, initialMounted = _a.initialMounted, unmountOnClose = _a.unmountOnClose, transition = _a.transition, transitionTimeout = _a.transitionTimeout, boundingBoxRef = _a.boundingBoxRef, boundingBoxPadding = _a.boundingBoxPadding, _b = _a.reposition, reposition = _b === void 0 ? "auto" : _b, _c = _a.submenuOpenDelay, submenuOpenDelay = _c === void 0 ? 300 : _c, _d = _a.submenuCloseDelay, submenuCloseDelay = _d === void 0 ? 150 : _d, skipOpen = _a.skipOpen, _e = _a.viewScroll, viewScroll = _e === void 0 ? "initial" : _e, portal = _a.portal, theming = _a.theming, onItemClick = _a.onItemClick, onClose = _a.onClose, saveButtonRef = _a.saveButtonRef, restProps = __rest(_a, ["aria-label", "className", "containerProps", "initialMounted", "unmountOnClose", "transition", "transitionTimeout", "boundingBoxRef", "boundingBoxPadding", "reposition", "submenuOpenDelay", "submenuCloseDelay", "skipOpen", "viewScroll", "portal", "theming", "onItemClick", "onClose", "saveButtonRef"]);
1985
- var containerRef = react.useRef(null);
1989
+ var containerRef = react.useRef();
1986
1990
  var scrollNodesRef = react.useRef({});
1987
1991
  var anchorRef = restProps.anchorRef, state = restProps.state;
1988
1992
  var settings = react.useMemo(function () { return ({
@@ -2020,7 +2024,7 @@ var ControlledMenu = react.forwardRef(function ControlledMenu(_a, externalRef) {
2020
2024
  // the cell doesn't refresh during update if save is invoked from a native event
2021
2025
  // This doesn't happen in React18
2022
2026
  // To work around it, I invoke the save by clicking on a passed in invisible button ref
2023
- if (saveButtonRef.current)
2027
+ if (saveButtonRef === null || saveButtonRef === void 0 ? void 0 : saveButtonRef.current)
2024
2028
  saveButtonRef.current.click();
2025
2029
  else
2026
2030
  safeCall(onClose, { reason: CloseReason.BLUR });
@@ -2035,7 +2039,7 @@ var ControlledMenu = react.forwardRef(function ControlledMenu(_a, externalRef) {
2035
2039
  setTimeout(function () { return (skipOpen.current = false); }, 300);
2036
2040
  }
2037
2041
  }
2038
- }, [clickIsWithinMenu, onClose]);
2042
+ }, [clickIsWithinMenu, onClose, saveButtonRef, skipOpen]);
2039
2043
  var handleScreenEventForCancel = react.useCallback(function (ev) {
2040
2044
  if (!clickIsWithinMenu(ev)) {
2041
2045
  ev.preventDefault();
@@ -2044,7 +2048,7 @@ var ControlledMenu = react.forwardRef(function ControlledMenu(_a, externalRef) {
2044
2048
  }, [clickIsWithinMenu]);
2045
2049
  react.useEffect(function () {
2046
2050
  if (isMenuOpen(state)) {
2047
- var thisDocument_1 = anchorRef.current ? anchorRef.current.ownerDocument : document;
2051
+ var thisDocument_1 = (anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current) ? anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current.ownerDocument : document;
2048
2052
  thisDocument_1.addEventListener("mousedown", handleScreenEventForCancel, true);
2049
2053
  thisDocument_1.addEventListener("mouseup", handleScreenEventForSave, true);
2050
2054
  thisDocument_1.addEventListener("click", handleScreenEventForCancel, true);
@@ -2057,13 +2061,13 @@ var ControlledMenu = react.forwardRef(function ControlledMenu(_a, externalRef) {
2057
2061
  };
2058
2062
  }
2059
2063
  return function () { };
2060
- }, [handleScreenEventForSave, handleScreenEventForCancel, state]);
2064
+ }, [handleScreenEventForSave, handleScreenEventForCancel, state, anchorRef]);
2061
2065
  var itemSettings = react.useMemo(function () { return ({
2062
2066
  submenuOpenDelay: submenuOpenDelay,
2063
2067
  submenuCloseDelay: submenuCloseDelay
2064
2068
  }); }, [submenuOpenDelay, submenuCloseDelay]);
2065
2069
  var eventHandlers = react.useMemo(function () { return ({
2066
- handleClick: function (event, isCheckorRadio) {
2070
+ handleClick: function (event, isCheckOrRadio) {
2067
2071
  if (!event.stopPropagation)
2068
2072
  safeCall(onItemClick, event);
2069
2073
  var keepOpen = event.keepOpen;
@@ -2071,7 +2075,7 @@ var ControlledMenu = react.forwardRef(function ControlledMenu(_a, externalRef) {
2071
2075
  // if event.keepOpen is undefined, the following default behaviour is used
2072
2076
  // According to WAI-ARIA Authoring Practices 1.1
2073
2077
  // Keep menu open when check or radio is invoked by SPACE key
2074
- keepOpen = isCheckorRadio && event.key === Keys.SPACE;
2078
+ keepOpen = isCheckOrRadio && event.key === Keys.SPACE;
2075
2079
  }
2076
2080
  if (!keepOpen) {
2077
2081
  safeCall(onClose, {
@@ -2099,7 +2103,7 @@ var ControlledMenu = react.forwardRef(function ControlledMenu(_a, externalRef) {
2099
2103
  // If a user clicks on the menu button when a menu is open, we need to close the menu.
2100
2104
  // However, a blur event will be fired prior to the click event on menu button,
2101
2105
  // which makes the menu first close and then open again.
2102
- // If this happen, e.relatedTarget is incorrectly set to null instead of the button in Safari and Firefox,
2106
+ // If this happens, e.relatedTarget is incorrectly set to null instead of the button in Safari and Firefox,
2103
2107
  // and makes it difficult to determine whether onBlur is fired because of clicking on menu button.
2104
2108
  // This is a workaround approach which sets a flag to skip a following click event.
2105
2109
  if (skipOpen) {
@@ -2115,27 +2119,25 @@ var ControlledMenu = react.forwardRef(function ControlledMenu(_a, externalRef) {
2115
2119
  modifiers: modifiers,
2116
2120
  className: className
2117
2121
  }), style: __assign(__assign({}, containerProps === null || containerProps === void 0 ? void 0 : containerProps.style), { position: "relative" }), ref: containerRef }, { children: state && (jsxRuntime.jsx(SettingsContext.Provider, __assign({ value: settings }, { children: jsxRuntime.jsx(ItemSettingsContext.Provider, __assign({ value: itemSettings }, { children: jsxRuntime.jsx(EventHandlersContext.Provider, __assign({ value: eventHandlers }, { children: jsxRuntime.jsx(MenuList, __assign({}, restProps, { ariaLabel: ariaLabel || "Menu", externalRef: externalRef, containerRef: containerRef, onClose: onClose })) })) })) }))) })));
2118
- if (portal === true && anchorRef.current !== undefined) {
2122
+ if (portal === true && (anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current) !== undefined) {
2119
2123
  portal = { target: anchorRef.current.ownerDocument.body };
2120
2124
  }
2121
- if (portal === true && typeof document !== "undefined") {
2122
- return reactDom.createPortal(menuList, document.body);
2123
- }
2124
- else if (portal) {
2125
- return portal.target ? reactDom.createPortal(menuList, portal.target) : portal.stablePosition ? null : menuList;
2125
+ if (portal) {
2126
+ if (typeof portal === "boolean") {
2127
+ if (portal && typeof document !== "undefined") {
2128
+ return reactDom.createPortal(menuList, document.body);
2129
+ }
2130
+ }
2131
+ else {
2132
+ return portal.target ? reactDom.createPortal(menuList, portal.target) : portal.stablePosition ? null : menuList;
2133
+ }
2126
2134
  }
2127
2135
  return menuList;
2128
- });
2129
- ControlledMenu.propTypes /* remove-proptypes */ = __assign(__assign({}, rootMenuPropTypes), { state: propTypes.oneOf(values(MenuStateMap)), anchorPoint: propTypes.exact({
2130
- x: propTypes.number,
2131
- y: propTypes.number
2132
- }), anchorRef: propTypes.object, skipOpen: propTypes.object, captureFocus: propTypes.bool, menuItemFocus: propTypes.exact({
2133
- position: propTypes.oneOfType([propTypes.string, propTypes.number]),
2134
- alwaysUpdate: propTypes.bool
2135
- }), onClose: propTypes.func });
2136
-
2137
- var Menu = react.forwardRef(function Menu(_a, externalRef) {
2138
- var ariaLabel = _a["aria-label"]; _a.captureFocus; var menuButton = _a.menuButton, instanceRef = _a.instanceRef, onMenuChange = _a.onMenuChange, restProps = __rest(_a, ["aria-label", "captureFocus", "menuButton", "instanceRef", "onMenuChange"]);
2136
+ };
2137
+ var ControlledMenu = react.forwardRef(ControlledMenuFr);
2138
+
2139
+ function MenuFr(_a, externalRef) {
2140
+ var ariaLabel = _a["aria-label"], menuButton = _a.menuButton, instanceRef = _a.instanceRef, onMenuChange = _a.onMenuChange, restProps = __rest(_a, ["aria-label", "menuButton", "instanceRef", "onMenuChange"]);
2139
2141
  var _b = useMenuStateAndFocus(restProps), stateProps = _b[0], toggleMenu = _b[1], openMenu = _b[2];
2140
2142
  var isOpen = isMenuOpen(stateProps.state);
2141
2143
  var skipOpen = react.useRef(false);
@@ -2143,7 +2145,7 @@ var Menu = react.forwardRef(function Menu(_a, externalRef) {
2143
2145
  var handleClose = react.useCallback(function (e) {
2144
2146
  toggleMenu(false);
2145
2147
  if (e.key)
2146
- buttonRef.current.focus();
2148
+ buttonRef.current && buttonRef.current.focus();
2147
2149
  }, [toggleMenu]);
2148
2150
  var onClick = function (e) {
2149
2151
  if (skipOpen.current)
@@ -2164,10 +2166,11 @@ var Menu = react.forwardRef(function Menu(_a, externalRef) {
2164
2166
  }
2165
2167
  e.preventDefault();
2166
2168
  };
2169
+ // FIXME erk! button seems to be many types
2167
2170
  var button = safeCall(menuButton, { open: isOpen });
2168
2171
  if (!button || !button.type)
2169
2172
  throw new Error("Menu requires a menuButton prop.");
2170
- var buttonProps = __assign({ ref: useCombinedRef(button.ref, buttonRef) }, mergeProps({ onClick: onClick, onKeyDown: onKeyDown }, button.props));
2173
+ var buttonProps = __assign(__assign({ ref: useCombinedRef(button.ref, buttonRef) }, mergeProps({ onClick: onClick, onKeyDown: onKeyDown }, button.props)), { isOpen: false });
2171
2174
  if (getName(button.type) === "MenuButton") {
2172
2175
  buttonProps.isOpen = isOpen;
2173
2176
  }
@@ -2178,27 +2181,28 @@ var Menu = react.forwardRef(function Menu(_a, externalRef) {
2178
2181
  closeMenu: function () { return toggleMenu(false); }
2179
2182
  }); });
2180
2183
  return (jsxRuntime.jsxs(react.Fragment, { children: [renderButton, jsxRuntime.jsx(ControlledMenu, __assign({}, restProps, stateProps, { "aria-label": ariaLabel || (typeof button.props.children === "string" ? button.props.children : "Menu"), anchorRef: buttonRef, ref: externalRef, onClose: handleClose, skipOpen: skipOpen }))] }));
2181
- });
2182
- Menu.propTypes = __assign(__assign(__assign({}, rootMenuPropTypes), uncontrolledMenuPropTypes), { menuButton: propTypes.oneOfType([propTypes.element, propTypes.func]).isRequired });
2184
+ }
2185
+ var Menu = react.forwardRef(MenuFr);
2183
2186
 
2184
- var SubMenu = withHovering("SubMenu", function SubMenu(_a) {
2185
- var ariaLabel = _a["aria-label"], className = _a.className, disabled = _a.disabled, direction = _a.direction, label = _a.label, openTrigger = _a.openTrigger, onMenuChange = _a.onMenuChange, isHovering = _a.isHovering, instanceRef = _a.instanceRef, itemRef = _a.itemRef; _a.captureFocus; _a.repositionFlag; var _b = _a.itemProps, itemProps = _b === void 0 ? {} : _b, restProps = __rest(_a, ["aria-label", "className", "disabled", "direction", "label", "openTrigger", "onMenuChange", "isHovering", "instanceRef", "itemRef", "captureFocus", "repositionFlag", "itemProps"]);
2187
+ var SubMenuFr = function (_a) {
2188
+ var ariaLabel = _a["aria-label"], className = _a.className, disabled = _a.disabled, direction = _a.direction, label = _a.label, openTrigger = _a.openTrigger, onMenuChange = _a.onMenuChange, isHovering = _a.isHovering, instanceRef = _a.instanceRef, menuItemRef = _a.menuItemRef, _b = _a.itemProps, itemProps = _b === void 0 ? {} : _b, restProps = __rest(_a, ["aria-label", "className", "disabled", "direction", "label", "openTrigger", "onMenuChange", "isHovering", "instanceRef", "menuItemRef", "itemProps"]);
2186
2189
  var settings = react.useContext(SettingsContext);
2187
2190
  var rootMenuRef = settings.rootMenuRef;
2188
2191
  var _c = react.useContext(ItemSettingsContext), submenuOpenDelay = _c.submenuOpenDelay, submenuCloseDelay = _c.submenuCloseDelay;
2189
2192
  var _d = react.useContext(MenuListContext), parentMenuRef = _d.parentMenuRef, parentDir = _d.parentDir, parentOverflow = _d.overflow;
2190
2193
  var _e = react.useContext(MenuListItemContext), isParentOpen = _e.isParentOpen, isSubmenuOpen = _e.isSubmenuOpen, setOpenSubmenuCount = _e.setOpenSubmenuCount, dispatch = _e.dispatch, updateItems = _e.updateItems;
2191
2194
  var isPortal = parentOverflow !== "visible";
2195
+ // FIXME Matt no idea what's going on here
2192
2196
  var _f = useMenuStateAndFocus(settings), stateProps = _f[0], toggleMenu = _f[1], _openMenu = _f[2];
2193
2197
  var state = stateProps.state;
2194
2198
  var isDisabled = !!disabled;
2195
2199
  var isOpen = isMenuOpen(state);
2196
2200
  var containerRef = react.useRef(null);
2197
- var timeoutId = react.useRef(0);
2201
+ var timeoutId = react.useRef();
2198
2202
  var stopTimer = function () {
2199
2203
  if (timeoutId.current) {
2200
2204
  clearTimeout(timeoutId.current);
2201
- timeoutId.current = 0;
2205
+ timeoutId.current = undefined;
2202
2206
  }
2203
2207
  };
2204
2208
  var openMenu = function () {
@@ -2210,7 +2214,7 @@ var SubMenu = withHovering("SubMenu", function SubMenu(_a) {
2210
2214
  setHover();
2211
2215
  !isDisabled && _openMenu.apply(void 0, args);
2212
2216
  };
2213
- var setHover = function () { return !isHovering && !isDisabled && dispatch(HoverActionTypes.SET, itemRef.current); };
2217
+ var setHover = function () { return !isHovering && !isDisabled && dispatch(HoverActionTypes.SET, menuItemRef === null || menuItemRef === void 0 ? void 0 : menuItemRef.current, 0); };
2214
2218
  var delayOpen = function (delay) {
2215
2219
  setHover();
2216
2220
  if (!openTrigger)
@@ -2229,7 +2233,7 @@ var SubMenu = withHovering("SubMenu", function SubMenu(_a) {
2229
2233
  var handlePointerLeave = function () {
2230
2234
  stopTimer();
2231
2235
  if (!isOpen)
2232
- dispatch(HoverActionTypes.UNSET, itemRef.current);
2236
+ dispatch(HoverActionTypes.UNSET, menuItemRef === null || menuItemRef === void 0 ? void 0 : menuItemRef.current, 0);
2233
2237
  };
2234
2238
  var handleKeyDown = function (e) {
2235
2239
  var handled = false;
@@ -2237,7 +2241,7 @@ var SubMenu = withHovering("SubMenu", function SubMenu(_a) {
2237
2241
  // LEFT key is bubbled up from submenu items
2238
2242
  case Keys.LEFT:
2239
2243
  if (isOpen) {
2240
- itemRef.current.focus();
2244
+ (menuItemRef === null || menuItemRef === void 0 ? void 0 : menuItemRef.current) && menuItemRef.current.focus();
2241
2245
  toggleMenu(false);
2242
2246
  handled = true;
2243
2247
  }
@@ -2264,19 +2268,19 @@ var SubMenu = withHovering("SubMenu", function SubMenu(_a) {
2264
2268
  break;
2265
2269
  }
2266
2270
  };
2267
- useItemEffect(isDisabled, itemRef, updateItems);
2271
+ useItemEffect(isDisabled, menuItemRef, updateItems);
2268
2272
  useMenuChange(onMenuChange, isOpen);
2269
2273
  react.useEffect(function () { return function () { return clearTimeout(timeoutId.current); }; }, []);
2270
2274
  react.useEffect(function () {
2271
2275
  // Don't set focus when parent menu is closed, otherwise focus will be lost
2272
2276
  // and onBlur event will be fired with relatedTarget setting as null.
2273
2277
  if (isHovering && isParentOpen) {
2274
- itemRef.current.focus();
2278
+ (menuItemRef === null || menuItemRef === void 0 ? void 0 : menuItemRef.current) && menuItemRef.current.focus();
2275
2279
  }
2276
2280
  else {
2277
2281
  toggleMenu(false);
2278
2282
  }
2279
- }, [isHovering, isParentOpen, toggleMenu, itemRef]);
2283
+ }, [isHovering, isParentOpen, toggleMenu, menuItemRef]);
2280
2284
  react.useEffect(function () {
2281
2285
  setOpenSubmenuCount(function (count) { return (isOpen ? count + 1 : Math.max(count - 1, 0)); });
2282
2286
  }, [setOpenSubmenuCount, isOpen]);
@@ -2290,7 +2294,7 @@ var SubMenu = withHovering("SubMenu", function SubMenu(_a) {
2290
2294
  },
2291
2295
  closeMenu: function () {
2292
2296
  if (isOpen) {
2293
- itemRef.current.focus();
2297
+ (menuItemRef === null || menuItemRef === void 0 ? void 0 : menuItemRef.current) && menuItemRef.current.focus();
2294
2298
  toggleMenu(false);
2295
2299
  }
2296
2300
  }
@@ -2309,36 +2313,40 @@ var SubMenu = withHovering("SubMenu", function SubMenu(_a) {
2309
2313
  onClick: function () { return openTrigger !== "none" && openMenu(); }
2310
2314
  }, restItemProps);
2311
2315
  var getMenuList = function () {
2312
- var menuList = (jsxRuntime.jsx(MenuList, __assign({}, restProps, stateProps, { ariaLabel: ariaLabel || (typeof label === "string" ? label : "Submenu"), anchorRef: itemRef, containerRef: isPortal ? rootMenuRef : containerRef, direction: direction || (parentDir === "right" || parentDir === "left" ? parentDir : "right"), parentScrollingRef: isPortal && parentMenuRef, isDisabled: isDisabled })));
2313
- var container = rootMenuRef.current;
2316
+ var menuList = (jsxRuntime.jsx(MenuList, __assign({}, restProps, stateProps, { ariaLabel: ariaLabel || (typeof label === "string" ? label : "Submenu"), anchorRef: menuItemRef, containerRef: isPortal ? rootMenuRef : containerRef, direction: direction || (parentDir === "right" || parentDir === "left" ? parentDir : "right"), parentScrollingRef: isPortal && parentMenuRef, isDisabled: isDisabled })));
2317
+ var container = rootMenuRef === null || rootMenuRef === void 0 ? void 0 : rootMenuRef.current;
2314
2318
  return isPortal && container ? reactDom.createPortal(menuList, container) : menuList;
2315
2319
  };
2316
- return (jsxRuntime.jsxs("li", __assign({ className: useBEM({ block: menuClass, element: subMenuClass, className: className }), style: { position: "relative" }, role: "presentation", ref: containerRef, onKeyDown: handleKeyDown }, { children: [jsxRuntime.jsx("div", __assign({ role: "menuitem", "aria-haspopup": true, "aria-expanded": isOpen }, mergedItemProps, commonProps(isDisabled, isHovering), { ref: useCombinedRef(externalItemRef, itemRef), className: useBEM({
2320
+ return (jsxRuntime.jsxs("li", __assign({ className: useBEM({ block: menuClass, element: subMenuClass, className: className }), style: { position: "relative" }, role: "presentation", ref: containerRef, onKeyDown: handleKeyDown }, { children: [jsxRuntime.jsx("div", __assign({ role: "menuitem", "aria-haspopup": true, "aria-expanded": isOpen }, mergedItemProps, commonProps(isDisabled, isHovering), { ref: useCombinedRef(externalItemRef, menuItemRef), className: useBEM({
2317
2321
  block: menuClass,
2318
2322
  element: menuItemClass,
2319
2323
  modifiers: modifiers,
2320
2324
  className: itemClassName
2321
2325
  }) }, { children: react.useMemo(function () { return safeCall(label, modifiers); }, [label, modifiers]) })), state && getMenuList()] })));
2322
- });
2323
- SubMenu.propTypes = __assign(__assign(__assign({}, menuPropTypes), uncontrolledMenuPropTypes), { disabled: propTypes.bool, openTrigger: propTypes.oneOf(["none", "clickOnly"]), label: propTypes.oneOfType([propTypes.node, propTypes.func]), itemProps: propTypes.shape(__assign({}, stylePropTypes())) });
2326
+ };
2327
+ var SubMenu = withHovering("SubMenu", SubMenuFr);
2324
2328
 
2325
- var MenuItem = withHovering("MenuItem", function MenuItem(_a) {
2326
- var className = _a.className, value = _a.value, href = _a.href, type = _a.type, checked = _a.checked, disabled = _a.disabled, children = _a.children, onClick = _a.onClick, isHovering = _a.isHovering, itemRef = _a.itemRef, externalRef = _a.externalRef, restProps = __rest(_a, ["className", "value", "href", "type", "checked", "disabled", "children", "onClick", "isHovering", "itemRef", "externalRef"]);
2329
+ var MenuItemFr = function (_a) {
2330
+ var className = _a.className, value = _a.value, href = _a.href, type = _a.type, checked = _a.checked, disabled = _a.disabled, children = _a.children, onClick = _a.onClick, isHovering = _a.isHovering, menuItemRef = _a.menuItemRef, externalRef = _a.externalRef, restProps = __rest(_a, ["className", "value", "href", "type", "checked", "disabled", "children", "onClick", "isHovering", "menuItemRef", "externalRef"]);
2327
2331
  var isDisabled = !!disabled;
2328
- var _b = useItemState(itemRef, itemRef, isHovering, isDisabled), setHover = _b.setHover, restStateProps = __rest(_b, ["setHover"]);
2332
+ var _b = useItemState(menuItemRef, menuItemRef, isHovering, isDisabled), setHover = _b.setHover, restStateProps = __rest(_b, ["setHover"]);
2329
2333
  var eventHandlers = react.useContext(EventHandlersContext);
2330
2334
  var radioGroup = react.useContext(RadioGroupContext);
2331
2335
  var isRadio = type === "radio";
2332
2336
  var isCheckBox = type === "checkbox";
2333
2337
  var isAnchor = !!href && !isDisabled && !isRadio && !isCheckBox;
2334
2338
  var isChecked = isRadio ? radioGroup.value === value : isCheckBox ? !!checked : false;
2339
+ // FIXME handle click seems to be a combination of multiple event types
2335
2340
  var handleClick = function (e) {
2336
2341
  if (isDisabled) {
2337
2342
  e.stopPropagation();
2338
2343
  e.preventDefault();
2339
2344
  return;
2340
2345
  }
2341
- var event = { value: value, syntheticEvent: e };
2346
+ var event = {
2347
+ value: value,
2348
+ syntheticEvent: e
2349
+ };
2342
2350
  if (e.key !== undefined)
2343
2351
  event.key = e.key;
2344
2352
  if (isCheckBox)
@@ -2357,7 +2365,7 @@ var MenuItem = withHovering("MenuItem", function MenuItem(_a) {
2357
2365
  case Keys.ENTER:
2358
2366
  case Keys.SPACE:
2359
2367
  if (isAnchor) {
2360
- itemRef.current.click();
2368
+ (menuItemRef === null || menuItemRef === void 0 ? void 0 : menuItemRef.current) && menuItemRef.current.click();
2361
2369
  }
2362
2370
  else {
2363
2371
  handleClick(e);
@@ -2377,21 +2385,21 @@ var MenuItem = withHovering("MenuItem", function MenuItem(_a) {
2377
2385
  // 1. Preset props adhering to WAI-ARIA Authoring Practices.
2378
2386
  // 2. Merged outer and local props
2379
2387
  // 3. ref, className
2380
- var menuItemProps = __assign(__assign(__assign({ role: isRadio ? "menuitemradio" : isCheckBox ? "menuitemcheckbox" : "menuitem", "aria-checked": isRadio || isCheckBox ? isChecked : undefined }, mergedProps), commonProps(isDisabled, isHovering)), { ref: useCombinedRef(externalRef, itemRef), className: useBEM({ block: menuClass, element: menuItemClass, modifiers: modifiers, className: className }), children: react.useMemo(function () { return safeCall(children, modifiers); }, [children, modifiers]) });
2388
+ var menuItemProps = __assign(__assign(__assign({ role: isRadio ? "menuitemradio" : isCheckBox ? "menuitemcheckbox" : "menuitem", "aria-checked": isRadio || isCheckBox ? isChecked : undefined }, mergedProps), commonProps(isDisabled, isHovering)), { ref: useCombinedRef(externalRef, menuItemRef), className: useBEM({ block: menuClass, element: menuItemClass, modifiers: modifiers, className: className }), children: react.useMemo(function () { return safeCall(children, modifiers); }, [children, modifiers]) });
2381
2389
  if (isAnchor) {
2382
2390
  return (jsxRuntime.jsx("li", __assign({ role: "presentation" }, { children: jsxRuntime.jsx("a", __assign({ href: href }, menuItemProps)) })));
2383
2391
  }
2384
2392
  else {
2385
2393
  return jsxRuntime.jsx("li", __assign({}, menuItemProps));
2386
2394
  }
2387
- });
2388
- MenuItem.propTypes = __assign(__assign({}, stylePropTypes()), { value: propTypes.any, href: propTypes.string, type: propTypes.oneOf(["checkbox", "radio"]), checked: propTypes.bool, disabled: propTypes.bool, children: propTypes.oneOfType([propTypes.node, propTypes.func]), onClick: propTypes.func });
2395
+ };
2396
+ var MenuItem = withHovering("MenuItem", MenuItemFr);
2389
2397
 
2390
- var FocusableItem = withHovering("FocusableItem", function FocusableItem(_a) {
2391
- var className = _a.className, disabled = _a.disabled, children = _a.children, isHovering = _a.isHovering, itemRef = _a.itemRef, externalRef = _a.externalRef, restProps = __rest(_a, ["className", "disabled", "children", "isHovering", "itemRef", "externalRef"]);
2398
+ var FocusableItemFr = function (_a) {
2399
+ var className = _a.className, disabled = _a.disabled, children = _a.children, isHovering = _a.isHovering, menuItemRef = _a.menuItemRef, externalRef = _a.externalRef, restProps = __rest(_a, ["className", "disabled", "children", "isHovering", "menuItemRef", "externalRef"]);
2392
2400
  var isDisabled = !!disabled;
2393
2401
  var ref = react.useRef(null);
2394
- var _b = useItemState(itemRef, ref, isHovering, isDisabled), setHover = _b.setHover, onPointerLeave = _b.onPointerLeave, restStateProps = __rest(_b, ["setHover", "onPointerLeave"]);
2402
+ var _b = useItemState(menuItemRef, ref, isHovering, isDisabled), setHover = _b.setHover, onPointerLeave = _b.onPointerLeave, restStateProps = __rest(_b, ["setHover", "onPointerLeave"]);
2395
2403
  var handleClose = react.useContext(EventHandlersContext).handleClose;
2396
2404
  var modifiers = react.useMemo(function () { return ({
2397
2405
  disabled: isDisabled,
@@ -2402,50 +2410,51 @@ var FocusableItem = withHovering("FocusableItem", function FocusableItem(_a) {
2402
2410
  return safeCall(children, __assign(__assign({}, modifiers), { ref: ref, closeMenu: handleClose }));
2403
2411
  }, [children, modifiers, handleClose]);
2404
2412
  var mergedProps = mergeProps(__assign(__assign({}, restStateProps), { onPointerLeave: function (e) { return onPointerLeave(e, true); }, onFocus: setHover }), restProps);
2405
- return (jsxRuntime.jsx("li", __assign({ role: "menuitem" }, mergedProps, commonProps(isDisabled), { ref: useCombinedRef(externalRef, itemRef), className: useBEM({ block: menuClass, element: menuItemClass, modifiers: modifiers, className: className }) }, { children: renderChildren })));
2406
- });
2407
- FocusableItem.propTypes = __assign(__assign({}, stylePropTypes()), { disabled: propTypes.bool, children: propTypes.func });
2413
+ return (jsxRuntime.jsx("li", __assign({ role: "menuitem" }, mergedProps, commonProps(isDisabled), { ref: useCombinedRef(externalRef, menuItemRef), className: useBEM({ block: menuClass, element: menuItemClass, modifiers: modifiers, className: className }) }, { children: renderChildren })));
2414
+ };
2415
+ var FocusableItem = withHovering("FocusableItem", FocusableItemFr);
2408
2416
 
2409
- var MenuDivider = react.memo(react.forwardRef(function MenuDivider(_a, externalRef) {
2417
+ var MenuDividerFr = function (_a, externalRef) {
2410
2418
  var className = _a.className, restProps = __rest(_a, ["className"]);
2411
2419
  return (jsxRuntime.jsx("li", __assign({ role: "separator" }, restProps, { ref: externalRef, className: useBEM({ block: menuClass, element: menuDividerClass, className: className }) })));
2412
- }));
2413
- MenuDivider.propTypes = __assign({}, stylePropTypes());
2420
+ };
2421
+ var MenuDivider = react.memo(react.forwardRef(MenuDividerFr));
2414
2422
 
2415
- var MenuHeader = react.memo(react.forwardRef(function MenuHeader(_a, externalRef) {
2423
+ var MenuHeaderFr = function (_a, externalRef) {
2416
2424
  var className = _a.className, restProps = __rest(_a, ["className"]);
2417
2425
  return (jsxRuntime.jsx("li", __assign({ role: "presentation" }, restProps, { ref: externalRef, className: useBEM({ block: menuClass, element: menuHeaderClass, className: className }) })));
2418
- }));
2419
- MenuHeader.propTypes = __assign({}, stylePropTypes());
2426
+ };
2427
+ var MenuHeader = react.memo(react.forwardRef(MenuHeaderFr));
2420
2428
 
2421
- var MenuGroup = react.forwardRef(function MenuGroup(_a, externalRef) {
2429
+ var MenuGroupFr = function (_a, externalRef) {
2422
2430
  var className = _a.className, style = _a.style, takeOverflow = _a.takeOverflow, restProps = __rest(_a, ["className", "style", "takeOverflow"]);
2423
2431
  var ref = react.useRef(null);
2424
2432
  var _b = react.useState(), overflowStyle = _b[0], setOverflowStyle = _b[1];
2425
2433
  var _c = react.useContext(MenuListContext), overflow = _c.overflow, overflowAmt = _c.overflowAmt;
2426
2434
  useIsomorphicLayoutEffect(function () {
2427
2435
  var maxHeight;
2428
- if (takeOverflow && overflowAmt >= 0) {
2436
+ if (takeOverflow && overflowAmt != null && overflowAmt >= 0 && ref.current) {
2437
+ // FIXME Matt added && ref.current
2429
2438
  maxHeight = ref.current.getBoundingClientRect().height - overflowAmt;
2430
2439
  if (maxHeight < 0)
2431
2440
  maxHeight = 0;
2432
2441
  }
2433
- setOverflowStyle(maxHeight >= 0 ? { maxHeight: maxHeight, overflow: overflow } : undefined);
2442
+ setOverflowStyle(maxHeight != null && maxHeight >= 0 ? { maxHeight: maxHeight, overflow: overflow } : undefined);
2434
2443
  }, [takeOverflow, overflow, overflowAmt]);
2435
2444
  useIsomorphicLayoutEffect(function () {
2436
- if (overflowStyle)
2445
+ if (overflowStyle && ref.current)
2437
2446
  ref.current.scrollTop = 0;
2438
2447
  }, [overflowStyle]);
2439
2448
  return (jsxRuntime.jsx("div", __assign({}, restProps, { ref: useCombinedRef(externalRef, ref), className: useBEM({ block: menuClass, element: menuGroupClass, className: className }), style: __assign(__assign({}, style), overflowStyle) })));
2440
- });
2441
- MenuGroup.propTypes = __assign(__assign({}, stylePropTypes()), { takeOverflow: propTypes.bool });
2449
+ };
2450
+ var MenuGroup = react.forwardRef(MenuGroupFr);
2442
2451
 
2443
- var MenuRadioGroup = react.forwardRef(function MenuRadioGroup(_a, externalRef) {
2452
+ var MenuRadioGroupFr = function (_a, externalRef) {
2444
2453
  var ariaLabel = _a["aria-label"], className = _a.className, name = _a.name, value = _a.value, onRadioChange = _a.onRadioChange, restProps = __rest(_a, ["aria-label", "className", "name", "value", "onRadioChange"]);
2445
2454
  var contextValue = react.useMemo(function () { return ({ name: name, value: value, onRadioChange: onRadioChange }); }, [name, value, onRadioChange]);
2446
2455
  return (jsxRuntime.jsx(RadioGroupContext.Provider, __assign({ value: contextValue }, { children: jsxRuntime.jsx("li", __assign({ role: "presentation" }, { children: jsxRuntime.jsx("ul", __assign({ role: "group", "aria-label": ariaLabel || name || "Radio group" }, restProps, { ref: externalRef, className: useBEM({ block: menuClass, element: radioGroupClass, className: className }) })) })) })));
2447
- });
2448
- MenuRadioGroup.propTypes = __assign(__assign({}, stylePropTypes()), { name: propTypes.string, value: propTypes.any, onRadioChange: propTypes.func });
2456
+ };
2457
+ var MenuRadioGroup = react.forwardRef(MenuRadioGroupFr);
2449
2458
 
2450
2459
  var useGridPopoverHook = function (props, save) {
2451
2460
  var cellEditorParams = props.cellEditorParams, saving = props.saving, updateValue = props.updateValue;
@@ -2499,7 +2508,18 @@ var GridRenderPopoutMenuCell = function (props) {
2499
2508
  var _a, _b, _c;
2500
2509
  var checkUpdating = react.useContext(UpdatingContext).checkUpdating;
2501
2510
  var isLoading = checkUpdating((_b = (_a = props.colDef) === null || _a === void 0 ? void 0 : _a.field) !== null && _b !== void 0 ? _b : "", props.data.id);
2502
- var disabled = !((_c = props.colDef) === null || _c === void 0 ? void 0 : _c.editable);
2511
+ var editable = (_c = props.colDef) === null || _c === void 0 ? void 0 : _c.editable;
2512
+ var disabled = !(typeof editable === "function"
2513
+ ? editable({
2514
+ node: props.node,
2515
+ data: props.data,
2516
+ column: props.column,
2517
+ colDef: props.colDef,
2518
+ api: props.api,
2519
+ columnApi: props.columnApi,
2520
+ context: props.context
2521
+ })
2522
+ : editable);
2503
2523
  return (jsxRuntime.jsx(GridLoadableCell, __assign({ isLoading: isLoading, className: disabled ? "GridPopoutMenu-burgerDisabled" : "GridPopoutMenu-burger" }, { children: jsxRuntime.jsx(lui.LuiIcon, { name: "ic_more_vert", alt: "More actions", size: "md" }) })));
2504
2524
  };
2505
2525
 
@@ -2533,7 +2553,7 @@ var GridFormMultiSelect = function (props) {
2533
2553
  }
2534
2554
  });
2535
2555
  }); }, [formProps, selectedValues]);
2536
- var popoverWrapper = useGridPopoverHook(props, save).popoverWrapper;
2556
+ var _e = useGridPopoverHook(props, save), popoverWrapper = _e.popoverWrapper, triggerSave = _e.triggerSave;
2537
2557
  // Load up options list if it's async function
2538
2558
  react.useEffect(function () {
2539
2559
  var _a;
@@ -2582,7 +2602,7 @@ var GridFormMultiSelect = function (props) {
2582
2602
  return undefined;
2583
2603
  }
2584
2604
  var str = option.label || "";
2585
- return str.toLowerCase().indexOf(filter) === -1 ? option.value : undefined;
2605
+ return str.toLowerCase().indexOf(filter.trim()) === -1 ? option.value : undefined;
2586
2606
  })
2587
2607
  .filter(function (r) { return r !== undefined; }));
2588
2608
  }, [formProps.filtered, filter, options]);
@@ -2590,27 +2610,48 @@ var GridFormMultiSelect = function (props) {
2590
2610
  var _b;
2591
2611
  var ref = _a.ref;
2592
2612
  return (jsxRuntime.jsx("div", __assign({ style: { display: "flex", width: "100%" } }, { children: jsxRuntime.jsx("input", { autoFocus: true, className: "free-text-input", style: { border: "0px" }, ref: ref, type: "text", placeholder: (_b = formProps.filterPlaceholder) !== null && _b !== void 0 ? _b : "Placeholder", "data-testid": "filteredMenu-free-text-input", defaultValue: "", onChange: function (e) { return setFilter(e.target.value.toLowerCase()); } }) })));
2593
- } })), jsxRuntime.jsx(MenuDivider, {}, "$$divider_filter")] })), options === null || options === void 0 ? void 0 : options.map(function (item, index) {
2613
+ } }), "filter"), jsxRuntime.jsx(MenuDivider, {}, "$$divider_filter")] })), options === null || options === void 0 ? void 0 : options.map(function (item, index) {
2594
2614
  var _a;
2595
- return item.value === MenuSeparatorString$1 ? (jsxRuntime.jsx(MenuDivider, {}, "$$divider_".concat(index))) : filteredValues.includes(item.value) ? null : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(MenuItem, __assign({ onClick: function (e) {
2615
+ return item.value === MenuSeparatorString$1 ? (jsxRuntime.jsx(MenuDivider, {}, "$$divider_".concat(index))) : filteredValues.includes(item.value) ? null : (jsxRuntime.jsxs(react.Fragment, { children: [jsxRuntime.jsx(MenuItem, __assign({ onClick: function (e) {
2596
2616
  e.keepOpen = true;
2597
- // onSelectMenuOption(itemIndex, e.value);
2598
- return false;
2599
- } }, { children: jsxRuntime.jsx(lui.LuiCheckboxInput, { isChecked: selectedValues.includes(item.value), value: "".concat(item.value), label: (_a = item.label) !== null && _a !== void 0 ? _a : (item.value == null ? "<".concat(item.value, ">") : "".concat(item.value)), onChange: function (e) {
2600
- if (e.target.checked) {
2601
- setSelectedValues(__spreadArray(__spreadArray([], selectedValues, true), [item.value], false));
2617
+ if (selectedValues.includes(item.value)) {
2618
+ setSelectedValues(selectedValues.filter(function (value) { return value != item.value; }));
2619
+ }
2620
+ else {
2621
+ setSelectedValues(__spreadArray(__spreadArray([], selectedValues, true), [item.value], false));
2622
+ }
2623
+ }, onKeyDown: function (e) { return __awaiter(void 0, void 0, void 0, function () {
2624
+ return __generator(this, function (_a) {
2625
+ if (e.key === "Enter")
2626
+ triggerSave().then();
2627
+ else if (e.key === " ") {
2628
+ if (selectedValues.includes(item.value)) {
2629
+ setSelectedValues(selectedValues.filter(function (value) { return value != item.value; }));
2630
+ }
2631
+ else {
2632
+ setSelectedValues(__spreadArray(__spreadArray([], selectedValues, true), [item.value], false));
2633
+ }
2634
+ e.preventDefault();
2635
+ e.stopPropagation();
2602
2636
  }
2603
- else {
2604
- setSelectedValues(selectedValues.filter(function (value) { return value != item.value; }));
2637
+ return [2 /*return*/];
2638
+ });
2639
+ }); } }, { children: jsxRuntime.jsx(lui.LuiCheckboxInput, { isChecked: selectedValues.includes(item.value), value: "".concat(item.value), label: (_a = item.label) !== null && _a !== void 0 ? _a : (item.value == null ? "<".concat(item.value, ">") : "".concat(item.value)), inputProps: {
2640
+ onClick: function (e) {
2641
+ e.preventDefault();
2642
+ e.stopPropagation();
2643
+ return false;
2605
2644
  }
2606
- } }) }), "".concat(item.value)), selectedValues.includes(item.value) && item.subComponent && (jsxRuntime.jsx(FocusableItem, __assign({ className: "LuiDeprecatedForms" }, { children: function (ref) {
2645
+ }, onChange: function () {
2646
+ /*Do nothing, change handled by menuItem*/
2647
+ } }) }), "".concat(index)), selectedValues.includes(item.value) && item.subComponent && (jsxRuntime.jsx(FocusableItem, __assign({ className: "LuiDeprecatedForms" }, { children: function (ref) {
2607
2648
  return item.subComponent &&
2608
2649
  item.subComponent({
2609
2650
  setValue: function (value) {
2610
2651
  subSelectedValues.current[item.value] = value;
2611
2652
  }
2612
2653
  }, ref);
2613
- } }), "".concat(item.value, "_subcomponent")))] }));
2654
+ } }), "".concat(item.value, "_subcomponent")))] }, "".concat(index)));
2614
2655
  })] })) })));
2615
2656
  };
2616
2657
 
@@ -2997,7 +3038,7 @@ var GridFormDropDown = function (props) {
2997
3038
  }
2998
3039
  });
2999
3040
  }); }, [filteredValues, options, selectItemHandler, stopEditing]);
3000
- return popoverWrapper(jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [formProps.filtered && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(FocusableItem, __assign({ className: "filter-item", index: -1 }, { children: function (_a) {
3041
+ return popoverWrapper(jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [formProps.filtered && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(FocusableItem, __assign({ className: "filter-item" }, { children: function (_a) {
3001
3042
  var _b;
3002
3043
  var ref = _a.ref;
3003
3044
  return (jsxRuntime.jsx("div", __assign({ style: { display: "flex", width: "100%" } }, { children: jsxRuntime.jsx("input", { autoFocus: true, className: "free-text-input", style: { border: "0px" }, ref: ref, type: "text", placeholder: (_b = formProps.filterPlaceholder) !== null && _b !== void 0 ? _b : "Placeholder", "data-testid": "filteredMenu-free-text-input", defaultValue: filter, onChange: function (e) { return setFilter(e.target.value.toLowerCase()); }, onKeyDown: function (e) { return onFilterKeyDown(e); } }) })));
@@ -3160,6 +3201,8 @@ var GridPopoverTextInput = function (colDef) {
3160
3201
  };
3161
3202
 
3162
3203
  exports.ComponentLoadingWrapper = ComponentLoadingWrapper;
3204
+ exports.ControlledMenu = ControlledMenu;
3205
+ exports.FocusableItem = FocusableItem;
3163
3206
  exports.GenericMultiEditCellClass = GenericMultiEditCellClass;
3164
3207
  exports.Grid = Grid;
3165
3208
  exports.GridCell = GridCell;
@@ -3185,6 +3228,14 @@ exports.GridPopoverTextArea = GridPopoverTextArea;
3185
3228
  exports.GridPopoverTextInput = GridPopoverTextInput;
3186
3229
  exports.GridRenderPopoutMenuCell = GridRenderPopoutMenuCell;
3187
3230
  exports.GridRendererGenericCell = GridRendererGenericCell;
3231
+ exports.Menu = Menu;
3232
+ exports.MenuButton = MenuButton;
3233
+ exports.MenuDivider = MenuDivider;
3234
+ exports.MenuGroup = MenuGroup;
3235
+ exports.MenuHeader = MenuHeader;
3236
+ exports.MenuItem = MenuItem;
3237
+ exports.MenuRadioGroup = MenuRadioGroup;
3238
+ exports.SubMenu = SubMenu;
3188
3239
  exports.TextAreaInput = TextAreaInput;
3189
3240
  exports.TextInputFormatted = TextInputFormatted;
3190
3241
  exports.UpdatingContext = UpdatingContext;
@@ -3198,6 +3249,7 @@ exports.hasParentClass = hasParentClass;
3198
3249
  exports.isFloat = isFloat;
3199
3250
  exports.isNotEmpty = isNotEmpty;
3200
3251
  exports.useGridPopoverHook = useGridPopoverHook;
3252
+ exports.useMenuState = useMenuState;
3201
3253
  exports.usePostSortRowsHook = usePostSortRowsHook;
3202
3254
  exports.wait = wait;
3203
3255
  //# sourceMappingURL=index.js.map