@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.js CHANGED
@@ -27988,6 +27988,7 @@ function LazySelectDropdown({
27988
27988
  onMouseDown: (e) => e.stopPropagation(),
27989
27989
  className: "absolute z-[900] w-fit mt-1 bg-white border border-gray-300 rounded-lg shadow-lg max-h-60 overflow-y-auto",
27990
27990
  style: {
27991
+ zIndex: 900,
27991
27992
  width: dropdownRef.current?.offsetWidth,
27992
27993
  top: dropdownRef.current ? dropdownRef.current.getBoundingClientRect().bottom + window.scrollY : 0,
27993
27994
  left: dropdownRef.current ? dropdownRef.current.getBoundingClientRect().left + window.scrollX : 0
@@ -29953,6 +29954,7 @@ var import_link5 = __toESM(require("next/link"));
29953
29954
  var import_navigation3 = require("next/navigation");
29954
29955
  var import_jsx_runtime57 = require("react/jsx-runtime");
29955
29956
  var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuilder = false, source, parentKey, menuNameKey, menuUrlKey, loading }) => {
29957
+ const [openIndex, setOpenIndex] = (0, import_react29.useState)(null);
29956
29958
  function groupMenus(menus = []) {
29957
29959
  const menuMap = /* @__PURE__ */ new Map();
29958
29960
  menus.forEach((menu) => {
@@ -30016,40 +30018,69 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
30016
30018
  router.push(pendingUrl);
30017
30019
  }
30018
30020
  };
30021
+ let timeout;
30019
30022
  const renderDesktopTab = (tab, index) => {
30020
30023
  const finalClasses = [baseClasses, isActive(tab.url) ? activeClasses : hoverClasses, tab.className || ""].join(" ");
30021
30024
  if (Array.isArray(tab.children) && tab.children.length > 0 && tab.isDropDown) {
30022
- return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(DropdownMenu, { children: [
30023
- /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(DropdownMenuTrigger, { className: `${finalClasses} inline-flex items-center gap-1`, children: [
30024
- tab.header,
30025
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(ChevronDown, { className: "h-4 w-4 opacity-80" })
30026
- ] }),
30027
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
30028
- DropdownMenuContent,
30029
- {
30030
- align: "start",
30031
- sideOffset: 6,
30032
- className: "z-50 min-w-[160px] rounded-md border border-gray-200 bg-white p-1 shadow-lg",
30033
- children: tab.children.map((item, index2) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
30034
- DropdownMenuItem,
30025
+ return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
30026
+ DropdownMenu,
30027
+ {
30028
+ open: openIndex === index,
30029
+ onOpenChange: (open) => setOpenIndex(open ? index : null),
30030
+ children: [
30031
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
30032
+ DropdownMenuTrigger,
30033
+ {
30034
+ className: `${finalClasses} inline-flex items-center gap-1`,
30035
+ onMouseEnter: () => {
30036
+ clearTimeout(timeout);
30037
+ setOpenIndex(index);
30038
+ },
30039
+ onMouseLeave: () => {
30040
+ timeout = setTimeout(() => setOpenIndex(null), 150);
30041
+ },
30042
+ children: [
30043
+ tab.header,
30044
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(ChevronDown, { className: "h-4 w-4 opacity-80" })
30045
+ ]
30046
+ }
30047
+ ),
30048
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
30049
+ DropdownMenuContent,
30035
30050
  {
30036
- asChild: true,
30037
- className: "cursor-pointer rounded-sm px-3 py-2 text-[12px] text-gray-800 hover:bg-gray-100 focus:bg-gray-100",
30038
- children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
30039
- import_link5.default,
30051
+ align: "start",
30052
+ sideOffset: 6,
30053
+ className: "z-50 min-w-[200px] max-h-80 rounded-md border border-gray-200 bg-white p-1 shadow-lg",
30054
+ onMouseEnter: () => {
30055
+ clearTimeout(timeout);
30056
+ setOpenIndex(index);
30057
+ },
30058
+ onMouseLeave: () => {
30059
+ timeout = setTimeout(() => setOpenIndex(null), 150);
30060
+ },
30061
+ children: tab.children.map((item, index2) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
30062
+ DropdownMenuItem,
30040
30063
  {
30041
- href: item.url || "#",
30042
- target: item.opens_in_new_tab ? "_blank" : "_self",
30043
- onClick: (e) => handleBuilderExit(e, item.url || "#"),
30044
- children: item.header
30045
- }
30046
- )
30047
- },
30048
- item.id || index2
30049
- ))
30050
- }
30051
- )
30052
- ] }, index);
30064
+ asChild: true,
30065
+ className: "cursor-pointer rounded-sm px-3 py-2 text-[12px] text-gray-800 hover:bg-gray-100 focus:bg-gray-100",
30066
+ children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
30067
+ import_link5.default,
30068
+ {
30069
+ href: item.url || "#",
30070
+ target: item.opens_in_new_tab ? "_blank" : "_self",
30071
+ onClick: (e) => handleBuilderExit(e, item.url || "#"),
30072
+ children: item.header
30073
+ }
30074
+ )
30075
+ },
30076
+ item.id || index2
30077
+ ))
30078
+ }
30079
+ )
30080
+ ]
30081
+ },
30082
+ index
30083
+ );
30053
30084
  }
30054
30085
  return tab.url ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
30055
30086
  import_link5.default,
@@ -30107,7 +30138,7 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
30107
30138
  const forceMobile = canvasMode ? canvasMode === "mobile" || canvasMode === "tablet" : void 0;
30108
30139
  const forceDesktop = canvasMode ? canvasMode === "desktop" : void 0;
30109
30140
  return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
30110
- /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className, style, children: [
30141
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: cn("min-h-10", className), style, children: [
30111
30142
  forceDesktop !== void 0 ? forceDesktop && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "hidden md:flex", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: `flex gap-2 ${verticalMenu ? "flex-col items-start" : "flex-row"}`, children: rawTabs.map(renderDesktopTab) }) }) : /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "hidden md:flex", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: `flex gap-2 ${verticalMenu ? "flex-col items-start" : "flex-row"}`, children: rawTabs.map(renderDesktopTab) }) }),
30112
30143
  forceMobile !== void 0 ? forceMobile && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { children: renderMobileMenu() }) : /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "flex md:hidden", children: renderMobileMenu() })
30113
30144
  ] }),