@algorithm-shift/design-system 1.2.962 → 1.2.964
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 +19 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -29894,7 +29894,7 @@ var Pagination_default = CustomPagination;
|
|
|
29894
29894
|
// src/components/Navigation/Tabs/Tabs.tsx
|
|
29895
29895
|
import { useCallback as useCallback3, useMemo as useMemo6, useState as useState8 } from "react";
|
|
29896
29896
|
import Link5 from "next/link";
|
|
29897
|
-
import { useRouter } from "next/navigation";
|
|
29897
|
+
import { usePathname, useRouter } from "next/navigation";
|
|
29898
29898
|
|
|
29899
29899
|
// src/components/ui/dialog.tsx
|
|
29900
29900
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
@@ -30051,6 +30051,7 @@ function showSonnerToast({
|
|
|
30051
30051
|
import { Fragment as Fragment22, jsx as jsx56, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
30052
30052
|
var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuilder = false, source, parentKey, menuNameKey, menuUrlKey, loading, bgActiveColor, textActiveColor }) => {
|
|
30053
30053
|
const [openIndex, setOpenIndex] = useState8(null);
|
|
30054
|
+
const currentPathname = usePathname();
|
|
30054
30055
|
function groupMenus(menus = []) {
|
|
30055
30056
|
const menuMap = /* @__PURE__ */ new Map();
|
|
30056
30057
|
menus.forEach((menu) => {
|
|
@@ -30089,12 +30090,17 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
30089
30090
|
return groupMenus(tabs);
|
|
30090
30091
|
}, [tabs, source, parentKey, menuNameKey, menuUrlKey]);
|
|
30091
30092
|
const baseClasses = "text-foreground p-2 text-center rounded-md transition-colors";
|
|
30092
|
-
const
|
|
30093
|
-
const
|
|
30093
|
+
const bgActiveColorFinal = bgActiveColor ? `bg-[${bgActiveColor}]` : "bg-white/10";
|
|
30094
|
+
const textActiveColorFinal = textActiveColor ? `text-[${textActiveColor}]` : "text-white";
|
|
30095
|
+
const activeClasses = `${bgActiveColorFinal} ${textActiveColorFinal}`;
|
|
30096
|
+
const hoverClasses = `${bgActiveColorFinal ? bgActiveColorFinal.replace("bg-", "hover:bg-") : "hover:bg-white/5"} ${textActiveColorFinal ? textActiveColorFinal.replace("text-", "hover:text-") : "hover:text-white"}`;
|
|
30094
30097
|
const isActive = (path) => {
|
|
30095
30098
|
if (!path) return false;
|
|
30096
|
-
const clean = (p) =>
|
|
30097
|
-
|
|
30099
|
+
const clean = (p) => {
|
|
30100
|
+
while (p.endsWith("/")) p = p.slice(0, -1);
|
|
30101
|
+
return p;
|
|
30102
|
+
};
|
|
30103
|
+
const current = clean(pathname ?? currentPathname ?? "");
|
|
30098
30104
|
const target = clean(path);
|
|
30099
30105
|
if (!current || !target) return false;
|
|
30100
30106
|
if (current === target) return true;
|
|
@@ -30134,6 +30140,12 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
30134
30140
|
const renderDesktopTab = (tab, index) => {
|
|
30135
30141
|
const active = isActive(tab.url) || isParentActive(tab);
|
|
30136
30142
|
const finalClasses = [baseClasses, active ? activeClasses : hoverClasses, tab.className || ""].join(" ");
|
|
30143
|
+
const finalStyle = {
|
|
30144
|
+
...tab.style,
|
|
30145
|
+
backgroundColor: active && bgActiveColor ? bgActiveColor : void 0,
|
|
30146
|
+
color: active && textActiveColor ? textActiveColor : void 0,
|
|
30147
|
+
border: active && textActiveColor ? `1px solid ${textActiveColor}` : void 0
|
|
30148
|
+
};
|
|
30137
30149
|
if (Array.isArray(tab.children) && tab.children.length > 0 && tab.isDropDown) {
|
|
30138
30150
|
return /* @__PURE__ */ jsxs33(
|
|
30139
30151
|
DropdownMenu,
|
|
@@ -30152,6 +30164,7 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
30152
30164
|
onMouseLeave: () => {
|
|
30153
30165
|
timeout = setTimeout(() => setOpenIndex(null), 150);
|
|
30154
30166
|
},
|
|
30167
|
+
style: finalStyle,
|
|
30155
30168
|
children: [
|
|
30156
30169
|
tab.header,
|
|
30157
30170
|
/* @__PURE__ */ jsx56(ChevronDown, { className: "h-4 w-4 opacity-80" })
|
|
@@ -30201,12 +30214,12 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
30201
30214
|
href: tab.url,
|
|
30202
30215
|
target: tab.opens_in_new_tab ? "_blank" : "_self",
|
|
30203
30216
|
className: finalClasses,
|
|
30204
|
-
style:
|
|
30217
|
+
style: finalStyle,
|
|
30205
30218
|
onClick: (e) => handleBuilderExit(e, tab.url || "#"),
|
|
30206
30219
|
children: tab.header
|
|
30207
30220
|
},
|
|
30208
30221
|
index
|
|
30209
|
-
) : /* @__PURE__ */ jsx56("div", { className: finalClasses, style:
|
|
30222
|
+
) : /* @__PURE__ */ jsx56("div", { className: finalClasses, style: finalStyle, role: "button", tabIndex: 0, children: tab.header }, index);
|
|
30210
30223
|
};
|
|
30211
30224
|
const renderMobileMenu = () => /* @__PURE__ */ jsxs33(DropdownMenu, { children: [
|
|
30212
30225
|
/* @__PURE__ */ jsxs33(DropdownMenuTrigger, { className: "flex items-center gap-2 px-3 py-2 rounded-md bg-white/10 text-white text-sm", children: [
|