@algorithm-shift/design-system 1.2.89 → 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
@@ -27891,6 +27891,7 @@ function LazySelectDropdown({
27891
27891
  onMouseDown: (e) => e.stopPropagation(),
27892
27892
  className: "absolute z-[900] w-fit mt-1 bg-white border border-gray-300 rounded-lg shadow-lg max-h-60 overflow-y-auto",
27893
27893
  style: {
27894
+ zIndex: 900,
27894
27895
  width: dropdownRef.current?.offsetWidth,
27895
27896
  top: dropdownRef.current ? dropdownRef.current.getBoundingClientRect().bottom + window.scrollY : 0,
27896
27897
  left: dropdownRef.current ? dropdownRef.current.getBoundingClientRect().left + window.scrollX : 0
@@ -29862,6 +29863,7 @@ import Link5 from "next/link";
29862
29863
  import { useRouter } from "next/navigation";
29863
29864
  import { Fragment as Fragment21, jsx as jsx57, jsxs as jsxs34 } from "react/jsx-runtime";
29864
29865
  var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuilder = false, source, parentKey, menuNameKey, menuUrlKey, loading }) => {
29866
+ const [openIndex, setOpenIndex] = useState8(null);
29865
29867
  function groupMenus(menus = []) {
29866
29868
  const menuMap = /* @__PURE__ */ new Map();
29867
29869
  menus.forEach((menu) => {
@@ -29925,40 +29927,69 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
29925
29927
  router.push(pendingUrl);
29926
29928
  }
29927
29929
  };
29930
+ let timeout;
29928
29931
  const renderDesktopTab = (tab, index) => {
29929
29932
  const finalClasses = [baseClasses, isActive(tab.url) ? activeClasses : hoverClasses, tab.className || ""].join(" ");
29930
29933
  if (Array.isArray(tab.children) && tab.children.length > 0 && tab.isDropDown) {
29931
- return /* @__PURE__ */ jsxs34(DropdownMenu, { children: [
29932
- /* @__PURE__ */ jsxs34(DropdownMenuTrigger, { className: `${finalClasses} inline-flex items-center gap-1`, children: [
29933
- tab.header,
29934
- /* @__PURE__ */ jsx57(ChevronDown, { className: "h-4 w-4 opacity-80" })
29935
- ] }),
29936
- /* @__PURE__ */ jsx57(
29937
- DropdownMenuContent,
29938
- {
29939
- align: "start",
29940
- sideOffset: 6,
29941
- className: "z-50 min-w-[160px] rounded-md border border-gray-200 bg-white p-1 shadow-lg",
29942
- children: tab.children.map((item, index2) => /* @__PURE__ */ jsx57(
29943
- 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,
29944
29959
  {
29945
- asChild: true,
29946
- className: "cursor-pointer rounded-sm px-3 py-2 text-[12px] text-gray-800 hover:bg-gray-100 focus:bg-gray-100",
29947
- children: /* @__PURE__ */ jsx57(
29948
- 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,
29949
29972
  {
29950
- href: item.url || "#",
29951
- target: item.opens_in_new_tab ? "_blank" : "_self",
29952
- onClick: (e) => handleBuilderExit(e, item.url || "#"),
29953
- children: item.header
29954
- }
29955
- )
29956
- },
29957
- item.id || index2
29958
- ))
29959
- }
29960
- )
29961
- ] }, 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
+ );
29962
29993
  }
29963
29994
  return tab.url ? /* @__PURE__ */ jsx57(
29964
29995
  Link5,
@@ -30016,7 +30047,7 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
30016
30047
  const forceMobile = canvasMode ? canvasMode === "mobile" || canvasMode === "tablet" : void 0;
30017
30048
  const forceDesktop = canvasMode ? canvasMode === "desktop" : void 0;
30018
30049
  return /* @__PURE__ */ jsxs34(Fragment21, { children: [
30019
- /* @__PURE__ */ jsxs34("div", { className, style, children: [
30050
+ /* @__PURE__ */ jsxs34("div", { className: cn("min-h-10", className), style, children: [
30020
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) }) }),
30021
30052
  forceMobile !== void 0 ? forceMobile && /* @__PURE__ */ jsx57("div", { children: renderMobileMenu() }) : /* @__PURE__ */ jsx57("div", { className: "flex md:hidden", children: renderMobileMenu() })
30022
30053
  ] }),