@xh/hoist 73.0.0-SNAPSHOT.1744315927263 → 73.0.0-SNAPSHOT.1744325910318

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/CHANGELOG.md CHANGED
@@ -6,6 +6,7 @@
6
6
 
7
7
  * Added option from the Admin Console > Websockets tab to request a client health report from any
8
8
  connected clients.
9
+ * Updated `MenuItem.actionFn()` to receive the click event as an additional argument.
9
10
 
10
11
  ## v72.4.0 - 2025-04-09
11
12
 
@@ -1,5 +1,5 @@
1
1
  import { RuleLike } from '@xh/hoist/data';
2
- import { ReactElement, ReactNode } from 'react';
2
+ import { MouseEvent, ReactElement, ReactNode } from 'react';
3
3
  import { LoadSpec } from '../load';
4
4
  import { Intent, PlainObject, Thunkable } from './Types';
5
5
  /**
@@ -226,7 +226,7 @@ export interface MenuItem {
226
226
  /** Css class name to be added when rendering the menu item. */
227
227
  className?: string;
228
228
  /** Executed when the user clicks the menu item. */
229
- actionFn?: () => void;
229
+ actionFn?: (e: MouseEvent | PointerEvent) => void;
230
230
  /** Executed before the item is shown. Use to adjust properties dynamically. */
231
231
  prepareFn?: (me: MenuItem) => void;
232
232
  /** Child menu items. */
@@ -6,7 +6,7 @@
6
6
  */
7
7
 
8
8
  import {RuleLike} from '@xh/hoist/data';
9
- import {ReactElement, ReactNode} from 'react';
9
+ import {MouseEvent, ReactElement, ReactNode} from 'react';
10
10
  import {LoadSpec} from '../load';
11
11
  import {Intent, PlainObject, Thunkable} from './Types';
12
12
 
@@ -284,7 +284,7 @@ export interface MenuItem {
284
284
  className?: string;
285
285
 
286
286
  /** Executed when the user clicks the menu item. */
287
- actionFn?: () => void;
287
+ actionFn?: (e: MouseEvent | PointerEvent) => void;
288
288
 
289
289
  /** Executed before the item is shown. Use to adjust properties dynamically. */
290
290
  prepareFn?: (me: MenuItem) => void;
@@ -202,7 +202,7 @@ function parseMenuItems(items: MenuItemLike[]): ReactNode[] {
202
202
  icon: item.icon,
203
203
  intent: item.intent,
204
204
  className: item.className,
205
- onClick: actionFn ? () => wait().then(actionFn) : null, // do async to allow menu to close
205
+ onClick: actionFn ? e => wait().then(() => actionFn(e)) : null, // do async to allow menu to close
206
206
  disabled: item.disabled
207
207
  };
208
208
 
@@ -70,7 +70,7 @@ function parseItems(items: MenuItemLike[]): ReactNode[] {
70
70
  icon: item.icon,
71
71
  intent: item.intent,
72
72
  className: item.className,
73
- onClick: item.actionFn ? () => wait().then(item.actionFn) : null, // do async to allow menu to close
73
+ onClick: item.actionFn ? e => wait().then(() => item.actionFn(e)) : null, // do async to allow menu to close
74
74
  popoverProps: {usePortal: true},
75
75
  disabled: item.disabled,
76
76
  items
@@ -98,9 +98,9 @@ class LocalMenuModel extends HoistModel {
98
98
  omit: hidden,
99
99
  onTouchStart: () => (this.pressedIdx = idx),
100
100
  onTouchEnd: () => (this.pressedIdx = null),
101
- onClick: () => {
101
+ onClick: e => {
102
102
  this.pressedIdx = null;
103
- if (actionFn) actionFn();
103
+ if (actionFn) actionFn(e);
104
104
  onDismiss();
105
105
  }
106
106
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xh/hoist",
3
- "version": "73.0.0-SNAPSHOT.1744315927263",
3
+ "version": "73.0.0-SNAPSHOT.1744325910318",
4
4
  "description": "Hoist add-on for building and deploying React Applications.",
5
5
  "repository": "github:xh/hoist-react",
6
6
  "homepage": "https://xh.io",