@algorithm-shift/design-system 1.2.67 → 1.2.69

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
@@ -7,45 +7,69 @@ import {
7
7
 
8
8
  // src/components/Layout/Modal.tsx
9
9
  import { useEffect } from "react";
10
+ import { faTimes } from "@fortawesome/free-solid-svg-icons";
11
+ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
10
12
  import { jsx, jsxs } from "react/jsx-runtime";
11
- var Modal = ({
13
+ function Modal({
14
+ isOpen,
15
+ onClose,
16
+ title,
12
17
  children,
13
- className,
14
- style,
15
- showModal,
16
- onModalClose,
17
- label
18
- }) => {
18
+ size = "md",
19
+ showCloseButton = true,
20
+ className = "",
21
+ style = {}
22
+ }) {
19
23
  useEffect(() => {
20
- if (showModal) {
21
- const wrapper = document.getElementById("canvas-wrapper") || document.getElementById("canvas-preview");
22
- if (!wrapper) return;
23
- const overlay = document.createElement("div");
24
- overlay.className = "absolute flex inset-0 bg-black opacity-50 z-10 w-full h-full";
25
- wrapper.appendChild(overlay);
26
- return () => {
27
- if (wrapper.contains(overlay)) wrapper.removeChild(overlay);
28
- };
29
- }
30
- }, [showModal]);
31
- if (!showModal) return null;
32
- return /* @__PURE__ */ jsx("div", { className: `${className} top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 shadow-lg rounded-md z-90 bg-[#fff] `, style: { position: "fixed", ...style }, children: /* @__PURE__ */ jsxs("div", { className: "min-h-80", children: [
33
- /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center p-4 border-b border-gray-300 bg-gray-100", children: [
34
- /* @__PURE__ */ jsx("h4", { className: "text-[#000]", children: label || "Modal Title" }),
35
- /* @__PURE__ */ jsx(
36
- "span",
37
- {
38
- className: "cursor-pointer text-[#000]",
39
- role: "presentation",
40
- onClick: () => onModalClose && onModalClose(false),
41
- children: "X"
42
- }
43
- )
44
- ] }),
45
- /* @__PURE__ */ jsx("div", { className: "h-90 overflow-y-auto p-4 custom-scroll", children })
46
- ] }) });
47
- };
48
- var Modal_default = Modal;
24
+ const handleEscape = (e) => {
25
+ if (e.key === "Escape") {
26
+ onClose?.();
27
+ }
28
+ };
29
+ if (isOpen) {
30
+ document.addEventListener("keydown", handleEscape);
31
+ document.body.style.overflow = "hidden";
32
+ }
33
+ return () => {
34
+ document.removeEventListener("keydown", handleEscape);
35
+ document.body.style.overflow = "unset";
36
+ };
37
+ }, [isOpen, onClose]);
38
+ if (!isOpen) return null;
39
+ const sizeClasses = {
40
+ sm: "w-md",
41
+ md: "w-lg",
42
+ lg: "w-2xl",
43
+ xl: "w-4xl"
44
+ };
45
+ return /* @__PURE__ */ jsx("div", { className: "fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 shadow-lg rounded-md z-90", children: /* @__PURE__ */ jsxs(
46
+ "div",
47
+ {
48
+ className: cn(
49
+ "bg-white dark:bg-gray-800 rounded-lg shadow-xl w-full max-h-[90vh] overflow-hidden",
50
+ `bg-white dark:bg-gray-800 rounded-lg shadow-xl w-full ${sizeClasses[size]} max-h-[90vh] overflow-hidden`,
51
+ className,
52
+ `${sizeClasses[size]}`
53
+ ),
54
+ style,
55
+ children: [
56
+ (title || showCloseButton) && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between p-4 py-3 border-b border-gray-200 dark:border-gray-700", children: [
57
+ title && /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-900 dark:text-white", children: title }),
58
+ showCloseButton && /* @__PURE__ */ jsx(
59
+ "button",
60
+ {
61
+ onClick: onClose,
62
+ className: "text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors cursor-pointer",
63
+ "aria-label": "Close modal",
64
+ children: /* @__PURE__ */ jsx(FontAwesomeIcon, { icon: faTimes, className: "w-5 h-5" })
65
+ }
66
+ )
67
+ ] }),
68
+ /* @__PURE__ */ jsx("div", { className: "p-4 py-3 overflow-y-auto max-h-[calc(90vh-140px)] min-h-[90px]", children })
69
+ ]
70
+ }
71
+ ) });
72
+ }
49
73
 
50
74
  // src/components/Layout/Flex.tsx
51
75
  import { jsx as jsx2 } from "react/jsx-runtime";
@@ -157,7 +181,7 @@ function TabList({
157
181
  }
158
182
 
159
183
  // src/components/Layout/TabGroup.tsx
160
- import { useEffect as useEffect2, useMemo } from "react";
184
+ import { useEffect as useEffect2, useMemo, useState as useState2 } from "react";
161
185
  import { jsx as jsx9, jsxs as jsxs3 } from "react/jsx-runtime";
162
186
  function TabGroupComponent({
163
187
  children,
@@ -167,11 +191,13 @@ function TabGroupComponent({
167
191
  activeTab,
168
192
  onTabChange
169
193
  }) {
194
+ const [mounted, setMounted] = useState2(false);
170
195
  useEffect2(() => {
171
- if (list && list.length > 0 && !activeTab && onTabChange) {
196
+ if (list && list.length > 0 && !activeTab && onTabChange && !mounted) {
172
197
  onTabChange(list[0]?.tabId);
198
+ setMounted(true);
173
199
  }
174
- }, [list, activeTab, onTabChange]);
200
+ }, [list, activeTab, onTabChange, mounted]);
175
201
  const formatedList = useMemo(
176
202
  () => Array.isArray(list) ? [...list].sort((a, b) => (a.orderNumber ?? 0) - (b.orderNumber ?? 0)) : [],
177
203
  [list]
@@ -301,7 +327,7 @@ var Shape = ({
301
327
  var Shape_default = Shape;
302
328
 
303
329
  // src/components/Basic/Typography/Typography.tsx
304
- import React2 from "react";
330
+ import React3 from "react";
305
331
  var Typography = ({
306
332
  className,
307
333
  style,
@@ -309,14 +335,14 @@ var Typography = ({
309
335
  textContent
310
336
  }) => {
311
337
  const Tag2 = tagName || "h1";
312
- return React2.createElement(
338
+ return React3.createElement(
313
339
  Tag2,
314
340
  {
315
341
  style,
316
342
  className: cn(className, "pointer-events-auto")
317
343
  },
318
344
  [
319
- React2.createElement("span", {
345
+ React3.createElement("span", {
320
346
  key: "html",
321
347
  className: "pointer-events-none",
322
348
  dangerouslySetInnerHTML: { __html: textContent }
@@ -26794,7 +26820,7 @@ function SplitButton({ style, textContent, className, list = [] }) {
26794
26820
 
26795
26821
  // src/components/Basic/Icon/Icon.tsx
26796
26822
  import * as faSolid from "@fortawesome/free-solid-svg-icons";
26797
- import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
26823
+ import { FontAwesomeIcon as FontAwesomeIcon2 } from "@fortawesome/react-fontawesome";
26798
26824
  import { jsx as jsx17 } from "react/jsx-runtime";
26799
26825
  var Icon2 = ({ iconType = "fontawesome", name = "Envelope", className, fontSize = 10, style }) => {
26800
26826
  let content = null;
@@ -26805,7 +26831,7 @@ var Icon2 = ({ iconType = "fontawesome", name = "Envelope", className, fontSize
26805
26831
  return null;
26806
26832
  }
26807
26833
  content = /* @__PURE__ */ jsx17(
26808
- FontAwesomeIcon,
26834
+ FontAwesomeIcon2,
26809
26835
  {
26810
26836
  icon: faIcon,
26811
26837
  className: cn("inline-block"),
@@ -27304,7 +27330,7 @@ var RadioInput = ({
27304
27330
  var RadioInput_default = RadioInput;
27305
27331
 
27306
27332
  // src/components/Inputs/MultiCheckbox/MultiCheckbox.tsx
27307
- import { useCallback, useEffect as useEffect11, useState as useState2 } from "react";
27333
+ import { useCallback, useEffect as useEffect11, useState as useState3 } from "react";
27308
27334
  import { jsx as jsx31, jsxs as jsxs15 } from "react/jsx-runtime";
27309
27335
  var MultiCheckbox = ({
27310
27336
  className,
@@ -27318,7 +27344,7 @@ var MultiCheckbox = ({
27318
27344
  isDisabled = false
27319
27345
  }) => {
27320
27346
  const list = Array.isArray(data) ? data : [];
27321
- const [value, setValue] = useState2(propValue);
27347
+ const [value, setValue] = useState3(propValue);
27322
27348
  const options = (list || []).map((item) => ({
27323
27349
  value: item[dataKey || "value"],
27324
27350
  label: item[dataLabel || "label"]
@@ -27907,11 +27933,11 @@ function DatePicker({ className, style, ...props }) {
27907
27933
  }
27908
27934
 
27909
27935
  // src/components/Inputs/DateRange/DateRange.tsx
27910
- import React5, { useEffect as useEffect20 } from "react";
27936
+ import React6, { useEffect as useEffect20 } from "react";
27911
27937
  import { addDays, format } from "date-fns";
27912
27938
 
27913
27939
  // src/components/ui/calendar.tsx
27914
- import * as React4 from "react";
27940
+ import * as React5 from "react";
27915
27941
  import { DayPicker, getDefaultClassNames } from "react-day-picker";
27916
27942
  import { jsx as jsx42 } from "react/jsx-runtime";
27917
27943
  function Calendar2({
@@ -28066,8 +28092,8 @@ function CalendarDayButton({
28066
28092
  ...props
28067
28093
  }) {
28068
28094
  const defaultClassNames = getDefaultClassNames();
28069
- const ref = React4.useRef(null);
28070
- React4.useEffect(() => {
28095
+ const ref = React5.useRef(null);
28096
+ React5.useEffect(() => {
28071
28097
  if (modifiers.focused) ref.current?.focus();
28072
28098
  }, [modifiers.focused]);
28073
28099
  return /* @__PURE__ */ jsx42(
@@ -28129,7 +28155,7 @@ function PopoverContent({
28129
28155
  import { Fragment as Fragment15, jsx as jsx44, jsxs as jsxs24 } from "react/jsx-runtime";
28130
28156
  var DateRange = ({ className, style, ...props }) => {
28131
28157
  const isDateRange = (val) => !!val && val.from instanceof Date;
28132
- const [date, setDate] = React5.useState(
28158
+ const [date, setDate] = React6.useState(
28133
28159
  isDateRange(props.value) ? props.value : {
28134
28160
  from: /* @__PURE__ */ new Date(),
28135
28161
  to: addDays(/* @__PURE__ */ new Date(), 7)
@@ -28243,9 +28269,9 @@ var TextInputGroup = ({ className, style, prepend, append, ...props }) => {
28243
28269
  var TextInputGroup_default = TextInputGroup;
28244
28270
 
28245
28271
  // src/components/ui/data-table.tsx
28246
- import * as React6 from "react";
28272
+ import * as React7 from "react";
28247
28273
  import { faEllipsisH } from "@fortawesome/free-solid-svg-icons";
28248
- import { FontAwesomeIcon as FontAwesomeIcon2 } from "@fortawesome/react-fontawesome";
28274
+ import { FontAwesomeIcon as FontAwesomeIcon3 } from "@fortawesome/react-fontawesome";
28249
28275
  import {
28250
28276
  flexRender,
28251
28277
  getCoreRowModel,
@@ -28356,10 +28382,10 @@ function DataTable({
28356
28382
  onGlobalSearch,
28357
28383
  globalSearch
28358
28384
  }) {
28359
- const [columnFilters, setColumnFilters] = React6.useState([]);
28360
- const [columnVisibility, setColumnVisibility] = React6.useState({});
28361
- const [manualSort, setManualSort] = React6.useState(null);
28362
- const [searchTerm, setSearchTerm] = React6.useState("");
28385
+ const [columnFilters, setColumnFilters] = React7.useState([]);
28386
+ const [columnVisibility, setColumnVisibility] = React7.useState({});
28387
+ const [manualSort, setManualSort] = React7.useState(null);
28388
+ const [searchTerm, setSearchTerm] = React7.useState("");
28363
28389
  const table = useReactTable({
28364
28390
  data,
28365
28391
  columns,
@@ -28513,7 +28539,7 @@ function DataTable({
28513
28539
  role: "presentation",
28514
28540
  className: "pl-5 cursor-pointer",
28515
28541
  onClick: (e) => e.stopPropagation(),
28516
- children: /* @__PURE__ */ jsx47(FontAwesomeIcon2, { icon: faEllipsisH, className: "w-5 h-5 text-gray-500" })
28542
+ children: /* @__PURE__ */ jsx47(FontAwesomeIcon3, { icon: faEllipsisH, className: "w-5 h-5 text-gray-500" })
28517
28543
  }
28518
28544
  ) }),
28519
28545
  /* @__PURE__ */ jsx47(
@@ -28956,12 +28982,12 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode }) => {
28956
28982
  var Tabs_default = Tabs;
28957
28983
 
28958
28984
  // src/components/Navigation/Stages/Stages.tsx
28959
- import React7 from "react";
28985
+ import React8 from "react";
28960
28986
  import { jsx as jsx52, jsxs as jsxs30 } from "react/jsx-runtime";
28961
28987
  var StagesComponent = ({ stages, isShowBtn, buttonText, className, style }) => {
28962
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: [
28963
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" }) }) }) }),
28964
- /* @__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(React7.Fragment, { children: [
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: [
28965
28991
  /* @__PURE__ */ jsx52(
28966
28992
  "button",
28967
28993
  {
@@ -28993,10 +29019,10 @@ import { jsx as jsx55, jsxs as jsxs32 } from "react/jsx-runtime";
28993
29019
  import { jsx as jsx56 } from "react/jsx-runtime";
28994
29020
 
28995
29021
  // src/components/ui/avatar.tsx
28996
- import * as React8 from "react";
29022
+ import * as React9 from "react";
28997
29023
  import * as AvatarPrimitive from "@radix-ui/react-avatar";
28998
29024
  import { jsx as jsx57 } from "react/jsx-runtime";
28999
- var Avatar = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx57(
29025
+ var Avatar = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx57(
29000
29026
  AvatarPrimitive.Root,
29001
29027
  {
29002
29028
  ref,
@@ -29008,7 +29034,7 @@ var Avatar = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
29008
29034
  }
29009
29035
  ));
29010
29036
  Avatar.displayName = AvatarPrimitive.Root.displayName;
29011
- var AvatarImage = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx57(
29037
+ var AvatarImage = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx57(
29012
29038
  AvatarPrimitive.Image,
29013
29039
  {
29014
29040
  ref,
@@ -29017,7 +29043,7 @@ var AvatarImage = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE
29017
29043
  }
29018
29044
  ));
29019
29045
  AvatarImage.displayName = AvatarPrimitive.Image.displayName;
29020
- var AvatarFallback = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx57(
29046
+ var AvatarFallback = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx57(
29021
29047
  AvatarPrimitive.Fallback,
29022
29048
  {
29023
29049
  ref,
@@ -29121,7 +29147,7 @@ function Navbar({
29121
29147
  }
29122
29148
 
29123
29149
  // src/components/Chart/BarChart.tsx
29124
- import React9 from "react";
29150
+ import React10 from "react";
29125
29151
  import {
29126
29152
  BarChart,
29127
29153
  Bar,
@@ -29193,10 +29219,10 @@ var ChartComponent = ({ className, style, loading, ...props }) => {
29193
29219
  )
29194
29220
  ] }) }) });
29195
29221
  };
29196
- var BarChart_default = React9.memo(ChartComponent);
29222
+ var BarChart_default = React10.memo(ChartComponent);
29197
29223
 
29198
29224
  // src/components/Chart/PieChart.tsx
29199
- import React10, { useMemo as useMemo3 } from "react";
29225
+ import React11, { useMemo as useMemo3 } from "react";
29200
29226
  import {
29201
29227
  PieChart,
29202
29228
  Pie,
@@ -29318,7 +29344,7 @@ var DonutChart = ({ className, style, loading, ...props }) => {
29318
29344
  }
29319
29345
  );
29320
29346
  };
29321
- var PieChart_default = React10.memo(DonutChart);
29347
+ var PieChart_default = React11.memo(DonutChart);
29322
29348
 
29323
29349
  // src/components/Blocks/EmailComposer.tsx
29324
29350
  import { jsx as jsx61, jsxs as jsxs36 } from "react/jsx-runtime";
@@ -29477,7 +29503,7 @@ export {
29477
29503
  Grid_default as GridLayout,
29478
29504
  Icon_default as Icon,
29479
29505
  Image_default as Image,
29480
- Modal_default as Modal,
29506
+ Modal,
29481
29507
  MultiCheckbox_default as MultiCheckbox,
29482
29508
  Navbar,
29483
29509
  NumberInput_default as NumberInput,