@joewinke/jatui 0.8.5 → 0.8.6

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.
@@ -66,6 +66,12 @@
66
66
  * ArrowRight from the parent explicitly focuses into the submenu.
67
67
  */
68
68
  autoFocus?: boolean;
69
+ /**
70
+ * Called when an action item (not a submenu owner) is chosen, before
71
+ * this menu closes. A nested submenu uses it to close the WHOLE menu
72
+ * chain on a pick; Escape/ArrowLeft in a submenu still close only it.
73
+ */
74
+ onItemSelected?: () => void;
69
75
  }
70
76
 
71
77
  let {
@@ -77,7 +83,8 @@
77
83
  zIndex = 70,
78
84
  class: className = '',
79
85
  onClose,
80
- autoFocus = true
86
+ autoFocus = true,
87
+ onItemSelected
81
88
  }: Props = $props();
82
89
 
83
90
  // Submenu state — index into `items` of the currently-open submenu (if any),
@@ -124,6 +131,7 @@
124
131
  submitAction(item.submit);
125
132
  }
126
133
  item.onSelect?.();
134
+ onItemSelected?.();
127
135
  close();
128
136
  }
129
137
 
@@ -397,6 +405,10 @@
397
405
  zIndex={zIndex + 1}
398
406
  autoFocus={false}
399
407
  onClose={closeSubmenu}
408
+ onItemSelected={() => {
409
+ onItemSelected?.();
410
+ close();
411
+ }}
400
412
  />
401
413
  {/if}
402
414
  </div>
@@ -24,6 +24,12 @@ interface Props {
24
24
  * ArrowRight from the parent explicitly focuses into the submenu.
25
25
  */
26
26
  autoFocus?: boolean;
27
+ /**
28
+ * Called when an action item (not a submenu owner) is chosen, before
29
+ * this menu closes. A nested submenu uses it to close the WHOLE menu
30
+ * chain on a pick; Escape/ArrowLeft in a submenu still close only it.
31
+ */
32
+ onItemSelected?: () => void;
27
33
  }
28
34
  declare const ContextMenu: import("svelte").Component<Props, {}, "open">;
29
35
  type ContextMenu = ReturnType<typeof ContextMenu>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joewinke/jatui",
3
- "version": "0.8.5",
3
+ "version": "0.8.6",
4
4
  "private": false,
5
5
  "description": "Shared Svelte 5 component library for JAT projects",
6
6
  "type": "module",