@juv/codego-react-ui 3.0.6 → 3.0.7

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.cjs CHANGED
@@ -5358,45 +5358,52 @@ function DataGrid({
5358
5358
  onPageChange: setPage
5359
5359
  }
5360
5360
  ),
5361
- serverPagination && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center justify-between gap-2 flex-wrap", children: [
5362
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "text-xs text-muted-foreground", children: [
5363
- serverPagination.pagination.total,
5364
- " total rows \xB7 page ",
5365
- serverPagination.currentPage
5366
- ] }),
5367
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-1", children: [
5368
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5369
- "button",
5370
- {
5371
- onClick: () => serverPagination.goToPage(serverPagination.currentPage - 1),
5372
- disabled: !serverPagination.pagination.prev_page_url,
5373
- className: "flex h-8 w-8 items-center justify-center rounded-lg border border-border text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-40 disabled:pointer-events-none",
5374
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react15.ChevronLeft, { className: "h-4 w-4" })
5375
- }
5376
- ),
5377
- serverPagination.pagination.links.map((link) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5378
- "button",
5379
- {
5380
- onClick: () => serverPagination.goToPage(link.page),
5381
- className: cn(
5382
- "flex h-8 w-8 items-center justify-center rounded-lg border text-xs font-medium transition-colors",
5383
- link.active ? "border-primary bg-primary text-primary-foreground shadow-sm" : "border-border text-muted-foreground hover:bg-muted hover:text-foreground"
5384
- ),
5385
- children: link.page
5386
- },
5387
- link.page
5388
- )),
5389
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5390
- "button",
5391
- {
5392
- onClick: () => serverPagination.goToPage(serverPagination.currentPage + 1),
5393
- disabled: !serverPagination.pagination.next_page_url,
5394
- className: "flex h-8 w-8 items-center justify-center rounded-lg border border-border text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-40 disabled:pointer-events-none",
5395
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react15.ChevronRight, { className: "h-4 w-4" })
5396
- }
5397
- )
5398
- ] })
5399
- ] }),
5361
+ serverPagination && (() => {
5362
+ const { pagination, currentPage: cp, goToPage } = serverPagination;
5363
+ const totalServerPages = Math.ceil(pagination.total / pagination.per_page);
5364
+ const pageLinks = Array.from({ length: totalServerPages }, (_, i) => i + 1);
5365
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center justify-between gap-2 flex-wrap", children: [
5366
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "text-xs text-muted-foreground", children: [
5367
+ pagination.total,
5368
+ " total rows \xB7 page ",
5369
+ cp,
5370
+ " of ",
5371
+ totalServerPages
5372
+ ] }),
5373
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-1", children: [
5374
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5375
+ "button",
5376
+ {
5377
+ onClick: () => goToPage(cp - 1),
5378
+ disabled: !pagination.prev_page_url,
5379
+ className: "flex h-8 w-8 items-center justify-center rounded-lg border border-border text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-40 disabled:pointer-events-none",
5380
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react15.ChevronLeft, { className: "h-4 w-4" })
5381
+ }
5382
+ ),
5383
+ pageLinks.map((p) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5384
+ "button",
5385
+ {
5386
+ onClick: () => goToPage(p),
5387
+ className: cn(
5388
+ "flex h-8 w-8 items-center justify-center rounded-lg border text-xs font-medium transition-colors",
5389
+ p === cp ? "border-primary bg-primary text-primary-foreground shadow-sm" : "border-border text-muted-foreground hover:bg-muted hover:text-foreground"
5390
+ ),
5391
+ children: p
5392
+ },
5393
+ p
5394
+ )),
5395
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5396
+ "button",
5397
+ {
5398
+ onClick: () => goToPage(cp + 1),
5399
+ disabled: !pagination.next_page_url,
5400
+ className: "flex h-8 w-8 items-center justify-center rounded-lg border border-border text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-40 disabled:pointer-events-none",
5401
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react15.ChevronRight, { className: "h-4 w-4" })
5402
+ }
5403
+ )
5404
+ ] })
5405
+ ] });
5406
+ })(),
5400
5407
  defaultActions && viewItem && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(DGViewModal, { item: viewItem, fields: viewFields, onClose: () => setViewItem(null) }),
5401
5408
  defaultActions && editItem && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5402
5409
  DGEditModal,
@@ -10145,45 +10152,52 @@ function Table({
10145
10152
  )
10146
10153
  ] })
10147
10154
  ] }),
10148
- serverPagination && /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex items-center justify-between gap-2 flex-wrap", children: [
10149
- /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("span", { className: "text-xs text-muted-foreground", children: [
10150
- serverPagination.pagination.total,
10151
- " total rows \xB7 page ",
10152
- serverPagination.currentPage
10153
- ] }),
10154
- /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex items-center gap-1", children: [
10155
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
10156
- "button",
10157
- {
10158
- onClick: () => serverPagination.goToPage(serverPagination.currentPage - 1),
10159
- disabled: !serverPagination.pagination.prev_page_url,
10160
- className: "flex h-8 w-8 items-center justify-center rounded-lg border border-border text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-40 disabled:pointer-events-none",
10161
- children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_lucide_react28.ChevronLeft, { className: "h-4 w-4" })
10162
- }
10163
- ),
10164
- serverPagination.pagination.links.map((link) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
10165
- "button",
10166
- {
10167
- onClick: () => serverPagination.goToPage(link.page),
10168
- className: cn(
10169
- "flex h-8 w-8 items-center justify-center rounded-lg border text-xs font-medium transition-colors",
10170
- link.active ? "border-primary bg-primary text-primary-foreground shadow-sm" : "border-border text-muted-foreground hover:bg-muted hover:text-foreground"
10171
- ),
10172
- children: link.page
10173
- },
10174
- link.page
10175
- )),
10176
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
10177
- "button",
10178
- {
10179
- onClick: () => serverPagination.goToPage(serverPagination.currentPage + 1),
10180
- disabled: !serverPagination.pagination.next_page_url,
10181
- className: "flex h-8 w-8 items-center justify-center rounded-lg border border-border text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-40 disabled:pointer-events-none",
10182
- children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_lucide_react28.ChevronRight, { className: "h-4 w-4" })
10183
- }
10184
- )
10185
- ] })
10186
- ] })
10155
+ serverPagination && (() => {
10156
+ const { pagination: pagination2, currentPage: cp, goToPage } = serverPagination;
10157
+ const totalServerPages = Math.ceil(pagination2.total / pagination2.per_page);
10158
+ const pageLinks = Array.from({ length: totalServerPages }, (_, i) => i + 1);
10159
+ return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex items-center justify-between gap-2 flex-wrap", children: [
10160
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("span", { className: "text-xs text-muted-foreground", children: [
10161
+ pagination2.total,
10162
+ " total rows \xB7 page ",
10163
+ cp,
10164
+ " of ",
10165
+ totalServerPages
10166
+ ] }),
10167
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex items-center gap-1", children: [
10168
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
10169
+ "button",
10170
+ {
10171
+ onClick: () => goToPage(cp - 1),
10172
+ disabled: !pagination2.prev_page_url,
10173
+ className: "flex h-8 w-8 items-center justify-center rounded-lg border border-border text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-40 disabled:pointer-events-none",
10174
+ children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_lucide_react28.ChevronLeft, { className: "h-4 w-4" })
10175
+ }
10176
+ ),
10177
+ pageLinks.map((p) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
10178
+ "button",
10179
+ {
10180
+ onClick: () => goToPage(p),
10181
+ className: cn(
10182
+ "flex h-8 w-8 items-center justify-center rounded-lg border text-xs font-medium transition-colors",
10183
+ p === cp ? "border-primary bg-primary text-primary-foreground shadow-sm" : "border-border text-muted-foreground hover:bg-muted hover:text-foreground"
10184
+ ),
10185
+ children: p
10186
+ },
10187
+ p
10188
+ )),
10189
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
10190
+ "button",
10191
+ {
10192
+ onClick: () => goToPage(cp + 1),
10193
+ disabled: !pagination2.next_page_url,
10194
+ className: "flex h-8 w-8 items-center justify-center rounded-lg border border-border text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-40 disabled:pointer-events-none",
10195
+ children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_lucide_react28.ChevronRight, { className: "h-4 w-4" })
10196
+ }
10197
+ )
10198
+ ] })
10199
+ ] });
10200
+ })()
10187
10201
  ] }),
10188
10202
  defaultActions && viewItem && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
10189
10203
  ViewModal,
package/dist/index.d.cts CHANGED
@@ -449,7 +449,7 @@ interface TableProps<T> {
449
449
  /** When provided, appends an Actions column with View / Edit / Delete buttons */
450
450
  defaultActions?: DefaultActionsConfig<T>;
451
451
  /** Pass the serverPagination object from useServerTable to enable server-side pagination */
452
- serverPagination?: ServerPaginationProp;
452
+ serverPagination?: ServerPaginationProp | null;
453
453
  className?: string;
454
454
  }
455
455
  declare function Table<T extends Record<string, any>>({ data, columns, searchable, searchPlaceholder, pagination, itemsPerPage, selectable, onBulkDelete, idKey, defaultActions, serverPagination, className, }: TableProps<T>): react_jsx_runtime.JSX.Element;
package/dist/index.d.ts CHANGED
@@ -449,7 +449,7 @@ interface TableProps<T> {
449
449
  /** When provided, appends an Actions column with View / Edit / Delete buttons */
450
450
  defaultActions?: DefaultActionsConfig<T>;
451
451
  /** Pass the serverPagination object from useServerTable to enable server-side pagination */
452
- serverPagination?: ServerPaginationProp;
452
+ serverPagination?: ServerPaginationProp | null;
453
453
  className?: string;
454
454
  }
455
455
  declare function Table<T extends Record<string, any>>({ data, columns, searchable, searchPlaceholder, pagination, itemsPerPage, selectable, onBulkDelete, idKey, defaultActions, serverPagination, className, }: TableProps<T>): react_jsx_runtime.JSX.Element;
@@ -61933,45 +61933,52 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
61933
61933
  onPageChange: setPage
61934
61934
  }
61935
61935
  ),
61936
- serverPagination && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center justify-between gap-2 flex-wrap", children: [
61937
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "text-xs text-muted-foreground", children: [
61938
- serverPagination.pagination.total,
61939
- " total rows \xB7 page ",
61940
- serverPagination.currentPage
61941
- ] }),
61942
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-1", children: [
61943
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
61944
- "button",
61945
- {
61946
- onClick: () => serverPagination.goToPage(serverPagination.currentPage - 1),
61947
- disabled: !serverPagination.pagination.prev_page_url,
61948
- className: "flex h-8 w-8 items-center justify-center rounded-lg border border-border text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-40 disabled:pointer-events-none",
61949
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ChevronLeft, { className: "h-4 w-4" })
61950
- }
61951
- ),
61952
- serverPagination.pagination.links.map((link) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
61953
- "button",
61954
- {
61955
- onClick: () => serverPagination.goToPage(link.page),
61956
- className: cn(
61957
- "flex h-8 w-8 items-center justify-center rounded-lg border text-xs font-medium transition-colors",
61958
- link.active ? "border-primary bg-primary text-primary-foreground shadow-sm" : "border-border text-muted-foreground hover:bg-muted hover:text-foreground"
61959
- ),
61960
- children: link.page
61961
- },
61962
- link.page
61963
- )),
61964
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
61965
- "button",
61966
- {
61967
- onClick: () => serverPagination.goToPage(serverPagination.currentPage + 1),
61968
- disabled: !serverPagination.pagination.next_page_url,
61969
- className: "flex h-8 w-8 items-center justify-center rounded-lg border border-border text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-40 disabled:pointer-events-none",
61970
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ChevronRight, { className: "h-4 w-4" })
61971
- }
61972
- )
61973
- ] })
61974
- ] }),
61936
+ serverPagination && (() => {
61937
+ const { pagination, currentPage: cp, goToPage } = serverPagination;
61938
+ const totalServerPages = Math.ceil(pagination.total / pagination.per_page);
61939
+ const pageLinks = Array.from({ length: totalServerPages }, (_, i) => i + 1);
61940
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center justify-between gap-2 flex-wrap", children: [
61941
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "text-xs text-muted-foreground", children: [
61942
+ pagination.total,
61943
+ " total rows \xB7 page ",
61944
+ cp,
61945
+ " of ",
61946
+ totalServerPages
61947
+ ] }),
61948
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-1", children: [
61949
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
61950
+ "button",
61951
+ {
61952
+ onClick: () => goToPage(cp - 1),
61953
+ disabled: !pagination.prev_page_url,
61954
+ className: "flex h-8 w-8 items-center justify-center rounded-lg border border-border text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-40 disabled:pointer-events-none",
61955
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ChevronLeft, { className: "h-4 w-4" })
61956
+ }
61957
+ ),
61958
+ pageLinks.map((p) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
61959
+ "button",
61960
+ {
61961
+ onClick: () => goToPage(p),
61962
+ className: cn(
61963
+ "flex h-8 w-8 items-center justify-center rounded-lg border text-xs font-medium transition-colors",
61964
+ p === cp ? "border-primary bg-primary text-primary-foreground shadow-sm" : "border-border text-muted-foreground hover:bg-muted hover:text-foreground"
61965
+ ),
61966
+ children: p
61967
+ },
61968
+ p
61969
+ )),
61970
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
61971
+ "button",
61972
+ {
61973
+ onClick: () => goToPage(cp + 1),
61974
+ disabled: !pagination.next_page_url,
61975
+ className: "flex h-8 w-8 items-center justify-center rounded-lg border border-border text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-40 disabled:pointer-events-none",
61976
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ChevronRight, { className: "h-4 w-4" })
61977
+ }
61978
+ )
61979
+ ] })
61980
+ ] });
61981
+ })(),
61975
61982
  defaultActions && viewItem && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(DGViewModal, { item: viewItem, fields: viewFields, onClose: () => setViewItem(null) }),
61976
61983
  defaultActions && editItem && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
61977
61984
  DGEditModal,
@@ -67131,45 +67138,52 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
67131
67138
  )
67132
67139
  ] })
67133
67140
  ] }),
67134
- serverPagination && /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex items-center justify-between gap-2 flex-wrap", children: [
67135
- /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("span", { className: "text-xs text-muted-foreground", children: [
67136
- serverPagination.pagination.total,
67137
- " total rows \xB7 page ",
67138
- serverPagination.currentPage
67139
- ] }),
67140
- /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex items-center gap-1", children: [
67141
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
67142
- "button",
67143
- {
67144
- onClick: () => serverPagination.goToPage(serverPagination.currentPage - 1),
67145
- disabled: !serverPagination.pagination.prev_page_url,
67146
- className: "flex h-8 w-8 items-center justify-center rounded-lg border border-border text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-40 disabled:pointer-events-none",
67147
- children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(ChevronLeft, { className: "h-4 w-4" })
67148
- }
67149
- ),
67150
- serverPagination.pagination.links.map((link) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
67151
- "button",
67152
- {
67153
- onClick: () => serverPagination.goToPage(link.page),
67154
- className: cn(
67155
- "flex h-8 w-8 items-center justify-center rounded-lg border text-xs font-medium transition-colors",
67156
- link.active ? "border-primary bg-primary text-primary-foreground shadow-sm" : "border-border text-muted-foreground hover:bg-muted hover:text-foreground"
67157
- ),
67158
- children: link.page
67159
- },
67160
- link.page
67161
- )),
67162
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
67163
- "button",
67164
- {
67165
- onClick: () => serverPagination.goToPage(serverPagination.currentPage + 1),
67166
- disabled: !serverPagination.pagination.next_page_url,
67167
- className: "flex h-8 w-8 items-center justify-center rounded-lg border border-border text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-40 disabled:pointer-events-none",
67168
- children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(ChevronRight, { className: "h-4 w-4" })
67169
- }
67170
- )
67171
- ] })
67172
- ] })
67141
+ serverPagination && (() => {
67142
+ const { pagination: pagination2, currentPage: cp, goToPage } = serverPagination;
67143
+ const totalServerPages = Math.ceil(pagination2.total / pagination2.per_page);
67144
+ const pageLinks = Array.from({ length: totalServerPages }, (_, i) => i + 1);
67145
+ return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex items-center justify-between gap-2 flex-wrap", children: [
67146
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("span", { className: "text-xs text-muted-foreground", children: [
67147
+ pagination2.total,
67148
+ " total rows \xB7 page ",
67149
+ cp,
67150
+ " of ",
67151
+ totalServerPages
67152
+ ] }),
67153
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex items-center gap-1", children: [
67154
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
67155
+ "button",
67156
+ {
67157
+ onClick: () => goToPage(cp - 1),
67158
+ disabled: !pagination2.prev_page_url,
67159
+ className: "flex h-8 w-8 items-center justify-center rounded-lg border border-border text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-40 disabled:pointer-events-none",
67160
+ children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(ChevronLeft, { className: "h-4 w-4" })
67161
+ }
67162
+ ),
67163
+ pageLinks.map((p) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
67164
+ "button",
67165
+ {
67166
+ onClick: () => goToPage(p),
67167
+ className: cn(
67168
+ "flex h-8 w-8 items-center justify-center rounded-lg border text-xs font-medium transition-colors",
67169
+ p === cp ? "border-primary bg-primary text-primary-foreground shadow-sm" : "border-border text-muted-foreground hover:bg-muted hover:text-foreground"
67170
+ ),
67171
+ children: p
67172
+ },
67173
+ p
67174
+ )),
67175
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
67176
+ "button",
67177
+ {
67178
+ onClick: () => goToPage(cp + 1),
67179
+ disabled: !pagination2.next_page_url,
67180
+ className: "flex h-8 w-8 items-center justify-center rounded-lg border border-border text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-40 disabled:pointer-events-none",
67181
+ children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(ChevronRight, { className: "h-4 w-4" })
67182
+ }
67183
+ )
67184
+ ] })
67185
+ ] });
67186
+ })()
67173
67187
  ] }),
67174
67188
  defaultActions && viewItem && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
67175
67189
  ViewModal,
package/dist/index.js CHANGED
@@ -5244,45 +5244,52 @@ function DataGrid({
5244
5244
  onPageChange: setPage
5245
5245
  }
5246
5246
  ),
5247
- serverPagination && /* @__PURE__ */ jsxs27("div", { className: "flex items-center justify-between gap-2 flex-wrap", children: [
5248
- /* @__PURE__ */ jsxs27("span", { className: "text-xs text-muted-foreground", children: [
5249
- serverPagination.pagination.total,
5250
- " total rows \xB7 page ",
5251
- serverPagination.currentPage
5252
- ] }),
5253
- /* @__PURE__ */ jsxs27("div", { className: "flex items-center gap-1", children: [
5254
- /* @__PURE__ */ jsx28(
5255
- "button",
5256
- {
5257
- onClick: () => serverPagination.goToPage(serverPagination.currentPage - 1),
5258
- disabled: !serverPagination.pagination.prev_page_url,
5259
- className: "flex h-8 w-8 items-center justify-center rounded-lg border border-border text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-40 disabled:pointer-events-none",
5260
- children: /* @__PURE__ */ jsx28(ChevronLeft5, { className: "h-4 w-4" })
5261
- }
5262
- ),
5263
- serverPagination.pagination.links.map((link) => /* @__PURE__ */ jsx28(
5264
- "button",
5265
- {
5266
- onClick: () => serverPagination.goToPage(link.page),
5267
- className: cn(
5268
- "flex h-8 w-8 items-center justify-center rounded-lg border text-xs font-medium transition-colors",
5269
- link.active ? "border-primary bg-primary text-primary-foreground shadow-sm" : "border-border text-muted-foreground hover:bg-muted hover:text-foreground"
5270
- ),
5271
- children: link.page
5272
- },
5273
- link.page
5274
- )),
5275
- /* @__PURE__ */ jsx28(
5276
- "button",
5277
- {
5278
- onClick: () => serverPagination.goToPage(serverPagination.currentPage + 1),
5279
- disabled: !serverPagination.pagination.next_page_url,
5280
- className: "flex h-8 w-8 items-center justify-center rounded-lg border border-border text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-40 disabled:pointer-events-none",
5281
- children: /* @__PURE__ */ jsx28(ChevronRight7, { className: "h-4 w-4" })
5282
- }
5283
- )
5284
- ] })
5285
- ] }),
5247
+ serverPagination && (() => {
5248
+ const { pagination, currentPage: cp, goToPage } = serverPagination;
5249
+ const totalServerPages = Math.ceil(pagination.total / pagination.per_page);
5250
+ const pageLinks = Array.from({ length: totalServerPages }, (_, i) => i + 1);
5251
+ return /* @__PURE__ */ jsxs27("div", { className: "flex items-center justify-between gap-2 flex-wrap", children: [
5252
+ /* @__PURE__ */ jsxs27("span", { className: "text-xs text-muted-foreground", children: [
5253
+ pagination.total,
5254
+ " total rows \xB7 page ",
5255
+ cp,
5256
+ " of ",
5257
+ totalServerPages
5258
+ ] }),
5259
+ /* @__PURE__ */ jsxs27("div", { className: "flex items-center gap-1", children: [
5260
+ /* @__PURE__ */ jsx28(
5261
+ "button",
5262
+ {
5263
+ onClick: () => goToPage(cp - 1),
5264
+ disabled: !pagination.prev_page_url,
5265
+ className: "flex h-8 w-8 items-center justify-center rounded-lg border border-border text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-40 disabled:pointer-events-none",
5266
+ children: /* @__PURE__ */ jsx28(ChevronLeft5, { className: "h-4 w-4" })
5267
+ }
5268
+ ),
5269
+ pageLinks.map((p) => /* @__PURE__ */ jsx28(
5270
+ "button",
5271
+ {
5272
+ onClick: () => goToPage(p),
5273
+ className: cn(
5274
+ "flex h-8 w-8 items-center justify-center rounded-lg border text-xs font-medium transition-colors",
5275
+ p === cp ? "border-primary bg-primary text-primary-foreground shadow-sm" : "border-border text-muted-foreground hover:bg-muted hover:text-foreground"
5276
+ ),
5277
+ children: p
5278
+ },
5279
+ p
5280
+ )),
5281
+ /* @__PURE__ */ jsx28(
5282
+ "button",
5283
+ {
5284
+ onClick: () => goToPage(cp + 1),
5285
+ disabled: !pagination.next_page_url,
5286
+ className: "flex h-8 w-8 items-center justify-center rounded-lg border border-border text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-40 disabled:pointer-events-none",
5287
+ children: /* @__PURE__ */ jsx28(ChevronRight7, { className: "h-4 w-4" })
5288
+ }
5289
+ )
5290
+ ] })
5291
+ ] });
5292
+ })(),
5286
5293
  defaultActions && viewItem && /* @__PURE__ */ jsx28(DGViewModal, { item: viewItem, fields: viewFields, onClose: () => setViewItem(null) }),
5287
5294
  defaultActions && editItem && /* @__PURE__ */ jsx28(
5288
5295
  DGEditModal,
@@ -10031,45 +10038,52 @@ function Table({
10031
10038
  )
10032
10039
  ] })
10033
10040
  ] }),
10034
- serverPagination && /* @__PURE__ */ jsxs48("div", { className: "flex items-center justify-between gap-2 flex-wrap", children: [
10035
- /* @__PURE__ */ jsxs48("span", { className: "text-xs text-muted-foreground", children: [
10036
- serverPagination.pagination.total,
10037
- " total rows \xB7 page ",
10038
- serverPagination.currentPage
10039
- ] }),
10040
- /* @__PURE__ */ jsxs48("div", { className: "flex items-center gap-1", children: [
10041
- /* @__PURE__ */ jsx55(
10042
- "button",
10043
- {
10044
- onClick: () => serverPagination.goToPage(serverPagination.currentPage - 1),
10045
- disabled: !serverPagination.pagination.prev_page_url,
10046
- className: "flex h-8 w-8 items-center justify-center rounded-lg border border-border text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-40 disabled:pointer-events-none",
10047
- children: /* @__PURE__ */ jsx55(ChevronLeft6, { className: "h-4 w-4" })
10048
- }
10049
- ),
10050
- serverPagination.pagination.links.map((link) => /* @__PURE__ */ jsx55(
10051
- "button",
10052
- {
10053
- onClick: () => serverPagination.goToPage(link.page),
10054
- className: cn(
10055
- "flex h-8 w-8 items-center justify-center rounded-lg border text-xs font-medium transition-colors",
10056
- link.active ? "border-primary bg-primary text-primary-foreground shadow-sm" : "border-border text-muted-foreground hover:bg-muted hover:text-foreground"
10057
- ),
10058
- children: link.page
10059
- },
10060
- link.page
10061
- )),
10062
- /* @__PURE__ */ jsx55(
10063
- "button",
10064
- {
10065
- onClick: () => serverPagination.goToPage(serverPagination.currentPage + 1),
10066
- disabled: !serverPagination.pagination.next_page_url,
10067
- className: "flex h-8 w-8 items-center justify-center rounded-lg border border-border text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-40 disabled:pointer-events-none",
10068
- children: /* @__PURE__ */ jsx55(ChevronRight9, { className: "h-4 w-4" })
10069
- }
10070
- )
10071
- ] })
10072
- ] })
10041
+ serverPagination && (() => {
10042
+ const { pagination: pagination2, currentPage: cp, goToPage } = serverPagination;
10043
+ const totalServerPages = Math.ceil(pagination2.total / pagination2.per_page);
10044
+ const pageLinks = Array.from({ length: totalServerPages }, (_, i) => i + 1);
10045
+ return /* @__PURE__ */ jsxs48("div", { className: "flex items-center justify-between gap-2 flex-wrap", children: [
10046
+ /* @__PURE__ */ jsxs48("span", { className: "text-xs text-muted-foreground", children: [
10047
+ pagination2.total,
10048
+ " total rows \xB7 page ",
10049
+ cp,
10050
+ " of ",
10051
+ totalServerPages
10052
+ ] }),
10053
+ /* @__PURE__ */ jsxs48("div", { className: "flex items-center gap-1", children: [
10054
+ /* @__PURE__ */ jsx55(
10055
+ "button",
10056
+ {
10057
+ onClick: () => goToPage(cp - 1),
10058
+ disabled: !pagination2.prev_page_url,
10059
+ className: "flex h-8 w-8 items-center justify-center rounded-lg border border-border text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-40 disabled:pointer-events-none",
10060
+ children: /* @__PURE__ */ jsx55(ChevronLeft6, { className: "h-4 w-4" })
10061
+ }
10062
+ ),
10063
+ pageLinks.map((p) => /* @__PURE__ */ jsx55(
10064
+ "button",
10065
+ {
10066
+ onClick: () => goToPage(p),
10067
+ className: cn(
10068
+ "flex h-8 w-8 items-center justify-center rounded-lg border text-xs font-medium transition-colors",
10069
+ p === cp ? "border-primary bg-primary text-primary-foreground shadow-sm" : "border-border text-muted-foreground hover:bg-muted hover:text-foreground"
10070
+ ),
10071
+ children: p
10072
+ },
10073
+ p
10074
+ )),
10075
+ /* @__PURE__ */ jsx55(
10076
+ "button",
10077
+ {
10078
+ onClick: () => goToPage(cp + 1),
10079
+ disabled: !pagination2.next_page_url,
10080
+ className: "flex h-8 w-8 items-center justify-center rounded-lg border border-border text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-40 disabled:pointer-events-none",
10081
+ children: /* @__PURE__ */ jsx55(ChevronRight9, { className: "h-4 w-4" })
10082
+ }
10083
+ )
10084
+ ] })
10085
+ ] });
10086
+ })()
10073
10087
  ] }),
10074
10088
  defaultActions && viewItem && /* @__PURE__ */ jsx55(
10075
10089
  ViewModal,
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "registry": "https://registry.npmjs.org/",
5
5
  "access": "public"
6
6
  },
7
- "version": "3.0.6",
7
+ "version": "3.0.7",
8
8
  "description": "Reusable React UI components",
9
9
  "license": "MIT",
10
10
  "main": "dist/index.js",