@algorithm-shift/design-system 1.2.68 → 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";
@@ -303,7 +327,7 @@ var Shape = ({
303
327
  var Shape_default = Shape;
304
328
 
305
329
  // src/components/Basic/Typography/Typography.tsx
306
- import React2 from "react";
330
+ import React3 from "react";
307
331
  var Typography = ({
308
332
  className,
309
333
  style,
@@ -311,14 +335,14 @@ var Typography = ({
311
335
  textContent
312
336
  }) => {
313
337
  const Tag2 = tagName || "h1";
314
- return React2.createElement(
338
+ return React3.createElement(
315
339
  Tag2,
316
340
  {
317
341
  style,
318
342
  className: cn(className, "pointer-events-auto")
319
343
  },
320
344
  [
321
- React2.createElement("span", {
345
+ React3.createElement("span", {
322
346
  key: "html",
323
347
  className: "pointer-events-none",
324
348
  dangerouslySetInnerHTML: { __html: textContent }
@@ -26796,7 +26820,7 @@ function SplitButton({ style, textContent, className, list = [] }) {
26796
26820
 
26797
26821
  // src/components/Basic/Icon/Icon.tsx
26798
26822
  import * as faSolid from "@fortawesome/free-solid-svg-icons";
26799
- import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
26823
+ import { FontAwesomeIcon as FontAwesomeIcon2 } from "@fortawesome/react-fontawesome";
26800
26824
  import { jsx as jsx17 } from "react/jsx-runtime";
26801
26825
  var Icon2 = ({ iconType = "fontawesome", name = "Envelope", className, fontSize = 10, style }) => {
26802
26826
  let content = null;
@@ -26807,7 +26831,7 @@ var Icon2 = ({ iconType = "fontawesome", name = "Envelope", className, fontSize
26807
26831
  return null;
26808
26832
  }
26809
26833
  content = /* @__PURE__ */ jsx17(
26810
- FontAwesomeIcon,
26834
+ FontAwesomeIcon2,
26811
26835
  {
26812
26836
  icon: faIcon,
26813
26837
  className: cn("inline-block"),
@@ -27909,11 +27933,11 @@ function DatePicker({ className, style, ...props }) {
27909
27933
  }
27910
27934
 
27911
27935
  // src/components/Inputs/DateRange/DateRange.tsx
27912
- import React5, { useEffect as useEffect20 } from "react";
27936
+ import React6, { useEffect as useEffect20 } from "react";
27913
27937
  import { addDays, format } from "date-fns";
27914
27938
 
27915
27939
  // src/components/ui/calendar.tsx
27916
- import * as React4 from "react";
27940
+ import * as React5 from "react";
27917
27941
  import { DayPicker, getDefaultClassNames } from "react-day-picker";
27918
27942
  import { jsx as jsx42 } from "react/jsx-runtime";
27919
27943
  function Calendar2({
@@ -28068,8 +28092,8 @@ function CalendarDayButton({
28068
28092
  ...props
28069
28093
  }) {
28070
28094
  const defaultClassNames = getDefaultClassNames();
28071
- const ref = React4.useRef(null);
28072
- React4.useEffect(() => {
28095
+ const ref = React5.useRef(null);
28096
+ React5.useEffect(() => {
28073
28097
  if (modifiers.focused) ref.current?.focus();
28074
28098
  }, [modifiers.focused]);
28075
28099
  return /* @__PURE__ */ jsx42(
@@ -28131,7 +28155,7 @@ function PopoverContent({
28131
28155
  import { Fragment as Fragment15, jsx as jsx44, jsxs as jsxs24 } from "react/jsx-runtime";
28132
28156
  var DateRange = ({ className, style, ...props }) => {
28133
28157
  const isDateRange = (val) => !!val && val.from instanceof Date;
28134
- const [date, setDate] = React5.useState(
28158
+ const [date, setDate] = React6.useState(
28135
28159
  isDateRange(props.value) ? props.value : {
28136
28160
  from: /* @__PURE__ */ new Date(),
28137
28161
  to: addDays(/* @__PURE__ */ new Date(), 7)
@@ -28245,9 +28269,9 @@ var TextInputGroup = ({ className, style, prepend, append, ...props }) => {
28245
28269
  var TextInputGroup_default = TextInputGroup;
28246
28270
 
28247
28271
  // src/components/ui/data-table.tsx
28248
- import * as React6 from "react";
28272
+ import * as React7 from "react";
28249
28273
  import { faEllipsisH } from "@fortawesome/free-solid-svg-icons";
28250
- import { FontAwesomeIcon as FontAwesomeIcon2 } from "@fortawesome/react-fontawesome";
28274
+ import { FontAwesomeIcon as FontAwesomeIcon3 } from "@fortawesome/react-fontawesome";
28251
28275
  import {
28252
28276
  flexRender,
28253
28277
  getCoreRowModel,
@@ -28358,10 +28382,10 @@ function DataTable({
28358
28382
  onGlobalSearch,
28359
28383
  globalSearch
28360
28384
  }) {
28361
- const [columnFilters, setColumnFilters] = React6.useState([]);
28362
- const [columnVisibility, setColumnVisibility] = React6.useState({});
28363
- const [manualSort, setManualSort] = React6.useState(null);
28364
- 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("");
28365
28389
  const table = useReactTable({
28366
28390
  data,
28367
28391
  columns,
@@ -28515,7 +28539,7 @@ function DataTable({
28515
28539
  role: "presentation",
28516
28540
  className: "pl-5 cursor-pointer",
28517
28541
  onClick: (e) => e.stopPropagation(),
28518
- 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" })
28519
28543
  }
28520
28544
  ) }),
28521
28545
  /* @__PURE__ */ jsx47(
@@ -28958,12 +28982,12 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode }) => {
28958
28982
  var Tabs_default = Tabs;
28959
28983
 
28960
28984
  // src/components/Navigation/Stages/Stages.tsx
28961
- import React7 from "react";
28985
+ import React8 from "react";
28962
28986
  import { jsx as jsx52, jsxs as jsxs30 } from "react/jsx-runtime";
28963
28987
  var StagesComponent = ({ stages, isShowBtn, buttonText, className, style }) => {
28964
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: [
28965
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" }) }) }) }),
28966
- /* @__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: [
28967
28991
  /* @__PURE__ */ jsx52(
28968
28992
  "button",
28969
28993
  {
@@ -28995,10 +29019,10 @@ import { jsx as jsx55, jsxs as jsxs32 } from "react/jsx-runtime";
28995
29019
  import { jsx as jsx56 } from "react/jsx-runtime";
28996
29020
 
28997
29021
  // src/components/ui/avatar.tsx
28998
- import * as React8 from "react";
29022
+ import * as React9 from "react";
28999
29023
  import * as AvatarPrimitive from "@radix-ui/react-avatar";
29000
29024
  import { jsx as jsx57 } from "react/jsx-runtime";
29001
- var Avatar = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx57(
29025
+ var Avatar = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx57(
29002
29026
  AvatarPrimitive.Root,
29003
29027
  {
29004
29028
  ref,
@@ -29010,7 +29034,7 @@ var Avatar = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
29010
29034
  }
29011
29035
  ));
29012
29036
  Avatar.displayName = AvatarPrimitive.Root.displayName;
29013
- var AvatarImage = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx57(
29037
+ var AvatarImage = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx57(
29014
29038
  AvatarPrimitive.Image,
29015
29039
  {
29016
29040
  ref,
@@ -29019,7 +29043,7 @@ var AvatarImage = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE
29019
29043
  }
29020
29044
  ));
29021
29045
  AvatarImage.displayName = AvatarPrimitive.Image.displayName;
29022
- var AvatarFallback = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx57(
29046
+ var AvatarFallback = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx57(
29023
29047
  AvatarPrimitive.Fallback,
29024
29048
  {
29025
29049
  ref,
@@ -29123,7 +29147,7 @@ function Navbar({
29123
29147
  }
29124
29148
 
29125
29149
  // src/components/Chart/BarChart.tsx
29126
- import React9 from "react";
29150
+ import React10 from "react";
29127
29151
  import {
29128
29152
  BarChart,
29129
29153
  Bar,
@@ -29195,10 +29219,10 @@ var ChartComponent = ({ className, style, loading, ...props }) => {
29195
29219
  )
29196
29220
  ] }) }) });
29197
29221
  };
29198
- var BarChart_default = React9.memo(ChartComponent);
29222
+ var BarChart_default = React10.memo(ChartComponent);
29199
29223
 
29200
29224
  // src/components/Chart/PieChart.tsx
29201
- import React10, { useMemo as useMemo3 } from "react";
29225
+ import React11, { useMemo as useMemo3 } from "react";
29202
29226
  import {
29203
29227
  PieChart,
29204
29228
  Pie,
@@ -29320,7 +29344,7 @@ var DonutChart = ({ className, style, loading, ...props }) => {
29320
29344
  }
29321
29345
  );
29322
29346
  };
29323
- var PieChart_default = React10.memo(DonutChart);
29347
+ var PieChart_default = React11.memo(DonutChart);
29324
29348
 
29325
29349
  // src/components/Blocks/EmailComposer.tsx
29326
29350
  import { jsx as jsx61, jsxs as jsxs36 } from "react/jsx-runtime";
@@ -29479,7 +29503,7 @@ export {
29479
29503
  Grid_default as GridLayout,
29480
29504
  Icon_default as Icon,
29481
29505
  Image_default as Image,
29482
- Modal_default as Modal,
29506
+ Modal,
29483
29507
  MultiCheckbox_default as MultiCheckbox,
29484
29508
  Navbar,
29485
29509
  NumberInput_default as NumberInput,