@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.js CHANGED
@@ -27772,7 +27772,7 @@ function useLazyDropdown(config) {
27772
27772
  }, [config]);
27773
27773
  function getValueByPath2(obj, path) {
27774
27774
  if (!obj || !path) return void 0;
27775
- const parts = path.split(/\.|__/);
27775
+ const parts = path.split(/\./);
27776
27776
  return parts.reduce((acc, key) => acc?.[key], obj);
27777
27777
  }
27778
27778
  const transformToOptions = (0, import_react19.useCallback)((data) => {
@@ -27782,7 +27782,7 @@ function useLazyDropdown(config) {
27782
27782
  const value = getValueByPath2(item, cfg.dataKey) ?? item.id ?? "";
27783
27783
  let label = "";
27784
27784
  if (cfg.dataLabel) {
27785
- label = getValueByPath2(item, cfg.dataLabel) ?? item.name ?? item.label ?? "";
27785
+ label = getValueByPath2(item, cfg.dataLabel) ?? item.name ?? item.label ?? item.first_name ?? "";
27786
27786
  }
27787
27787
  return {
27788
27788
  value,
@@ -29426,10 +29426,17 @@ function DataTable({
29426
29426
  onPageChange?.(currentPageIndex, newSize);
29427
29427
  setLocalPageSize(newSize);
29428
29428
  };
29429
+ const pageSizeOptions = React9.useMemo(() => {
29430
+ const options = [10, 20, 50, 100].filter((size) => size < totalRecords);
29431
+ if (options.length === 0) {
29432
+ options.push(10);
29433
+ }
29434
+ return options;
29435
+ }, [totalRecords]);
29429
29436
  return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "overflow-hidden rounded-md w-full", children: [
29430
29437
  !loading && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex justify-between p-2 bg-gray-50", children: [
29431
29438
  /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex items-center gap-4 w-full", children: [
29432
- /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("p", { className: "text-sm font-medium", children: [
29439
+ totalRecords && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("p", { className: "text-sm font-medium", children: [
29433
29440
  "Total Records : ",
29434
29441
  totalRecords.toLocaleString("en-IN") || 0
29435
29442
  ] }),
@@ -29659,7 +29666,7 @@ function DataTable({
29659
29666
  value: localPageSize,
29660
29667
  onChange: handlePageSizeChange,
29661
29668
  className: "ml-2 border rounded py-1 text-sm cursor-pointer border-blue-600",
29662
- children: [10, 20, 50, 100].map((size) => /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("option", { value: size, children: [
29669
+ children: pageSizeOptions.map((size) => /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("option", { value: size, children: [
29663
29670
  size,
29664
29671
  " / page"
29665
29672
  ] }, size))