@inf-monkeys-tech/monkeys-design 1.0.18 → 1.0.19
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/dist/components/agent-workbench/index.js.map +1 -1
- package/dist/components/agent-workbench/index.mjs.map +1 -1
- package/dist/components/layout/index.js +25 -2
- package/dist/components/layout/index.js.map +1 -1
- package/dist/components/layout/index.mjs +25 -2
- package/dist/components/layout/index.mjs.map +1 -1
- package/dist/index.js +25 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -2
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -3657,6 +3657,7 @@ function HeadbarNavMenuItem({
|
|
|
3657
3657
|
}) {
|
|
3658
3658
|
const [open, setOpen] = react.useState(false);
|
|
3659
3659
|
const closeTimerRef = react.useRef(null);
|
|
3660
|
+
const wasOpenOnPointerDownRef = react.useRef(false);
|
|
3660
3661
|
const clearCloseTimer = () => {
|
|
3661
3662
|
if (!closeTimerRef.current) return;
|
|
3662
3663
|
clearTimeout(closeTimerRef.current);
|
|
@@ -3673,6 +3674,13 @@ function HeadbarNavMenuItem({
|
|
|
3673
3674
|
closeTimerRef.current = null;
|
|
3674
3675
|
}, 120);
|
|
3675
3676
|
};
|
|
3677
|
+
const navigateToFirstEnabledChild = () => {
|
|
3678
|
+
const firstEnabledChild = item.children?.find((child) => !child.disabled);
|
|
3679
|
+
if (!firstEnabledChild) return false;
|
|
3680
|
+
setOpen(false);
|
|
3681
|
+
onNavigate?.(firstEnabledChild.id);
|
|
3682
|
+
return true;
|
|
3683
|
+
};
|
|
3676
3684
|
react.useEffect(() => clearCloseTimer, []);
|
|
3677
3685
|
return /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu__namespace.Root, { modal: false, open, onOpenChange: setOpen, children: [
|
|
3678
3686
|
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenu__namespace.Trigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3685,7 +3693,22 @@ function HeadbarNavMenuItem({
|
|
|
3685
3693
|
endIcon: /* @__PURE__ */ jsxRuntime.jsx(HeadbarChevronIcon, { open }),
|
|
3686
3694
|
label: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate whitespace-nowrap", children: label }),
|
|
3687
3695
|
disabled: item.disabled,
|
|
3688
|
-
onClick: () =>
|
|
3696
|
+
onClick: () => {
|
|
3697
|
+
const wasOpenOnPointerDown = wasOpenOnPointerDownRef.current;
|
|
3698
|
+
wasOpenOnPointerDownRef.current = false;
|
|
3699
|
+
if (wasOpenOnPointerDown && navigateToFirstEnabledChild()) return;
|
|
3700
|
+
setOpen(true);
|
|
3701
|
+
},
|
|
3702
|
+
onPointerDown: () => {
|
|
3703
|
+
wasOpenOnPointerDownRef.current = open;
|
|
3704
|
+
},
|
|
3705
|
+
onPointerCancel: () => {
|
|
3706
|
+
wasOpenOnPointerDownRef.current = false;
|
|
3707
|
+
},
|
|
3708
|
+
onKeyDown: (event) => {
|
|
3709
|
+
if (!open || event.key !== "Enter" && event.key !== " ") return;
|
|
3710
|
+
if (navigateToFirstEnabledChild()) event.preventDefault();
|
|
3711
|
+
},
|
|
3689
3712
|
onMouseEnter: openMenu,
|
|
3690
3713
|
onMouseLeave: scheduleCloseMenu,
|
|
3691
3714
|
style: getHeadbarItemStyle(isActive || open, useTokenRadius),
|
|
@@ -3724,7 +3747,7 @@ function HeadbarNavMenuItem({
|
|
|
3724
3747
|
{
|
|
3725
3748
|
disabled: child.disabled,
|
|
3726
3749
|
className: cn2(
|
|
3727
|
-
"relative flex cursor-pointer select-none items-center gap-2.5 px-3 py-2 text-sm outline-none transition-colors hover:bg-[var(--monkeys-component-navigation-headbar-item-hover-background,hsl(var(--accent)))]",
|
|
3750
|
+
"relative flex cursor-pointer select-none items-center gap-2.5 px-3 py-2 text-sm outline-none transition-colors hover:bg-[var(--monkeys-component-navigation-headbar-item-hover-background,hsl(var(--accent)))] focus:bg-[var(--monkeys-component-navigation-headbar-item-hover-background,hsl(var(--accent)))] [&[data-highlighted]]:bg-[var(--monkeys-component-navigation-headbar-item-hover-background,hsl(var(--accent)))]",
|
|
3728
3751
|
menuItemRadiusClass
|
|
3729
3752
|
),
|
|
3730
3753
|
style: getHeadbarItemStyle(
|