@algorithm-shift/design-system 1.2.961 → 1.2.963

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
@@ -29347,7 +29347,7 @@ function DataTable({
29347
29347
  return /* @__PURE__ */ jsxs29("div", { className: "overflow-hidden rounded-md w-full", children: [
29348
29348
  !loading && /* @__PURE__ */ jsxs29("div", { className: "flex justify-between p-2 bg-gray-50", children: [
29349
29349
  /* @__PURE__ */ jsxs29("div", { className: "flex items-center gap-4 w-full", children: [
29350
- totalRecords && /* @__PURE__ */ jsxs29("p", { className: "text-sm font-medium", children: [
29350
+ !!totalRecords && /* @__PURE__ */ jsxs29("p", { className: "text-sm font-medium", children: [
29351
29351
  "Total Records : ",
29352
29352
  totalRecords.toLocaleString("en-IN") || 0
29353
29353
  ] }),
@@ -30010,9 +30010,46 @@ function DialogDescription({
30010
30010
  );
30011
30011
  }
30012
30012
 
30013
+ // src/components/ui/sonner-toast.tsx
30014
+ import { toast } from "sonner";
30015
+ function showSonnerToast({
30016
+ title,
30017
+ description,
30018
+ variant = "default",
30019
+ duration = 3e3,
30020
+ actionLabel,
30021
+ onAction
30022
+ }) {
30023
+ const options = {
30024
+ description,
30025
+ duration,
30026
+ action: actionLabel ? {
30027
+ label: actionLabel,
30028
+ onClick: onAction || (() => {
30029
+ })
30030
+ } : void 0
30031
+ };
30032
+ switch (variant) {
30033
+ case "success":
30034
+ toast.success(title, options);
30035
+ break;
30036
+ case "error":
30037
+ toast.error(title, options);
30038
+ break;
30039
+ case "info":
30040
+ toast.info(title, options);
30041
+ break;
30042
+ case "warning":
30043
+ toast.warning(title, options);
30044
+ break;
30045
+ default:
30046
+ toast(title, options);
30047
+ }
30048
+ }
30049
+
30013
30050
  // src/components/Navigation/Tabs/Tabs.tsx
30014
30051
  import { Fragment as Fragment22, jsx as jsx56, jsxs as jsxs33 } from "react/jsx-runtime";
30015
- var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuilder = false, source, parentKey, menuNameKey, menuUrlKey, loading }) => {
30052
+ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuilder = false, source, parentKey, menuNameKey, menuUrlKey, loading, bgActiveColor, textActiveColor }) => {
30016
30053
  const [openIndex, setOpenIndex] = useState8(null);
30017
30054
  function groupMenus(menus = []) {
30018
30055
  const menuMap = /* @__PURE__ */ new Map();
@@ -30052,11 +30089,28 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
30052
30089
  return groupMenus(tabs);
30053
30090
  }, [tabs, source, parentKey, menuNameKey, menuUrlKey]);
30054
30091
  const baseClasses = "text-foreground p-2 text-center rounded-md transition-colors";
30055
- const activeClasses = "bg-white/10 text-white";
30056
- const hoverClasses = "hover:bg-white/5";
30092
+ const bgActiveColorFinal = bgActiveColor ? `bg-[${bgActiveColor}]` : "bg-white/10";
30093
+ const textActiveColorFinal = textActiveColor ? `text-[${textActiveColor}]` : "text-white";
30094
+ const activeClasses = `${bgActiveColorFinal} ${textActiveColorFinal}`;
30095
+ const hoverClasses = `${bgActiveColorFinal ? bgActiveColorFinal.replace("bg-", "hover:bg-") : "hover:bg-white/5"} ${textActiveColorFinal ? textActiveColorFinal.replace("text-", "hover:text-") : "hover:text-white"}`;
30057
30096
  const isActive = (path) => {
30058
30097
  if (!path) return false;
30059
- return pathname === path || path !== "/" && pathname?.startsWith(path);
30098
+ const clean = (p) => {
30099
+ while (p.endsWith("/")) p = p.slice(0, -1);
30100
+ return p;
30101
+ };
30102
+ const current = clean(pathname || "");
30103
+ const target = clean(path);
30104
+ if (!current || !target) return false;
30105
+ if (current === target) return true;
30106
+ if (current.startsWith(target) || target.startsWith(current)) return true;
30107
+ const currentLast = current.split("/").pop();
30108
+ const targetLast = target.split("/").pop();
30109
+ return !!currentLast && !!targetLast && currentLast === targetLast;
30110
+ };
30111
+ const isParentActive = (tab) => {
30112
+ if (!Array.isArray(tab.children)) return false;
30113
+ return tab.children.some((child) => isActive(child.url));
30060
30114
  };
30061
30115
  const router = useRouter();
30062
30116
  const [showExitDialog, setShowExitDialog] = useState8(false);
@@ -30066,7 +30120,11 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
30066
30120
  if (isBuilder) {
30067
30121
  e.preventDefault();
30068
30122
  setPendingUrl(url);
30069
- setShowExitDialog(true);
30123
+ showSonnerToast({
30124
+ variant: "success",
30125
+ title: "Navigation Alert",
30126
+ description: `You will be redirected to ${url} in the built application.`
30127
+ });
30070
30128
  }
30071
30129
  },
30072
30130
  [isBuilder]
@@ -30079,7 +30137,13 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
30079
30137
  };
30080
30138
  let timeout;
30081
30139
  const renderDesktopTab = (tab, index) => {
30082
- const finalClasses = [baseClasses, isActive(tab.url) ? activeClasses : hoverClasses, tab.className || ""].join(" ");
30140
+ const active = isActive(tab.url) || isParentActive(tab);
30141
+ const finalClasses = [baseClasses, active ? activeClasses : hoverClasses, tab.className || ""].join(" ");
30142
+ const finalStyle = {
30143
+ ...tab.style,
30144
+ backgroundColor: active && bgActiveColor ? bgActiveColor : void 0,
30145
+ color: active && textActiveColor ? textActiveColor : void 0
30146
+ };
30083
30147
  if (Array.isArray(tab.children) && tab.children.length > 0 && tab.isDropDown) {
30084
30148
  return /* @__PURE__ */ jsxs33(
30085
30149
  DropdownMenu,
@@ -30098,6 +30162,7 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
30098
30162
  onMouseLeave: () => {
30099
30163
  timeout = setTimeout(() => setOpenIndex(null), 150);
30100
30164
  },
30165
+ style: finalStyle,
30101
30166
  children: [
30102
30167
  tab.header,
30103
30168
  /* @__PURE__ */ jsx56(ChevronDown, { className: "h-4 w-4 opacity-80" })
@@ -30147,12 +30212,12 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
30147
30212
  href: tab.url,
30148
30213
  target: tab.opens_in_new_tab ? "_blank" : "_self",
30149
30214
  className: finalClasses,
30150
- style: tab.style,
30215
+ style: finalStyle,
30151
30216
  onClick: (e) => handleBuilderExit(e, tab.url || "#"),
30152
30217
  children: tab.header
30153
30218
  },
30154
30219
  index
30155
- ) : /* @__PURE__ */ jsx56("div", { className: finalClasses, style: tab.style, role: "button", tabIndex: 0, children: tab.header }, index);
30220
+ ) : /* @__PURE__ */ jsx56("div", { className: finalClasses, style: finalStyle, role: "button", tabIndex: 0, children: tab.header }, index);
30156
30221
  };
30157
30222
  const renderMobileMenu = () => /* @__PURE__ */ jsxs33(DropdownMenu, { children: [
30158
30223
  /* @__PURE__ */ jsxs33(DropdownMenuTrigger, { className: "flex items-center gap-2 px-3 py-2 rounded-md bg-white/10 text-white text-sm", children: [
@@ -30769,43 +30834,6 @@ function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc
30769
30834
  ] }) });
30770
30835
  }
30771
30836
 
30772
- // src/components/ui/sonner-toast.tsx
30773
- import { toast } from "sonner";
30774
- function showSonnerToast({
30775
- title,
30776
- description,
30777
- variant = "default",
30778
- duration = 3e3,
30779
- actionLabel,
30780
- onAction
30781
- }) {
30782
- const options = {
30783
- description,
30784
- duration,
30785
- action: actionLabel ? {
30786
- label: actionLabel,
30787
- onClick: onAction || (() => {
30788
- })
30789
- } : void 0
30790
- };
30791
- switch (variant) {
30792
- case "success":
30793
- toast.success(title, options);
30794
- break;
30795
- case "error":
30796
- toast.error(title, options);
30797
- break;
30798
- case "info":
30799
- toast.info(title, options);
30800
- break;
30801
- case "warning":
30802
- toast.warning(title, options);
30803
- break;
30804
- default:
30805
- toast(title, options);
30806
- }
30807
- }
30808
-
30809
30837
  // src/components/ui/sonner.tsx
30810
30838
  import { useTheme } from "next-themes";
30811
30839
  import { Toaster as Sonner } from "sonner";