@algorithm-shift/design-system 1.2.961 → 1.2.962

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,23 @@ 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 activeClasses = `${bgActiveColor ?? "bg-white/10"} ${textActiveColor ?? "text-white"}`;
30093
+ const hoverClasses = `${bgActiveColor ? bgActiveColor.replace("bg-", "hover:bg-") : "hover:bg-white/5"} ${textActiveColor ? textActiveColor.replace("text-", "hover:text-") : "hover:text-white"}`;
30057
30094
  const isActive = (path) => {
30058
30095
  if (!path) return false;
30059
- return pathname === path || path !== "/" && pathname?.startsWith(path);
30096
+ const clean = (p) => p.replace(/\/+$/, "");
30097
+ const current = clean(pathname || "");
30098
+ const target = clean(path);
30099
+ if (!current || !target) return false;
30100
+ if (current === target) return true;
30101
+ if (current.startsWith(target) || target.startsWith(current)) return true;
30102
+ const currentLast = current.split("/").pop();
30103
+ const targetLast = target.split("/").pop();
30104
+ return !!currentLast && !!targetLast && currentLast === targetLast;
30105
+ };
30106
+ const isParentActive = (tab) => {
30107
+ if (!Array.isArray(tab.children)) return false;
30108
+ return tab.children.some((child) => isActive(child.url));
30060
30109
  };
30061
30110
  const router = useRouter();
30062
30111
  const [showExitDialog, setShowExitDialog] = useState8(false);
@@ -30066,7 +30115,11 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
30066
30115
  if (isBuilder) {
30067
30116
  e.preventDefault();
30068
30117
  setPendingUrl(url);
30069
- setShowExitDialog(true);
30118
+ showSonnerToast({
30119
+ variant: "success",
30120
+ title: "Navigation Alert",
30121
+ description: `You will be redirected to ${url} in the built application.`
30122
+ });
30070
30123
  }
30071
30124
  },
30072
30125
  [isBuilder]
@@ -30079,7 +30132,8 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
30079
30132
  };
30080
30133
  let timeout;
30081
30134
  const renderDesktopTab = (tab, index) => {
30082
- const finalClasses = [baseClasses, isActive(tab.url) ? activeClasses : hoverClasses, tab.className || ""].join(" ");
30135
+ const active = isActive(tab.url) || isParentActive(tab);
30136
+ const finalClasses = [baseClasses, active ? activeClasses : hoverClasses, tab.className || ""].join(" ");
30083
30137
  if (Array.isArray(tab.children) && tab.children.length > 0 && tab.isDropDown) {
30084
30138
  return /* @__PURE__ */ jsxs33(
30085
30139
  DropdownMenu,
@@ -30769,43 +30823,6 @@ function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc
30769
30823
  ] }) });
30770
30824
  }
30771
30825
 
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
30826
  // src/components/ui/sonner.tsx
30810
30827
  import { useTheme } from "next-themes";
30811
30828
  import { Toaster as Sonner } from "sonner";