@balena/ui-shared-components 3.4.1 → 3.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -33,14 +33,14 @@ export const DropDownButton = (_a) => {
33
33
  }, [items, groupByProp]);
34
34
  const handleClick = (event) => {
35
35
  var _a, _b, _c;
36
- return ((_c = (_b = (_a = items === null || items === void 0 ? void 0 : items[selectedIndex]) === null || _a === void 0 ? void 0 : _a.onClick) === null || _b === void 0 ? void 0 : _b.call(_a, event)) !== null && _c !== void 0 ? _c : onClick === null || onClick === void 0 ? void 0 : onClick(event, items[selectedIndex]));
36
+ return ((_c = (_b = (_a = memoizedItems === null || memoizedItems === void 0 ? void 0 : memoizedItems[selectedIndex]) === null || _a === void 0 ? void 0 : _a.onClick) === null || _b === void 0 ? void 0 : _b.call(_a, event)) !== null && _c !== void 0 ? _c : onClick === null || onClick === void 0 ? void 0 : onClick(event, memoizedItems[selectedIndex]));
37
37
  };
38
38
  const handleMenuItemClick = (event, index) => {
39
39
  var _a, _b, _c;
40
40
  setSelectedIndex(index);
41
41
  setAnchorEl(null);
42
42
  if (children) {
43
- return ((_c = (_b = (_a = items === null || items === void 0 ? void 0 : items[index]) === null || _a === void 0 ? void 0 : _a.onClick) === null || _b === void 0 ? void 0 : _b.call(_a, event)) !== null && _c !== void 0 ? _c : onClick === null || onClick === void 0 ? void 0 : onClick(event, items[selectedIndex]));
43
+ return ((_c = (_b = (_a = memoizedItems === null || memoizedItems === void 0 ? void 0 : memoizedItems[index]) === null || _a === void 0 ? void 0 : _a.onClick) === null || _b === void 0 ? void 0 : _b.call(_a, event)) !== null && _c !== void 0 ? _c : onClick === null || onClick === void 0 ? void 0 : onClick(event, memoizedItems[selectedIndex]));
44
44
  }
45
45
  };
46
46
  const handleToggle = (event) => {
@@ -48,11 +48,11 @@ export const DropDownButton = (_a) => {
48
48
  };
49
49
  return (_jsxs(_Fragment, { children: [children ? (_jsx(Button, Object.assign({ "aria-controls": !!anchorEl ? 'dropdown' : undefined, "aria-expanded": !!anchorEl ? 'true' : undefined, onClick: (event) => {
50
50
  setAnchorEl(event.currentTarget);
51
- }, endIcon: anchorEl ? _jsx(KeyboardArrowUp, {}) : _jsx(KeyboardArrowDown, {}) }, buttonProps, { children: children }))) : (_jsxs(ButtonGroup, Object.assign({ variant: "contained", disableElevation: true }, buttonProps, { children: [_jsx(ButtonWithTracking, Object.assign({ onClick: handleClick, eventName: items[selectedIndex].eventName, eventProperties: items[selectedIndex].eventProperties, tooltip: items[selectedIndex].tooltip }, { children: items[selectedIndex].children })), _jsx(Button, Object.assign({ onClick: handleToggle,
51
+ }, endIcon: anchorEl ? _jsx(KeyboardArrowUp, {}) : _jsx(KeyboardArrowDown, {}) }, buttonProps, { children: children }))) : (_jsxs(ButtonGroup, Object.assign({ variant: "contained", disableElevation: true }, buttonProps, { children: [_jsx(ButtonWithTracking, Object.assign({ onClick: handleClick, eventName: memoizedItems[selectedIndex].eventName, eventProperties: memoizedItems[selectedIndex].eventProperties, tooltip: memoizedItems[selectedIndex].tooltip }, { children: memoizedItems[selectedIndex].children })), _jsx(Button, Object.assign({ onClick: handleToggle,
52
52
  // It doesn't look good without it, hence the addition.
53
53
  sx: (theme) => ({ pl: 2, pr: `calc(${theme.spacing(2)} + 2px)` }) }, { children: anchorEl ? _jsx(ArrowDropUp, {}) : _jsx(ArrowDropDown, {}) }))] }))), _jsx(Menu, Object.assign({ anchorEl: anchorEl, open: !!anchorEl, onClose: () => {
54
54
  setAnchorEl(null);
55
- } }, { children: memoizedItems.map((item, index) => (_jsx(MenuItemWithTracking, Object.assign({}, item, { onClick: (event) => handleMenuItemClick(event, index) }, { children: item.children })))) }))] }));
55
+ } }, { children: memoizedItems.map((item, index) => (_jsx(MenuItemWithTracking, Object.assign({}, item, { onClick: (event) => handleMenuItemClick(event, index) }, { children: item.children }), index))) }))] }));
56
56
  };
57
57
  /**
58
58
  * This MenuItem will send analytics in case the analytics context is passed through the provider (AnalyticsProvider).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@balena/ui-shared-components",
3
- "version": "3.4.1",
3
+ "version": "3.4.2",
4
4
  "main": "./dist/index.js",
5
5
  "sideEffects": false,
6
6
  "files": [
@@ -110,6 +110,6 @@
110
110
  },
111
111
  "homepage": "https://github.com/balena-io/ui-shared-components#readme",
112
112
  "versionist": {
113
- "publishedAt": "2024-02-28T12:50:24.078Z"
113
+ "publishedAt": "2024-02-28T15:06:00.357Z"
114
114
  }
115
115
  }