@algorithm-shift/design-system 1.2.77 → 1.2.79

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
@@ -126,6 +126,11 @@ interface TabsProps extends ElementProps {
126
126
  verticalMenu?: boolean;
127
127
  canvasMode?: 'desktop' | 'tablet' | 'mobile';
128
128
  isBuilder?: boolean;
129
+ source?: string;
130
+ parentKey?: string;
131
+ menuNameKey?: string;
132
+ menuUrlKey?: string;
133
+ loading?: boolean;
129
134
  }
130
135
 
131
136
  interface StagesProps extends ElementProps {
@@ -362,7 +367,7 @@ declare const Table: ({ columns, data, rowActions, className, style, pagination,
362
367
 
363
368
  declare const CustomPagination: ({ totalPages, currentPage, onPageChange, maxVisiblePages, perPage, }: CustomPaginationProps) => react_jsx_runtime.JSX.Element;
364
369
 
365
- declare const Tabs: ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuilder }: TabsProps) => react_jsx_runtime.JSX.Element;
370
+ declare const Tabs: ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuilder, source, parentKey, menuNameKey, menuUrlKey, loading }: TabsProps) => react_jsx_runtime.JSX.Element;
366
371
 
367
372
  declare const StagesComponent: ({ stages, isShowBtn, buttonText, className, style, onStageChange, currentStage }: StagesProps) => react_jsx_runtime.JSX.Element;
368
373
 
package/dist/index.d.ts CHANGED
@@ -126,6 +126,11 @@ interface TabsProps extends ElementProps {
126
126
  verticalMenu?: boolean;
127
127
  canvasMode?: 'desktop' | 'tablet' | 'mobile';
128
128
  isBuilder?: boolean;
129
+ source?: string;
130
+ parentKey?: string;
131
+ menuNameKey?: string;
132
+ menuUrlKey?: string;
133
+ loading?: boolean;
129
134
  }
130
135
 
131
136
  interface StagesProps extends ElementProps {
@@ -362,7 +367,7 @@ declare const Table: ({ columns, data, rowActions, className, style, pagination,
362
367
 
363
368
  declare const CustomPagination: ({ totalPages, currentPage, onPageChange, maxVisiblePages, perPage, }: CustomPaginationProps) => react_jsx_runtime.JSX.Element;
364
369
 
365
- declare const Tabs: ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuilder }: TabsProps) => react_jsx_runtime.JSX.Element;
370
+ declare const Tabs: ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuilder, source, parentKey, menuNameKey, menuUrlKey, loading }: TabsProps) => react_jsx_runtime.JSX.Element;
366
371
 
367
372
  declare const StagesComponent: ({ stages, isShowBtn, buttonText, className, style, onStageChange, currentStage }: StagesProps) => react_jsx_runtime.JSX.Element;
368
373
 
package/dist/index.js CHANGED
@@ -3578,7 +3578,7 @@ __export(lucide_react_exports, {
3578
3578
  LucideMailX: () => MailX,
3579
3579
  LucideMailbox: () => Mailbox,
3580
3580
  LucideMails: () => Mails,
3581
- LucideMap: () => Map,
3581
+ LucideMap: () => Map2,
3582
3582
  LucideMapMinus: () => MapMinus,
3583
3583
  LucideMapPin: () => MapPin,
3584
3584
  LucideMapPinCheck: () => MapPinCheck,
@@ -4414,8 +4414,8 @@ __export(lucide_react_exports, {
4414
4414
  MailboxIcon: () => Mailbox,
4415
4415
  Mails: () => Mails,
4416
4416
  MailsIcon: () => Mails,
4417
- Map: () => Map,
4418
- MapIcon: () => Map,
4417
+ Map: () => Map2,
4418
+ MapIcon: () => Map2,
4419
4419
  MapMinus: () => MapMinus,
4420
4420
  MapMinusIcon: () => MapMinus,
4421
4421
  MapPin: () => MapPin,
@@ -6950,7 +6950,7 @@ __export(icons_exports, {
6950
6950
  MailX: () => MailX,
6951
6951
  Mailbox: () => Mailbox,
6952
6952
  Mails: () => Mails,
6953
- Map: () => Map,
6953
+ Map: () => Map2,
6954
6954
  MapMinus: () => MapMinus,
6955
6955
  MapPin: () => MapPin,
6956
6956
  MapPinCheck: () => MapPinCheck,
@@ -18563,7 +18563,7 @@ var __iconNode933 = [
18563
18563
  ["path", { d: "M15 5.764v15", key: "1pn4in" }],
18564
18564
  ["path", { d: "M9 3.236v15", key: "1uimfh" }]
18565
18565
  ];
18566
- var Map = createLucideIcon("map", __iconNode933);
18566
+ var Map2 = createLucideIcon("map", __iconNode933);
18567
18567
 
18568
18568
  // node_modules/lucide-react/dist/esm/icons/mars-stroke.js
18569
18569
  var __iconNode934 = [
@@ -29368,12 +29368,48 @@ var CustomPagination = ({
29368
29368
  var Pagination_default = CustomPagination;
29369
29369
 
29370
29370
  // src/components/Navigation/Tabs/Tabs.tsx
29371
+ var import_react27 = require("react");
29371
29372
  var import_link5 = __toESM(require("next/link"));
29372
29373
  var import_navigation3 = require("next/navigation");
29373
- var import_react27 = require("react");
29374
29374
  var import_jsx_runtime55 = require("react/jsx-runtime");
29375
- var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuilder = true }) => {
29376
- const rawTabs = Array.isArray(tabs) ? tabs : [];
29375
+ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuilder = true, source, parentKey, menuNameKey, menuUrlKey, loading }) => {
29376
+ function groupMenus(menus = []) {
29377
+ const menuMap = /* @__PURE__ */ new Map();
29378
+ menus.forEach((menu) => {
29379
+ menuMap.set(menu.menu_id, {
29380
+ ...menu,
29381
+ url: menu[menuUrlKey || "url"],
29382
+ header: menu[menuNameKey || "name"],
29383
+ isDropDown: false,
29384
+ children: []
29385
+ });
29386
+ });
29387
+ const rootMenus = [];
29388
+ menus.forEach((menu) => {
29389
+ if (menu[parentKey || "parentId"]) {
29390
+ const parent = menuMap.get(menu[parentKey || "parentId"]);
29391
+ if (parent) {
29392
+ parent.children.push(menuMap.get(menu.menu_id));
29393
+ }
29394
+ } else {
29395
+ rootMenus.push(menuMap.get(menu.menu_id));
29396
+ }
29397
+ });
29398
+ const sortMenus = (list) => list.sort((a, b) => (a.sort_order || 0) - (b.sort_order || 0)).map((menu) => {
29399
+ const sortedChildren = sortMenus(menu.children || []);
29400
+ return {
29401
+ ...menu,
29402
+ children: sortedChildren,
29403
+ isDropDown: sortedChildren.length > 0
29404
+ };
29405
+ });
29406
+ return sortMenus(rootMenus);
29407
+ }
29408
+ const rawTabs = (0, import_react27.useMemo)(() => {
29409
+ if (!Array.isArray(tabs)) return [];
29410
+ if (source === "manual") return Array.isArray(tabs) ? tabs : [];
29411
+ return groupMenus(tabs);
29412
+ }, [tabs, source, parentKey, menuNameKey, menuUrlKey]);
29377
29413
  const baseClasses = "text-[12px] text-foreground p-2 text-center rounded-md transition-colors";
29378
29414
  const activeClasses = "bg-white/10 text-white";
29379
29415
  const hoverClasses = "hover:bg-white/5";
@@ -29414,14 +29450,22 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
29414
29450
  align: "start",
29415
29451
  sideOffset: 6,
29416
29452
  className: "z-50 min-w-[160px] rounded-md border border-gray-200 bg-white p-1 shadow-lg",
29417
- children: tab.children.map((item) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
29453
+ children: tab.children.map((item, index2) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
29418
29454
  DropdownMenuItem,
29419
29455
  {
29420
29456
  asChild: true,
29421
29457
  className: "cursor-pointer rounded-sm px-3 py-2 text-[12px] text-gray-800 hover:bg-gray-100 focus:bg-gray-100",
29422
- children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_link5.default, { href: item.url || "#", onClick: (e) => handleBuilderExit(e, item.url || "#"), children: item.header })
29458
+ children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
29459
+ import_link5.default,
29460
+ {
29461
+ href: item.url || "#",
29462
+ target: item.opens_in_new_tab ? "_blank" : "_self",
29463
+ onClick: (e) => handleBuilderExit(e, item.url || "#"),
29464
+ children: item.header
29465
+ }
29466
+ )
29423
29467
  },
29424
- item.id
29468
+ item.id || index2
29425
29469
  ))
29426
29470
  }
29427
29471
  )
@@ -29431,6 +29475,7 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
29431
29475
  import_link5.default,
29432
29476
  {
29433
29477
  href: tab.url,
29478
+ target: tab.opens_in_new_tab ? "_blank" : "_self",
29434
29479
  className: finalClasses,
29435
29480
  style: tab.style,
29436
29481
  onClick: (e) => handleBuilderExit(e, tab.url || "#"),
@@ -29455,14 +29500,14 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
29455
29500
  if (hasChildren) {
29456
29501
  return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(DropdownMenuSub, { children: [
29457
29502
  /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(DropdownMenuSubTrigger, { className: "flex items-center justify-between cursor-pointer rounded-sm px-3 py-2 text-[13px] text-foreground hover:text-foreground", children: tab.header }),
29458
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(DropdownMenuSubContent, { className: "bg-white border shadow-lg rounded-md p-1", children: tab.children.map((item) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
29503
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(DropdownMenuSubContent, { className: "bg-white border shadow-lg rounded-md p-1", children: tab.children.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
29459
29504
  DropdownMenuItem,
29460
29505
  {
29461
29506
  asChild: true,
29462
29507
  className: "cursor-pointer rounded-sm px-3 py-2 text-[12px] text-gray-800 hover:bg-gray-100",
29463
29508
  children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_link5.default, { href: item.url || "#", onClick: (e) => handleBuilderExit(e, item.url || "#"), children: item.header })
29464
29509
  },
29465
- item.id
29510
+ item.id || index
29466
29511
  )) })
29467
29512
  ] }, i);
29468
29513
  }