@algorithm-shift/design-system 1.2.87 → 1.2.88

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
@@ -30035,29 +30035,44 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
30035
30035
  var Tabs_default = Tabs;
30036
30036
 
30037
30037
  // src/components/Navigation/Stages/Stages.tsx
30038
- import React10 from "react";
30038
+ import React10, { useState as useState9 } from "react";
30039
30039
  import { jsx as jsx58, jsxs as jsxs35 } from "react/jsx-runtime";
30040
- var StagesComponent = ({ stages, isShowBtn, buttonText, className, style, onStageChange, currentStage }) => {
30040
+ var StagesComponent = ({ stages, isShowBtn, buttonText, className, style, onStageChange, currentStage, dataKey = "key", dataLabel = "header" }) => {
30041
+ const [activeStage, setActiveStage] = useState9(currentStage || (stages && stages.length > 0 ? stages[0].key : null));
30042
+ const nextStage = () => {
30043
+ if (!stages || stages.length === 0) return;
30044
+ const currentIndex = stages.findIndex((stage) => stage[dataKey] === activeStage);
30045
+ if (currentIndex < stages.length - 1) {
30046
+ const newStage = stages[currentIndex + 1];
30047
+ setActiveStage(newStage[dataKey]);
30048
+ onStageChange?.(newStage[dataKey]);
30049
+ }
30050
+ };
30051
+ const lastStage = stages && stages.length > 0 ? stages[stages.length - 1][dataKey] : null;
30052
+ const onStageClick = (stageKey) => {
30053
+ if (!stageKey || stageKey === activeStage || activeStage === lastStage) return;
30054
+ setActiveStage(stageKey);
30055
+ onStageChange?.(stageKey);
30056
+ };
30057
+ const isAllStagesCompleted = activeStage === lastStage;
30041
30058
  return /* @__PURE__ */ jsx58("div", { className, style, children: /* @__PURE__ */ jsxs35("div", { className: "flex items-center justify-between bg-red p-2 rounded-lg border border-gray-200 w-full", children: [
30042
30059
  /* @__PURE__ */ jsx58("div", { className: "flex items-center", children: /* @__PURE__ */ jsx58("button", { className: "p-2 hover:bg-gray-100 rounded", children: /* @__PURE__ */ jsx58("svg", { className: "w-4 h-4 text-gray-600", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx58("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" }) }) }) }),
30043
30060
  /* @__PURE__ */ jsx58("div", { className: "flex items-center flex-1 px-2 flex-wrap gap-2", children: stages?.length > 0 && stages?.map((stage, index) => {
30044
- const currentIndex = stages.findIndex((s) => s.key === currentStage);
30045
- const isAllCompleted = currentStage === "completed";
30046
- const isCompleted = isAllCompleted || index < currentIndex;
30047
- const isActive = !isAllCompleted && index === currentIndex;
30061
+ const currentIndex = stages.findIndex((s) => s[dataKey] === activeStage);
30062
+ const isCompleted = isAllStagesCompleted || index < currentIndex;
30063
+ const isActive = !isAllStagesCompleted && index === currentIndex;
30048
30064
  return /* @__PURE__ */ jsxs35(React10.Fragment, { children: [
30049
30065
  /* @__PURE__ */ jsx58(
30050
30066
  "button",
30051
30067
  {
30052
30068
  className: `
30053
30069
  min-w-[120px] px-4 py-2 rounded-full text-sm font-medium transition-colors duration-200 whitespace-nowrap
30054
- ${isActive ? "bg-[#034486] text-white shadow-md" : isCompleted ? "bg-[#e0f2fe] text-[#034486] border border-[#034486]" : "bg-white text-gray-700 hover:bg-gray-100 border border-gray-200"}`,
30070
+ ${isActive ? "bg-green-700 text-white shadow-md" : isCompleted ? "bg-green-50 text-green-700 border border-green-700" : "bg-white text-gray-700 hover:bg-gray-100 border border-gray-200"}`,
30055
30071
  onClick: () => {
30056
- if (onStageChange) {
30057
- onStageChange(stage.key);
30058
- }
30072
+ if (isAllStagesCompleted) return;
30073
+ onStageClick(stage[dataKey]);
30059
30074
  },
30060
- children: stage.header
30075
+ children: stage[dataLabel]
30061
30076
  }
30062
30077
  ),
30063
30078
  index < stages.length - 1 && /* @__PURE__ */ jsx58("div", { className: "flex-shrink-0 w-3 h-px bg-gray-300" })
@@ -30066,9 +30081,9 @@ var StagesComponent = ({ stages, isShowBtn, buttonText, className, style, onStag
30066
30081
  isShowBtn && /* @__PURE__ */ jsx58("div", { className: "flex items-center", children: /* @__PURE__ */ jsx58(
30067
30082
  "button",
30068
30083
  {
30069
- className: "bg-[#034486] text-white px-6 py-2 rounded-lg text-sm font-medium transition-colors duration-200 shadow-sm",
30084
+ className: "bg-green-700 text-white px-6 py-2 rounded-lg text-sm font-medium transition-colors duration-200 shadow-sm",
30070
30085
  onClick: () => {
30071
- onStageChange?.("completed");
30086
+ nextStage();
30072
30087
  },
30073
30088
  children: buttonText
30074
30089
  }
@@ -30136,7 +30151,7 @@ import Link6 from "next/link";
30136
30151
  import Image4 from "next/image";
30137
30152
  import { useRouter as useRouter2 } from "next/navigation";
30138
30153
  import { DropdownMenuSeparator } from "@radix-ui/react-dropdown-menu";
30139
- import { useCallback as useCallback4, useMemo as useMemo5, useState as useState9 } from "react";
30154
+ import { useCallback as useCallback4, useMemo as useMemo5, useState as useState10 } from "react";
30140
30155
  import { Fragment as Fragment22, jsx as jsx64, jsxs as jsxs38 } from "react/jsx-runtime";
30141
30156
  function Navbar({
30142
30157
  style,
@@ -30157,8 +30172,8 @@ function Navbar({
30157
30172
  }) {
30158
30173
  const isMobileView = canvasMode === "mobile" || canvasMode === "tablet";
30159
30174
  const router = useRouter2();
30160
- const [showExitDialog, setShowExitDialog] = useState9(false);
30161
- const [pendingUrl, setPendingUrl] = useState9(null);
30175
+ const [showExitDialog, setShowExitDialog] = useState10(false);
30176
+ const [pendingUrl, setPendingUrl] = useState10(null);
30162
30177
  const handleBuilderExit = useCallback4(
30163
30178
  (e, url) => {
30164
30179
  if (isBuilder) {
@@ -30353,7 +30368,7 @@ var ChartComponent = ({ className, style, loading, ...props }) => {
30353
30368
  var BarChart_default = React12.memo(ChartComponent);
30354
30369
 
30355
30370
  // src/components/Chart/PieChart.tsx
30356
- import React13, { useEffect as useEffect25, useMemo as useMemo6, useState as useState10 } from "react";
30371
+ import React13, { useEffect as useEffect25, useMemo as useMemo6, useState as useState11 } from "react";
30357
30372
  import {
30358
30373
  PieChart,
30359
30374
  Pie,
@@ -30388,7 +30403,7 @@ var DonutChart = ({ className, style, loading, ...props }) => {
30388
30403
  }, [props.data]);
30389
30404
  const total = useMemo6(() => data.reduce((sum, d) => sum + d.value, 0), [data]);
30390
30405
  const forceMobile = canvasMode === "mobile" || canvasMode === "tablet";
30391
- const [mounted, setMounted] = useState10(false);
30406
+ const [mounted, setMounted] = useState11(false);
30392
30407
  useEffect25(() => {
30393
30408
  const timeout = setTimeout(() => setMounted(true), 100);
30394
30409
  return () => clearTimeout(timeout);