@algorithm-shift/design-system 1.2.68 → 1.2.70

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.d.mts CHANGED
@@ -3,6 +3,18 @@ import React$1 from 'react';
3
3
  import { ToasterProps } from 'sonner';
4
4
  import { ClassValue } from 'clsx';
5
5
 
6
+ interface ModalProps {
7
+ isOpen: boolean;
8
+ onModalClose?: () => void;
9
+ title: string;
10
+ children: React$1.ReactNode;
11
+ size?: 'sm' | 'md' | 'lg' | 'xl';
12
+ showCloseButton?: boolean;
13
+ className?: string;
14
+ style?: React$1.CSSProperties;
15
+ }
16
+ declare function Modal({ isOpen, onModalClose, title, children, size, showCloseButton, className, style }: ModalProps): react_jsx_runtime.JSX.Element | null;
17
+
6
18
  interface ElementProps {
7
19
  children?: React.ReactNode;
8
20
  className?: string;
@@ -144,12 +156,6 @@ interface BarChartProps extends ElementProps {
144
156
  loading?: boolean;
145
157
  }
146
158
 
147
- interface ModalProps extends ElementProps {
148
- label?: string;
149
- showModal: boolean;
150
- onModalClose?: (show: boolean) => void;
151
- }
152
-
153
159
  interface EmailComposerProps extends ElementProps {
154
160
  to?: string;
155
161
  setTo?: (to: string) => void;
@@ -211,8 +217,6 @@ interface TabGroupProps extends ElementProps {
211
217
  onTabChange?: (tabId: string) => void;
212
218
  }
213
219
 
214
- declare const Modal: ({ children, className, style, showModal, onModalClose, label }: ModalProps) => react_jsx_runtime.JSX.Element | null;
215
-
216
220
  declare const Flex: ({ children, className, style, ...props }: ElementProps) => react_jsx_runtime.JSX.Element;
217
221
 
218
222
  declare const Grid: ({ children, className, style, ...props }: ElementProps) => react_jsx_runtime.JSX.Element;
package/dist/index.d.ts CHANGED
@@ -3,6 +3,18 @@ import React$1 from 'react';
3
3
  import { ToasterProps } from 'sonner';
4
4
  import { ClassValue } from 'clsx';
5
5
 
6
+ interface ModalProps {
7
+ isOpen: boolean;
8
+ onModalClose?: () => void;
9
+ title: string;
10
+ children: React$1.ReactNode;
11
+ size?: 'sm' | 'md' | 'lg' | 'xl';
12
+ showCloseButton?: boolean;
13
+ className?: string;
14
+ style?: React$1.CSSProperties;
15
+ }
16
+ declare function Modal({ isOpen, onModalClose, title, children, size, showCloseButton, className, style }: ModalProps): react_jsx_runtime.JSX.Element | null;
17
+
6
18
  interface ElementProps {
7
19
  children?: React.ReactNode;
8
20
  className?: string;
@@ -144,12 +156,6 @@ interface BarChartProps extends ElementProps {
144
156
  loading?: boolean;
145
157
  }
146
158
 
147
- interface ModalProps extends ElementProps {
148
- label?: string;
149
- showModal: boolean;
150
- onModalClose?: (show: boolean) => void;
151
- }
152
-
153
159
  interface EmailComposerProps extends ElementProps {
154
160
  to?: string;
155
161
  setTo?: (to: string) => void;
@@ -211,8 +217,6 @@ interface TabGroupProps extends ElementProps {
211
217
  onTabChange?: (tabId: string) => void;
212
218
  }
213
219
 
214
- declare const Modal: ({ children, className, style, showModal, onModalClose, label }: ModalProps) => react_jsx_runtime.JSX.Element | null;
215
-
216
220
  declare const Flex: ({ children, className, style, ...props }: ElementProps) => react_jsx_runtime.JSX.Element;
217
221
 
218
222
  declare const Grid: ({ children, className, style, ...props }: ElementProps) => react_jsx_runtime.JSX.Element;
package/dist/index.js CHANGED
@@ -49,7 +49,7 @@ __export(src_exports, {
49
49
  GridLayout: () => Grid_default,
50
50
  Icon: () => Icon_default,
51
51
  Image: () => Image_default,
52
- Modal: () => Modal_default,
52
+ Modal: () => Modal,
53
53
  MultiCheckbox: () => MultiCheckbox_default,
54
54
  Navbar: () => Navbar,
55
55
  NumberInput: () => NumberInput_default,
@@ -83,45 +83,88 @@ module.exports = __toCommonJS(src_exports);
83
83
 
84
84
  // src/components/Layout/Modal.tsx
85
85
  var import_react = require("react");
86
+ var import_free_solid_svg_icons = require("@fortawesome/free-solid-svg-icons");
87
+ var import_react_fontawesome = require("@fortawesome/react-fontawesome");
88
+
89
+ // src/lib/utils.ts
90
+ var import_clsx = require("clsx");
91
+ var import_tailwind_merge = require("tailwind-merge");
92
+ function cn(...inputs) {
93
+ return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
94
+ }
95
+ function getInitials(name) {
96
+ const words = name.split(" ");
97
+ if (words.length === 0) {
98
+ return "";
99
+ }
100
+ if (words.length === 1) {
101
+ return words[0].charAt(0);
102
+ }
103
+ return words[0].charAt(0) + words[1].charAt(0);
104
+ }
105
+
106
+ // src/components/Layout/Modal.tsx
86
107
  var import_jsx_runtime = require("react/jsx-runtime");
87
- var Modal = ({
88
- children,
89
- className,
90
- style,
91
- showModal,
108
+ function Modal({
109
+ isOpen,
92
110
  onModalClose,
93
- label
94
- }) => {
111
+ title,
112
+ children,
113
+ size = "md",
114
+ showCloseButton = true,
115
+ className = "",
116
+ style = {}
117
+ }) {
95
118
  (0, import_react.useEffect)(() => {
96
- if (showModal) {
97
- const wrapper = document.getElementById("canvas-wrapper") || document.getElementById("canvas-preview");
98
- if (!wrapper) return;
99
- const overlay = document.createElement("div");
100
- overlay.className = "absolute flex inset-0 bg-black opacity-50 z-10 w-full h-full";
101
- wrapper.appendChild(overlay);
102
- return () => {
103
- if (wrapper.contains(overlay)) wrapper.removeChild(overlay);
104
- };
105
- }
106
- }, [showModal]);
107
- if (!showModal) return null;
108
- return /* @__PURE__ */ (0, import_jsx_runtime.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__ */ (0, import_jsx_runtime.jsxs)("div", { className: "min-h-80", children: [
109
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex justify-between items-center p-4 border-b border-gray-300 bg-gray-100", children: [
110
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h4", { className: "text-[#000]", children: label || "Modal Title" }),
111
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
112
- "span",
113
- {
114
- className: "cursor-pointer text-[#000]",
115
- role: "presentation",
116
- onClick: () => onModalClose && onModalClose(false),
117
- children: "X"
118
- }
119
- )
120
- ] }),
121
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "h-90 overflow-y-auto p-4 custom-scroll", children })
122
- ] }) });
123
- };
124
- var Modal_default = Modal;
119
+ const handleEscape = (e) => {
120
+ if (e.key === "Escape") {
121
+ onModalClose?.();
122
+ }
123
+ };
124
+ if (isOpen) {
125
+ document.addEventListener("keydown", handleEscape);
126
+ document.body.style.overflow = "hidden";
127
+ }
128
+ return () => {
129
+ document.removeEventListener("keydown", handleEscape);
130
+ document.body.style.overflow = "unset";
131
+ };
132
+ }, [isOpen, onModalClose]);
133
+ if (!isOpen) return null;
134
+ const sizeClasses = {
135
+ sm: "w-md",
136
+ md: "w-lg",
137
+ lg: "w-2xl",
138
+ xl: "w-4xl"
139
+ };
140
+ return /* @__PURE__ */ (0, import_jsx_runtime.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__ */ (0, import_jsx_runtime.jsxs)(
141
+ "div",
142
+ {
143
+ className: cn(
144
+ "bg-white dark:bg-gray-800 rounded-lg shadow-xl w-full max-h-[90vh] overflow-hidden",
145
+ `bg-white dark:bg-gray-800 rounded-lg shadow-xl w-full ${sizeClasses[size]} max-h-[90vh] overflow-hidden`,
146
+ className,
147
+ `${sizeClasses[size]}`
148
+ ),
149
+ style,
150
+ children: [
151
+ (title || showCloseButton) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center justify-between p-4 py-3 border-b border-gray-200 dark:border-gray-700", children: [
152
+ title && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { className: "text-lg font-semibold text-gray-900 dark:text-white", children: title }),
153
+ showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
154
+ "button",
155
+ {
156
+ onClick: onModalClose,
157
+ className: "text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors cursor-pointer",
158
+ "aria-label": "Close modal",
159
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_fontawesome.FontAwesomeIcon, { icon: import_free_solid_svg_icons.faTimes, className: "w-5 h-5" })
160
+ }
161
+ )
162
+ ] }),
163
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "p-4 py-3 overflow-y-auto max-h-[calc(90vh-140px)] min-h-[90px]", children })
164
+ ]
165
+ }
166
+ ) });
167
+ }
125
168
 
126
169
  // src/components/Layout/Flex.tsx
127
170
  var import_jsx_runtime2 = require("react/jsx-runtime");
@@ -272,25 +315,6 @@ function TabGroupComponent({
272
315
  // src/components/ui/button.tsx
273
316
  var import_react_slot = require("@radix-ui/react-slot");
274
317
  var import_class_variance_authority = require("class-variance-authority");
275
-
276
- // src/lib/utils.ts
277
- var import_clsx = require("clsx");
278
- var import_tailwind_merge = require("tailwind-merge");
279
- function cn(...inputs) {
280
- return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
281
- }
282
- function getInitials(name) {
283
- const words = name.split(" ");
284
- if (words.length === 0) {
285
- return "";
286
- }
287
- if (words.length === 1) {
288
- return words[0].charAt(0);
289
- }
290
- return words[0].charAt(0) + words[1].charAt(0);
291
- }
292
-
293
- // src/components/ui/button.tsx
294
318
  var import_jsx_runtime10 = require("react/jsx-runtime");
295
319
  var buttonVariants = (0, import_class_variance_authority.cva)(
296
320
  "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
@@ -26891,7 +26915,7 @@ function SplitButton({ style, textContent, className, list = [] }) {
26891
26915
 
26892
26916
  // src/components/Basic/Icon/Icon.tsx
26893
26917
  var faSolid = __toESM(require("@fortawesome/free-solid-svg-icons"));
26894
- var import_react_fontawesome = require("@fortawesome/react-fontawesome");
26918
+ var import_react_fontawesome2 = require("@fortawesome/react-fontawesome");
26895
26919
  var import_jsx_runtime17 = require("react/jsx-runtime");
26896
26920
  var Icon2 = ({ iconType = "fontawesome", name = "Envelope", className, fontSize = 10, style }) => {
26897
26921
  let content = null;
@@ -26902,7 +26926,7 @@ var Icon2 = ({ iconType = "fontawesome", name = "Envelope", className, fontSize
26902
26926
  return null;
26903
26927
  }
26904
26928
  content = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
26905
- import_react_fontawesome.FontAwesomeIcon,
26929
+ import_react_fontawesome2.FontAwesomeIcon,
26906
26930
  {
26907
26931
  icon: faIcon,
26908
26932
  className: cn("inline-block"),
@@ -28008,7 +28032,7 @@ var import_react24 = __toESM(require("react"));
28008
28032
  var import_date_fns = require("date-fns");
28009
28033
 
28010
28034
  // src/components/ui/calendar.tsx
28011
- var React4 = __toESM(require("react"));
28035
+ var React5 = __toESM(require("react"));
28012
28036
  var import_react_day_picker = require("react-day-picker");
28013
28037
  var import_jsx_runtime42 = require("react/jsx-runtime");
28014
28038
  function Calendar2({
@@ -28163,8 +28187,8 @@ function CalendarDayButton({
28163
28187
  ...props
28164
28188
  }) {
28165
28189
  const defaultClassNames = (0, import_react_day_picker.getDefaultClassNames)();
28166
- const ref = React4.useRef(null);
28167
- React4.useEffect(() => {
28190
+ const ref = React5.useRef(null);
28191
+ React5.useEffect(() => {
28168
28192
  if (modifiers.focused) ref.current?.focus();
28169
28193
  }, [modifiers.focused]);
28170
28194
  return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
@@ -28340,9 +28364,9 @@ var TextInputGroup = ({ className, style, prepend, append, ...props }) => {
28340
28364
  var TextInputGroup_default = TextInputGroup;
28341
28365
 
28342
28366
  // src/components/ui/data-table.tsx
28343
- var React6 = __toESM(require("react"));
28344
- var import_free_solid_svg_icons = require("@fortawesome/free-solid-svg-icons");
28345
- var import_react_fontawesome2 = require("@fortawesome/react-fontawesome");
28367
+ var React7 = __toESM(require("react"));
28368
+ var import_free_solid_svg_icons2 = require("@fortawesome/free-solid-svg-icons");
28369
+ var import_react_fontawesome3 = require("@fortawesome/react-fontawesome");
28346
28370
  var import_react_table = require("@tanstack/react-table");
28347
28371
 
28348
28372
  // src/components/ui/table.tsx
@@ -28447,10 +28471,10 @@ function DataTable({
28447
28471
  onGlobalSearch,
28448
28472
  globalSearch
28449
28473
  }) {
28450
- const [columnFilters, setColumnFilters] = React6.useState([]);
28451
- const [columnVisibility, setColumnVisibility] = React6.useState({});
28452
- const [manualSort, setManualSort] = React6.useState(null);
28453
- const [searchTerm, setSearchTerm] = React6.useState("");
28474
+ const [columnFilters, setColumnFilters] = React7.useState([]);
28475
+ const [columnVisibility, setColumnVisibility] = React7.useState({});
28476
+ const [manualSort, setManualSort] = React7.useState(null);
28477
+ const [searchTerm, setSearchTerm] = React7.useState("");
28454
28478
  const table = (0, import_react_table.useReactTable)({
28455
28479
  data,
28456
28480
  columns,
@@ -28604,7 +28628,7 @@ function DataTable({
28604
28628
  role: "presentation",
28605
28629
  className: "pl-5 cursor-pointer",
28606
28630
  onClick: (e) => e.stopPropagation(),
28607
- children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react_fontawesome2.FontAwesomeIcon, { icon: import_free_solid_svg_icons.faEllipsisH, className: "w-5 h-5 text-gray-500" })
28631
+ children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react_fontawesome3.FontAwesomeIcon, { icon: import_free_solid_svg_icons2.faEllipsisH, className: "w-5 h-5 text-gray-500" })
28608
28632
  }
28609
28633
  ) }),
28610
28634
  /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
@@ -29084,10 +29108,10 @@ var import_jsx_runtime55 = require("react/jsx-runtime");
29084
29108
  var import_jsx_runtime56 = require("react/jsx-runtime");
29085
29109
 
29086
29110
  // src/components/ui/avatar.tsx
29087
- var React8 = __toESM(require("react"));
29111
+ var React9 = __toESM(require("react"));
29088
29112
  var AvatarPrimitive = __toESM(require("@radix-ui/react-avatar"));
29089
29113
  var import_jsx_runtime57 = require("react/jsx-runtime");
29090
- var Avatar = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
29114
+ var Avatar = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
29091
29115
  AvatarPrimitive.Root,
29092
29116
  {
29093
29117
  ref,
@@ -29099,7 +29123,7 @@ var Avatar = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
29099
29123
  }
29100
29124
  ));
29101
29125
  Avatar.displayName = AvatarPrimitive.Root.displayName;
29102
- var AvatarImage = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
29126
+ var AvatarImage = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
29103
29127
  AvatarPrimitive.Image,
29104
29128
  {
29105
29129
  ref,
@@ -29108,7 +29132,7 @@ var AvatarImage = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE
29108
29132
  }
29109
29133
  ));
29110
29134
  AvatarImage.displayName = AvatarPrimitive.Image.displayName;
29111
- var AvatarFallback = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
29135
+ var AvatarFallback = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
29112
29136
  AvatarPrimitive.Fallback,
29113
29137
  {
29114
29138
  ref,