@djangocfg/ui-nextjs 2.1.188 → 2.1.190

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@djangocfg/ui-nextjs",
3
- "version": "2.1.188",
3
+ "version": "2.1.190",
4
4
  "description": "Next.js UI component library with Radix UI primitives, Tailwind CSS styling, charts, and form components",
5
5
  "keywords": [
6
6
  "ui-components",
@@ -80,10 +80,10 @@
80
80
  "check": "tsc --noEmit"
81
81
  },
82
82
  "peerDependencies": {
83
- "@djangocfg/api": "^2.1.188",
84
- "@djangocfg/nextjs": "^2.1.188",
85
- "@djangocfg/ui-core": "^2.1.188",
86
- "@djangocfg/ui-tools": "^2.1.188",
83
+ "@djangocfg/api": "^2.1.190",
84
+ "@djangocfg/nextjs": "^2.1.190",
85
+ "@djangocfg/ui-core": "^2.1.190",
86
+ "@djangocfg/ui-tools": "^2.1.190",
87
87
  "@types/react": "^19.1.0",
88
88
  "@types/react-dom": "^19.1.0",
89
89
  "consola": "^3.4.2",
@@ -106,7 +106,7 @@
106
106
  "react-chartjs-2": "^5.3.0"
107
107
  },
108
108
  "devDependencies": {
109
- "@djangocfg/typescript-config": "^2.1.188",
109
+ "@djangocfg/typescript-config": "^2.1.190",
110
110
  "@radix-ui/react-dropdown-menu": "^2.1.16",
111
111
  "@radix-ui/react-slot": "^1.2.4",
112
112
  "@types/node": "^24.7.2",
@@ -61,13 +61,6 @@ export const SSRPagination: React.FC<SSRPaginationProps> = ({
61
61
  // Calculate actual navigation state based on current page from URL
62
62
  const actualHasPreviousPage = actualCurrentPage > 1;
63
63
 
64
- // Smart total pages calculation - if we're on a page higher than totalPages,
65
- // extend totalPages to include current page + some extra
66
- const smartTotalPages = Math.max(
67
- totalPages,
68
- actualCurrentPage + (hasNextPage ? 5 : 0)
69
- );
70
-
71
64
  // actualHasNextPage kept for clarity, even though it equals hasNextPage
72
65
  // @ts-ignore reserved for future use
73
66
  const _actualHasNextPage = hasNextPage;
@@ -101,8 +94,8 @@ export const SSRPagination: React.FC<SSRPaginationProps> = ({
101
94
  const mobileMaxVisible = 3;
102
95
  const effectiveMaxVisible = isMobile ? mobileMaxVisible : maxVisiblePages;
103
96
 
104
- if (smartTotalPages <= effectiveMaxVisible) {
105
- return Array.from({ length: smartTotalPages }, (_, i) => i + 1);
97
+ if (totalPages <= effectiveMaxVisible) {
98
+ return Array.from({ length: totalPages }, (_, i) => i + 1);
106
99
  }
107
100
 
108
101
  const pages: (number | 'ellipsis')[] = [];
@@ -114,7 +107,7 @@ export const SSRPagination: React.FC<SSRPaginationProps> = ({
114
107
  pages.push(actualCurrentPage - 1);
115
108
  }
116
109
  pages.push(actualCurrentPage);
117
- if (actualCurrentPage < smartTotalPages) {
110
+ if (actualCurrentPage < totalPages) {
118
111
  pages.push(actualCurrentPage + 1);
119
112
  }
120
113
  } else {
@@ -123,13 +116,13 @@ export const SSRPagination: React.FC<SSRPaginationProps> = ({
123
116
  pages.push(1);
124
117
 
125
118
  let start = Math.max(2, actualCurrentPage - halfVisible);
126
- let end = Math.min(smartTotalPages - 1, actualCurrentPage + halfVisible);
119
+ let end = Math.min(totalPages - 1, actualCurrentPage + halfVisible);
127
120
 
128
121
  // Adjust range if we're near the beginning or end
129
122
  if (actualCurrentPage <= halfVisible + 1) {
130
- end = Math.min(smartTotalPages - 1, effectiveMaxVisible - 1);
131
- } else if (actualCurrentPage >= smartTotalPages - halfVisible) {
132
- start = Math.max(2, smartTotalPages - effectiveMaxVisible + 2);
123
+ end = Math.min(totalPages - 1, effectiveMaxVisible - 1);
124
+ } else if (actualCurrentPage >= totalPages - halfVisible) {
125
+ start = Math.max(2, totalPages - effectiveMaxVisible + 2);
133
126
  }
134
127
 
135
128
  // Add ellipsis after first page if needed
@@ -143,13 +136,13 @@ export const SSRPagination: React.FC<SSRPaginationProps> = ({
143
136
  }
144
137
 
145
138
  // Add ellipsis before last page if needed
146
- if (end < smartTotalPages - 1) {
139
+ if (end < totalPages - 1) {
147
140
  pages.push('ellipsis');
148
141
  }
149
142
 
150
143
  // Always show last page (if more than 1 page)
151
- if (smartTotalPages > 1) {
152
- pages.push(smartTotalPages);
144
+ if (totalPages > 1) {
145
+ pages.push(totalPages);
153
146
  }
154
147
  }
155
148
 
@@ -171,7 +164,7 @@ export const SSRPagination: React.FC<SSRPaginationProps> = ({
171
164
  {showInfo && (
172
165
  <div className="text-sm text-muted-foreground text-center">
173
166
  {isMobile ? (
174
- `Page ${actualCurrentPage} of ${smartTotalPages}`
167
+ `Page ${actualCurrentPage} of ${totalPages}`
175
168
  ) : (
176
169
  `Showing ${startItem.toLocaleString()} to ${endItem.toLocaleString()} of ${totalItems.toLocaleString()} results`
177
170
  )}