@algorithm-shift/design-system 1.2.986 → 1.2.988

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
@@ -350,7 +350,7 @@ function useFileService(options) {
350
350
  formData.append(key, value);
351
351
  });
352
352
  const axiosClient = options.axiosInstance ?? axios;
353
- const apiUrl = "/fileservice/upload";
353
+ const apiUrl = options.apiUrl ?? "/fileservice/upload";
354
354
  const result = await axiosClient.post(`${apiUrl}`, formData, {
355
355
  withCredentials: true
356
356
  });
@@ -422,6 +422,7 @@ var ImageControl = ({
422
422
  style,
423
423
  imageUrl,
424
424
  altText = "Preview",
425
+ apiUrl,
425
426
  ...props
426
427
  }) => {
427
428
  const defaultImgClass = cn(
@@ -438,6 +439,7 @@ var ImageControl = ({
438
439
  };
439
440
  const { uploadFile } = useFileService({
440
441
  axiosInstance: props.axiosInstance,
442
+ apiUrl,
441
443
  onSuccess: async (result) => {
442
444
  if (!result?.data?.url && !props.onSuccess) return;
443
445
  props.onSuccess?.({ url: result.data.url || "", fileName: result.data.originalname || "" });
@@ -5053,7 +5055,7 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
5053
5055
  var Tabs_default = Tabs;
5054
5056
 
5055
5057
  // src/components/Navigation/Stages/Stages.tsx
5056
- import React11, { useState as useState13 } from "react";
5058
+ import React11, { useEffect as useEffect26, useState as useState13 } from "react";
5057
5059
  import { jsx as jsx60, jsxs as jsxs37 } from "react/jsx-runtime";
5058
5060
  var StagesComponent = ({
5059
5061
  stages,
@@ -5070,8 +5072,15 @@ var StagesComponent = ({
5070
5072
  triggerOnClick = false,
5071
5073
  canvasMode = "desktop"
5072
5074
  }) => {
5073
- const [activeStage, setActiveStage] = useState13(currentStage || (stages && stages.length > 0 ? stages[0][dataKey] : null));
5075
+ const [activeStage, setActiveStage] = useState13("");
5074
5076
  const [isCompleted, setIsCompleted] = useState13(false);
5077
+ useEffect26(() => {
5078
+ if (currentStage) {
5079
+ setActiveStage(currentStage);
5080
+ } else {
5081
+ setActiveStage(stages && stages.length > 0 ? stages[0][dataKey] : null);
5082
+ }
5083
+ }, [currentStage]);
5075
5084
  const updateStage = (stageKey) => {
5076
5085
  setActiveStage(stageKey);
5077
5086
  onStageChange?.(stageKey);
@@ -5086,7 +5095,7 @@ var StagesComponent = ({
5086
5095
  return;
5087
5096
  }
5088
5097
  if (currentIndex < stages.length - 1) {
5089
- const nextStageObj = stages[currentIndex + 1];
5098
+ const nextStageObj = stages[currentIndex];
5090
5099
  updateStage(nextStageObj[dataKey]);
5091
5100
  return;
5092
5101
  }
@@ -5207,7 +5216,7 @@ import { jsx as jsx63, jsxs as jsxs39 } from "react/jsx-runtime";
5207
5216
  import { jsx as jsx64 } from "react/jsx-runtime";
5208
5217
 
5209
5218
  // src/components/Navigation/Navbar/Navbar.tsx
5210
- import { useCallback as useCallback4, useMemo as useMemo9, useState as useState14, useEffect as useEffect26 } from "react";
5219
+ import { useCallback as useCallback4, useMemo as useMemo9, useState as useState14, useEffect as useEffect27 } from "react";
5211
5220
  import { Bell, Search as Search2, Menu as Menu2 } from "lucide-react";
5212
5221
  import Image3 from "next/image";
5213
5222
  import Link4 from "next/link";
@@ -5276,7 +5285,7 @@ function Navbar({
5276
5285
  const [screenMode, setScreenMode] = useState14(
5277
5286
  canvasMode
5278
5287
  );
5279
- useEffect26(() => {
5288
+ useEffect27(() => {
5280
5289
  const detectMode = () => {
5281
5290
  if (window.innerWidth < 640) setScreenMode("mobile");
5282
5291
  else if (window.innerWidth < 1024) setScreenMode("tablet");
@@ -5383,7 +5392,7 @@ function Navbar({
5383
5392
  }
5384
5393
 
5385
5394
  // src/components/Chart/BarChart.tsx
5386
- import React13, { useEffect as useEffect27, useMemo as useMemo10, useState as useState15, useCallback as useCallback5 } from "react";
5395
+ import React13, { useEffect as useEffect28, useMemo as useMemo10, useState as useState15, useCallback as useCallback5 } from "react";
5387
5396
  import axios3 from "axios";
5388
5397
  import {
5389
5398
  BarChart,
@@ -5461,7 +5470,7 @@ var ChartComponent = ({
5461
5470
  const [currentPage, setCurrentPage] = useState15(1);
5462
5471
  const effectiveData = apiUrl ? rawData : props.data || [];
5463
5472
  const effectiveLoading = apiUrl ? localLoading : externalLoading;
5464
- useEffect27(() => {
5473
+ useEffect28(() => {
5465
5474
  if (apiUrl) {
5466
5475
  setCurrentPage(1);
5467
5476
  }
@@ -5503,7 +5512,7 @@ var ChartComponent = ({
5503
5512
  if (!cancelled) setLocalLoading(false);
5504
5513
  }
5505
5514
  }, [apiUrl, limit]);
5506
- useEffect27(() => {
5515
+ useEffect28(() => {
5507
5516
  if (!apiUrl) return;
5508
5517
  fetchData(currentPage);
5509
5518
  }, [apiUrl, currentPage, fetchData]);
@@ -5702,7 +5711,7 @@ var ChartComponent = ({
5702
5711
  var BarChart_default = React13.memo(ChartComponent);
5703
5712
 
5704
5713
  // src/components/Chart/PieChart.tsx
5705
- import React14, { useEffect as useEffect28, useMemo as useMemo11, useState as useState16 } from "react";
5714
+ import React14, { useEffect as useEffect29, useMemo as useMemo11, useState as useState16 } from "react";
5706
5715
  import axios4 from "axios";
5707
5716
  import {
5708
5717
  PieChart,
@@ -5792,7 +5801,7 @@ var DonutChart = ({
5792
5801
  const [localLoading, setLocalLoading] = useState16(false);
5793
5802
  const effectiveData = apiUrl ? rawData : props.data || [];
5794
5803
  const effectiveLoading = apiUrl ? localLoading : externalLoading;
5795
- useEffect28(() => {
5804
+ useEffect29(() => {
5796
5805
  if (!apiUrl) return;
5797
5806
  let cancelled = false;
5798
5807
  const fetchData = async () => {
@@ -5874,7 +5883,7 @@ var DonutChart = ({
5874
5883
  return { inner: 70, outer: 130 };
5875
5884
  };
5876
5885
  const [mounted, setMounted] = useState16(false);
5877
- useEffect28(() => {
5886
+ useEffect29(() => {
5878
5887
  const timeout = setTimeout(() => setMounted(true), 100);
5879
5888
  return () => clearTimeout(timeout);
5880
5889
  }, []);