@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.js
CHANGED
|
@@ -30140,6 +30140,7 @@ function showSonnerToast({
|
|
|
30140
30140
|
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
30141
30141
|
var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuilder = false, source, parentKey, menuNameKey, menuUrlKey, loading, bgActiveColor, textActiveColor }) => {
|
|
30142
30142
|
const [openIndex, setOpenIndex] = (0, import_react31.useState)(null);
|
|
30143
|
+
const currentPathname = (0, import_navigation3.usePathname)();
|
|
30143
30144
|
function groupMenus(menus = []) {
|
|
30144
30145
|
const menuMap = /* @__PURE__ */ new Map();
|
|
30145
30146
|
menus.forEach((menu) => {
|
|
@@ -30178,12 +30179,17 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
30178
30179
|
return groupMenus(tabs);
|
|
30179
30180
|
}, [tabs, source, parentKey, menuNameKey, menuUrlKey]);
|
|
30180
30181
|
const baseClasses = "text-foreground p-2 text-center rounded-md transition-colors";
|
|
30181
|
-
const
|
|
30182
|
-
const
|
|
30182
|
+
const bgActiveColorFinal = bgActiveColor ? `bg-[${bgActiveColor}]` : "bg-white/10";
|
|
30183
|
+
const textActiveColorFinal = textActiveColor ? `text-[${textActiveColor}]` : "text-white";
|
|
30184
|
+
const activeClasses = `${bgActiveColorFinal} ${textActiveColorFinal}`;
|
|
30185
|
+
const hoverClasses = `${bgActiveColorFinal ? bgActiveColorFinal.replace("bg-", "hover:bg-") : "hover:bg-white/5"} ${textActiveColorFinal ? textActiveColorFinal.replace("text-", "hover:text-") : "hover:text-white"}`;
|
|
30183
30186
|
const isActive = (path) => {
|
|
30184
30187
|
if (!path) return false;
|
|
30185
|
-
const clean = (p) =>
|
|
30186
|
-
|
|
30188
|
+
const clean = (p) => {
|
|
30189
|
+
while (p.endsWith("/")) p = p.slice(0, -1);
|
|
30190
|
+
return p;
|
|
30191
|
+
};
|
|
30192
|
+
const current = clean(pathname ?? currentPathname ?? "");
|
|
30187
30193
|
const target = clean(path);
|
|
30188
30194
|
if (!current || !target) return false;
|
|
30189
30195
|
if (current === target) return true;
|
|
@@ -30223,6 +30229,12 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
30223
30229
|
const renderDesktopTab = (tab, index) => {
|
|
30224
30230
|
const active = isActive(tab.url) || isParentActive(tab);
|
|
30225
30231
|
const finalClasses = [baseClasses, active ? activeClasses : hoverClasses, tab.className || ""].join(" ");
|
|
30232
|
+
const finalStyle = {
|
|
30233
|
+
...tab.style,
|
|
30234
|
+
backgroundColor: active && bgActiveColor ? bgActiveColor : void 0,
|
|
30235
|
+
color: active && textActiveColor ? textActiveColor : void 0,
|
|
30236
|
+
border: active && textActiveColor ? `1px solid ${textActiveColor}` : void 0
|
|
30237
|
+
};
|
|
30226
30238
|
if (Array.isArray(tab.children) && tab.children.length > 0 && tab.isDropDown) {
|
|
30227
30239
|
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
30228
30240
|
DropdownMenu,
|
|
@@ -30241,6 +30253,7 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
30241
30253
|
onMouseLeave: () => {
|
|
30242
30254
|
timeout = setTimeout(() => setOpenIndex(null), 150);
|
|
30243
30255
|
},
|
|
30256
|
+
style: finalStyle,
|
|
30244
30257
|
children: [
|
|
30245
30258
|
tab.header,
|
|
30246
30259
|
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(ChevronDown, { className: "h-4 w-4 opacity-80" })
|
|
@@ -30290,12 +30303,12 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
30290
30303
|
href: tab.url,
|
|
30291
30304
|
target: tab.opens_in_new_tab ? "_blank" : "_self",
|
|
30292
30305
|
className: finalClasses,
|
|
30293
|
-
style:
|
|
30306
|
+
style: finalStyle,
|
|
30294
30307
|
onClick: (e) => handleBuilderExit(e, tab.url || "#"),
|
|
30295
30308
|
children: tab.header
|
|
30296
30309
|
},
|
|
30297
30310
|
index
|
|
30298
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: finalClasses, style:
|
|
30311
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: finalClasses, style: finalStyle, role: "button", tabIndex: 0, children: tab.header }, index);
|
|
30299
30312
|
};
|
|
30300
30313
|
const renderMobileMenu = () => /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(DropdownMenu, { children: [
|
|
30301
30314
|
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(DropdownMenuTrigger, { className: "flex items-center gap-2 px-3 py-2 rounded-md bg-white/10 text-white text-sm", children: [
|