@algorithm-shift/design-system 1.2.90 → 1.2.91

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/index.mjs CHANGED
@@ -29863,6 +29863,7 @@ import Link5 from "next/link";
29863
29863
  import { useRouter } from "next/navigation";
29864
29864
  import { Fragment as Fragment21, jsx as jsx57, jsxs as jsxs34 } from "react/jsx-runtime";
29865
29865
  var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuilder = false, source, parentKey, menuNameKey, menuUrlKey, loading }) => {
29866
+ const [openIndex, setOpenIndex] = useState8(null);
29866
29867
  function groupMenus(menus = []) {
29867
29868
  const menuMap = /* @__PURE__ */ new Map();
29868
29869
  menus.forEach((menu) => {
@@ -29926,40 +29927,69 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
29926
29927
  router.push(pendingUrl);
29927
29928
  }
29928
29929
  };
29930
+ let timeout;
29929
29931
  const renderDesktopTab = (tab, index) => {
29930
29932
  const finalClasses = [baseClasses, isActive(tab.url) ? activeClasses : hoverClasses, tab.className || ""].join(" ");
29931
29933
  if (Array.isArray(tab.children) && tab.children.length > 0 && tab.isDropDown) {
29932
- return /* @__PURE__ */ jsxs34(DropdownMenu, { children: [
29933
- /* @__PURE__ */ jsxs34(DropdownMenuTrigger, { className: `${finalClasses} inline-flex items-center gap-1`, children: [
29934
- tab.header,
29935
- /* @__PURE__ */ jsx57(ChevronDown, { className: "h-4 w-4 opacity-80" })
29936
- ] }),
29937
- /* @__PURE__ */ jsx57(
29938
- DropdownMenuContent,
29939
- {
29940
- align: "start",
29941
- sideOffset: 6,
29942
- className: "z-50 min-w-[160px] rounded-md border border-gray-200 bg-white p-1 shadow-lg",
29943
- children: tab.children.map((item, index2) => /* @__PURE__ */ jsx57(
29944
- DropdownMenuItem,
29934
+ return /* @__PURE__ */ jsxs34(
29935
+ DropdownMenu,
29936
+ {
29937
+ open: openIndex === index,
29938
+ onOpenChange: (open) => setOpenIndex(open ? index : null),
29939
+ children: [
29940
+ /* @__PURE__ */ jsxs34(
29941
+ DropdownMenuTrigger,
29942
+ {
29943
+ className: `${finalClasses} inline-flex items-center gap-1`,
29944
+ onMouseEnter: () => {
29945
+ clearTimeout(timeout);
29946
+ setOpenIndex(index);
29947
+ },
29948
+ onMouseLeave: () => {
29949
+ timeout = setTimeout(() => setOpenIndex(null), 150);
29950
+ },
29951
+ children: [
29952
+ tab.header,
29953
+ /* @__PURE__ */ jsx57(ChevronDown, { className: "h-4 w-4 opacity-80" })
29954
+ ]
29955
+ }
29956
+ ),
29957
+ /* @__PURE__ */ jsx57(
29958
+ DropdownMenuContent,
29945
29959
  {
29946
- asChild: true,
29947
- className: "cursor-pointer rounded-sm px-3 py-2 text-[12px] text-gray-800 hover:bg-gray-100 focus:bg-gray-100",
29948
- children: /* @__PURE__ */ jsx57(
29949
- Link5,
29960
+ align: "start",
29961
+ sideOffset: 6,
29962
+ className: "z-50 min-w-[200px] max-h-80 rounded-md border border-gray-200 bg-white p-1 shadow-lg",
29963
+ onMouseEnter: () => {
29964
+ clearTimeout(timeout);
29965
+ setOpenIndex(index);
29966
+ },
29967
+ onMouseLeave: () => {
29968
+ timeout = setTimeout(() => setOpenIndex(null), 150);
29969
+ },
29970
+ children: tab.children.map((item, index2) => /* @__PURE__ */ jsx57(
29971
+ DropdownMenuItem,
29950
29972
  {
29951
- href: item.url || "#",
29952
- target: item.opens_in_new_tab ? "_blank" : "_self",
29953
- onClick: (e) => handleBuilderExit(e, item.url || "#"),
29954
- children: item.header
29955
- }
29956
- )
29957
- },
29958
- item.id || index2
29959
- ))
29960
- }
29961
- )
29962
- ] }, index);
29973
+ asChild: true,
29974
+ className: "cursor-pointer rounded-sm px-3 py-2 text-[12px] text-gray-800 hover:bg-gray-100 focus:bg-gray-100",
29975
+ children: /* @__PURE__ */ jsx57(
29976
+ Link5,
29977
+ {
29978
+ href: item.url || "#",
29979
+ target: item.opens_in_new_tab ? "_blank" : "_self",
29980
+ onClick: (e) => handleBuilderExit(e, item.url || "#"),
29981
+ children: item.header
29982
+ }
29983
+ )
29984
+ },
29985
+ item.id || index2
29986
+ ))
29987
+ }
29988
+ )
29989
+ ]
29990
+ },
29991
+ index
29992
+ );
29963
29993
  }
29964
29994
  return tab.url ? /* @__PURE__ */ jsx57(
29965
29995
  Link5,
@@ -30017,7 +30047,7 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
30017
30047
  const forceMobile = canvasMode ? canvasMode === "mobile" || canvasMode === "tablet" : void 0;
30018
30048
  const forceDesktop = canvasMode ? canvasMode === "desktop" : void 0;
30019
30049
  return /* @__PURE__ */ jsxs34(Fragment21, { children: [
30020
- /* @__PURE__ */ jsxs34("div", { className, style, children: [
30050
+ /* @__PURE__ */ jsxs34("div", { className: cn("min-h-10", className), style, children: [
30021
30051
  forceDesktop !== void 0 ? forceDesktop && /* @__PURE__ */ jsx57("div", { className: "hidden md:flex", children: /* @__PURE__ */ jsx57("div", { className: `flex gap-2 ${verticalMenu ? "flex-col items-start" : "flex-row"}`, children: rawTabs.map(renderDesktopTab) }) }) : /* @__PURE__ */ jsx57("div", { className: "hidden md:flex", children: /* @__PURE__ */ jsx57("div", { className: `flex gap-2 ${verticalMenu ? "flex-col items-start" : "flex-row"}`, children: rawTabs.map(renderDesktopTab) }) }),
30022
30052
  forceMobile !== void 0 ? forceMobile && /* @__PURE__ */ jsx57("div", { children: renderMobileMenu() }) : /* @__PURE__ */ jsx57("div", { className: "flex md:hidden", children: renderMobileMenu() })
30023
30053
  ] }),