@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.d.mts CHANGED
@@ -137,6 +137,8 @@ interface TabsProps extends ElementProps {
137
137
  menuNameKey?: string;
138
138
  menuUrlKey?: string;
139
139
  loading?: boolean;
140
+ bgActiveColor?: string;
141
+ textActiveColor?: string;
140
142
  }
141
143
 
142
144
  interface StagesProps extends ElementProps {
@@ -382,7 +384,7 @@ declare const Table: ({ columns, data, rowActions, className, style, pagination,
382
384
 
383
385
  declare const CustomPagination: ({ totalPages, currentPage, onPageChange, maxVisiblePages, perPage, }: CustomPaginationProps) => react_jsx_runtime.JSX.Element;
384
386
 
385
- declare const Tabs: ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuilder, source, parentKey, menuNameKey, menuUrlKey, loading }: TabsProps) => react_jsx_runtime.JSX.Element;
387
+ declare const Tabs: ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuilder, source, parentKey, menuNameKey, menuUrlKey, loading, bgActiveColor, textActiveColor }: TabsProps) => react_jsx_runtime.JSX.Element;
386
388
 
387
389
  declare const StagesComponent: ({ stages, isShowBtn, buttonText, className, style, onStageChange, currentStage, dataKey, dataLabel, loading }: StagesProps) => react_jsx_runtime.JSX.Element;
388
390
 
package/dist/index.d.ts CHANGED
@@ -137,6 +137,8 @@ interface TabsProps extends ElementProps {
137
137
  menuNameKey?: string;
138
138
  menuUrlKey?: string;
139
139
  loading?: boolean;
140
+ bgActiveColor?: string;
141
+ textActiveColor?: string;
140
142
  }
141
143
 
142
144
  interface StagesProps extends ElementProps {
@@ -382,7 +384,7 @@ declare const Table: ({ columns, data, rowActions, className, style, pagination,
382
384
 
383
385
  declare const CustomPagination: ({ totalPages, currentPage, onPageChange, maxVisiblePages, perPage, }: CustomPaginationProps) => react_jsx_runtime.JSX.Element;
384
386
 
385
- declare const Tabs: ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuilder, source, parentKey, menuNameKey, menuUrlKey, loading }: TabsProps) => react_jsx_runtime.JSX.Element;
387
+ declare const Tabs: ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuilder, source, parentKey, menuNameKey, menuUrlKey, loading, bgActiveColor, textActiveColor }: TabsProps) => react_jsx_runtime.JSX.Element;
386
388
 
387
389
  declare const StagesComponent: ({ stages, isShowBtn, buttonText, className, style, onStageChange, currentStage, dataKey, dataLabel, loading }: StagesProps) => react_jsx_runtime.JSX.Element;
388
390
 
package/dist/index.js CHANGED
@@ -29436,7 +29436,7 @@ function DataTable({
29436
29436
  return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "overflow-hidden rounded-md w-full", children: [
29437
29437
  !loading && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex justify-between p-2 bg-gray-50", children: [
29438
29438
  /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex items-center gap-4 w-full", children: [
29439
- totalRecords && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("p", { className: "text-sm font-medium", children: [
29439
+ !!totalRecords && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("p", { className: "text-sm font-medium", children: [
29440
29440
  "Total Records : ",
29441
29441
  totalRecords.toLocaleString("en-IN") || 0
29442
29442
  ] }),
@@ -30099,9 +30099,46 @@ function DialogDescription({
30099
30099
  );
30100
30100
  }
30101
30101
 
30102
+ // src/components/ui/sonner-toast.tsx
30103
+ var import_sonner = require("sonner");
30104
+ function showSonnerToast({
30105
+ title,
30106
+ description,
30107
+ variant = "default",
30108
+ duration = 3e3,
30109
+ actionLabel,
30110
+ onAction
30111
+ }) {
30112
+ const options = {
30113
+ description,
30114
+ duration,
30115
+ action: actionLabel ? {
30116
+ label: actionLabel,
30117
+ onClick: onAction || (() => {
30118
+ })
30119
+ } : void 0
30120
+ };
30121
+ switch (variant) {
30122
+ case "success":
30123
+ import_sonner.toast.success(title, options);
30124
+ break;
30125
+ case "error":
30126
+ import_sonner.toast.error(title, options);
30127
+ break;
30128
+ case "info":
30129
+ import_sonner.toast.info(title, options);
30130
+ break;
30131
+ case "warning":
30132
+ import_sonner.toast.warning(title, options);
30133
+ break;
30134
+ default:
30135
+ (0, import_sonner.toast)(title, options);
30136
+ }
30137
+ }
30138
+
30102
30139
  // src/components/Navigation/Tabs/Tabs.tsx
30103
30140
  var import_jsx_runtime56 = require("react/jsx-runtime");
30104
- var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuilder = false, source, parentKey, menuNameKey, menuUrlKey, loading }) => {
30141
+ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuilder = false, source, parentKey, menuNameKey, menuUrlKey, loading, bgActiveColor, textActiveColor }) => {
30105
30142
  const [openIndex, setOpenIndex] = (0, import_react31.useState)(null);
30106
30143
  function groupMenus(menus = []) {
30107
30144
  const menuMap = /* @__PURE__ */ new Map();
@@ -30141,11 +30178,23 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
30141
30178
  return groupMenus(tabs);
30142
30179
  }, [tabs, source, parentKey, menuNameKey, menuUrlKey]);
30143
30180
  const baseClasses = "text-foreground p-2 text-center rounded-md transition-colors";
30144
- const activeClasses = "bg-white/10 text-white";
30145
- const hoverClasses = "hover:bg-white/5";
30181
+ const activeClasses = `${bgActiveColor ?? "bg-white/10"} ${textActiveColor ?? "text-white"}`;
30182
+ const hoverClasses = `${bgActiveColor ? bgActiveColor.replace("bg-", "hover:bg-") : "hover:bg-white/5"} ${textActiveColor ? textActiveColor.replace("text-", "hover:text-") : "hover:text-white"}`;
30146
30183
  const isActive = (path) => {
30147
30184
  if (!path) return false;
30148
- return pathname === path || path !== "/" && pathname?.startsWith(path);
30185
+ const clean = (p) => p.replace(/\/+$/, "");
30186
+ const current = clean(pathname || "");
30187
+ const target = clean(path);
30188
+ if (!current || !target) return false;
30189
+ if (current === target) return true;
30190
+ if (current.startsWith(target) || target.startsWith(current)) return true;
30191
+ const currentLast = current.split("/").pop();
30192
+ const targetLast = target.split("/").pop();
30193
+ return !!currentLast && !!targetLast && currentLast === targetLast;
30194
+ };
30195
+ const isParentActive = (tab) => {
30196
+ if (!Array.isArray(tab.children)) return false;
30197
+ return tab.children.some((child) => isActive(child.url));
30149
30198
  };
30150
30199
  const router = (0, import_navigation3.useRouter)();
30151
30200
  const [showExitDialog, setShowExitDialog] = (0, import_react31.useState)(false);
@@ -30155,7 +30204,11 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
30155
30204
  if (isBuilder) {
30156
30205
  e.preventDefault();
30157
30206
  setPendingUrl(url);
30158
- setShowExitDialog(true);
30207
+ showSonnerToast({
30208
+ variant: "success",
30209
+ title: "Navigation Alert",
30210
+ description: `You will be redirected to ${url} in the built application.`
30211
+ });
30159
30212
  }
30160
30213
  },
30161
30214
  [isBuilder]
@@ -30168,7 +30221,8 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
30168
30221
  };
30169
30222
  let timeout;
30170
30223
  const renderDesktopTab = (tab, index) => {
30171
- const finalClasses = [baseClasses, isActive(tab.url) ? activeClasses : hoverClasses, tab.className || ""].join(" ");
30224
+ const active = isActive(tab.url) || isParentActive(tab);
30225
+ const finalClasses = [baseClasses, active ? activeClasses : hoverClasses, tab.className || ""].join(" ");
30172
30226
  if (Array.isArray(tab.children) && tab.children.length > 0 && tab.isDropDown) {
30173
30227
  return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
30174
30228
  DropdownMenu,
@@ -30840,43 +30894,6 @@ function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc
30840
30894
  ] }) });
30841
30895
  }
30842
30896
 
30843
- // src/components/ui/sonner-toast.tsx
30844
- var import_sonner = require("sonner");
30845
- function showSonnerToast({
30846
- title,
30847
- description,
30848
- variant = "default",
30849
- duration = 3e3,
30850
- actionLabel,
30851
- onAction
30852
- }) {
30853
- const options = {
30854
- description,
30855
- duration,
30856
- action: actionLabel ? {
30857
- label: actionLabel,
30858
- onClick: onAction || (() => {
30859
- })
30860
- } : void 0
30861
- };
30862
- switch (variant) {
30863
- case "success":
30864
- import_sonner.toast.success(title, options);
30865
- break;
30866
- case "error":
30867
- import_sonner.toast.error(title, options);
30868
- break;
30869
- case "info":
30870
- import_sonner.toast.info(title, options);
30871
- break;
30872
- case "warning":
30873
- import_sonner.toast.warning(title, options);
30874
- break;
30875
- default:
30876
- (0, import_sonner.toast)(title, options);
30877
- }
30878
- }
30879
-
30880
30897
  // src/components/ui/sonner.tsx
30881
30898
  var import_next_themes = require("next-themes");
30882
30899
  var import_sonner2 = require("sonner");