@algorithm-shift/design-system 1.2.91 → 1.2.92

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
@@ -27678,7 +27678,8 @@ function useLazyDropdown(config) {
27678
27678
  const limit = PAGE_SIZE;
27679
27679
  const params = { page: pageNum, limit };
27680
27680
  if (term) params[configRef.current.dataLabel ?? "search"] = term;
27681
- const res = await axios.get(configRef.current.apiUrl, {
27681
+ const axiosClient = configRef.current.axiosInstance ?? axios;
27682
+ const res = await axiosClient.get(configRef.current.apiUrl, {
27682
27683
  params,
27683
27684
  withCredentials: true
27684
27685
  });
@@ -27726,7 +27727,8 @@ function useLazyDropdown(config) {
27726
27727
  if (!configRef.current.apiUrl) return [];
27727
27728
  try {
27728
27729
  setLoading(true);
27729
- const res = await axios.get(configRef.current.apiUrl, {
27730
+ const axiosClient = configRef.current.axiosInstance ?? axios;
27731
+ const res = await axiosClient.get(configRef.current.apiUrl, {
27730
27732
  params: { [configRef.current.dataKey]: configRef.current.value },
27731
27733
  withCredentials: true
27732
27734
  });
@@ -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(() => {
@@ -28913,7 +28917,7 @@ var MultiSelect = ({
28913
28917
  var MultiSelect_default = MultiSelect;
28914
28918
 
28915
28919
  // src/components/ui/data-table.tsx
28916
- import * as React9 from "react";
28920
+ import * as React10 from "react";
28917
28921
  import { faEllipsisH } from "@fortawesome/free-solid-svg-icons";
28918
28922
  import { FontAwesomeIcon as FontAwesomeIcon3 } from "@fortawesome/react-fontawesome";
28919
28923
  import {
@@ -29013,6 +29017,7 @@ function TableCell({ className, ...props }) {
29013
29017
  import { createColumnHelper } from "@tanstack/react-table";
29014
29018
 
29015
29019
  // src/lib/table/cellRendererFactory.tsx
29020
+ import React9 from "react";
29016
29021
  import Image2 from "next/image";
29017
29022
 
29018
29023
  // src/lib/dayjs-setup.ts
@@ -29093,6 +29098,22 @@ var getContrastColor = (bg) => {
29093
29098
  const brightness = (r * 299 + g * 587 + b * 114) / 1e3;
29094
29099
  return brightness > 160 ? "#000000" : "#FFFFFF";
29095
29100
  };
29101
+ var sanitizeValue = (val) => {
29102
+ if (val == null) return null;
29103
+ if (React9.isValidElement(val)) return val;
29104
+ if (typeof val === "string" || typeof val === "number") return val;
29105
+ if (Array.isArray(val)) return val.map((v, i) => /* @__PURE__ */ jsx52(React9.Fragment, { children: sanitizeValue(v) }, i));
29106
+ if (typeof val === "object") {
29107
+ if ("name" in val && typeof val.name === "string") return val.name;
29108
+ if ("label" in val && typeof val.label === "string") return val.label;
29109
+ try {
29110
+ return JSON.stringify(val);
29111
+ } catch {
29112
+ return "[object]";
29113
+ }
29114
+ }
29115
+ return String(val);
29116
+ };
29096
29117
  var cellRendererFactory = (renderer, rendererProps, value, row, customRenderers = {}, format2, customFormatters = {}) => {
29097
29118
  const formattedValue = valueFormatter(value, format2, customFormatters);
29098
29119
  switch (renderer) {
@@ -29244,13 +29265,15 @@ var useDynamicColumns = (config, customRenderers = {}, customFormatters = {}) =>
29244
29265
  return config.columns.map((col) => {
29245
29266
  const accessorKey = col.accessorKey ?? col.id;
29246
29267
  const accessorFn = (row) => {
29268
+ if (!row) return null;
29247
29269
  if (Object.prototype.hasOwnProperty.call(row, accessorKey)) {
29248
- return row[accessorKey];
29270
+ return sanitizeValue(row[accessorKey]);
29249
29271
  }
29250
29272
  if (accessorKey.includes(".")) {
29251
- return getValueByPath(row, accessorKey);
29273
+ const val = getValueByPath(row, accessorKey);
29274
+ return sanitizeValue(val);
29252
29275
  }
29253
- return row[accessorKey];
29276
+ return sanitizeValue(row[accessorKey]);
29254
29277
  };
29255
29278
  return columnHelper.accessor(accessorFn, {
29256
29279
  id: col.id ?? accessorKey,
@@ -29295,13 +29318,13 @@ function DataTable({
29295
29318
  onDeleteRow,
29296
29319
  rowActions
29297
29320
  }) {
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("");
29321
+ const [columnFilters, setColumnFilters] = React10.useState([]);
29322
+ const [columnVisibility, setColumnVisibility] = React10.useState({});
29323
+ const [manualSort, setManualSort] = React10.useState(null);
29324
+ const [searchTerm, setSearchTerm] = React10.useState("");
29302
29325
  const dynamicCols = useDynamicColumns({ columns });
29303
29326
  const table = useReactTable({
29304
- data,
29327
+ data: data ?? [],
29305
29328
  columns: dynamicCols,
29306
29329
  state: {
29307
29330
  columnFilters,
@@ -29514,7 +29537,7 @@ function DataTable({
29514
29537
  return /* @__PURE__ */ jsxs31(
29515
29538
  TableCell,
29516
29539
  {
29517
- className: `${meta?.cellClass ?? ""} ${isClickable ? "cursor-pointer hover:bg-gray-100" : ""} relative`,
29540
+ className: `${meta?.cellClass ?? ""} ${isClickable ? "cursor-pointer hover:bg-gray-100 underline text-blue-500" : ""} relative`,
29518
29541
  style: meta?.cellStyle,
29519
29542
  onClick: () => {
29520
29543
  if (isClickable && onCellClick) {
@@ -30066,7 +30089,7 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
30066
30089
  var Tabs_default = Tabs;
30067
30090
 
30068
30091
  // src/components/Navigation/Stages/Stages.tsx
30069
- import React10, { useState as useState9 } from "react";
30092
+ import React11, { useState as useState9 } from "react";
30070
30093
  import { jsx as jsx58, jsxs as jsxs35 } from "react/jsx-runtime";
30071
30094
  var StagesComponent = ({ stages, isShowBtn, buttonText, className, style, onStageChange, currentStage, dataKey = "key", dataLabel = "header", loading }) => {
30072
30095
  const [activeStage, setActiveStage] = useState9(currentStage || (stages && stages.length > 0 ? stages[0].key : null));
@@ -30101,7 +30124,7 @@ var StagesComponent = ({ stages, isShowBtn, buttonText, className, style, onStag
30101
30124
  const currentIndex = stages.findIndex((s) => s[dataKey] === activeStage);
30102
30125
  const isCompleted = isAllStagesCompleted || index < currentIndex;
30103
30126
  const isActive = !isAllStagesCompleted && index === currentIndex;
30104
- return /* @__PURE__ */ jsxs35(React10.Fragment, { children: [
30127
+ return /* @__PURE__ */ jsxs35(React11.Fragment, { children: [
30105
30128
  /* @__PURE__ */ jsx58(
30106
30129
  "button",
30107
30130
  {
@@ -30149,10 +30172,10 @@ import { jsx as jsx61, jsxs as jsxs37 } from "react/jsx-runtime";
30149
30172
  import { jsx as jsx62 } from "react/jsx-runtime";
30150
30173
 
30151
30174
  // src/components/ui/avatar.tsx
30152
- import * as React11 from "react";
30175
+ import * as React12 from "react";
30153
30176
  import * as AvatarPrimitive from "@radix-ui/react-avatar";
30154
30177
  import { jsx as jsx63 } from "react/jsx-runtime";
30155
- var Avatar = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx63(
30178
+ var Avatar = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx63(
30156
30179
  AvatarPrimitive.Root,
30157
30180
  {
30158
30181
  ref,
@@ -30164,7 +30187,7 @@ var Avatar = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ *
30164
30187
  }
30165
30188
  ));
30166
30189
  Avatar.displayName = AvatarPrimitive.Root.displayName;
30167
- var AvatarImage = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx63(
30190
+ var AvatarImage = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx63(
30168
30191
  AvatarPrimitive.Image,
30169
30192
  {
30170
30193
  ref,
@@ -30173,7 +30196,7 @@ var AvatarImage = React11.forwardRef(({ className, ...props }, ref) => /* @__PUR
30173
30196
  }
30174
30197
  ));
30175
30198
  AvatarImage.displayName = AvatarPrimitive.Image.displayName;
30176
- var AvatarFallback = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx63(
30199
+ var AvatarFallback = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx63(
30177
30200
  AvatarPrimitive.Fallback,
30178
30201
  {
30179
30202
  ref,
@@ -30333,7 +30356,7 @@ function Navbar({
30333
30356
  }
30334
30357
 
30335
30358
  // src/components/Chart/BarChart.tsx
30336
- import React12 from "react";
30359
+ import React13 from "react";
30337
30360
  import {
30338
30361
  BarChart,
30339
30362
  Bar,
@@ -30405,10 +30428,10 @@ var ChartComponent = ({ className, style, loading, ...props }) => {
30405
30428
  )
30406
30429
  ] }) }) });
30407
30430
  };
30408
- var BarChart_default = React12.memo(ChartComponent);
30431
+ var BarChart_default = React13.memo(ChartComponent);
30409
30432
 
30410
30433
  // src/components/Chart/PieChart.tsx
30411
- import React13, { useEffect as useEffect25, useMemo as useMemo6, useState as useState11 } from "react";
30434
+ import React14, { useEffect as useEffect25, useMemo as useMemo6, useState as useState11 } from "react";
30412
30435
  import {
30413
30436
  PieChart,
30414
30437
  Pie,
@@ -30536,7 +30559,7 @@ var DonutChart = ({ className, style, loading, ...props }) => {
30536
30559
  }
30537
30560
  );
30538
30561
  };
30539
- var PieChart_default = React13.memo(DonutChart);
30562
+ var PieChart_default = React14.memo(DonutChart);
30540
30563
 
30541
30564
  // src/components/Blocks/EmailComposer.tsx
30542
30565
  import { jsx as jsx67, jsxs as jsxs41 } from "react/jsx-runtime";