@algorithm-shift/design-system 1.2.960 → 1.2.961

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
@@ -27677,7 +27677,7 @@ function useLazyDropdown(config) {
27677
27677
  }, [config]);
27678
27678
  function getValueByPath2(obj, path) {
27679
27679
  if (!obj || !path) return void 0;
27680
- const parts = path.split(/\.|__/);
27680
+ const parts = path.split(/\./);
27681
27681
  return parts.reduce((acc, key) => acc?.[key], obj);
27682
27682
  }
27683
27683
  const transformToOptions = useCallback2((data) => {
@@ -27687,7 +27687,7 @@ function useLazyDropdown(config) {
27687
27687
  const value = getValueByPath2(item, cfg.dataKey) ?? item.id ?? "";
27688
27688
  let label = "";
27689
27689
  if (cfg.dataLabel) {
27690
- label = getValueByPath2(item, cfg.dataLabel) ?? item.name ?? item.label ?? "";
27690
+ label = getValueByPath2(item, cfg.dataLabel) ?? item.name ?? item.label ?? item.first_name ?? "";
27691
27691
  }
27692
27692
  return {
27693
27693
  value,
@@ -29337,10 +29337,17 @@ function DataTable({
29337
29337
  onPageChange?.(currentPageIndex, newSize);
29338
29338
  setLocalPageSize(newSize);
29339
29339
  };
29340
+ const pageSizeOptions = React9.useMemo(() => {
29341
+ const options = [10, 20, 50, 100].filter((size) => size < totalRecords);
29342
+ if (options.length === 0) {
29343
+ options.push(10);
29344
+ }
29345
+ return options;
29346
+ }, [totalRecords]);
29340
29347
  return /* @__PURE__ */ jsxs29("div", { className: "overflow-hidden rounded-md w-full", children: [
29341
29348
  !loading && /* @__PURE__ */ jsxs29("div", { className: "flex justify-between p-2 bg-gray-50", children: [
29342
29349
  /* @__PURE__ */ jsxs29("div", { className: "flex items-center gap-4 w-full", children: [
29343
- /* @__PURE__ */ jsxs29("p", { className: "text-sm font-medium", children: [
29350
+ totalRecords && /* @__PURE__ */ jsxs29("p", { className: "text-sm font-medium", children: [
29344
29351
  "Total Records : ",
29345
29352
  totalRecords.toLocaleString("en-IN") || 0
29346
29353
  ] }),
@@ -29570,7 +29577,7 @@ function DataTable({
29570
29577
  value: localPageSize,
29571
29578
  onChange: handlePageSizeChange,
29572
29579
  className: "ml-2 border rounded py-1 text-sm cursor-pointer border-blue-600",
29573
- children: [10, 20, 50, 100].map((size) => /* @__PURE__ */ jsxs29("option", { value: size, children: [
29580
+ children: pageSizeOptions.map((size) => /* @__PURE__ */ jsxs29("option", { value: size, children: [
29574
29581
  size,
29575
29582
  " / page"
29576
29583
  ] }, size))
@@ -29885,7 +29892,7 @@ var CustomPagination = ({
29885
29892
  var Pagination_default = CustomPagination;
29886
29893
 
29887
29894
  // src/components/Navigation/Tabs/Tabs.tsx
29888
- import { useCallback as useCallback3, useMemo as useMemo5, useState as useState8 } from "react";
29895
+ import { useCallback as useCallback3, useMemo as useMemo6, useState as useState8 } from "react";
29889
29896
  import Link5 from "next/link";
29890
29897
  import { useRouter } from "next/navigation";
29891
29898
 
@@ -30039,7 +30046,7 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
30039
30046
  });
30040
30047
  return sortMenus(rootMenus);
30041
30048
  }
30042
- const rawTabs = useMemo5(() => {
30049
+ const rawTabs = useMemo6(() => {
30043
30050
  if (!Array.isArray(tabs)) return [];
30044
30051
  if (source === "manual") return Array.isArray(tabs) ? tabs : [];
30045
30052
  return groupMenus(tabs);
@@ -30334,7 +30341,7 @@ import Link6 from "next/link";
30334
30341
  import Image4 from "next/image";
30335
30342
  import { useRouter as useRouter2 } from "next/navigation";
30336
30343
  import { DropdownMenuSeparator } from "@radix-ui/react-dropdown-menu";
30337
- import { useCallback as useCallback4, useMemo as useMemo6, useState as useState10 } from "react";
30344
+ import { useCallback as useCallback4, useMemo as useMemo7, useState as useState10 } from "react";
30338
30345
  import { Fragment as Fragment23, jsx as jsx63, jsxs as jsxs37 } from "react/jsx-runtime";
30339
30346
  function Navbar({
30340
30347
  style,
@@ -30373,7 +30380,7 @@ function Navbar({
30373
30380
  router.push(pendingUrl);
30374
30381
  }
30375
30382
  };
30376
- const formatedMenu = useMemo6(() => {
30383
+ const formatedMenu = useMemo7(() => {
30377
30384
  if (source === "state" && navList && navList.length) {
30378
30385
  return navList.map((i) => ({ ...i, header: i.name || "Menu" }));
30379
30386
  }
@@ -30551,7 +30558,7 @@ var ChartComponent = ({ className, style, loading, ...props }) => {
30551
30558
  var BarChart_default = React12.memo(ChartComponent);
30552
30559
 
30553
30560
  // src/components/Chart/PieChart.tsx
30554
- import React13, { useEffect as useEffect25, useMemo as useMemo7, useState as useState11 } from "react";
30561
+ import React13, { useEffect as useEffect25, useMemo as useMemo8, useState as useState11 } from "react";
30555
30562
  import {
30556
30563
  PieChart,
30557
30564
  Pie,
@@ -30580,18 +30587,18 @@ var DonutChart = ({ className, style, loading, ...props }) => {
30580
30587
  const showLegends = props.showLegends ?? true;
30581
30588
  const labelType = props.labelType || "inside";
30582
30589
  const canvasMode = props.canvasMode;
30583
- const data = useMemo7(() => {
30590
+ const data = useMemo8(() => {
30584
30591
  if (!Array.isArray(props.data)) return [];
30585
30592
  return props.data.map((item) => ({ ...item, color: getRandomColor() }));
30586
30593
  }, [props.data]);
30587
- const total = useMemo7(() => data.reduce((sum, d) => sum + d.value, 0), [data]);
30594
+ const total = useMemo8(() => data.reduce((sum, d) => sum + d.value, 0), [data]);
30588
30595
  const forceMobile = canvasMode === "mobile" || canvasMode === "tablet";
30589
30596
  const [mounted, setMounted] = useState11(false);
30590
30597
  useEffect25(() => {
30591
30598
  const timeout = setTimeout(() => setMounted(true), 100);
30592
30599
  return () => clearTimeout(timeout);
30593
30600
  }, []);
30594
- const renderLegends = useMemo7(() => {
30601
+ const renderLegends = useMemo8(() => {
30595
30602
  if (!showLegends) return null;
30596
30603
  return /* @__PURE__ */ jsx65(Fragment24, { children: data.map((d) => /* @__PURE__ */ jsxs39(
30597
30604
  "div",