@algorithm-shift/design-system 1.2.985 → 1.2.987

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
@@ -22,6 +22,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
22
22
  function Modal({
23
23
  isOpen,
24
24
  onModalClose,
25
+ onModalOpen,
25
26
  title,
26
27
  children,
27
28
  size = "md",
@@ -29,6 +30,11 @@ function Modal({
29
30
  className = "",
30
31
  style = {}
31
32
  }) {
33
+ useEffect(() => {
34
+ if (isOpen && onModalOpen) {
35
+ onModalOpen();
36
+ }
37
+ }, [isOpen]);
32
38
  useEffect(() => {
33
39
  const handleEscape = (e) => {
34
40
  if (e.key === "Escape") {
@@ -550,6 +556,7 @@ var Breadcrumb_default = Breadcrumb;
550
556
 
551
557
  // src/components/Basic/ButtonGroup/ButtonGroup.tsx
552
558
  import { ChevronDown } from "lucide-react";
559
+ import Link2 from "next/link";
553
560
 
554
561
  // src/components/ui/dropdown-menu.tsx
555
562
  import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
@@ -668,9 +675,9 @@ function DropdownMenuSubContent({
668
675
  }
669
676
 
670
677
  // src/components/Basic/ButtonGroup/ButtonGroup.tsx
671
- import Link2 from "next/link";
672
678
  import { jsx as jsx17, jsxs as jsxs7 } from "react/jsx-runtime";
673
- function SplitButton({ style, textContent, className, list = [] }) {
679
+ function ButtonGroup({ style, textContent, className, list = [], onGroupItemClick, onClick }) {
680
+ const data = Array.isArray(list) ? list : [];
674
681
  const bgColor = style?.backgroundColor || "";
675
682
  return /* @__PURE__ */ jsxs7("div", { className: "inline-flex rounded-md overflow-hidden border border-teal-200 bg-teal-700 items-center focus:ring-0", style: { backgroundColor: bgColor }, children: [
676
683
  /* @__PURE__ */ jsx17(
@@ -678,6 +685,7 @@ function SplitButton({ style, textContent, className, list = [] }) {
678
685
  {
679
686
  className: `rounded-none border-r px-4 py-2 text-whit focus:ring-0 ${className || ""}`,
680
687
  style: { backgroundColor: bgColor },
688
+ onClick: (e) => onClick?.(e),
681
689
  children: textContent || "Button"
682
690
  }
683
691
  ),
@@ -691,7 +699,24 @@ function SplitButton({ style, textContent, className, list = [] }) {
691
699
  children: /* @__PURE__ */ jsx17(ChevronDown, { className: "w-4 h-4" })
692
700
  }
693
701
  ) }),
694
- /* @__PURE__ */ jsx17(DropdownMenuContent, { align: "end", className: "bg-white min-w-[120px]", children: list.map((item) => /* @__PURE__ */ jsx17(DropdownMenuItem, { className: "text-black", children: /* @__PURE__ */ jsx17(Link2, { href: item.url || "#", children: item.header }) }, item.id)) })
702
+ /* @__PURE__ */ jsx17(
703
+ DropdownMenuContent,
704
+ {
705
+ align: "end",
706
+ className: "bg-white min-w-[120px]",
707
+ children: data.map((item) => /* @__PURE__ */ jsx17(
708
+ DropdownMenuItem,
709
+ {
710
+ className: "text-black",
711
+ onSelect: () => onGroupItemClick?.({
712
+ item
713
+ }),
714
+ children: /* @__PURE__ */ jsx17(Link2, { href: item.url || "#", children: item.header })
715
+ },
716
+ item.id
717
+ ))
718
+ }
719
+ )
695
720
  ] })
696
721
  ] });
697
722
  }
@@ -1468,6 +1493,7 @@ function MultiCheckbox({
1468
1493
  {
1469
1494
  id: props.name ? `${props.name}-${opt.value}` : opt.value,
1470
1495
  className: cn(hasError && "text-red-600"),
1496
+ htmlFor: props.name ? `${props.name}-${opt.value}` : opt.value,
1471
1497
  children: opt.label
1472
1498
  }
1473
1499
  )
@@ -2083,7 +2109,8 @@ function LazySelectDropdown({
2083
2109
  onFocus: handleFocus,
2084
2110
  onChange: handleSearchChange,
2085
2111
  readOnly: !isOpen || readOnly,
2086
- disabled
2112
+ disabled,
2113
+ autoComplete: "off"
2087
2114
  }
2088
2115
  ),
2089
2116
  selectedOption && !disabled && !readOnly && /* @__PURE__ */ jsx36(
@@ -3275,7 +3302,8 @@ function LazyMultiSelectDropdown({
3275
3302
  value: isOpen ? searchTerm : "",
3276
3303
  onChange: handleSearch,
3277
3304
  readOnly,
3278
- disabled
3305
+ disabled,
3306
+ autoComplete: "off"
3279
3307
  }
3280
3308
  )
3281
3309
  ]
@@ -3849,13 +3877,13 @@ function DataTable({
3849
3877
  const shouldShowLeftDots = leftSiblingIndex > 2;
3850
3878
  const shouldShowRightDots = rightSiblingIndex < totalPages - 1;
3851
3879
  if (!shouldShowLeftDots && shouldShowRightDots) {
3852
- return [1, 2, 3, "...", totalPages];
3880
+ return [1, 2, 3, "..."];
3853
3881
  }
3854
3882
  if (shouldShowLeftDots && !shouldShowRightDots) {
3855
3883
  return [1, "...", totalPages - 2, totalPages - 1, totalPages];
3856
3884
  }
3857
3885
  if (shouldShowLeftDots && shouldShowRightDots) {
3858
- return [1, "...", currentPage - 1, currentPage, currentPage + 1, "...", totalPages];
3886
+ return [1, "...", currentPage - 1, currentPage, currentPage + 1, "..."];
3859
3887
  }
3860
3888
  return [];
3861
3889
  };
@@ -4061,7 +4089,7 @@ function DataTable({
4061
4089
  return /* @__PURE__ */ jsxs30(
4062
4090
  TableCell,
4063
4091
  {
4064
- className: `${meta?.cellClass ?? ""} ${isClickable ? "cursor-pointer hover:bg-gray-100 underline text-blue-500" : ""} relative py-2`,
4092
+ className: `break-words whitespace-normal align-top ${meta?.cellClass ?? ""} ${isClickable ? "cursor-pointer hover:bg-gray-100 underline text-blue-500" : ""} relative py-2`,
4065
4093
  style: {
4066
4094
  width: cell.column.getSize(),
4067
4095
  minWidth: cell.column.columnDef.minSize,
@@ -5025,7 +5053,7 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
5025
5053
  var Tabs_default = Tabs;
5026
5054
 
5027
5055
  // src/components/Navigation/Stages/Stages.tsx
5028
- import React11, { useState as useState13 } from "react";
5056
+ import React11, { useEffect as useEffect26, useState as useState13 } from "react";
5029
5057
  import { jsx as jsx60, jsxs as jsxs37 } from "react/jsx-runtime";
5030
5058
  var StagesComponent = ({
5031
5059
  stages,
@@ -5042,8 +5070,15 @@ var StagesComponent = ({
5042
5070
  triggerOnClick = false,
5043
5071
  canvasMode = "desktop"
5044
5072
  }) => {
5045
- const [activeStage, setActiveStage] = useState13(currentStage || (stages && stages.length > 0 ? stages[0][dataKey] : null));
5073
+ const [activeStage, setActiveStage] = useState13("");
5046
5074
  const [isCompleted, setIsCompleted] = useState13(false);
5075
+ useEffect26(() => {
5076
+ if (currentStage) {
5077
+ setActiveStage(currentStage);
5078
+ } else {
5079
+ setActiveStage(stages && stages.length > 0 ? stages[0][dataKey] : null);
5080
+ }
5081
+ }, [currentStage]);
5047
5082
  const updateStage = (stageKey) => {
5048
5083
  setActiveStage(stageKey);
5049
5084
  onStageChange?.(stageKey);
@@ -5058,7 +5093,7 @@ var StagesComponent = ({
5058
5093
  return;
5059
5094
  }
5060
5095
  if (currentIndex < stages.length - 1) {
5061
- const nextStageObj = stages[currentIndex + 1];
5096
+ const nextStageObj = stages[currentIndex];
5062
5097
  updateStage(nextStageObj[dataKey]);
5063
5098
  return;
5064
5099
  }
@@ -5179,7 +5214,7 @@ import { jsx as jsx63, jsxs as jsxs39 } from "react/jsx-runtime";
5179
5214
  import { jsx as jsx64 } from "react/jsx-runtime";
5180
5215
 
5181
5216
  // src/components/Navigation/Navbar/Navbar.tsx
5182
- import { useCallback as useCallback4, useMemo as useMemo9, useState as useState14, useEffect as useEffect26 } from "react";
5217
+ import { useCallback as useCallback4, useMemo as useMemo9, useState as useState14, useEffect as useEffect27 } from "react";
5183
5218
  import { Bell, Search as Search2, Menu as Menu2 } from "lucide-react";
5184
5219
  import Image3 from "next/image";
5185
5220
  import Link4 from "next/link";
@@ -5248,7 +5283,7 @@ function Navbar({
5248
5283
  const [screenMode, setScreenMode] = useState14(
5249
5284
  canvasMode
5250
5285
  );
5251
- useEffect26(() => {
5286
+ useEffect27(() => {
5252
5287
  const detectMode = () => {
5253
5288
  if (window.innerWidth < 640) setScreenMode("mobile");
5254
5289
  else if (window.innerWidth < 1024) setScreenMode("tablet");
@@ -5355,7 +5390,7 @@ function Navbar({
5355
5390
  }
5356
5391
 
5357
5392
  // src/components/Chart/BarChart.tsx
5358
- import React13, { useEffect as useEffect27, useMemo as useMemo10, useState as useState15, useCallback as useCallback5 } from "react";
5393
+ import React13, { useEffect as useEffect28, useMemo as useMemo10, useState as useState15, useCallback as useCallback5 } from "react";
5359
5394
  import axios3 from "axios";
5360
5395
  import {
5361
5396
  BarChart,
@@ -5433,7 +5468,7 @@ var ChartComponent = ({
5433
5468
  const [currentPage, setCurrentPage] = useState15(1);
5434
5469
  const effectiveData = apiUrl ? rawData : props.data || [];
5435
5470
  const effectiveLoading = apiUrl ? localLoading : externalLoading;
5436
- useEffect27(() => {
5471
+ useEffect28(() => {
5437
5472
  if (apiUrl) {
5438
5473
  setCurrentPage(1);
5439
5474
  }
@@ -5475,7 +5510,7 @@ var ChartComponent = ({
5475
5510
  if (!cancelled) setLocalLoading(false);
5476
5511
  }
5477
5512
  }, [apiUrl, limit]);
5478
- useEffect27(() => {
5513
+ useEffect28(() => {
5479
5514
  if (!apiUrl) return;
5480
5515
  fetchData(currentPage);
5481
5516
  }, [apiUrl, currentPage, fetchData]);
@@ -5674,7 +5709,7 @@ var ChartComponent = ({
5674
5709
  var BarChart_default = React13.memo(ChartComponent);
5675
5710
 
5676
5711
  // src/components/Chart/PieChart.tsx
5677
- import React14, { useEffect as useEffect28, useMemo as useMemo11, useState as useState16 } from "react";
5712
+ import React14, { useEffect as useEffect29, useMemo as useMemo11, useState as useState16 } from "react";
5678
5713
  import axios4 from "axios";
5679
5714
  import {
5680
5715
  PieChart,
@@ -5764,7 +5799,7 @@ var DonutChart = ({
5764
5799
  const [localLoading, setLocalLoading] = useState16(false);
5765
5800
  const effectiveData = apiUrl ? rawData : props.data || [];
5766
5801
  const effectiveLoading = apiUrl ? localLoading : externalLoading;
5767
- useEffect28(() => {
5802
+ useEffect29(() => {
5768
5803
  if (!apiUrl) return;
5769
5804
  let cancelled = false;
5770
5805
  const fetchData = async () => {
@@ -5846,7 +5881,7 @@ var DonutChart = ({
5846
5881
  return { inner: 70, outer: 130 };
5847
5882
  };
5848
5883
  const [mounted, setMounted] = useState16(false);
5849
- useEffect28(() => {
5884
+ useEffect29(() => {
5850
5885
  const timeout = setTimeout(() => setMounted(true), 100);
5851
5886
  return () => clearTimeout(timeout);
5852
5887
  }, []);
@@ -6087,7 +6122,7 @@ export {
6087
6122
  BarChart_default as BarChart,
6088
6123
  Breadcrumb_default as Breadcrumb,
6089
6124
  Button_default as Button,
6090
- SplitButton as ButtonGroup,
6125
+ ButtonGroup,
6091
6126
  Checkbox_default as Checkbox,
6092
6127
  Container_default as Container,
6093
6128
  DateTimePicker as DatePicker,