@algorithm-shift/design-system 1.3.106 → 1.3.108

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.js CHANGED
@@ -895,11 +895,13 @@ var ButtonGroup = ({
895
895
  "rounded-md overflow-hidden",
896
896
  "border border-border",
897
897
  "bg-background",
898
- "focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2"
898
+ "focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2",
899
+ className,
900
+ "p-0"
899
901
  );
900
902
  const mainButtonClasses = cn(
901
903
  className,
902
- orientation === "horizontal" ? "rounded-none border-l-0 border-t-0 border-r last:border-r-0" : "rounded-none border-t-0 border-b last:border-b-0",
904
+ orientation === "horizontal" ? "rounded-none border-l-0 border-t-0 border-b-0 border-r last:border-r-0" : "rounded-none border-t-0 border-l-0 border-r-0 last:border-b-0",
903
905
  "focus:ring-0 focus-visible:ring-0"
904
906
  );
905
907
  const dropdownButtonClasses = cn(
@@ -3663,6 +3665,7 @@ var React11 = __toESM(require("react"));
3663
3665
  var import_free_solid_svg_icons2 = require("@fortawesome/free-solid-svg-icons");
3664
3666
  var import_react_fontawesome3 = require("@fortawesome/react-fontawesome");
3665
3667
  var import_react_table2 = require("@tanstack/react-table");
3668
+ var import_axios3 = __toESM(require("axios"));
3666
3669
  var import_lucide_react12 = require("lucide-react");
3667
3670
 
3668
3671
  // src/components/ui/table.tsx
@@ -4099,13 +4102,153 @@ function DataTable({
4099
4102
  onDeleteRow,
4100
4103
  rowActions,
4101
4104
  enableRowSelection = false,
4102
- getRowSelection
4105
+ getRowSelection,
4106
+ tableId,
4107
+ manageColumns = false,
4108
+ preferenceUrl,
4109
+ axiosInstance
4103
4110
  }) {
4104
4111
  const [columnFilters, setColumnFilters] = React11.useState([]);
4105
4112
  const [columnVisibility, setColumnVisibility] = React11.useState({});
4113
+ const hasLoadedInitialState = React11.useRef(false);
4114
+ const isSavingRef = React11.useRef(false);
4115
+ const isFetchingRef = React11.useRef(false);
4116
+ const transformApiToFrontend = React11.useCallback((apiSettings, allColumnIds) => {
4117
+ if (!apiSettings || !apiSettings.columns || !apiSettings.columns.visible) {
4118
+ return {};
4119
+ }
4120
+ const visibleColumns = apiSettings.columns.visible;
4121
+ const result = {};
4122
+ allColumnIds.forEach((colId) => {
4123
+ result[colId] = visibleColumns.includes(colId);
4124
+ });
4125
+ return result;
4126
+ }, []);
4127
+ const transformFrontendToApi = React11.useCallback((visibility) => {
4128
+ const visibleColumns = Object.keys(visibility).filter((colId) => visibility[colId] === true);
4129
+ return {
4130
+ columns: {
4131
+ visible: visibleColumns
4132
+ }
4133
+ };
4134
+ }, []);
4135
+ const fetchColumnPreferences = React11.useCallback(async () => {
4136
+ if (isFetchingRef.current) {
4137
+ return;
4138
+ }
4139
+ if (!tableId || !manageColumns) {
4140
+ hasLoadedInitialState.current = true;
4141
+ return;
4142
+ }
4143
+ isFetchingRef.current = true;
4144
+ try {
4145
+ const entityKey = `table:${tableId}`;
4146
+ const apiUrl = `${preferenceUrl}/${encodeURIComponent(entityKey)}`;
4147
+ const axiosClient = axiosInstance ?? import_axios3.default;
4148
+ const response = await axiosClient.get(apiUrl, {
4149
+ withCredentials: true
4150
+ });
4151
+ if (response) {
4152
+ const data2 = response.data;
4153
+ if (data2.success && data2.data && data2.data.exists && data2.data.settings) {
4154
+ let allColumnIds = [];
4155
+ if (tableRef.current) {
4156
+ allColumnIds = tableRef.current.getAllLeafColumns().map((col) => col.id).filter(Boolean);
4157
+ } else {
4158
+ allColumnIds = columns.map((col) => {
4159
+ if (typeof col.id === "string") {
4160
+ return col.id;
4161
+ }
4162
+ if (col.accessorKey) {
4163
+ return col.accessorKey;
4164
+ }
4165
+ return null;
4166
+ }).filter((id) => !!id);
4167
+ if (enableRowSelection && !allColumnIds.includes("__select__")) {
4168
+ allColumnIds.unshift("__select__");
4169
+ }
4170
+ }
4171
+ if (allColumnIds.length > 0) {
4172
+ const transformed = transformApiToFrontend(data2.data.settings, allColumnIds);
4173
+ console.log("[DataTable] Loaded column preferences:", {
4174
+ visibleColumns: data2.data.settings.columns?.visible,
4175
+ allColumnIds,
4176
+ transformed
4177
+ });
4178
+ if (Object.keys(transformed).length > 0) {
4179
+ setColumnVisibility(transformed);
4180
+ }
4181
+ }
4182
+ } else {
4183
+ console.log("[DataTable] No saved preferences found, using default visibility");
4184
+ }
4185
+ } else {
4186
+ console.warn("Failed to fetch column preferences:", response);
4187
+ }
4188
+ } catch (error) {
4189
+ console.error("Error fetching column preferences:", error);
4190
+ } finally {
4191
+ hasLoadedInitialState.current = true;
4192
+ isFetchingRef.current = false;
4193
+ }
4194
+ }, [tableId, transformApiToFrontend, manageColumns]);
4195
+ const saveColumnPreferences = React11.useCallback(async (visibility) => {
4196
+ if (!tableId || isSavingRef.current || !manageColumns) {
4197
+ return;
4198
+ }
4199
+ isSavingRef.current = true;
4200
+ try {
4201
+ const entityKey = `table:${tableId}`;
4202
+ const apiUrl = `${preferenceUrl}/${encodeURIComponent(entityKey)}`;
4203
+ const settings = transformFrontendToApi(visibility);
4204
+ const requestBody = {
4205
+ settings,
4206
+ is_default: true
4207
+ };
4208
+ const axiosClient = axiosInstance ?? import_axios3.default;
4209
+ const response = await axiosClient.post(apiUrl, requestBody, {
4210
+ withCredentials: true
4211
+ });
4212
+ if (!response) {
4213
+ console.error("Failed to save column preferences:", response);
4214
+ }
4215
+ } catch (error) {
4216
+ console.error("Error saving column preferences:", error);
4217
+ } finally {
4218
+ isSavingRef.current = false;
4219
+ }
4220
+ }, [tableId, transformFrontendToApi, manageColumns]);
4221
+ React11.useEffect(() => {
4222
+ if (hasLoadedInitialState.current || isFetchingRef.current) {
4223
+ return;
4224
+ }
4225
+ if (!tableId) {
4226
+ return;
4227
+ }
4228
+ if (manageColumns) {
4229
+ fetchColumnPreferences();
4230
+ }
4231
+ }, [tableId, manageColumns]);
4106
4232
  const [manualSort, setManualSort] = React11.useState(null);
4107
4233
  const [searchTerm, setSearchTerm] = React11.useState("");
4108
4234
  const tableData = Array.isArray(data) ? data : [];
4235
+ const filteredData = React11.useMemo(() => {
4236
+ if (paginationMode === "client" && globalSearch && searchTerm.trim()) {
4237
+ const searchLower = searchTerm.toLowerCase().trim();
4238
+ return tableData.filter((row) => {
4239
+ return columns.some((column) => {
4240
+ const columnId = typeof column.id === "string" ? column.id : column.accessorKey;
4241
+ if (!columnId) return false;
4242
+ const accessorFn = column.accessorFn;
4243
+ const cellValue = accessorFn ? accessorFn(row, 0) : row[columnId];
4244
+ const cellValueStr = cellValue != null ? String(cellValue).toLowerCase() : "";
4245
+ return cellValueStr.includes(searchLower);
4246
+ });
4247
+ });
4248
+ }
4249
+ return tableData;
4250
+ }, [tableData, searchTerm, paginationMode, globalSearch, columns]);
4251
+ const finalData = paginationMode === "client" && globalSearch ? filteredData : tableData;
4109
4252
  const finalCols = [...columns];
4110
4253
  if (enableRowSelection) {
4111
4254
  finalCols.unshift({
@@ -4132,44 +4275,89 @@ function DataTable({
4132
4275
  const dynamicCols = useDynamicColumns({ columns: finalCols, enableRowSelection });
4133
4276
  const [rowSelection, setRowSelection] = React11.useState({});
4134
4277
  const [localPageSize, setLocalPageSize] = React11.useState(pageSize);
4278
+ const [localPageIndex, setLocalPageIndex] = React11.useState(0);
4279
+ const isUpdatingPageSizeRef = React11.useRef(false);
4280
+ const tableRef = React11.useRef(null);
4281
+ React11.useEffect(() => {
4282
+ if (paginationMode === "client") {
4283
+ setLocalPageSize(pageSize);
4284
+ }
4285
+ }, [pageSize, paginationMode]);
4135
4286
  const table = (0, import_react_table2.useReactTable)({
4136
- data: tableData,
4287
+ data: finalData,
4137
4288
  columns: dynamicCols,
4289
+ initialState: {
4290
+ pagination: {
4291
+ pageIndex: 0,
4292
+ pageSize
4293
+ }
4294
+ },
4138
4295
  state: {
4139
4296
  columnFilters,
4140
4297
  columnVisibility,
4141
4298
  rowSelection,
4142
- ...paginationMode === "server" ? {
4143
- pagination: {
4144
- pageIndex: controlledPageIndex ?? 0,
4145
- pageSize: localPageSize
4146
- }
4147
- } : {}
4299
+ pagination: {
4300
+ pageIndex: paginationMode === "server" ? controlledPageIndex ?? 0 : localPageIndex,
4301
+ pageSize: localPageSize
4302
+ }
4148
4303
  },
4149
4304
  enableRowSelection: !!enableRowSelection,
4150
4305
  onRowSelectionChange: (updater) => {
4151
4306
  setRowSelection((old) => {
4152
4307
  const newState = typeof updater === "function" ? updater(old) : updater;
4153
- const selectedData = Object.keys(newState).filter((key) => newState[key]).map((rowId) => tableData[Number(rowId)]);
4308
+ const selectedData = Object.keys(newState).filter((key) => newState[key]).map((rowId) => finalData[Number(rowId)]);
4154
4309
  getRowSelection?.({ rows: selectedData });
4155
4310
  return newState;
4156
4311
  });
4157
4312
  },
4158
4313
  onColumnFiltersChange: setColumnFilters,
4159
- onColumnVisibilityChange: setColumnVisibility,
4314
+ onColumnVisibilityChange: (updater) => {
4315
+ setColumnVisibility((old) => {
4316
+ const newState = typeof updater === "function" ? updater(old) : updater;
4317
+ setTimeout(() => {
4318
+ if (tableRef.current && tableId && hasLoadedInitialState.current) {
4319
+ try {
4320
+ const completeVisibility = {};
4321
+ tableRef.current.getAllLeafColumns().forEach((column) => {
4322
+ completeVisibility[column.id] = column.getIsVisible();
4323
+ });
4324
+ if (Object.keys(completeVisibility).length > 0) {
4325
+ saveColumnPreferences(completeVisibility);
4326
+ }
4327
+ } catch (error) {
4328
+ console.error("Error saving column visibility to API:", error);
4329
+ }
4330
+ }
4331
+ }, 0);
4332
+ return newState;
4333
+ });
4334
+ },
4160
4335
  getCoreRowModel: (0, import_react_table2.getCoreRowModel)(),
4161
4336
  getFilteredRowModel: (0, import_react_table2.getFilteredRowModel)(),
4162
4337
  getPaginationRowModel: pagination && paginationMode === "client" ? (0, import_react_table2.getPaginationRowModel)() : void 0,
4163
4338
  manualPagination: paginationMode === "server",
4164
4339
  pageCount: paginationMode === "server" ? Math.ceil(totalRecords / localPageSize) : void 0,
4165
- ...paginationMode === "server" ? {
4166
- onPaginationChange: (updater) => {
4167
- const prev = table.getState().pagination;
4168
- const next = typeof updater === "function" ? updater(prev) : updater;
4340
+ onPaginationChange: (updater) => {
4341
+ if (isUpdatingPageSizeRef.current) {
4342
+ isUpdatingPageSizeRef.current = false;
4343
+ return;
4344
+ }
4345
+ const prev = table.getState().pagination;
4346
+ const next = typeof updater === "function" ? updater(prev) : updater;
4347
+ if (paginationMode === "server") {
4169
4348
  onPageChange?.(next.pageIndex, next.pageSize);
4349
+ } else {
4350
+ setLocalPageIndex(next.pageIndex);
4351
+ setLocalPageSize(next.pageSize);
4170
4352
  }
4171
- } : {}
4353
+ }
4172
4354
  });
4355
+ React11.useEffect(() => {
4356
+ tableRef.current = table;
4357
+ if (table && !hasLoadedInitialState.current && !isFetchingRef.current && tableId) {
4358
+ fetchColumnPreferences();
4359
+ }
4360
+ }, [table, tableId]);
4173
4361
  const getPageNumbers = (currentPage, totalPages, maxVisiblePages = 5) => {
4174
4362
  if (totalPages <= maxVisiblePages) {
4175
4363
  return Array.from({ length: totalPages }, (_, i) => i + 1);
@@ -4192,17 +4380,26 @@ function DataTable({
4192
4380
  const pageCount = table.getPageCount() === 0 ? 1 : table.getPageCount();
4193
4381
  const handlePageSizeChange = (e) => {
4194
4382
  const newSize = Number(e.target.value);
4195
- const currentPageIndex = table.getState().pagination.pageIndex;
4196
- onPageChange?.(currentPageIndex, newSize);
4197
- setLocalPageSize(newSize);
4383
+ if (paginationMode === "server") {
4384
+ const currentPageIndex = table.getState().pagination.pageIndex;
4385
+ onPageChange?.(currentPageIndex, newSize);
4386
+ setLocalPageSize(newSize);
4387
+ } else {
4388
+ isUpdatingPageSizeRef.current = true;
4389
+ setLocalPageSize(newSize);
4390
+ setLocalPageIndex(0);
4391
+ }
4198
4392
  };
4199
4393
  const pageSizeOptions = React11.useMemo(() => {
4394
+ if (paginationMode === "client") {
4395
+ return [5, 10, 20, 50, 100];
4396
+ }
4200
4397
  const options = [5, 10, 20, 50, 100].filter((size) => size < totalRecords);
4201
4398
  if (options.length === 0) {
4202
4399
  options.push(5);
4203
4400
  }
4204
4401
  return options;
4205
- }, [totalRecords]);
4402
+ }, [paginationMode, totalRecords]);
4206
4403
  return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "overflow-hidden rounded-md w-full", children: [
4207
4404
  !loading && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex justify-between p-2 bg-gray-50", children: [
4208
4405
  /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex items-center gap-4 w-full", children: [
@@ -4218,10 +4415,17 @@ function DataTable({
4218
4415
  type: "text",
4219
4416
  placeholder: "Search...",
4220
4417
  value: searchTerm,
4221
- onChange: (e) => setSearchTerm(e.target.value),
4418
+ onChange: (e) => {
4419
+ setSearchTerm(e.target.value);
4420
+ if (paginationMode === "client") {
4421
+ setLocalPageIndex(0);
4422
+ }
4423
+ },
4222
4424
  onKeyDown: (e) => {
4223
- if (e.key === "Enter" && onGlobalSearch) {
4224
- onGlobalSearch(searchTerm.trim());
4425
+ if (e.key === "Enter") {
4426
+ if (paginationMode === "server" && onGlobalSearch) {
4427
+ onGlobalSearch(searchTerm.trim());
4428
+ }
4225
4429
  }
4226
4430
  },
4227
4431
  className: "border border-gray-300 rounded-md text-sm px-3 py-2 pl-8 w-full focus:outline-none focus:ring-1 focus:ring-[#12715B]"
@@ -4229,7 +4433,7 @@ function DataTable({
4229
4433
  ),
4230
4434
  /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_lucide_react12.Search, { className: "absolute left-2 top-2.5 text-gray-400", size: 16 })
4231
4435
  ] }),
4232
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
4436
+ paginationMode === "server" && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
4233
4437
  Button,
4234
4438
  {
4235
4439
  size: "sm",
@@ -4240,7 +4444,7 @@ function DataTable({
4240
4444
  )
4241
4445
  ] })
4242
4446
  ] }),
4243
- /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(Popover, { children: [
4447
+ manageColumns && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(Popover, { children: [
4244
4448
  /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
4245
4449
  Button,
4246
4450
  {
@@ -4250,42 +4454,44 @@ function DataTable({
4250
4454
  children: "Manage Columns"
4251
4455
  }
4252
4456
  ) }),
4253
- /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(PopoverContent, { align: "end", className: "w-48 p-3 space-y-2", children: [
4457
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(PopoverContent, { align: "end", className: "w-48 p-3", children: [
4254
4458
  /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "text-sm font-medium mb-2", children: "Show / Hide Columns" }),
4255
- /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("label", { className: "flex items-center gap-2 text-sm font-semibold border-b pb-2 mb-2", children: [
4256
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
4257
- "input",
4258
- {
4259
- type: "checkbox",
4260
- checked: table.getAllLeafColumns().every((col) => col.getIsVisible()),
4261
- ref: (input) => {
4262
- if (input) {
4263
- input.indeterminate = table.getAllLeafColumns().some((col) => col.getIsVisible()) && !table.getAllLeafColumns().every((col) => col.getIsVisible());
4264
- }
4265
- },
4266
- onChange: (e) => {
4267
- table.getAllLeafColumns().forEach(
4268
- (col) => col.toggleVisibility(e.target.checked)
4269
- );
4270
- }
4271
- }
4272
- ),
4273
- "Toggle All"
4274
- ] }),
4275
- table.getAllLeafColumns().map((column) => {
4276
- const header = column.columnDef.header;
4277
- return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("label", { className: "flex items-center gap-2 text-sm", children: [
4459
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "max-h-56 overflow-y-auto pr-1 space-y-2", children: [
4460
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("label", { className: "flex items-center gap-2 text-sm font-semibold border-b pb-2 mb-2", children: [
4278
4461
  /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
4279
4462
  "input",
4280
4463
  {
4281
4464
  type: "checkbox",
4282
- checked: column.getIsVisible(),
4283
- onChange: (e) => column.toggleVisibility(e.target.checked)
4465
+ checked: table.getAllLeafColumns().every((col) => col.getIsVisible()),
4466
+ ref: (input) => {
4467
+ if (input) {
4468
+ input.indeterminate = table.getAllLeafColumns().some((col) => col.getIsVisible()) && !table.getAllLeafColumns().every((col) => col.getIsVisible());
4469
+ }
4470
+ },
4471
+ onChange: (e) => {
4472
+ table.getAllLeafColumns().forEach(
4473
+ (col) => col.toggleVisibility(e.target.checked)
4474
+ );
4475
+ }
4284
4476
  }
4285
4477
  ),
4286
- typeof header === "function" ? header({ column, header, table }) : typeof header === "string" ? header : column.id
4287
- ] }, column.id);
4288
- })
4478
+ "Toggle All"
4479
+ ] }),
4480
+ table.getAllLeafColumns().map((column) => {
4481
+ const header = column.columnDef.header;
4482
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("label", { className: "flex items-center gap-2 text-sm", children: [
4483
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
4484
+ "input",
4485
+ {
4486
+ type: "checkbox",
4487
+ checked: column.getIsVisible(),
4488
+ onChange: (e) => column.toggleVisibility(e.target.checked)
4489
+ }
4490
+ ),
4491
+ typeof header === "function" ? header({ column, header, table }) : typeof header === "string" ? header : column.id
4492
+ ] }, column.id);
4493
+ })
4494
+ ] })
4289
4495
  ] })
4290
4496
  ] })
4291
4497
  ] }),
@@ -4384,7 +4590,22 @@ function DataTable({
4384
4590
  `header-${header.id}-${index}`
4385
4591
  );
4386
4592
  }) }, `header-group-${hg.id}`)) }),
4387
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(TableBody, { children: loading ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_jsx_runtime51.Fragment, { children: Array.from({ length: 5 }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(TableRow, { children: dynamicCols.map((_2, j) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(TableCell, { className: "p-3", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "h-4 bg-gray-200 rounded w-3/4 block animate-pulse" }) }, j)) }, i)) }) : table.getRowModel().rows.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(TableRow, { children: row.getVisibleCells().map((cell, cellIndex, arr) => {
4593
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(TableBody, { children: loading ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_jsx_runtime51.Fragment, { children: Array.from({ length: 5 }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(TableRow, { children: table.getHeaderGroups()[0].headers.map((header, j) => {
4594
+ const column = header.column;
4595
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
4596
+ TableCell,
4597
+ {
4598
+ className: "p-3",
4599
+ style: {
4600
+ width: column.getSize(),
4601
+ minWidth: column.columnDef.minSize,
4602
+ maxWidth: column.columnDef.maxSize
4603
+ },
4604
+ children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "h-4 bg-gray-200 rounded w-full block animate-pulse" })
4605
+ },
4606
+ j
4607
+ );
4608
+ }) }, i)) }) : table.getRowModel().rows.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(TableRow, { children: row.getVisibleCells().map((cell, cellIndex, arr) => {
4388
4609
  const meta = cell.column.columnDef.meta || {};
4389
4610
  const isClickable = meta?.isClickable;
4390
4611
  const isLastCell = cellIndex === arr.length - 1;
@@ -5821,7 +6042,7 @@ function Navbar({
5821
6042
 
5822
6043
  // src/components/Chart/BarChart.tsx
5823
6044
  var import_react36 = __toESM(require("react"));
5824
- var import_axios3 = __toESM(require("axios"));
6045
+ var import_axios4 = __toESM(require("axios"));
5825
6046
  var import_recharts = require("recharts");
5826
6047
  var import_jsx_runtime68 = require("react/jsx-runtime");
5827
6048
  var getRandomColor = () => {
@@ -5901,7 +6122,7 @@ var ChartComponent = ({
5901
6122
  page: page.toString(),
5902
6123
  limit: limit.toString()
5903
6124
  });
5904
- const axiosClient = props.axiosInstance ?? import_axios3.default;
6125
+ const axiosClient = props.axiosInstance ?? import_axios4.default;
5905
6126
  const res = await axiosClient.get(`${apiUrl}?${params.toString()}`, {
5906
6127
  withCredentials: true
5907
6128
  });
@@ -6129,7 +6350,7 @@ var BarChart_default = import_react36.default.memo(ChartComponent);
6129
6350
 
6130
6351
  // src/components/Chart/PieChart.tsx
6131
6352
  var import_react37 = __toESM(require("react"));
6132
- var import_axios4 = __toESM(require("axios"));
6353
+ var import_axios5 = __toESM(require("axios"));
6133
6354
  var import_recharts2 = require("recharts");
6134
6355
  var import_jsx_runtime69 = require("react/jsx-runtime");
6135
6356
  var getRandomColor2 = () => {
@@ -6218,7 +6439,7 @@ var DonutChart = ({
6218
6439
  const fetchData = async () => {
6219
6440
  try {
6220
6441
  setLocalLoading(true);
6221
- const axiosClient = props.axiosInstance ?? import_axios4.default;
6442
+ const axiosClient = props.axiosInstance ?? import_axios5.default;
6222
6443
  const res = await axiosClient.get(apiUrl, {
6223
6444
  withCredentials: true
6224
6445
  });