@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.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,28 @@ 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 bgActiveColorFinal = bgActiveColor ? `bg-[${bgActiveColor}]` : "bg-white/10";
30182
+ const textActiveColorFinal = textActiveColor ? `text-[${textActiveColor}]` : "text-white";
30183
+ const activeClasses = `${bgActiveColorFinal} ${textActiveColorFinal}`;
30184
+ const hoverClasses = `${bgActiveColorFinal ? bgActiveColorFinal.replace("bg-", "hover:bg-") : "hover:bg-white/5"} ${textActiveColorFinal ? textActiveColorFinal.replace("text-", "hover:text-") : "hover:text-white"}`;
30146
30185
  const isActive = (path) => {
30147
30186
  if (!path) return false;
30148
- return pathname === path || path !== "/" && pathname?.startsWith(path);
30187
+ const clean = (p) => {
30188
+ while (p.endsWith("/")) p = p.slice(0, -1);
30189
+ return p;
30190
+ };
30191
+ const current = clean(pathname || "");
30192
+ const target = clean(path);
30193
+ if (!current || !target) return false;
30194
+ if (current === target) return true;
30195
+ if (current.startsWith(target) || target.startsWith(current)) return true;
30196
+ const currentLast = current.split("/").pop();
30197
+ const targetLast = target.split("/").pop();
30198
+ return !!currentLast && !!targetLast && currentLast === targetLast;
30199
+ };
30200
+ const isParentActive = (tab) => {
30201
+ if (!Array.isArray(tab.children)) return false;
30202
+ return tab.children.some((child) => isActive(child.url));
30149
30203
  };
30150
30204
  const router = (0, import_navigation3.useRouter)();
30151
30205
  const [showExitDialog, setShowExitDialog] = (0, import_react31.useState)(false);
@@ -30155,7 +30209,11 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
30155
30209
  if (isBuilder) {
30156
30210
  e.preventDefault();
30157
30211
  setPendingUrl(url);
30158
- setShowExitDialog(true);
30212
+ showSonnerToast({
30213
+ variant: "success",
30214
+ title: "Navigation Alert",
30215
+ description: `You will be redirected to ${url} in the built application.`
30216
+ });
30159
30217
  }
30160
30218
  },
30161
30219
  [isBuilder]
@@ -30168,7 +30226,13 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
30168
30226
  };
30169
30227
  let timeout;
30170
30228
  const renderDesktopTab = (tab, index) => {
30171
- const finalClasses = [baseClasses, isActive(tab.url) ? activeClasses : hoverClasses, tab.className || ""].join(" ");
30229
+ const active = isActive(tab.url) || isParentActive(tab);
30230
+ const finalClasses = [baseClasses, active ? activeClasses : hoverClasses, tab.className || ""].join(" ");
30231
+ const finalStyle = {
30232
+ ...tab.style,
30233
+ backgroundColor: active && bgActiveColor ? bgActiveColor : void 0,
30234
+ color: active && textActiveColor ? textActiveColor : void 0
30235
+ };
30172
30236
  if (Array.isArray(tab.children) && tab.children.length > 0 && tab.isDropDown) {
30173
30237
  return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
30174
30238
  DropdownMenu,
@@ -30187,6 +30251,7 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
30187
30251
  onMouseLeave: () => {
30188
30252
  timeout = setTimeout(() => setOpenIndex(null), 150);
30189
30253
  },
30254
+ style: finalStyle,
30190
30255
  children: [
30191
30256
  tab.header,
30192
30257
  /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(ChevronDown, { className: "h-4 w-4 opacity-80" })
@@ -30236,12 +30301,12 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
30236
30301
  href: tab.url,
30237
30302
  target: tab.opens_in_new_tab ? "_blank" : "_self",
30238
30303
  className: finalClasses,
30239
- style: tab.style,
30304
+ style: finalStyle,
30240
30305
  onClick: (e) => handleBuilderExit(e, tab.url || "#"),
30241
30306
  children: tab.header
30242
30307
  },
30243
30308
  index
30244
- ) : /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: finalClasses, style: tab.style, role: "button", tabIndex: 0, children: tab.header }, index);
30309
+ ) : /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: finalClasses, style: finalStyle, role: "button", tabIndex: 0, children: tab.header }, index);
30245
30310
  };
30246
30311
  const renderMobileMenu = () => /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(DropdownMenu, { children: [
30247
30312
  /* @__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: [
@@ -30840,43 +30905,6 @@ function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc
30840
30905
  ] }) });
30841
30906
  }
30842
30907
 
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
30908
  // src/components/ui/sonner.tsx
30881
30909
  var import_next_themes = require("next-themes");
30882
30910
  var import_sonner2 = require("sonner");