@algorithm-shift/design-system 1.2.91 → 1.2.93

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
@@ -26915,7 +26915,7 @@ var TextInput = ({ className, style, ...props }) => {
26915
26915
  }
26916
26916
  }, []);
26917
26917
  const handleChange = (e) => {
26918
- props.onChange?.(e);
26918
+ props.onChange?.(e, e.target.name || "");
26919
26919
  };
26920
26920
  return /* @__PURE__ */ jsxs7(Fragment3, { children: [
26921
26921
  /* @__PURE__ */ jsx20(
@@ -26957,7 +26957,7 @@ var NumberInput = ({ className, style, ...props }) => {
26957
26957
  }
26958
26958
  }, []);
26959
26959
  const handleChange = (e) => {
26960
- props.onChange?.(e);
26960
+ props.onChange?.(e, e.target.name || "");
26961
26961
  };
26962
26962
  return /* @__PURE__ */ jsxs8(Fragment4, { children: [
26963
26963
  /* @__PURE__ */ jsx21("div", { className: "flex justify-start items-center relative", children: /* @__PURE__ */ jsx21(
@@ -27000,7 +27000,7 @@ var EmailInput = ({ className, style, ...props }) => {
27000
27000
  }
27001
27001
  }, []);
27002
27002
  const handleChange = (e) => {
27003
- props.onChange?.(e);
27003
+ props.onChange?.(e, props.name || "");
27004
27004
  };
27005
27005
  return /* @__PURE__ */ jsxs9(Fragment5, { children: [
27006
27006
  /* @__PURE__ */ jsx22("div", { className: "flex justify-start items-center relative", children: /* @__PURE__ */ jsx22(
@@ -27042,7 +27042,7 @@ var PasswordInput = ({ className, style, ...props }) => {
27042
27042
  }
27043
27043
  }, []);
27044
27044
  const handleChange = (e) => {
27045
- props.onChange?.(e);
27045
+ props.onChange?.(e, e.target.name || "");
27046
27046
  };
27047
27047
  return /* @__PURE__ */ jsxs10(Fragment6, { children: [
27048
27048
  /* @__PURE__ */ jsx23("div", { className: "flex justify-start items-center relative", children: /* @__PURE__ */ jsx23(
@@ -27103,7 +27103,7 @@ var Textarea2 = ({ className, style, ...props }) => {
27103
27103
  }
27104
27104
  }, []);
27105
27105
  const handleChange = (e) => {
27106
- props.onChange?.(e);
27106
+ props.onChange?.(e, e.target.name || "");
27107
27107
  };
27108
27108
  return /* @__PURE__ */ jsxs11(Fragment7, { children: [
27109
27109
  /* @__PURE__ */ jsx25(
@@ -27145,7 +27145,7 @@ var UrlInput = ({ className, style, ...props }) => {
27145
27145
  }
27146
27146
  }, []);
27147
27147
  const handleChange = (e) => {
27148
- props.onChange?.(e);
27148
+ props.onChange?.(e, e.target.name || "");
27149
27149
  };
27150
27150
  return /* @__PURE__ */ jsxs12(Fragment8, { children: [
27151
27151
  /* @__PURE__ */ jsxs12("div", { className: "flex justify-start items-center relative", children: [
@@ -27238,7 +27238,7 @@ var CheckboxInput = ({ className, style, ...props }) => {
27238
27238
  }
27239
27239
  }, []);
27240
27240
  const handleChange = (value) => {
27241
- props.onChange?.(value);
27241
+ props.onChange?.(value, props.name || "");
27242
27242
  };
27243
27243
  return /* @__PURE__ */ jsxs13(Fragment9, { children: [
27244
27244
  /* @__PURE__ */ jsx29("div", { className, style, children: /* @__PURE__ */ jsxs13("div", { className: "flex items-center space-x-2", children: [
@@ -27325,7 +27325,7 @@ var RadioInput = ({
27325
27325
  }
27326
27326
  }, []);
27327
27327
  const handleChange = (value) => {
27328
- onChange?.(value);
27328
+ onChange?.(value, props.name || "");
27329
27329
  };
27330
27330
  const resolvedDefaultValue = (typeof defaultValue === "string" ? defaultValue : void 0) ?? options[0]?.value;
27331
27331
  return /* @__PURE__ */ jsxs14(Fragment10, { children: [
@@ -27360,7 +27360,8 @@ var MultiCheckbox = ({
27360
27360
  value: propValue = {},
27361
27361
  onChange,
27362
27362
  isEditable = true,
27363
- isDisabled = false
27363
+ isDisabled = false,
27364
+ ...props
27364
27365
  }) => {
27365
27366
  const list = Array.isArray(data) ? data : [];
27366
27367
  const [value, setValue] = useState3(propValue);
@@ -27370,14 +27371,14 @@ var MultiCheckbox = ({
27370
27371
  }));
27371
27372
  useEffect11(() => {
27372
27373
  if (propValue !== void 0) {
27373
- onChange?.(propValue);
27374
+ onChange?.(propValue, props.name || "");
27374
27375
  }
27375
27376
  }, []);
27376
27377
  const handleChange = useCallback(
27377
27378
  (key, checked) => {
27378
27379
  setValue((prev) => {
27379
27380
  const newValue = { ...prev, [key]: checked };
27380
- onChange?.(newValue);
27381
+ onChange?.(newValue, props.name || "");
27381
27382
  return newValue;
27382
27383
  });
27383
27384
  },
@@ -27491,7 +27492,7 @@ function RichText({ className, style, ...props }) {
27491
27492
  }
27492
27493
  }, []);
27493
27494
  const handleChange = (content) => {
27494
- props.onChange?.(content);
27495
+ props.onChange?.(content, props.name || "");
27495
27496
  };
27496
27497
  return /* @__PURE__ */ jsxs16(
27497
27498
  "div",
@@ -27678,7 +27679,8 @@ function useLazyDropdown(config) {
27678
27679
  const limit = PAGE_SIZE;
27679
27680
  const params = { page: pageNum, limit };
27680
27681
  if (term) params[configRef.current.dataLabel ?? "search"] = term;
27681
- const res = await axios.get(configRef.current.apiUrl, {
27682
+ const axiosClient = configRef.current.axiosInstance ?? axios;
27683
+ const res = await axiosClient.get(configRef.current.apiUrl, {
27682
27684
  params,
27683
27685
  withCredentials: true
27684
27686
  });
@@ -27726,7 +27728,8 @@ function useLazyDropdown(config) {
27726
27728
  if (!configRef.current.apiUrl) return [];
27727
27729
  try {
27728
27730
  setLoading(true);
27729
- const res = await axios.get(configRef.current.apiUrl, {
27731
+ const axiosClient = configRef.current.axiosInstance ?? axios;
27732
+ const res = await axiosClient.get(configRef.current.apiUrl, {
27730
27733
  params: { [configRef.current.dataKey]: configRef.current.value },
27731
27734
  withCredentials: true
27732
27735
  });
@@ -27762,8 +27765,7 @@ function useLazyDropdown(config) {
27762
27765
  const reset = useCallback2(() => {
27763
27766
  setSearchTerm("");
27764
27767
  setPage(1);
27765
- loadPage(1, "");
27766
- }, [loadPage]);
27768
+ }, []);
27767
27769
  useEffect13(() => {
27768
27770
  if (config.initialData?.length) {
27769
27771
  allDataRef.current = config.initialData;
@@ -27802,7 +27804,8 @@ function LazySelectDropdown({
27802
27804
  pageSize,
27803
27805
  dataKey = "id",
27804
27806
  dataLabel = "name",
27805
- errorMessage
27807
+ errorMessage,
27808
+ axiosInstance
27806
27809
  }) {
27807
27810
  const [isOpen, setIsOpen] = useState5(false);
27808
27811
  const [searchTerm, setSearchTerm] = useState5("");
@@ -27824,7 +27827,8 @@ function LazySelectDropdown({
27824
27827
  dataKey,
27825
27828
  dataLabel,
27826
27829
  initialData: options || [],
27827
- value
27830
+ value,
27831
+ axiosInstance
27828
27832
  });
27829
27833
  const selectedOption = lazyOptions.find((opt) => opt.value === value);
27830
27834
  useEffect14(() => {
@@ -27854,7 +27858,7 @@ function LazySelectDropdown({
27854
27858
  search(term);
27855
27859
  };
27856
27860
  const handleSelect = (optValue) => {
27857
- onChange?.(optValue);
27861
+ onChange?.(optValue, id || "");
27858
27862
  setIsOpen(false);
27859
27863
  setSearchTerm("");
27860
27864
  reset();
@@ -27943,7 +27947,7 @@ var Dropdown = ({ className, style, ...props }) => {
27943
27947
  }
27944
27948
  }, []);
27945
27949
  const handleChange = (value) => {
27946
- props.onChange?.(value);
27950
+ props.onChange?.(value, props.name ?? "");
27947
27951
  };
27948
27952
  const dataKey = props.dataKey || "value";
27949
27953
  const dataLabel = props.dataLabel || "label";
@@ -28038,7 +28042,7 @@ var SwitchToggle = ({ className, style, ...props }) => {
28038
28042
  }
28039
28043
  }, []);
28040
28044
  const handleChange = (value) => {
28041
- props.onChange?.(value);
28045
+ props.onChange?.(value, props.name || "");
28042
28046
  };
28043
28047
  return /* @__PURE__ */ jsxs20(Fragment13, { children: [
28044
28048
  /* @__PURE__ */ jsx39("div", { className, style, children: /* @__PURE__ */ jsxs20("div", { className: "flex items-center space-x-2 mb-2", children: [
@@ -28073,7 +28077,7 @@ var PhoneInput = ({ className, style, ...props }) => {
28073
28077
  }
28074
28078
  }, []);
28075
28079
  const handleChange = (val) => {
28076
- props.onChange?.(val);
28080
+ props.onChange?.(val, props.name || "");
28077
28081
  };
28078
28082
  return /* @__PURE__ */ jsxs21(Fragment14, { children: [
28079
28083
  /* @__PURE__ */ jsx40(
@@ -28121,7 +28125,7 @@ var SearchInput = ({ className, style, ...props }) => {
28121
28125
  }
28122
28126
  }, []);
28123
28127
  const handleChange = (e) => {
28124
- props.onChange?.(e);
28128
+ props.onChange?.(e, e.target.name || "");
28125
28129
  };
28126
28130
  return /* @__PURE__ */ jsxs22(Fragment15, { children: [
28127
28131
  /* @__PURE__ */ jsx41("div", { className: "flex justify-start items-center relative", children: /* @__PURE__ */ jsx41(
@@ -28160,7 +28164,7 @@ var FileInput2 = ({ className, style, ...props }) => {
28160
28164
  }
28161
28165
  }, []);
28162
28166
  const handleChange = (e) => {
28163
- props.onChange?.(e);
28167
+ props.onChange?.(e, props.name || "");
28164
28168
  };
28165
28169
  return /* @__PURE__ */ jsxs23("div", { className: "d-flex items-center relative align-middle", children: [
28166
28170
  /* @__PURE__ */ jsx42(
@@ -28218,7 +28222,7 @@ function DatePicker({ className, style, ...props }) {
28218
28222
  }
28219
28223
  }, []);
28220
28224
  const handleChange = (e) => {
28221
- props.onChange?.(e);
28225
+ props.onChange?.(e, e.target.name || "");
28222
28226
  };
28223
28227
  const toDateInputValue = (value) => {
28224
28228
  if (!value) return "";
@@ -28491,7 +28495,7 @@ var DateRange = ({ className, style, ...props }) => {
28491
28495
  const handleChange = (value) => {
28492
28496
  setDate(value);
28493
28497
  if (value) {
28494
- props.onChange?.(value);
28498
+ props.onChange?.(value, props.name || "");
28495
28499
  }
28496
28500
  };
28497
28501
  return /* @__PURE__ */ jsxs25(Fragment17, { children: [
@@ -28545,7 +28549,7 @@ var TextInputGroup = ({ className, style, prepend, append, ...props }) => {
28545
28549
  }
28546
28550
  }, []);
28547
28551
  const handleChange = (e) => {
28548
- props.onChange?.(e);
28552
+ props.onChange?.(e, e.target.name || "");
28549
28553
  };
28550
28554
  return /* @__PURE__ */ jsxs26(Fragment18, { children: [
28551
28555
  /* @__PURE__ */ jsxs26(
@@ -28832,12 +28836,13 @@ var MultiSelect = ({
28832
28836
  const [open, setOpen] = React8.useState(false);
28833
28837
  React8.useEffect(() => {
28834
28838
  if (value) {
28835
- onChange(value);
28839
+ onChange(value, props.name || "");
28836
28840
  }
28837
28841
  }, []);
28838
28842
  const toggleOption = (val) => {
28839
28843
  onChange(
28840
- value?.includes(val) ? value.filter((v) => v !== val) : [...value || [], val]
28844
+ value?.includes(val) ? value.filter((v) => v !== val) : [...value || [], val],
28845
+ props.name || ""
28841
28846
  );
28842
28847
  };
28843
28848
  const selectedLabels = React8.useMemo(
@@ -28913,7 +28918,7 @@ var MultiSelect = ({
28913
28918
  var MultiSelect_default = MultiSelect;
28914
28919
 
28915
28920
  // src/components/ui/data-table.tsx
28916
- import * as React9 from "react";
28921
+ import * as React10 from "react";
28917
28922
  import { faEllipsisH } from "@fortawesome/free-solid-svg-icons";
28918
28923
  import { FontAwesomeIcon as FontAwesomeIcon3 } from "@fortawesome/react-fontawesome";
28919
28924
  import {
@@ -29013,6 +29018,7 @@ function TableCell({ className, ...props }) {
29013
29018
  import { createColumnHelper } from "@tanstack/react-table";
29014
29019
 
29015
29020
  // src/lib/table/cellRendererFactory.tsx
29021
+ import React9 from "react";
29016
29022
  import Image2 from "next/image";
29017
29023
 
29018
29024
  // src/lib/dayjs-setup.ts
@@ -29093,6 +29099,22 @@ var getContrastColor = (bg) => {
29093
29099
  const brightness = (r * 299 + g * 587 + b * 114) / 1e3;
29094
29100
  return brightness > 160 ? "#000000" : "#FFFFFF";
29095
29101
  };
29102
+ var sanitizeValue = (val) => {
29103
+ if (val == null) return null;
29104
+ if (React9.isValidElement(val)) return val;
29105
+ if (typeof val === "string" || typeof val === "number") return val;
29106
+ if (Array.isArray(val)) return val.map((v, i) => /* @__PURE__ */ jsx52(React9.Fragment, { children: sanitizeValue(v) }, i));
29107
+ if (typeof val === "object") {
29108
+ if ("name" in val && typeof val.name === "string") return val.name;
29109
+ if ("label" in val && typeof val.label === "string") return val.label;
29110
+ try {
29111
+ return JSON.stringify(val);
29112
+ } catch {
29113
+ return "[object]";
29114
+ }
29115
+ }
29116
+ return String(val);
29117
+ };
29096
29118
  var cellRendererFactory = (renderer, rendererProps, value, row, customRenderers = {}, format2, customFormatters = {}) => {
29097
29119
  const formattedValue = valueFormatter(value, format2, customFormatters);
29098
29120
  switch (renderer) {
@@ -29244,13 +29266,15 @@ var useDynamicColumns = (config, customRenderers = {}, customFormatters = {}) =>
29244
29266
  return config.columns.map((col) => {
29245
29267
  const accessorKey = col.accessorKey ?? col.id;
29246
29268
  const accessorFn = (row) => {
29269
+ if (!row) return null;
29247
29270
  if (Object.prototype.hasOwnProperty.call(row, accessorKey)) {
29248
- return row[accessorKey];
29271
+ return sanitizeValue(row[accessorKey]);
29249
29272
  }
29250
29273
  if (accessorKey.includes(".")) {
29251
- return getValueByPath(row, accessorKey);
29274
+ const val = getValueByPath(row, accessorKey);
29275
+ return sanitizeValue(val);
29252
29276
  }
29253
- return row[accessorKey];
29277
+ return sanitizeValue(row[accessorKey]);
29254
29278
  };
29255
29279
  return columnHelper.accessor(accessorFn, {
29256
29280
  id: col.id ?? accessorKey,
@@ -29295,13 +29319,13 @@ function DataTable({
29295
29319
  onDeleteRow,
29296
29320
  rowActions
29297
29321
  }) {
29298
- const [columnFilters, setColumnFilters] = React9.useState([]);
29299
- const [columnVisibility, setColumnVisibility] = React9.useState({});
29300
- const [manualSort, setManualSort] = React9.useState(null);
29301
- const [searchTerm, setSearchTerm] = React9.useState("");
29322
+ const [columnFilters, setColumnFilters] = React10.useState([]);
29323
+ const [columnVisibility, setColumnVisibility] = React10.useState({});
29324
+ const [manualSort, setManualSort] = React10.useState(null);
29325
+ const [searchTerm, setSearchTerm] = React10.useState("");
29302
29326
  const dynamicCols = useDynamicColumns({ columns });
29303
29327
  const table = useReactTable({
29304
- data,
29328
+ data: data ?? [],
29305
29329
  columns: dynamicCols,
29306
29330
  state: {
29307
29331
  columnFilters,
@@ -29514,7 +29538,7 @@ function DataTable({
29514
29538
  return /* @__PURE__ */ jsxs31(
29515
29539
  TableCell,
29516
29540
  {
29517
- className: `${meta?.cellClass ?? ""} ${isClickable ? "cursor-pointer hover:bg-gray-100" : ""} relative`,
29541
+ className: `${meta?.cellClass ?? ""} ${isClickable ? "cursor-pointer hover:bg-gray-100 underline text-blue-500" : ""} relative`,
29518
29542
  style: meta?.cellStyle,
29519
29543
  onClick: () => {
29520
29544
  if (isClickable && onCellClick) {
@@ -30066,7 +30090,7 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
30066
30090
  var Tabs_default = Tabs;
30067
30091
 
30068
30092
  // src/components/Navigation/Stages/Stages.tsx
30069
- import React10, { useState as useState9 } from "react";
30093
+ import React11, { useState as useState9 } from "react";
30070
30094
  import { jsx as jsx58, jsxs as jsxs35 } from "react/jsx-runtime";
30071
30095
  var StagesComponent = ({ stages, isShowBtn, buttonText, className, style, onStageChange, currentStage, dataKey = "key", dataLabel = "header", loading }) => {
30072
30096
  const [activeStage, setActiveStage] = useState9(currentStage || (stages && stages.length > 0 ? stages[0].key : null));
@@ -30101,7 +30125,7 @@ var StagesComponent = ({ stages, isShowBtn, buttonText, className, style, onStag
30101
30125
  const currentIndex = stages.findIndex((s) => s[dataKey] === activeStage);
30102
30126
  const isCompleted = isAllStagesCompleted || index < currentIndex;
30103
30127
  const isActive = !isAllStagesCompleted && index === currentIndex;
30104
- return /* @__PURE__ */ jsxs35(React10.Fragment, { children: [
30128
+ return /* @__PURE__ */ jsxs35(React11.Fragment, { children: [
30105
30129
  /* @__PURE__ */ jsx58(
30106
30130
  "button",
30107
30131
  {
@@ -30149,10 +30173,10 @@ import { jsx as jsx61, jsxs as jsxs37 } from "react/jsx-runtime";
30149
30173
  import { jsx as jsx62 } from "react/jsx-runtime";
30150
30174
 
30151
30175
  // src/components/ui/avatar.tsx
30152
- import * as React11 from "react";
30176
+ import * as React12 from "react";
30153
30177
  import * as AvatarPrimitive from "@radix-ui/react-avatar";
30154
30178
  import { jsx as jsx63 } from "react/jsx-runtime";
30155
- var Avatar = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx63(
30179
+ var Avatar = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx63(
30156
30180
  AvatarPrimitive.Root,
30157
30181
  {
30158
30182
  ref,
@@ -30164,7 +30188,7 @@ var Avatar = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ *
30164
30188
  }
30165
30189
  ));
30166
30190
  Avatar.displayName = AvatarPrimitive.Root.displayName;
30167
- var AvatarImage = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx63(
30191
+ var AvatarImage = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx63(
30168
30192
  AvatarPrimitive.Image,
30169
30193
  {
30170
30194
  ref,
@@ -30173,7 +30197,7 @@ var AvatarImage = React11.forwardRef(({ className, ...props }, ref) => /* @__PUR
30173
30197
  }
30174
30198
  ));
30175
30199
  AvatarImage.displayName = AvatarPrimitive.Image.displayName;
30176
- var AvatarFallback = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx63(
30200
+ var AvatarFallback = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx63(
30177
30201
  AvatarPrimitive.Fallback,
30178
30202
  {
30179
30203
  ref,
@@ -30333,7 +30357,7 @@ function Navbar({
30333
30357
  }
30334
30358
 
30335
30359
  // src/components/Chart/BarChart.tsx
30336
- import React12 from "react";
30360
+ import React13 from "react";
30337
30361
  import {
30338
30362
  BarChart,
30339
30363
  Bar,
@@ -30405,10 +30429,10 @@ var ChartComponent = ({ className, style, loading, ...props }) => {
30405
30429
  )
30406
30430
  ] }) }) });
30407
30431
  };
30408
- var BarChart_default = React12.memo(ChartComponent);
30432
+ var BarChart_default = React13.memo(ChartComponent);
30409
30433
 
30410
30434
  // src/components/Chart/PieChart.tsx
30411
- import React13, { useEffect as useEffect25, useMemo as useMemo6, useState as useState11 } from "react";
30435
+ import React14, { useEffect as useEffect25, useMemo as useMemo6, useState as useState11 } from "react";
30412
30436
  import {
30413
30437
  PieChart,
30414
30438
  Pie,
@@ -30536,7 +30560,7 @@ var DonutChart = ({ className, style, loading, ...props }) => {
30536
30560
  }
30537
30561
  );
30538
30562
  };
30539
- var PieChart_default = React13.memo(DonutChart);
30563
+ var PieChart_default = React14.memo(DonutChart);
30540
30564
 
30541
30565
  // src/components/Blocks/EmailComposer.tsx
30542
30566
  import { jsx as jsx67, jsxs as jsxs41 } from "react/jsx-runtime";