@jini-ai/ui-kit 0.1.0 → 0.1.1

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 ADDED
@@ -0,0 +1,9 @@
1
+ # @jini-ai/ui-kit
2
+
3
+ ## 0.1.1 — 2026-10-05
4
+
5
+ - Native menu items step by their position among enabled items (from the render closure) instead of re-querying the menu ref. Same order as `focus()`; arrow keys skip a disabled item. Behavior unchanged.
6
+
7
+ ## 0.1.0
8
+
9
+ - First published release.
@@ -58,7 +58,8 @@ export function useNativeMenu(required, _optional = {}) {
58
58
  document.addEventListener('pointerdown', dismiss);
59
59
  return () => document.removeEventListener('pointerdown', dismiss);
60
60
  }, [open]);
61
- function onKeyDown(event) {
61
+ // `current` is the item's position among enabled items, the same order focus() walks, so no DOM lookup is needed.
62
+ function onKeyDown(event, current) {
62
63
  if (event.key === 'Escape') {
63
64
  event.preventDefault();
64
65
  close();
@@ -68,7 +69,6 @@ export function useNativeMenu(required, _optional = {}) {
68
69
  setOpen(false);
69
70
  return;
70
71
  }
71
- const current = Array.from(menu.current?.querySelectorAll('[role="menuitem"]:not(:disabled)') ?? []).indexOf(event.target);
72
72
  const next = event.key === 'Home' ? 0 : event.key === 'End' ? enabled.length - 1 :
73
73
  event.key === 'ArrowDown' ? (current + 1) % enabled.length : event.key === 'ArrowUp' ? (current - 1 + enabled.length) % enabled.length : undefined;
74
74
  if (next !== undefined) {
@@ -81,7 +81,7 @@ export function useNativeMenu(required, _optional = {}) {
81
81
  onClick: () => { if (!item.disabled) {
82
82
  close();
83
83
  item.onPress({});
84
- } }, onKeyDown }, item.label));
84
+ } }, onKeyDown: (event) => onKeyDown(event, enabled.indexOf(item)) }, item.label));
85
85
  const menuProps = { ref: menu, id, role: 'menu', 'aria-label': required.label, hidden: !open, className: 'jini-row-menu-popup', 'data-jini-part': 'kit.menu', style: { position: 'fixed', ...position } };
86
86
  return { label: '⋮', items, popup: open ? createPortal(createElement('div', menuProps, items), document.body) : null,
87
87
  triggerProps: { 'data-jini-part': 'kit.menu-trigger', ...required.attrs, ref: trigger, type: 'button',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jini-ai/ui-kit",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Framework-free UI contract, injected React facades and native defaults.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -51,11 +51,13 @@
51
51
  "dist",
52
52
  "src/react/native/styles.css",
53
53
  "README.md",
54
+ "CHANGELOG.md",
54
55
  "docs",
55
56
  "LICENSE",
56
57
  "!dist/**/__tests__/**",
57
58
  "!dist/**/*.test.*",
58
- "!dist/**/*.typecheck.*"
59
+ "!dist/**/*.typecheck.*",
60
+ "!dist/**/*.map"
59
61
  ],
60
62
  "publishConfig": {
61
63
  "access": "public",