@cccsaurora/howler-ui 3.1.0-dev.1635 → 3.1.0-dev.1636

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -97,7 +97,7 @@
97
97
  "url": "https://github.com/CybercentreCanada/howler"
98
98
  },
99
99
  "type": "module",
100
- "version": "3.1.0-dev.1635",
100
+ "version": "3.1.0-dev.1636",
101
101
  "exports": {
102
102
  "./i18n": "./i18n.js",
103
103
  "./index.css": "./index.css",
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useClueActionsSelector, useClueEnrichSelector } from '@cccsaurora/clue-ui';
3
3
  import { Icon } from '@iconify/react';
4
4
  import { Settings } from '@mui/icons-material';
@@ -124,8 +124,9 @@ const CluePivot = ({ pivot, hit, compact, variant = 'card', onNavigate }) => {
124
124
  if (!actions[pivot.value]) {
125
125
  return null;
126
126
  }
127
+ const children = (_jsxs(_Fragment, { children: [_jsx(Icon, { fontSize: "1.5rem", icon: pivot.icon }), _jsx(Typography, { noWrap: true, children: pivot.label[i18n.language] }), _jsx(Divider, { orientation: "vertical", flexItem: true }), _jsx(IconButton, { size: "small", onClick: e => onClueClick(e, true), children: _jsx(Settings, { fontSize: "small" }) })] }));
127
128
  if (variant === 'menu-item') {
128
- return (_jsxs(Stack, { component: "button", type: "button", role: "menuitem", onClick: event => {
129
+ return (_jsx(Stack, { role: "menuitem", onClick: event => {
129
130
  void onClueClick(event);
130
131
  onNavigate?.();
131
132
  }, direction: "row", spacing: 1, alignItems: "center", sx: theme => ({
@@ -138,7 +139,7 @@ const CluePivot = ({ pivot, hit, compact, variant = 'card', onNavigate }) => {
138
139
  font: 'inherit',
139
140
  textAlign: 'left',
140
141
  '&:hover': { backgroundColor: theme.palette.action.hover }
141
- }), children: [_jsx(Icon, { fontSize: "1.5rem", icon: pivot.icon }), _jsx(Typography, { noWrap: true, children: pivot.label[i18n.language] })] }));
142
+ }), children: children }));
142
143
  }
143
144
  return (_jsx(HowlerCard, { variant: compact ? 'outlined' : 'elevation', onClick: e => onClueClick(e), sx: [
144
145
  theme => ({
@@ -155,6 +156,6 @@ const CluePivot = ({ pivot, hit, compact, variant = 'card', onNavigate }) => {
155
156
  cursor: 'pointer'
156
157
  },
157
158
  !compact && { border: 'thin solid', borderColor: 'transparent' }
158
- ], children: _jsxs(Stack, { direction: "row", p: compact ? 0.5 : 1, spacing: 1, alignItems: "center", children: [_jsx(Icon, { fontSize: "1.5rem", icon: pivot.icon }), _jsx(Typography, { children: pivot.label[i18n.language] }), _jsx(Divider, { orientation: "vertical", flexItem: true }), _jsx(IconButton, { size: "small", onClick: e => onClueClick(e, true), children: _jsx(Settings, { fontSize: "small" }) })] }) }));
159
+ ], children: _jsx(Stack, { direction: "row", p: compact ? 0.5 : 1, spacing: 1, alignItems: "center", children: children }) }));
159
160
  };
160
161
  export default memo(CluePivot);
@@ -67,7 +67,7 @@ describe('CluePivot', () => {
67
67
  clueState.guessType.mockReturnValue('indicator');
68
68
  showErrorMessage.mockReset();
69
69
  });
70
- it('renders a menu item and executes the mapped action without opening a window', async () => {
70
+ it('renders a menu item and executes the mapped action', async () => {
71
71
  const user = userEvent.setup();
72
72
  const onNavigate = vi.fn();
73
73
  render(_jsx(Wrapper, { children: _jsx(CluePivot, { pivot: pivot(), hit: hit, dossier: dossier, variant: "menu-item", onNavigate: onNavigate }) }));
@@ -77,6 +77,16 @@ describe('CluePivot', () => {
77
77
  expect(clueState.executeAction).toHaveBeenCalledWith('enrich', [{ type: 'indicator', value: 'hit-1' }], { note: 'from-pivot' }, { forceMenu: false });
78
78
  });
79
79
  });
80
+ it('opens the force menu from the settings control in a menu item', async () => {
81
+ const user = userEvent.setup();
82
+ const onNavigate = vi.fn();
83
+ render(_jsx(Wrapper, { children: _jsx(CluePivot, { pivot: pivot(), hit: hit, dossier: dossier, variant: "menu-item", onNavigate: onNavigate }) }));
84
+ await user.click(screen.getByRole('button', { name: '' }));
85
+ expect(onNavigate).not.toHaveBeenCalled();
86
+ await waitFor(() => {
87
+ expect(clueState.executeAction).toHaveBeenCalledWith('enrich', [{ type: 'indicator', value: 'hit-1' }], { note: 'from-pivot' }, { forceMenu: true });
88
+ });
89
+ });
80
90
  it('passes forceMenu when the settings button is clicked on a card pivot', async () => {
81
91
  const user = userEvent.setup();
82
92
  render(_jsx(Wrapper, { children: _jsx(CluePivot, { pivot: pivot(), hit: hit, dossier: dossier, compact: true }) }));