@algorithm-shift/design-system 1.2.70 → 1.2.72

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
@@ -28392,10 +28392,12 @@ function DataTable({
28392
28392
  state: {
28393
28393
  columnFilters,
28394
28394
  columnVisibility,
28395
- pagination: {
28396
- pageIndex: controlledPageIndex ?? 0,
28397
- pageSize
28398
- }
28395
+ ...paginationMode === "server" ? {
28396
+ pagination: {
28397
+ pageIndex: controlledPageIndex ?? 0,
28398
+ pageSize
28399
+ }
28400
+ } : {}
28399
28401
  },
28400
28402
  onColumnFiltersChange: setColumnFilters,
28401
28403
  onColumnVisibilityChange: setColumnVisibility,
@@ -28404,11 +28406,13 @@ function DataTable({
28404
28406
  getPaginationRowModel: pagination && paginationMode === "client" ? getPaginationRowModel() : void 0,
28405
28407
  manualPagination: paginationMode === "server",
28406
28408
  pageCount: paginationMode === "server" ? Math.ceil(totalRecords / pageSize) : void 0,
28407
- onPaginationChange: (updater) => {
28408
- const prev = table.getState().pagination;
28409
- const next = typeof updater === "function" ? updater(prev) : updater;
28410
- onPageChange?.(next.pageIndex, next.pageSize);
28411
- }
28409
+ ...paginationMode === "server" ? {
28410
+ onPaginationChange: (updater) => {
28411
+ const prev = table.getState().pagination;
28412
+ const next = typeof updater === "function" ? updater(prev) : updater;
28413
+ onPageChange?.(next.pageIndex, next.pageSize);
28414
+ }
28415
+ } : {}
28412
28416
  });
28413
28417
  const getPageNumbers = (currentPage, totalPages, maxVisiblePages = 5) => {
28414
28418
  if (totalPages <= maxVisiblePages) {
@@ -28893,8 +28897,126 @@ var Pagination_default = CustomPagination;
28893
28897
 
28894
28898
  // src/components/Navigation/Tabs/Tabs.tsx
28895
28899
  import Link5 from "next/link";
28900
+ import { useRouter } from "next/navigation";
28901
+
28902
+ // src/components/ui/dialog.tsx
28903
+ import * as DialogPrimitive from "@radix-ui/react-dialog";
28896
28904
  import { jsx as jsx51, jsxs as jsxs29 } from "react/jsx-runtime";
28897
- var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode }) => {
28905
+ function Dialog({
28906
+ ...props
28907
+ }) {
28908
+ return /* @__PURE__ */ jsx51(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
28909
+ }
28910
+ function DialogPortal({
28911
+ ...props
28912
+ }) {
28913
+ return /* @__PURE__ */ jsx51(DialogPrimitive.Portal, { "data-slot": "dialog-portal", ...props });
28914
+ }
28915
+ function DialogOverlay({
28916
+ className,
28917
+ ...props
28918
+ }) {
28919
+ return /* @__PURE__ */ jsx51(
28920
+ DialogPrimitive.Overlay,
28921
+ {
28922
+ "data-slot": "dialog-overlay",
28923
+ className: cn(
28924
+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-[60] bg-black/50",
28925
+ className
28926
+ ),
28927
+ ...props
28928
+ }
28929
+ );
28930
+ }
28931
+ function DialogContent({
28932
+ className,
28933
+ children,
28934
+ showCloseButton = true,
28935
+ ...props
28936
+ }) {
28937
+ return /* @__PURE__ */ jsxs29(DialogPortal, { "data-slot": "dialog-portal", children: [
28938
+ /* @__PURE__ */ jsx51(DialogOverlay, {}),
28939
+ /* @__PURE__ */ jsxs29(
28940
+ DialogPrimitive.Content,
28941
+ {
28942
+ "data-slot": "dialog-content",
28943
+ className: cn(
28944
+ "bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-[70] grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",
28945
+ className
28946
+ ),
28947
+ ...props,
28948
+ children: [
28949
+ children,
28950
+ showCloseButton && /* @__PURE__ */ jsxs29(
28951
+ DialogPrimitive.Close,
28952
+ {
28953
+ "data-slot": "dialog-close",
28954
+ className: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
28955
+ children: [
28956
+ /* @__PURE__ */ jsx51(X, {}),
28957
+ /* @__PURE__ */ jsx51("span", { className: "sr-only", children: "Close" })
28958
+ ]
28959
+ }
28960
+ )
28961
+ ]
28962
+ }
28963
+ )
28964
+ ] });
28965
+ }
28966
+ function DialogHeader({ className, ...props }) {
28967
+ return /* @__PURE__ */ jsx51(
28968
+ "div",
28969
+ {
28970
+ "data-slot": "dialog-header",
28971
+ className: cn("flex flex-col gap-2 text-center sm:text-left", className),
28972
+ ...props
28973
+ }
28974
+ );
28975
+ }
28976
+ function DialogFooter({ className, ...props }) {
28977
+ return /* @__PURE__ */ jsx51(
28978
+ "div",
28979
+ {
28980
+ "data-slot": "dialog-footer",
28981
+ className: cn(
28982
+ "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
28983
+ className
28984
+ ),
28985
+ ...props
28986
+ }
28987
+ );
28988
+ }
28989
+ function DialogTitle({
28990
+ className,
28991
+ ...props
28992
+ }) {
28993
+ return /* @__PURE__ */ jsx51(
28994
+ DialogPrimitive.Title,
28995
+ {
28996
+ "data-slot": "dialog-title",
28997
+ className: cn("text-lg leading-none font-semibold", className),
28998
+ ...props
28999
+ }
29000
+ );
29001
+ }
29002
+ function DialogDescription({
29003
+ className,
29004
+ ...props
29005
+ }) {
29006
+ return /* @__PURE__ */ jsx51(
29007
+ DialogPrimitive.Description,
29008
+ {
29009
+ "data-slot": "dialog-description",
29010
+ className: cn("text-muted-foreground text-sm", className),
29011
+ ...props
29012
+ }
29013
+ );
29014
+ }
29015
+
29016
+ // src/components/Navigation/Tabs/Tabs.tsx
29017
+ import { useCallback as useCallback2, useState as useState5 } from "react";
29018
+ import { Fragment as Fragment18, jsx as jsx52, jsxs as jsxs30 } from "react/jsx-runtime";
29019
+ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuilder = true }) => {
28898
29020
  const rawTabs = Array.isArray(tabs) ? tabs : [];
28899
29021
  const baseClasses = "text-[12px] text-foreground p-2 text-center rounded-md transition-colors";
28900
29022
  const activeClasses = "bg-white/10 text-white";
@@ -28903,26 +29025,45 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode }) => {
28903
29025
  if (!path) return false;
28904
29026
  return pathname === path || path !== "/" && pathname?.startsWith(path);
28905
29027
  };
29028
+ const router = useRouter();
29029
+ const [showExitDialog, setShowExitDialog] = useState5(false);
29030
+ const [pendingUrl, setPendingUrl] = useState5(null);
29031
+ const handleBuilderExit = useCallback2(
29032
+ (e, url) => {
29033
+ if (isBuilder) {
29034
+ e.preventDefault();
29035
+ setPendingUrl(url);
29036
+ setShowExitDialog(true);
29037
+ }
29038
+ },
29039
+ [isBuilder]
29040
+ );
29041
+ const confirmExit = () => {
29042
+ if (pendingUrl) {
29043
+ setShowExitDialog(false);
29044
+ router.push(pendingUrl);
29045
+ }
29046
+ };
28906
29047
  const renderDesktopTab = (tab, index) => {
28907
29048
  const finalClasses = [baseClasses, isActive(tab.url) ? activeClasses : hoverClasses, tab.className || ""].join(" ");
28908
29049
  if (Array.isArray(tab.children) && tab.children.length > 0 && tab.isDropDown) {
28909
- return /* @__PURE__ */ jsxs29(DropdownMenu, { children: [
28910
- /* @__PURE__ */ jsxs29(DropdownMenuTrigger, { className: `${finalClasses} inline-flex items-center gap-1`, children: [
29050
+ return /* @__PURE__ */ jsxs30(DropdownMenu, { children: [
29051
+ /* @__PURE__ */ jsxs30(DropdownMenuTrigger, { className: `${finalClasses} inline-flex items-center gap-1`, children: [
28911
29052
  tab.header,
28912
- /* @__PURE__ */ jsx51(ChevronDown, { className: "h-4 w-4 opacity-80" })
29053
+ /* @__PURE__ */ jsx52(ChevronDown, { className: "h-4 w-4 opacity-80" })
28913
29054
  ] }),
28914
- /* @__PURE__ */ jsx51(
29055
+ /* @__PURE__ */ jsx52(
28915
29056
  DropdownMenuContent,
28916
29057
  {
28917
29058
  align: "start",
28918
29059
  sideOffset: 6,
28919
29060
  className: "z-50 min-w-[160px] rounded-md border border-gray-200 bg-white p-1 shadow-lg",
28920
- children: tab.children.map((item) => /* @__PURE__ */ jsx51(
29061
+ children: tab.children.map((item) => /* @__PURE__ */ jsx52(
28921
29062
  DropdownMenuItem,
28922
29063
  {
28923
29064
  asChild: true,
28924
29065
  className: "cursor-pointer rounded-sm px-3 py-2 text-[12px] text-gray-800 hover:bg-gray-100 focus:bg-gray-100",
28925
- children: /* @__PURE__ */ jsx51(Link5, { href: item.url || "#", children: item.header })
29066
+ children: /* @__PURE__ */ jsx52(Link5, { href: item.url || "#", onClick: (e) => handleBuilderExit(e, item.url || "#"), children: item.header })
28926
29067
  },
28927
29068
  item.id
28928
29069
  ))
@@ -28930,14 +29071,24 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode }) => {
28930
29071
  )
28931
29072
  ] }, index);
28932
29073
  }
28933
- return tab.url ? /* @__PURE__ */ jsx51(Link5, { href: tab.url, className: finalClasses, style: tab.style, children: tab.header }, index) : /* @__PURE__ */ jsx51("div", { className: finalClasses, style: tab.style, role: "button", tabIndex: 0, children: tab.header }, index);
29074
+ return tab.url ? /* @__PURE__ */ jsx52(
29075
+ Link5,
29076
+ {
29077
+ href: tab.url,
29078
+ className: finalClasses,
29079
+ style: tab.style,
29080
+ onClick: (e) => handleBuilderExit(e, tab.url || "#"),
29081
+ children: tab.header
29082
+ },
29083
+ index
29084
+ ) : /* @__PURE__ */ jsx52("div", { className: finalClasses, style: tab.style, role: "button", tabIndex: 0, children: tab.header }, index);
28934
29085
  };
28935
- const renderMobileMenu = () => /* @__PURE__ */ jsxs29(DropdownMenu, { children: [
28936
- /* @__PURE__ */ jsxs29(DropdownMenuTrigger, { className: "flex items-center gap-2 px-3 py-2 rounded-md bg-white/10 text-white text-sm", children: [
28937
- /* @__PURE__ */ jsx51(Menu, { className: "h-4 w-4" }),
29086
+ const renderMobileMenu = () => /* @__PURE__ */ jsxs30(DropdownMenu, { children: [
29087
+ /* @__PURE__ */ jsxs30(DropdownMenuTrigger, { className: "flex items-center gap-2 px-3 py-2 rounded-md bg-white/10 text-white text-sm", children: [
29088
+ /* @__PURE__ */ jsx52(Menu, { className: "h-4 w-4" }),
28938
29089
  "Menu"
28939
29090
  ] }),
28940
- /* @__PURE__ */ jsx51(
29091
+ /* @__PURE__ */ jsx52(
28941
29092
  DropdownMenuContent,
28942
29093
  {
28943
29094
  align: "start",
@@ -28946,25 +29097,25 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode }) => {
28946
29097
  children: rawTabs.map((tab, i) => {
28947
29098
  const hasChildren = Array.isArray(tab.children) && tab.children.length > 0 && tab.isDropDown;
28948
29099
  if (hasChildren) {
28949
- return /* @__PURE__ */ jsxs29(DropdownMenuSub, { children: [
28950
- /* @__PURE__ */ jsx51(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 }),
28951
- /* @__PURE__ */ jsx51(DropdownMenuSubContent, { className: "bg-white border shadow-lg rounded-md p-1", children: tab.children.map((item) => /* @__PURE__ */ jsx51(
29100
+ return /* @__PURE__ */ jsxs30(DropdownMenuSub, { children: [
29101
+ /* @__PURE__ */ jsx52(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 }),
29102
+ /* @__PURE__ */ jsx52(DropdownMenuSubContent, { className: "bg-white border shadow-lg rounded-md p-1", children: tab.children.map((item) => /* @__PURE__ */ jsx52(
28952
29103
  DropdownMenuItem,
28953
29104
  {
28954
29105
  asChild: true,
28955
29106
  className: "cursor-pointer rounded-sm px-3 py-2 text-[12px] text-gray-800 hover:bg-gray-100",
28956
- children: /* @__PURE__ */ jsx51(Link5, { href: item.url || "#", children: item.header })
29107
+ children: /* @__PURE__ */ jsx52(Link5, { href: item.url || "#", onClick: (e) => handleBuilderExit(e, item.url || "#"), children: item.header })
28957
29108
  },
28958
29109
  item.id
28959
29110
  )) })
28960
29111
  ] }, i);
28961
29112
  }
28962
- return /* @__PURE__ */ jsx51(
29113
+ return /* @__PURE__ */ jsx52(
28963
29114
  DropdownMenuItem,
28964
29115
  {
28965
29116
  asChild: true,
28966
29117
  className: "cursor-pointer rounded-sm px-3 py-2 text-[13px] text-gray-800 hover:bg-gray-100",
28967
- children: /* @__PURE__ */ jsx51(Link5, { href: tab.url || "#", children: tab.header })
29118
+ children: /* @__PURE__ */ jsx52(Link5, { href: tab.url || "#", onClick: (e) => handleBuilderExit(e, tab.url || "#"), children: tab.header })
28968
29119
  },
28969
29120
  i
28970
29121
  );
@@ -28974,55 +29125,84 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode }) => {
28974
29125
  ] });
28975
29126
  const forceMobile = canvasMode ? canvasMode === "mobile" || canvasMode === "tablet" : void 0;
28976
29127
  const forceDesktop = canvasMode ? canvasMode === "desktop" : void 0;
28977
- return /* @__PURE__ */ jsxs29("div", { className, style, children: [
28978
- forceDesktop !== void 0 ? forceDesktop && /* @__PURE__ */ jsx51("div", { className: "hidden md:flex", children: /* @__PURE__ */ jsx51("div", { className: `flex gap-2 ${verticalMenu ? "flex-col items-start" : "flex-row"}`, children: rawTabs.map(renderDesktopTab) }) }) : /* @__PURE__ */ jsx51("div", { className: "hidden md:flex", children: /* @__PURE__ */ jsx51("div", { className: `flex gap-2 ${verticalMenu ? "flex-col items-start" : "flex-row"}`, children: rawTabs.map(renderDesktopTab) }) }),
28979
- forceMobile !== void 0 ? forceMobile && /* @__PURE__ */ jsx51("div", { children: renderMobileMenu() }) : /* @__PURE__ */ jsx51("div", { className: "flex md:hidden", children: renderMobileMenu() })
29128
+ return /* @__PURE__ */ jsxs30(Fragment18, { children: [
29129
+ /* @__PURE__ */ jsxs30("div", { className, style, children: [
29130
+ forceDesktop !== void 0 ? forceDesktop && /* @__PURE__ */ jsx52("div", { className: "hidden md:flex", children: /* @__PURE__ */ jsx52("div", { className: `flex gap-2 ${verticalMenu ? "flex-col items-start" : "flex-row"}`, children: rawTabs.map(renderDesktopTab) }) }) : /* @__PURE__ */ jsx52("div", { className: "hidden md:flex", children: /* @__PURE__ */ jsx52("div", { className: `flex gap-2 ${verticalMenu ? "flex-col items-start" : "flex-row"}`, children: rawTabs.map(renderDesktopTab) }) }),
29131
+ forceMobile !== void 0 ? forceMobile && /* @__PURE__ */ jsx52("div", { children: renderMobileMenu() }) : /* @__PURE__ */ jsx52("div", { className: "flex md:hidden", children: renderMobileMenu() })
29132
+ ] }),
29133
+ /* @__PURE__ */ jsx52(Dialog, { open: showExitDialog, onOpenChange: setShowExitDialog, children: /* @__PURE__ */ jsxs30(DialogContent, { className: "bg-[#fff]", children: [
29134
+ /* @__PURE__ */ jsxs30(DialogHeader, { children: [
29135
+ /* @__PURE__ */ jsx52(DialogTitle, { children: "Exit Builder?" }),
29136
+ /* @__PURE__ */ jsx52(DialogDescription, { children: "You are about to leave the builder. Any unsaved changes may be lost." })
29137
+ ] }),
29138
+ /* @__PURE__ */ jsxs30(DialogFooter, { children: [
29139
+ /* @__PURE__ */ jsx52(Button, { className: "cursor-pointer bg-[#12715b] text-[#fff]", variant: "outline", onClick: () => setShowExitDialog(false), children: "Cancel" }),
29140
+ /* @__PURE__ */ jsx52(Button, { className: "cursor-pointer border-[#12715b] border", onClick: confirmExit, children: "Yes, Exit" })
29141
+ ] })
29142
+ ] }) })
28980
29143
  ] });
28981
29144
  };
28982
29145
  var Tabs_default = Tabs;
28983
29146
 
28984
29147
  // src/components/Navigation/Stages/Stages.tsx
28985
29148
  import React8 from "react";
28986
- import { jsx as jsx52, jsxs as jsxs30 } from "react/jsx-runtime";
28987
- var StagesComponent = ({ stages, isShowBtn, buttonText, className, style }) => {
28988
- return /* @__PURE__ */ jsx52("div", { className, style, children: /* @__PURE__ */ jsxs30("div", { className: "flex items-center justify-between bg-red p-2 rounded-lg border border-gray-200 w-full", children: [
28989
- /* @__PURE__ */ jsx52("div", { className: "flex items-center", children: /* @__PURE__ */ jsx52("button", { className: "p-2 hover:bg-gray-100 rounded", children: /* @__PURE__ */ jsx52("svg", { className: "w-4 h-4 text-gray-600", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx52("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" }) }) }) }),
28990
- /* @__PURE__ */ jsx52("div", { className: "flex items-center flex-1 px-2 flex-wrap gap-2", children: stages?.length > 0 && stages?.map((stage, index) => /* @__PURE__ */ jsxs30(React8.Fragment, { children: [
28991
- /* @__PURE__ */ jsx52(
29149
+ import { jsx as jsx53, jsxs as jsxs31 } from "react/jsx-runtime";
29150
+ var StagesComponent = ({ stages, isShowBtn, buttonText, className, style, onStageChange }) => {
29151
+ return /* @__PURE__ */ jsx53("div", { className, style, children: /* @__PURE__ */ jsxs31("div", { className: "flex items-center justify-between bg-red p-2 rounded-lg border border-gray-200 w-full", children: [
29152
+ /* @__PURE__ */ jsx53("div", { className: "flex items-center", children: /* @__PURE__ */ jsx53("button", { className: "p-2 hover:bg-gray-100 rounded", children: /* @__PURE__ */ jsx53("svg", { className: "w-4 h-4 text-gray-600", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx53("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" }) }) }) }),
29153
+ /* @__PURE__ */ jsx53("div", { className: "flex items-center flex-1 px-2 flex-wrap gap-2", children: stages?.length > 0 && stages?.map((stage, index) => /* @__PURE__ */ jsxs31(React8.Fragment, { children: [
29154
+ /* @__PURE__ */ jsx53(
28992
29155
  "button",
28993
29156
  {
28994
29157
  className: `min-w-[120px] px-4 py-2 rounded-full text-sm font-medium transition-colors duration-200 whitespace-nowrap ${stage.isActive ? "bg-[#034486] text-white shadow-md" : "bg-white text-gray-700 hover:bg-gray-100 border border-gray-200"}`,
29158
+ onClick: () => {
29159
+ if (onStageChange) {
29160
+ onStageChange(stage.id);
29161
+ }
29162
+ },
28995
29163
  children: stage.header
28996
29164
  }
28997
29165
  ),
28998
- index < stages.length - 1 && /* @__PURE__ */ jsx52("div", { className: "flex-shrink-0 w-3 h-px bg-gray-300" })
29166
+ index < stages.length - 1 && /* @__PURE__ */ jsx53("div", { className: "flex-shrink-0 w-3 h-px bg-gray-300" })
28999
29167
  ] }, stage.id)) }),
29000
- isShowBtn && /* @__PURE__ */ jsx52("div", { className: "flex items-center", children: /* @__PURE__ */ jsx52("button", { className: "bg-[#034486] text-white px-6 py-2 rounded-lg text-sm font-medium transition-colors duration-200 shadow-sm", children: buttonText }) })
29168
+ isShowBtn && /* @__PURE__ */ jsx53("div", { className: "flex items-center", children: /* @__PURE__ */ jsx53(
29169
+ "button",
29170
+ {
29171
+ className: "bg-[#034486] text-white px-6 py-2 rounded-lg text-sm font-medium transition-colors duration-200 shadow-sm",
29172
+ onClick: () => {
29173
+ const activeStage = stages?.find((stage) => stage.isActive);
29174
+ if (activeStage && onStageChange) {
29175
+ onStageChange(activeStage.id);
29176
+ }
29177
+ },
29178
+ children: buttonText
29179
+ }
29180
+ ) })
29001
29181
  ] }) });
29002
29182
  };
29003
29183
  var Stages_default = StagesComponent;
29004
29184
 
29005
29185
  // src/components/Navigation/Spacer/Spacer.tsx
29006
- import { jsx as jsx53 } from "react/jsx-runtime";
29186
+ import { jsx as jsx54 } from "react/jsx-runtime";
29007
29187
  var Spacer = ({ className, style }) => {
29008
- return /* @__PURE__ */ jsx53("div", { className: `${className}`, style });
29188
+ return /* @__PURE__ */ jsx54("div", { className: `${className}`, style });
29009
29189
  };
29010
29190
  var Spacer_default = Spacer;
29011
29191
 
29012
29192
  // src/components/Navigation/Profile/Profile.tsx
29013
- import { jsx as jsx54, jsxs as jsxs31 } from "react/jsx-runtime";
29193
+ import { jsx as jsx55, jsxs as jsxs32 } from "react/jsx-runtime";
29014
29194
 
29015
29195
  // src/components/Navigation/Notification/Notification.tsx
29016
- import { jsx as jsx55, jsxs as jsxs32 } from "react/jsx-runtime";
29196
+ import { jsx as jsx56, jsxs as jsxs33 } from "react/jsx-runtime";
29017
29197
 
29018
29198
  // src/components/Navigation/Logo/Logo.tsx
29019
- import { jsx as jsx56 } from "react/jsx-runtime";
29199
+ import { jsx as jsx57 } from "react/jsx-runtime";
29020
29200
 
29021
29201
  // src/components/ui/avatar.tsx
29022
29202
  import * as React9 from "react";
29023
29203
  import * as AvatarPrimitive from "@radix-ui/react-avatar";
29024
- import { jsx as jsx57 } from "react/jsx-runtime";
29025
- var Avatar = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx57(
29204
+ import { jsx as jsx58 } from "react/jsx-runtime";
29205
+ var Avatar = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx58(
29026
29206
  AvatarPrimitive.Root,
29027
29207
  {
29028
29208
  ref,
@@ -29034,7 +29214,7 @@ var Avatar = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
29034
29214
  }
29035
29215
  ));
29036
29216
  Avatar.displayName = AvatarPrimitive.Root.displayName;
29037
- var AvatarImage = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx57(
29217
+ var AvatarImage = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx58(
29038
29218
  AvatarPrimitive.Image,
29039
29219
  {
29040
29220
  ref,
@@ -29043,7 +29223,7 @@ var AvatarImage = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE
29043
29223
  }
29044
29224
  ));
29045
29225
  AvatarImage.displayName = AvatarPrimitive.Image.displayName;
29046
- var AvatarFallback = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx57(
29226
+ var AvatarFallback = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx58(
29047
29227
  AvatarPrimitive.Fallback,
29048
29228
  {
29049
29229
  ref,
@@ -29059,8 +29239,10 @@ AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
29059
29239
  // src/components/Navigation/Navbar/Navbar.tsx
29060
29240
  import Link6 from "next/link";
29061
29241
  import Image3 from "next/image";
29242
+ import { useRouter as useRouter2 } from "next/navigation";
29062
29243
  import { DropdownMenuSeparator } from "@radix-ui/react-dropdown-menu";
29063
- import { Fragment as Fragment18, jsx as jsx58, jsxs as jsxs33 } from "react/jsx-runtime";
29244
+ import { useCallback as useCallback3, useMemo as useMemo3, useState as useState6 } from "react";
29245
+ import { Fragment as Fragment19, jsx as jsx59, jsxs as jsxs34 } from "react/jsx-runtime";
29064
29246
  function Navbar({
29065
29247
  style,
29066
29248
  badgeType,
@@ -29073,77 +29255,131 @@ function Navbar({
29073
29255
  canvasMode = "desktop",
29074
29256
  list = [],
29075
29257
  profileMenu = [],
29076
- userName = "Guest User"
29258
+ userName = "Guest User",
29259
+ isBuilder = true,
29260
+ source,
29261
+ navList
29077
29262
  }) {
29078
29263
  const isMobileView = canvasMode === "mobile" || canvasMode === "tablet";
29079
- return /* @__PURE__ */ jsx58("nav", { className: "w-full border-b border-b-white dark:border-b-gray-800 dark:bg-gray-800 bg-white shadow-sm", style, children: /* @__PURE__ */ jsxs33("div", { className: "mx-auto flex max-w-[90%] items-center justify-between px-4 py-4", children: [
29080
- /* @__PURE__ */ jsx58(Link6, { href: "/", className: "flex items-center space-x-2", children: imageUrl ? /* @__PURE__ */ jsx58(Image3, { src: imageUrl, alt: altText, width: 200, height: 200 }) : /* @__PURE__ */ jsx58("span", { className: "font-semibold text-blue-700", children: "Logo" }) }),
29081
- !isMobileView && /* @__PURE__ */ jsx58("div", { className: "flex items-center space-x-6 sm:hidden md:flex", children: list.map((item) => /* @__PURE__ */ jsx58(
29082
- Link6,
29264
+ const router = useRouter2();
29265
+ const [showExitDialog, setShowExitDialog] = useState6(false);
29266
+ const [pendingUrl, setPendingUrl] = useState6(null);
29267
+ const handleBuilderExit = useCallback3(
29268
+ (e, url) => {
29269
+ if (isBuilder) {
29270
+ e.preventDefault();
29271
+ setPendingUrl(url);
29272
+ setShowExitDialog(true);
29273
+ }
29274
+ },
29275
+ [isBuilder]
29276
+ );
29277
+ const confirmExit = () => {
29278
+ if (pendingUrl) {
29279
+ setShowExitDialog(false);
29280
+ router.push(pendingUrl);
29281
+ }
29282
+ };
29283
+ const formatedMenu = useMemo3(() => {
29284
+ if (source === "state" && navList && navList.length) {
29285
+ return navList.map((i) => ({ ...i, header: i.name || "Menu" }));
29286
+ }
29287
+ return list || [];
29288
+ }, [source, navList]);
29289
+ return /* @__PURE__ */ jsxs34(Fragment19, { children: [
29290
+ /* @__PURE__ */ jsx59(
29291
+ "nav",
29083
29292
  {
29084
- href: item.url || "#",
29085
- className: "text-sm font-medium dark:text-white text-gray-600 hover:text-gray-900 transition-colors",
29086
- children: item.header
29087
- },
29088
- item.id
29089
- )) }),
29090
- /* @__PURE__ */ jsxs33("div", { className: "flex items-center space-x-3", children: [
29091
- !isMobileView ? /* @__PURE__ */ jsx58("div", { className: "flex-1 px-6", children: /* @__PURE__ */ jsxs33("div", { className: "relative w-full max-w-md border border-gray-300 rounded-md", children: [
29092
- /* @__PURE__ */ jsx58(Search, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 dark:text-white text-gray-400" }),
29093
- /* @__PURE__ */ jsx58(Input, { placeholder: "Search", className: "pl-9 text-gray-400" })
29094
- ] }) }) : /* @__PURE__ */ jsx58(
29095
- Button,
29096
- {
29097
- variant: "ghost",
29098
- size: "icon",
29099
- className: "border border-gray-400",
29100
- children: /* @__PURE__ */ jsx58(Search, { className: "h-5 w-5 text-gray-400" })
29101
- }
29102
- ),
29103
- /* @__PURE__ */ jsxs33("div", { className: "relative bg-[#E9E9E9] dark:bg-gray-700 rounded-md", children: [
29104
- /* @__PURE__ */ jsx58(Button, { variant: "ghost", size: "icon", children: /* @__PURE__ */ jsx58(Bell, { className: "h-5 w-5 text-[#1C1B1F] dark:text-gray-400" }) }),
29105
- badgeType === "number" && !(hideBadgeWhenZero && badgeCount === 0) && Number(badgeCount) > 0 ? /* @__PURE__ */ jsx58("span", { className: "absolute -top-1 -right-1 flex h-4 w-4 items-center justify-center rounded-full bg-red-500 text-[10px] text-white leading-8", children: badgeCount }) : /* @__PURE__ */ jsx58("span", { className: "absolute -top-1 -right-1 flex h-2 w-2 items-center justify-center rounded-full bg-red-500" })
29106
- ] }),
29107
- /* @__PURE__ */ jsxs33(DropdownMenu, { children: [
29108
- /* @__PURE__ */ jsx58(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs33("div", { className: "flex items-center space-x-2", children: [
29109
- !isMobileView && showName && /* @__PURE__ */ jsx58("h4", { className: "text-[#000000] dark:text-gray-300 text-[13px] font-[500] mb-0", children: userName }),
29110
- !isMobileView ? /* @__PURE__ */ jsxs33(Fragment18, { children: [
29111
- /* @__PURE__ */ jsx58(Avatar, { className: "cursor-pointer h-8 w-8 text-gray-900", children: profileType === "avatar" ? /* @__PURE__ */ jsx58(
29112
- AvatarImage,
29113
- {
29114
- src: "/images/appbuilder/toolset/profile.svg",
29115
- alt: "Profile"
29116
- }
29117
- ) : /* @__PURE__ */ jsx58("div", { className: "w-8 h-8 bg-[#12715b] rounded-full text-[#fff] text-center text-[11px] flex items-center justify-center", children: userName && getInitials(userName) }) }),
29118
- /* @__PURE__ */ jsx58(
29119
- Button,
29120
- {
29121
- variant: "ghost",
29122
- size: "icon",
29123
- className: "text-gray-900 md:hidden dark:invert",
29124
- children: /* @__PURE__ */ jsx58(Menu, { className: "h-6 w-6" })
29125
- }
29126
- )
29127
- ] }) : /* @__PURE__ */ jsx58(
29128
- Button,
29293
+ className: "w-full border-b border-b-white dark:border-b-gray-800 dark:bg-gray-800 bg-white shadow-sm",
29294
+ style,
29295
+ children: /* @__PURE__ */ jsxs34("div", { className: "mx-auto flex max-w-[90%] items-center justify-between px-4 py-4", children: [
29296
+ /* @__PURE__ */ jsx59(
29297
+ Link6,
29129
29298
  {
29130
- variant: "ghost",
29131
- size: "icon",
29132
- className: "text-gray-900 dark:invert",
29133
- children: /* @__PURE__ */ jsx58(Menu, { className: "h-6 w-6" })
29299
+ href: "/",
29300
+ onClick: (e) => handleBuilderExit(e, "/"),
29301
+ className: "flex items-center space-x-2",
29302
+ children: imageUrl ? /* @__PURE__ */ jsx59(Image3, { src: imageUrl, alt: altText, width: 200, height: 200 }) : /* @__PURE__ */ jsx59("span", { className: "font-semibold text-blue-700", children: "Logo" })
29134
29303
  }
29135
- )
29136
- ] }) }),
29137
- /* @__PURE__ */ jsxs33(DropdownMenuContent, { align: "end", className: "bg-white dark:bg-gray-800", children: [
29138
- profileMenu && profileMenu.length > 0 && /* @__PURE__ */ jsx58(Fragment18, { children: profileMenu.map((item) => /* @__PURE__ */ jsx58(DropdownMenuItem, { className: "text-black dark:invert", children: /* @__PURE__ */ jsx58(Link6, { href: item.url || "#", children: item.header }) }, item.id)) }),
29139
- /* @__PURE__ */ jsxs33("div", { className: "md:hidden", children: [
29140
- /* @__PURE__ */ jsx58(DropdownMenuSeparator, {}),
29141
- list && list.length > 0 && /* @__PURE__ */ jsx58(Fragment18, { children: list.map((item) => /* @__PURE__ */ jsx58(DropdownMenuItem, { className: "text-black dark:invert", children: /* @__PURE__ */ jsx58(Link6, { href: item.url || "#", children: item.header }) }, item.id)) })
29304
+ ),
29305
+ !isMobileView && /* @__PURE__ */ jsx59("div", { className: "flex items-center space-x-6 sm:hidden md:flex", children: formatedMenu.map((item) => /* @__PURE__ */ jsx59(
29306
+ Link6,
29307
+ {
29308
+ href: item.url || "#",
29309
+ onClick: (e) => handleBuilderExit(e, item.url),
29310
+ className: "text-sm font-medium dark:text-white text-gray-600 hover:text-gray-900 transition-colors",
29311
+ children: item.header
29312
+ },
29313
+ item.id
29314
+ )) }),
29315
+ /* @__PURE__ */ jsxs34("div", { className: "flex items-center space-x-3", children: [
29316
+ !isMobileView ? /* @__PURE__ */ jsx59("div", { className: "flex-1 px-6", children: /* @__PURE__ */ jsxs34("div", { className: "relative w-full max-w-md border border-gray-300 rounded-md", children: [
29317
+ /* @__PURE__ */ jsx59(Search, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 dark:text-white text-gray-400" }),
29318
+ /* @__PURE__ */ jsx59(Input, { placeholder: "Search", className: "pl-9 text-gray-400" })
29319
+ ] }) }) : /* @__PURE__ */ jsx59(Button, { variant: "ghost", size: "icon", className: "border border-gray-400", children: /* @__PURE__ */ jsx59(Search, { className: "h-5 w-5 text-gray-400" }) }),
29320
+ /* @__PURE__ */ jsxs34("div", { className: "relative bg-[#E9E9E9] dark:bg-gray-700 rounded-md", children: [
29321
+ /* @__PURE__ */ jsx59(Button, { variant: "ghost", size: "icon", children: /* @__PURE__ */ jsx59(Bell, { className: "h-5 w-5 text-[#1C1B1F] dark:text-gray-400" }) }),
29322
+ badgeType === "number" && !(hideBadgeWhenZero && badgeCount === 0) && Number(badgeCount) > 0 ? /* @__PURE__ */ jsx59("span", { className: "absolute -top-1 -right-1 flex h-4 w-4 items-center justify-center rounded-full bg-red-500 text-[10px] text-white leading-8", children: badgeCount }) : /* @__PURE__ */ jsx59("span", { className: "absolute -top-1 -right-1 flex h-2 w-2 items-center justify-center rounded-full bg-red-500" })
29323
+ ] }),
29324
+ /* @__PURE__ */ jsxs34(DropdownMenu, { children: [
29325
+ /* @__PURE__ */ jsx59(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs34("div", { className: "flex items-center space-x-2", children: [
29326
+ !isMobileView && showName && /* @__PURE__ */ jsx59("h4", { className: "text-[#000000] dark:text-gray-300 text-[13px] font-[500] mb-0", children: userName }),
29327
+ !isMobileView ? /* @__PURE__ */ jsxs34(Fragment19, { children: [
29328
+ /* @__PURE__ */ jsx59(Avatar, { className: "cursor-pointer h-8 w-8 text-gray-900", children: profileType === "avatar" ? /* @__PURE__ */ jsx59(
29329
+ AvatarImage,
29330
+ {
29331
+ src: "/images/appbuilder/toolset/profile.svg",
29332
+ alt: "Profile"
29333
+ }
29334
+ ) : /* @__PURE__ */ jsx59("div", { className: "w-8 h-8 bg-[#12715b] rounded-full text-[#fff] text-center text-[11px] flex items-center justify-center", children: userName && getInitials(userName) }) }),
29335
+ /* @__PURE__ */ jsx59(
29336
+ Button,
29337
+ {
29338
+ variant: "ghost",
29339
+ size: "icon",
29340
+ className: "text-gray-900 md:hidden dark:invert",
29341
+ children: /* @__PURE__ */ jsx59(Menu, { className: "h-6 w-6" })
29342
+ }
29343
+ )
29344
+ ] }) : /* @__PURE__ */ jsx59(Button, { variant: "ghost", size: "icon", className: "text-gray-900 dark:invert", children: /* @__PURE__ */ jsx59(Menu, { className: "h-6 w-6" }) })
29345
+ ] }) }),
29346
+ /* @__PURE__ */ jsxs34(DropdownMenuContent, { align: "end", className: "bg-white dark:bg-gray-800", children: [
29347
+ profileMenu && profileMenu.length > 0 && /* @__PURE__ */ jsx59(Fragment19, { children: profileMenu.map((item) => /* @__PURE__ */ jsx59(DropdownMenuItem, { className: "text-black dark:invert", children: /* @__PURE__ */ jsx59(
29348
+ Link6,
29349
+ {
29350
+ href: item.url || "#",
29351
+ onClick: (e) => handleBuilderExit(e, item.url),
29352
+ children: item.header
29353
+ }
29354
+ ) }, item.id)) }),
29355
+ /* @__PURE__ */ jsxs34("div", { className: "md:hidden", children: [
29356
+ /* @__PURE__ */ jsx59(DropdownMenuSeparator, {}),
29357
+ formatedMenu && formatedMenu.length > 0 && /* @__PURE__ */ jsx59(Fragment19, { children: formatedMenu.map((item) => /* @__PURE__ */ jsx59(DropdownMenuItem, { className: "text-black dark:invert", children: /* @__PURE__ */ jsx59(
29358
+ Link6,
29359
+ {
29360
+ href: item.url || "#",
29361
+ onClick: (e) => handleBuilderExit(e, item.url),
29362
+ children: item.header
29363
+ }
29364
+ ) }, item.id)) })
29365
+ ] })
29366
+ ] })
29367
+ ] })
29142
29368
  ] })
29143
29369
  ] })
29370
+ }
29371
+ ),
29372
+ /* @__PURE__ */ jsx59(Dialog, { open: showExitDialog, onOpenChange: setShowExitDialog, children: /* @__PURE__ */ jsxs34(DialogContent, { className: "bg-[#fff]", children: [
29373
+ /* @__PURE__ */ jsxs34(DialogHeader, { children: [
29374
+ /* @__PURE__ */ jsx59(DialogTitle, { children: "Exit Builder?" }),
29375
+ /* @__PURE__ */ jsx59(DialogDescription, { children: "You are about to leave the builder. Any unsaved changes may be lost." })
29376
+ ] }),
29377
+ /* @__PURE__ */ jsxs34(DialogFooter, { children: [
29378
+ /* @__PURE__ */ jsx59(Button, { className: "cursor-pointer bg-[#12715b] text-[#fff]", variant: "outline", onClick: () => setShowExitDialog(false), children: "Cancel" }),
29379
+ /* @__PURE__ */ jsx59(Button, { className: "cursor-pointer border-[#12715b] border", onClick: confirmExit, children: "Yes, Exit" })
29144
29380
  ] })
29145
- ] })
29146
- ] }) });
29381
+ ] }) })
29382
+ ] });
29147
29383
  }
29148
29384
 
29149
29385
  // src/components/Chart/BarChart.tsx
@@ -29160,35 +29396,35 @@ import {
29160
29396
  ResponsiveContainer,
29161
29397
  Legend
29162
29398
  } from "recharts";
29163
- import { jsx as jsx59, jsxs as jsxs34 } from "react/jsx-runtime";
29399
+ import { jsx as jsx60, jsxs as jsxs35 } from "react/jsx-runtime";
29164
29400
  var ChartComponent = ({ className, style, loading, ...props }) => {
29165
29401
  const data = Array.isArray(props.data) ? props.data : [];
29166
29402
  const chartType = props.chartType || "bar";
29167
29403
  const legendsPosition = props.legendsPosition === "middle" || props.legendsPosition === "bottom" ? props.legendsPosition : "top";
29168
29404
  if (loading || data.length === 0) {
29169
- return /* @__PURE__ */ jsx59(
29405
+ return /* @__PURE__ */ jsx60(
29170
29406
  "div",
29171
29407
  {
29172
29408
  className: `flex items-center justify-center w-full h-[300px] md:h-[400px] bg-gray-50 animate-pulse rounded-lg ${className}`,
29173
29409
  style,
29174
- children: /* @__PURE__ */ jsx59("div", { className: "text-gray-400 text-sm md:text-base", children: loading ? "Loading chart report..." : "No data available to display the chart." })
29410
+ children: /* @__PURE__ */ jsx60("div", { className: "text-gray-400 text-sm md:text-base", children: loading ? "Loading chart report..." : "No data available to display the chart." })
29175
29411
  }
29176
29412
  );
29177
29413
  }
29178
- return /* @__PURE__ */ jsx59("div", { className: `${className} h-[400px]`, style, children: /* @__PURE__ */ jsx59(ResponsiveContainer, { width: "100%", height: "100%", children: chartType === "bar" ? /* @__PURE__ */ jsxs34(BarChart, { data, title: "Leads", desc: "content", children: [
29179
- /* @__PURE__ */ jsx59(CartesianGrid, { strokeDasharray: "3 3" }),
29180
- /* @__PURE__ */ jsx59(XAxis, { dataKey: "name" }),
29181
- /* @__PURE__ */ jsx59(YAxis, {}),
29182
- /* @__PURE__ */ jsx59(Tooltip, { formatter: (value) => `${value}k` }),
29183
- /* @__PURE__ */ jsx59(Legend, { verticalAlign: legendsPosition, align: "center" }),
29184
- /* @__PURE__ */ jsx59(
29414
+ return /* @__PURE__ */ jsx60("div", { className: `${className} h-[400px]`, style, children: /* @__PURE__ */ jsx60(ResponsiveContainer, { width: "100%", height: "100%", children: chartType === "bar" ? /* @__PURE__ */ jsxs35(BarChart, { data, title: "Leads", desc: "content", children: [
29415
+ /* @__PURE__ */ jsx60(CartesianGrid, { strokeDasharray: "3 3" }),
29416
+ /* @__PURE__ */ jsx60(XAxis, { dataKey: "name" }),
29417
+ /* @__PURE__ */ jsx60(YAxis, {}),
29418
+ /* @__PURE__ */ jsx60(Tooltip, { formatter: (value) => `${value}k` }),
29419
+ /* @__PURE__ */ jsx60(Legend, { verticalAlign: legendsPosition, align: "center" }),
29420
+ /* @__PURE__ */ jsx60(
29185
29421
  Bar,
29186
29422
  {
29187
29423
  dataKey: "value",
29188
29424
  fill: "#00695C",
29189
29425
  radius: [6, 6, 0, 0],
29190
29426
  isAnimationActive: false,
29191
- children: data.map((entry, index) => /* @__PURE__ */ jsx59(
29427
+ children: data.map((entry, index) => /* @__PURE__ */ jsx60(
29192
29428
  "rect",
29193
29429
  {
29194
29430
  fill: entry.color || "#00695C"
@@ -29197,16 +29433,16 @@ var ChartComponent = ({ className, style, loading, ...props }) => {
29197
29433
  ))
29198
29434
  }
29199
29435
  )
29200
- ] }) : /* @__PURE__ */ jsxs34(AreaChart, { data, children: [
29201
- /* @__PURE__ */ jsx59("defs", { children: /* @__PURE__ */ jsxs34("linearGradient", { id: "colorCount", x1: "0", y1: "0", x2: "0", y2: "1", children: [
29202
- /* @__PURE__ */ jsx59("stop", { offset: "5%", stopColor: "#00695C", stopOpacity: 0.8 }),
29203
- /* @__PURE__ */ jsx59("stop", { offset: "95%", stopColor: "#00695C", stopOpacity: 0 })
29436
+ ] }) : /* @__PURE__ */ jsxs35(AreaChart, { data, children: [
29437
+ /* @__PURE__ */ jsx60("defs", { children: /* @__PURE__ */ jsxs35("linearGradient", { id: "colorCount", x1: "0", y1: "0", x2: "0", y2: "1", children: [
29438
+ /* @__PURE__ */ jsx60("stop", { offset: "5%", stopColor: "#00695C", stopOpacity: 0.8 }),
29439
+ /* @__PURE__ */ jsx60("stop", { offset: "95%", stopColor: "#00695C", stopOpacity: 0 })
29204
29440
  ] }) }),
29205
- /* @__PURE__ */ jsx59(CartesianGrid, { strokeDasharray: "3 3" }),
29206
- /* @__PURE__ */ jsx59(XAxis, { dataKey: "name" }),
29207
- /* @__PURE__ */ jsx59(YAxis, {}),
29208
- /* @__PURE__ */ jsx59(Tooltip, { formatter: (value) => `${value}k` }),
29209
- /* @__PURE__ */ jsx59(
29441
+ /* @__PURE__ */ jsx60(CartesianGrid, { strokeDasharray: "3 3" }),
29442
+ /* @__PURE__ */ jsx60(XAxis, { dataKey: "name" }),
29443
+ /* @__PURE__ */ jsx60(YAxis, {}),
29444
+ /* @__PURE__ */ jsx60(Tooltip, { formatter: (value) => `${value}k` }),
29445
+ /* @__PURE__ */ jsx60(
29210
29446
  Area,
29211
29447
  {
29212
29448
  type: "monotone",
@@ -29222,7 +29458,7 @@ var ChartComponent = ({ className, style, loading, ...props }) => {
29222
29458
  var BarChart_default = React10.memo(ChartComponent);
29223
29459
 
29224
29460
  // src/components/Chart/PieChart.tsx
29225
- import React11, { useMemo as useMemo3 } from "react";
29461
+ import React11, { useEffect as useEffect22, useMemo as useMemo4, useState as useState7 } from "react";
29226
29462
  import {
29227
29463
  PieChart,
29228
29464
  Pie,
@@ -29231,7 +29467,7 @@ import {
29231
29467
  Tooltip as Tooltip2,
29232
29468
  LabelList
29233
29469
  } from "recharts";
29234
- import { Fragment as Fragment19, jsx as jsx60, jsxs as jsxs35 } from "react/jsx-runtime";
29470
+ import { Fragment as Fragment20, jsx as jsx61, jsxs as jsxs36 } from "react/jsx-runtime";
29235
29471
  var getRandomColor = () => {
29236
29472
  const palette = [
29237
29473
  "#2563eb",
@@ -29251,51 +29487,57 @@ var DonutChart = ({ className, style, loading, ...props }) => {
29251
29487
  const showLegends = props.showLegends ?? true;
29252
29488
  const labelType = props.labelType || "inside";
29253
29489
  const canvasMode = props.canvasMode;
29254
- const data = useMemo3(() => {
29490
+ const data = useMemo4(() => {
29255
29491
  if (!Array.isArray(props.data)) return [];
29256
29492
  return props.data.map((item) => ({ ...item, color: getRandomColor() }));
29257
29493
  }, [props.data]);
29258
- const total = useMemo3(() => data.reduce((sum, d) => sum + d.value, 0), [data]);
29494
+ const total = useMemo4(() => data.reduce((sum, d) => sum + d.value, 0), [data]);
29259
29495
  const forceMobile = canvasMode === "mobile" || canvasMode === "tablet";
29260
- const renderLegends = useMemo3(() => {
29496
+ const [mounted, setMounted] = useState7(false);
29497
+ useEffect22(() => {
29498
+ const timeout = setTimeout(() => setMounted(true), 100);
29499
+ return () => clearTimeout(timeout);
29500
+ }, []);
29501
+ const renderLegends = useMemo4(() => {
29261
29502
  if (!showLegends) return null;
29262
- return /* @__PURE__ */ jsx60(Fragment19, { children: data.map((d) => /* @__PURE__ */ jsxs35(
29503
+ return /* @__PURE__ */ jsx61(Fragment20, { children: data.map((d) => /* @__PURE__ */ jsxs36(
29263
29504
  "div",
29264
29505
  {
29265
29506
  className: "flex items-center space-x-2 rounded-md border border-gray-200 px-3 py-2 w-[48%] md:w-auto",
29266
29507
  children: [
29267
- /* @__PURE__ */ jsx60(
29508
+ /* @__PURE__ */ jsx61(
29268
29509
  "span",
29269
29510
  {
29270
29511
  className: "inline-block w-[16px] h-[16px] rounded",
29271
29512
  style: { backgroundColor: d.color }
29272
29513
  }
29273
29514
  ),
29274
- /* @__PURE__ */ jsx60("span", { className: "text-[#000000] text-[12px] md:text-[13px] font-[500]", children: d.name })
29515
+ /* @__PURE__ */ jsx61("span", { className: "text-[#000000] text-[12px] md:text-[13px] font-[500]", children: d.name })
29275
29516
  ]
29276
29517
  },
29277
29518
  d.name
29278
29519
  )) });
29279
29520
  }, [data, showLegends]);
29521
+ if (!mounted) return null;
29280
29522
  if (loading || data.length === 0) {
29281
- return /* @__PURE__ */ jsx60(
29523
+ return /* @__PURE__ */ jsx61(
29282
29524
  "div",
29283
29525
  {
29284
29526
  className: `flex items-center justify-center w-full h-[300px] md:h-[400px] bg-gray-50 animate-pulse rounded-lg ${className}`,
29285
29527
  style,
29286
- children: /* @__PURE__ */ jsx60("div", { className: "text-gray-400 text-sm md:text-base", children: loading ? "Loading chart report..." : "No data available to display the chart." })
29528
+ children: /* @__PURE__ */ jsx61("div", { className: "text-gray-400 text-sm md:text-base", children: loading ? "Loading chart report..." : "No data available to display the chart." })
29287
29529
  }
29288
29530
  );
29289
29531
  }
29290
- return /* @__PURE__ */ jsxs35(
29532
+ return /* @__PURE__ */ jsxs36(
29291
29533
  "div",
29292
29534
  {
29293
29535
  className: `relative flex flex-col items-center ${className}`,
29294
29536
  style,
29295
29537
  children: [
29296
- /* @__PURE__ */ jsxs35("div", { className: "relative w-full md:w-[70%] h-[300px] md:h-[400px] flex items-center justify-center", children: [
29297
- /* @__PURE__ */ jsx60(ResponsiveContainer2, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxs35(PieChart, { children: [
29298
- /* @__PURE__ */ jsxs35(
29538
+ /* @__PURE__ */ jsxs36("div", { className: "relative w-full md:w-[70%] h-[300px] md:h-[400px] flex items-center justify-center", children: [
29539
+ /* @__PURE__ */ jsx61(ResponsiveContainer2, { width: "99%", height: "100%", children: /* @__PURE__ */ jsxs36(PieChart, { children: [
29540
+ /* @__PURE__ */ jsxs36(
29299
29541
  Pie,
29300
29542
  {
29301
29543
  data,
@@ -29307,8 +29549,8 @@ var DonutChart = ({ className, style, loading, ...props }) => {
29307
29549
  labelLine: false,
29308
29550
  isAnimationActive: false,
29309
29551
  children: [
29310
- data.map((entry, index) => /* @__PURE__ */ jsx60(Cell, { fill: entry.color }, `cell-${index}`)),
29311
- /* @__PURE__ */ jsx60(
29552
+ data.map((entry, index) => /* @__PURE__ */ jsx61(Cell, { fill: entry.color }, `cell-${index}`)),
29553
+ /* @__PURE__ */ jsx61(
29312
29554
  LabelList,
29313
29555
  {
29314
29556
  dataKey: "value",
@@ -29321,14 +29563,14 @@ var DonutChart = ({ className, style, loading, ...props }) => {
29321
29563
  ]
29322
29564
  }
29323
29565
  ),
29324
- /* @__PURE__ */ jsx60(
29566
+ /* @__PURE__ */ jsx61(
29325
29567
  Tooltip2,
29326
29568
  {
29327
29569
  formatter: (value, name) => [`${value}k`, name]
29328
29570
  }
29329
29571
  )
29330
29572
  ] }) }),
29331
- /* @__PURE__ */ jsxs35(
29573
+ /* @__PURE__ */ jsxs36(
29332
29574
  "div",
29333
29575
  {
29334
29576
  className: `absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 ${forceMobile ? "text-2xl" : "text-4xl"} font-bold text-[#000]`,
@@ -29339,7 +29581,7 @@ var DonutChart = ({ className, style, loading, ...props }) => {
29339
29581
  }
29340
29582
  )
29341
29583
  ] }),
29342
- /* @__PURE__ */ jsx60("div", { className: "flex flex-wrap justify-center gap-2 mt-6 w-full md:w-auto", children: renderLegends })
29584
+ /* @__PURE__ */ jsx61("div", { className: "flex flex-wrap justify-center gap-2 mt-6 w-full md:w-auto", children: renderLegends })
29343
29585
  ]
29344
29586
  }
29345
29587
  );
@@ -29347,10 +29589,10 @@ var DonutChart = ({ className, style, loading, ...props }) => {
29347
29589
  var PieChart_default = React11.memo(DonutChart);
29348
29590
 
29349
29591
  // src/components/Blocks/EmailComposer.tsx
29350
- import { jsx as jsx61, jsxs as jsxs36 } from "react/jsx-runtime";
29592
+ import { jsx as jsx62, jsxs as jsxs37 } from "react/jsx-runtime";
29351
29593
  function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc, setShowBcc, cc, setCc, bcc, setBcc, subject, setSubject, body, setBody }) {
29352
- return /* @__PURE__ */ jsx61("div", { className, style, children: /* @__PURE__ */ jsxs36("div", { className: "border rounded-md shadow bg-[#fff] p-4 mx-auto z-[50] relative", children: [
29353
- /* @__PURE__ */ jsx61("div", { className: "mb-3", children: /* @__PURE__ */ jsx61(
29594
+ return /* @__PURE__ */ jsx62("div", { className, style, children: /* @__PURE__ */ jsxs37("div", { className: "border rounded-md shadow bg-[#fff] p-4 mx-auto z-[50] relative", children: [
29595
+ /* @__PURE__ */ jsx62("div", { className: "mb-3", children: /* @__PURE__ */ jsx62(
29354
29596
  "input",
29355
29597
  {
29356
29598
  type: "email",
@@ -29359,8 +29601,8 @@ function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc
29359
29601
  required: true
29360
29602
  }
29361
29603
  ) }),
29362
- /* @__PURE__ */ jsx61("div", { className: "mb-3", children: /* @__PURE__ */ jsxs36("div", { className: "flex items-center gap-2", children: [
29363
- /* @__PURE__ */ jsx61(
29604
+ /* @__PURE__ */ jsx62("div", { className: "mb-3", children: /* @__PURE__ */ jsxs37("div", { className: "flex items-center gap-2", children: [
29605
+ /* @__PURE__ */ jsx62(
29364
29606
  "input",
29365
29607
  {
29366
29608
  type: "email",
@@ -29371,7 +29613,7 @@ function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc
29371
29613
  required: true
29372
29614
  }
29373
29615
  ),
29374
- !showCc && /* @__PURE__ */ jsx61(
29616
+ !showCc && /* @__PURE__ */ jsx62(
29375
29617
  "button",
29376
29618
  {
29377
29619
  onClick: () => setShowCc?.(true),
@@ -29379,7 +29621,7 @@ function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc
29379
29621
  children: "Cc"
29380
29622
  }
29381
29623
  ),
29382
- !showBcc && /* @__PURE__ */ jsx61(
29624
+ !showBcc && /* @__PURE__ */ jsx62(
29383
29625
  "button",
29384
29626
  {
29385
29627
  onClick: () => setShowBcc?.(true),
@@ -29388,7 +29630,7 @@ function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc
29388
29630
  }
29389
29631
  )
29390
29632
  ] }) }),
29391
- showCc && /* @__PURE__ */ jsx61("div", { className: "mb-3", children: /* @__PURE__ */ jsx61(
29633
+ showCc && /* @__PURE__ */ jsx62("div", { className: "mb-3", children: /* @__PURE__ */ jsx62(
29392
29634
  "input",
29393
29635
  {
29394
29636
  type: "text",
@@ -29398,7 +29640,7 @@ function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc
29398
29640
  className: "w-full flex-1 border-2 rounded-md h-[40px] px-3 focus:outline-none border-[#E9E9E9] text-[#383838]"
29399
29641
  }
29400
29642
  ) }),
29401
- showBcc && /* @__PURE__ */ jsx61("div", { className: "mb-3", children: /* @__PURE__ */ jsx61(
29643
+ showBcc && /* @__PURE__ */ jsx62("div", { className: "mb-3", children: /* @__PURE__ */ jsx62(
29402
29644
  "input",
29403
29645
  {
29404
29646
  type: "text",
@@ -29408,7 +29650,7 @@ function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc
29408
29650
  className: "w-full flex-1 border-2 rounded-md h-[40px] px-3 focus:outline-none border-[#E9E9E9] text-[#383838]"
29409
29651
  }
29410
29652
  ) }),
29411
- /* @__PURE__ */ jsx61("div", { className: "mb-3", children: /* @__PURE__ */ jsx61(
29653
+ /* @__PURE__ */ jsx62("div", { className: "mb-3", children: /* @__PURE__ */ jsx62(
29412
29654
  "input",
29413
29655
  {
29414
29656
  type: "text",
@@ -29418,11 +29660,11 @@ function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc
29418
29660
  className: "w-full flex-1 border-2 rounded-md h-[40px] px-3 focus:outline-none border-[#E9E9E9] text-[#383838]"
29419
29661
  }
29420
29662
  ) }),
29421
- /* @__PURE__ */ jsx61("div", { className: "mb-4", children: /* @__PURE__ */ jsx61(MyEditor, { value: body, onChange: setBody }) }),
29422
- /* @__PURE__ */ jsxs36("div", { className: "flex justify-end gap-2", children: [
29423
- /* @__PURE__ */ jsx61("button", { className: "px-4 py-2 rounded-md text-gray-600 hover:bg-gray-100", children: "Discard" }),
29424
- /* @__PURE__ */ jsx61("button", { className: "px-4 py-2 rounded-md border text-[#12715B] border-[#12715B]", children: "Reset" }),
29425
- /* @__PURE__ */ jsx61("button", { className: "px-4 py-2 rounded-md bg-[#12715B] text-white", children: "Send" })
29663
+ /* @__PURE__ */ jsx62("div", { className: "mb-4", children: /* @__PURE__ */ jsx62(MyEditor, { value: body, onChange: setBody }) }),
29664
+ /* @__PURE__ */ jsxs37("div", { className: "flex justify-end gap-2", children: [
29665
+ /* @__PURE__ */ jsx62("button", { className: "px-4 py-2 rounded-md text-gray-600 hover:bg-gray-100", children: "Discard" }),
29666
+ /* @__PURE__ */ jsx62("button", { className: "px-4 py-2 rounded-md border text-[#12715B] border-[#12715B]", children: "Reset" }),
29667
+ /* @__PURE__ */ jsx62("button", { className: "px-4 py-2 rounded-md bg-[#12715B] text-white", children: "Send" })
29426
29668
  ] })
29427
29669
  ] }) });
29428
29670
  }
@@ -29467,10 +29709,10 @@ function showSonnerToast({
29467
29709
  // src/components/ui/sonner.tsx
29468
29710
  import { useTheme } from "next-themes";
29469
29711
  import { Toaster as Sonner } from "sonner";
29470
- import { jsx as jsx62 } from "react/jsx-runtime";
29712
+ import { jsx as jsx63 } from "react/jsx-runtime";
29471
29713
  var Toaster = ({ ...props }) => {
29472
29714
  const { theme = "system" } = useTheme();
29473
- return /* @__PURE__ */ jsx62(
29715
+ return /* @__PURE__ */ jsx63(
29474
29716
  Sonner,
29475
29717
  {
29476
29718
  theme,