@sproutsocial/seeds-react-pagination 0.1.27 → 0.1.29
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/.turbo/turbo-build.log +11 -11
- package/CHANGELOG.md +24 -0
- package/dist/esm/index.js +239 -66
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +32 -10
- package/dist/index.d.ts +32 -10
- package/dist/index.js +239 -66
- package/dist/index.js.map +1 -1
- package/dist/pagination.css +99 -0
- package/package.json +9 -8
- package/postcss.config.js +6 -0
- package/src/Pagination.stories.tsx +58 -0
- package/src/Pagination.tsx +17 -210
- package/src/PaginationHybrid.tsx +20 -0
- package/src/PaginationStyled.tsx +128 -0
- package/src/PaginationTailwind.tsx +152 -0
- package/src/PaginationTypes.ts +19 -0
- package/src/__tests__/Pagination.test.tsx +164 -0
- package/src/__tests__/usePaginationModel.test.ts +91 -0
- package/src/css.d.ts +1 -0
- package/src/pagination.css +99 -0
- package/src/usePaginationModel.ts +124 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
yarn run v1.22.22
|
|
2
|
-
$ tsup --dts
|
|
2
|
+
$ tsup --dts && cp src/pagination.css dist/pagination.css
|
|
3
3
|
[34mCLI[39m Building entry: src/index.ts
|
|
4
4
|
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
5
5
|
[34mCLI[39m tsup v8.5.0
|
|
@@ -8,14 +8,14 @@ $ tsup --dts
|
|
|
8
8
|
[34mCLI[39m Cleaning output folder
|
|
9
9
|
[34mCJS[39m Build start
|
|
10
10
|
[34mESM[39m Build start
|
|
11
|
-
[32mCJS[39m [1mdist/index.js [22m[
|
|
12
|
-
[32mCJS[39m [1mdist/index.js.map [22m[
|
|
13
|
-
[32mCJS[39m ⚡️ Build success in
|
|
14
|
-
[32mESM[39m [1mdist/esm/index.js [22m[
|
|
15
|
-
[32mESM[39m [1mdist/esm/index.js.map [22m[
|
|
16
|
-
[32mESM[39m ⚡️ Build success in
|
|
11
|
+
[32mCJS[39m [1mdist/index.js [22m[32m15.12 KB[39m
|
|
12
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m26.65 KB[39m
|
|
13
|
+
[32mCJS[39m ⚡️ Build success in 87ms
|
|
14
|
+
[32mESM[39m [1mdist/esm/index.js [22m[32m12.16 KB[39m
|
|
15
|
+
[32mESM[39m [1mdist/esm/index.js.map [22m[32m26.54 KB[39m
|
|
16
|
+
[32mESM[39m ⚡️ Build success in 87ms
|
|
17
17
|
[34mDTS[39m Build start
|
|
18
|
-
[32mDTS[39m ⚡️ Build success in
|
|
19
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m3.
|
|
20
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[32m3.
|
|
21
|
-
Done in
|
|
18
|
+
[32mDTS[39m ⚡️ Build success in 5791ms
|
|
19
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m3.83 KB[39m
|
|
20
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m3.83 KB[39m
|
|
21
|
+
Done in 7.59s.
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @sproutsocial/seeds-react-pagination
|
|
2
2
|
|
|
3
|
+
## 0.1.29
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- da85fb8: Migrate Pagination to the Tailwind hybrid pattern: a pure-CSS Tailwind
|
|
8
|
+
implementation with a styled-components fallback for system-prop / `styled()`
|
|
9
|
+
consumers, preserving full backward compatibility. Component CSS is shipped via
|
|
10
|
+
`@sproutsocial/racine/css/components` and its rules are wrapped in
|
|
11
|
+
`@layer components` so consumer Tailwind utilities win the cascade. An optional
|
|
12
|
+
`className` is now forwarded to the root container so consumers can apply
|
|
13
|
+
Tailwind utility overrides.
|
|
14
|
+
- Updated dependencies [ef91a0d]
|
|
15
|
+
- @sproutsocial/seeds-react-system-props@3.1.4
|
|
16
|
+
- @sproutsocial/seeds-react-icon@2.4.8
|
|
17
|
+
- @sproutsocial/seeds-react-select@1.1.49
|
|
18
|
+
- @sproutsocial/seeds-react-text@1.5.3
|
|
19
|
+
|
|
20
|
+
## 0.1.28
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- @sproutsocial/seeds-react-icon@2.4.7
|
|
25
|
+
- @sproutsocial/seeds-react-select@1.1.48
|
|
26
|
+
|
|
3
27
|
## 0.1.27
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
package/dist/esm/index.js
CHANGED
|
@@ -1,71 +1,13 @@
|
|
|
1
|
-
// src/
|
|
2
|
-
import "react";
|
|
1
|
+
// src/PaginationHybrid.tsx
|
|
2
|
+
import { hasStyledProps } from "@sproutsocial/seeds-react-system-props";
|
|
3
|
+
|
|
4
|
+
// src/PaginationStyled.tsx
|
|
3
5
|
import { Select } from "@sproutsocial/seeds-react-select";
|
|
4
6
|
import { Icon } from "@sproutsocial/seeds-react-icon";
|
|
5
7
|
|
|
6
|
-
// src/
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
var StyledPaginationContainer = styled.div`
|
|
10
|
-
${(props) => props.theme.typography[200]}
|
|
11
|
-
display: flex;
|
|
12
|
-
align-items: center;
|
|
13
|
-
gap: ${(props) => props.theme.space[300]};
|
|
14
|
-
margin-top: ${(props) => props.theme.space[400]};
|
|
15
|
-
flex-wrap: wrap;
|
|
16
|
-
`;
|
|
17
|
-
var StyledPaginationControls = styled.div`
|
|
18
|
-
display: flex;
|
|
19
|
-
align-items: center;
|
|
20
|
-
margin-left: auto;
|
|
21
|
-
`;
|
|
22
|
-
var StyledPaginationInfo = styled(Text)`
|
|
23
|
-
white-space: nowrap;
|
|
24
|
-
`;
|
|
25
|
-
var StyledPageSizeSelector = styled.div`
|
|
26
|
-
display: flex;
|
|
27
|
-
align-items: center;
|
|
28
|
-
gap: ${(props) => props.theme.space[300]};
|
|
29
|
-
`;
|
|
30
|
-
var StyledPageButtons = styled.div`
|
|
31
|
-
display: inline-flex;
|
|
32
|
-
flex-flow: row wrap;
|
|
33
|
-
background-clip: padding-box;
|
|
34
|
-
border: 1px solid
|
|
35
|
-
${(props) => props.theme.colors.button.secondary.border.base};
|
|
36
|
-
border-radius: ${(props) => props.theme.radii.outer};
|
|
37
|
-
padding: ${(props) => props.theme.space[100]};
|
|
38
|
-
background: transparent;
|
|
39
|
-
`;
|
|
40
|
-
var StyledPaginationButton = styled.button`
|
|
41
|
-
min-width: calc(${(props) => props.theme.space[500]} + 4px);
|
|
42
|
-
min-height: calc(${(props) => props.theme.space[500]} + 2px);
|
|
43
|
-
padding: calc(${(props) => props.theme.space[350]} - 6px);
|
|
44
|
-
line-height: ${(props) => props.theme.space[400]};
|
|
45
|
-
font-weight: ${(props) => props.theme.fontWeights.semibold};
|
|
46
|
-
background-color: ${(props) => props.isSelected ? props.theme.colors.button.secondary.background.active : "transparent"};
|
|
47
|
-
color: ${(props) => props.isSelected ? props.theme.colors.text.inverse : props.theme.colors.text.body};
|
|
48
|
-
border: none;
|
|
49
|
-
border-radius: ${(props) => props.theme.radii.inner};
|
|
50
|
-
cursor: pointer;
|
|
51
|
-
display: inline-flex;
|
|
52
|
-
align-items: center;
|
|
53
|
-
justify-content: center;
|
|
54
|
-
|
|
55
|
-
&:hover:not(:disabled) {
|
|
56
|
-
color: ${(props) => props.isSelected ? props.theme.colors.text.inverse : void 0};
|
|
57
|
-
background-color: ${(props) => props.isSelected ? props.theme.colors.button.secondary.background.active : props.theme.colors.listItem.background.hover};
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
&:disabled {
|
|
61
|
-
cursor: default;
|
|
62
|
-
opacity: ${(props) => props.isSelected ? 1 : 0.5};
|
|
63
|
-
}
|
|
64
|
-
`;
|
|
65
|
-
|
|
66
|
-
// src/Pagination.tsx
|
|
67
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
68
|
-
var Pagination = ({
|
|
8
|
+
// src/usePaginationModel.ts
|
|
9
|
+
import "react";
|
|
10
|
+
var usePaginationModel = ({
|
|
69
11
|
paginationConfig,
|
|
70
12
|
currentPageIndex,
|
|
71
13
|
pageSize,
|
|
@@ -132,10 +74,106 @@ var Pagination = ({
|
|
|
132
74
|
return pages;
|
|
133
75
|
};
|
|
134
76
|
const pageNumbers = getPageNumbers();
|
|
77
|
+
return {
|
|
78
|
+
displayType,
|
|
79
|
+
pageSizeOptions,
|
|
80
|
+
tableCountFunction,
|
|
81
|
+
totalPages,
|
|
82
|
+
currentPage,
|
|
83
|
+
startRow,
|
|
84
|
+
endRow,
|
|
85
|
+
canGoPrevious,
|
|
86
|
+
canGoNext,
|
|
87
|
+
handlePrevious,
|
|
88
|
+
handleNext,
|
|
89
|
+
handlePageSizeChange,
|
|
90
|
+
pageNumbers
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
// src/styles.ts
|
|
95
|
+
import styled from "styled-components";
|
|
96
|
+
import { Text } from "@sproutsocial/seeds-react-text";
|
|
97
|
+
var StyledPaginationContainer = styled.div`
|
|
98
|
+
${(props) => props.theme.typography[200]}
|
|
99
|
+
display: flex;
|
|
100
|
+
align-items: center;
|
|
101
|
+
gap: ${(props) => props.theme.space[300]};
|
|
102
|
+
margin-top: ${(props) => props.theme.space[400]};
|
|
103
|
+
flex-wrap: wrap;
|
|
104
|
+
`;
|
|
105
|
+
var StyledPaginationControls = styled.div`
|
|
106
|
+
display: flex;
|
|
107
|
+
align-items: center;
|
|
108
|
+
margin-left: auto;
|
|
109
|
+
`;
|
|
110
|
+
var StyledPaginationInfo = styled(Text)`
|
|
111
|
+
white-space: nowrap;
|
|
112
|
+
`;
|
|
113
|
+
var StyledPageSizeSelector = styled.div`
|
|
114
|
+
display: flex;
|
|
115
|
+
align-items: center;
|
|
116
|
+
gap: ${(props) => props.theme.space[300]};
|
|
117
|
+
`;
|
|
118
|
+
var StyledPageButtons = styled.div`
|
|
119
|
+
display: inline-flex;
|
|
120
|
+
flex-flow: row wrap;
|
|
121
|
+
background-clip: padding-box;
|
|
122
|
+
border: 1px solid
|
|
123
|
+
${(props) => props.theme.colors.button.secondary.border.base};
|
|
124
|
+
border-radius: ${(props) => props.theme.radii.outer};
|
|
125
|
+
padding: ${(props) => props.theme.space[100]};
|
|
126
|
+
background: transparent;
|
|
127
|
+
`;
|
|
128
|
+
var StyledPaginationButton = styled.button`
|
|
129
|
+
min-width: calc(${(props) => props.theme.space[500]} + 4px);
|
|
130
|
+
min-height: calc(${(props) => props.theme.space[500]} + 2px);
|
|
131
|
+
padding: calc(${(props) => props.theme.space[350]} - 6px);
|
|
132
|
+
line-height: ${(props) => props.theme.space[400]};
|
|
133
|
+
font-weight: ${(props) => props.theme.fontWeights.semibold};
|
|
134
|
+
background-color: ${(props) => props.isSelected ? props.theme.colors.button.secondary.background.active : "transparent"};
|
|
135
|
+
color: ${(props) => props.isSelected ? props.theme.colors.text.inverse : props.theme.colors.text.body};
|
|
136
|
+
border: none;
|
|
137
|
+
border-radius: ${(props) => props.theme.radii.inner};
|
|
138
|
+
cursor: pointer;
|
|
139
|
+
display: inline-flex;
|
|
140
|
+
align-items: center;
|
|
141
|
+
justify-content: center;
|
|
142
|
+
|
|
143
|
+
&:hover:not(:disabled) {
|
|
144
|
+
color: ${(props) => props.isSelected ? props.theme.colors.text.inverse : void 0};
|
|
145
|
+
background-color: ${(props) => props.isSelected ? props.theme.colors.button.secondary.background.active : props.theme.colors.listItem.background.hover};
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
&:disabled {
|
|
149
|
+
cursor: default;
|
|
150
|
+
opacity: ${(props) => props.isSelected ? 1 : 0.5};
|
|
151
|
+
}
|
|
152
|
+
`;
|
|
153
|
+
|
|
154
|
+
// src/PaginationStyled.tsx
|
|
155
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
156
|
+
var PaginationStyled = (props) => {
|
|
157
|
+
const { pageSize, totalRows, onPageChange, className } = props;
|
|
158
|
+
const {
|
|
159
|
+
displayType,
|
|
160
|
+
pageSizeOptions,
|
|
161
|
+
tableCountFunction,
|
|
162
|
+
totalPages,
|
|
163
|
+
currentPage,
|
|
164
|
+
startRow,
|
|
165
|
+
endRow,
|
|
166
|
+
canGoPrevious,
|
|
167
|
+
canGoNext,
|
|
168
|
+
handlePrevious,
|
|
169
|
+
handleNext,
|
|
170
|
+
handlePageSizeChange,
|
|
171
|
+
pageNumbers
|
|
172
|
+
} = usePaginationModel(props);
|
|
135
173
|
if (totalPages <= 1 && !pageSizeOptions) {
|
|
136
174
|
return null;
|
|
137
175
|
}
|
|
138
|
-
return /* @__PURE__ */ jsxs(StyledPaginationContainer, { children: [
|
|
176
|
+
return /* @__PURE__ */ jsxs(StyledPaginationContainer, { className, children: [
|
|
139
177
|
/* @__PURE__ */ jsx(StyledPaginationInfo, { children: tableCountFunction({
|
|
140
178
|
startNum: startRow,
|
|
141
179
|
endNum: endRow,
|
|
@@ -206,6 +244,141 @@ var Pagination = ({
|
|
|
206
244
|
] });
|
|
207
245
|
};
|
|
208
246
|
|
|
247
|
+
// src/PaginationTailwind.tsx
|
|
248
|
+
import { Select as Select2 } from "@sproutsocial/seeds-react-select";
|
|
249
|
+
import { Icon as Icon2 } from "@sproutsocial/seeds-react-icon";
|
|
250
|
+
import { Text as Text2 } from "@sproutsocial/seeds-react-text";
|
|
251
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
252
|
+
function cn(...inputs) {
|
|
253
|
+
const classes = [];
|
|
254
|
+
for (const input of inputs) {
|
|
255
|
+
if (!input) continue;
|
|
256
|
+
if (typeof input === "string") {
|
|
257
|
+
classes.push(input);
|
|
258
|
+
} else if (typeof input === "object") {
|
|
259
|
+
for (const [key, value] of Object.entries(input)) {
|
|
260
|
+
if (value) {
|
|
261
|
+
classes.push(key);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
return classes.join(" ");
|
|
267
|
+
}
|
|
268
|
+
var PaginationTailwind = (props) => {
|
|
269
|
+
const { pageSize, totalRows, onPageChange, className } = props;
|
|
270
|
+
const {
|
|
271
|
+
displayType,
|
|
272
|
+
pageSizeOptions,
|
|
273
|
+
tableCountFunction,
|
|
274
|
+
totalPages,
|
|
275
|
+
currentPage,
|
|
276
|
+
startRow,
|
|
277
|
+
endRow,
|
|
278
|
+
canGoPrevious,
|
|
279
|
+
canGoNext,
|
|
280
|
+
handlePrevious,
|
|
281
|
+
handleNext,
|
|
282
|
+
handlePageSizeChange,
|
|
283
|
+
pageNumbers
|
|
284
|
+
} = usePaginationModel(props);
|
|
285
|
+
if (totalPages <= 1 && !pageSizeOptions) {
|
|
286
|
+
return null;
|
|
287
|
+
}
|
|
288
|
+
return /* @__PURE__ */ jsxs2("div", { className: cn("seeds-pagination-container", className), children: [
|
|
289
|
+
/* @__PURE__ */ jsx2(Text2, { className: cn("seeds-pagination-info"), children: tableCountFunction({
|
|
290
|
+
startNum: startRow,
|
|
291
|
+
endNum: endRow,
|
|
292
|
+
totalRowCount: totalRows
|
|
293
|
+
}) }),
|
|
294
|
+
pageSizeOptions && displayType === "dropdown" && /* @__PURE__ */ jsx2("div", { className: cn("seeds-pagination-page-size-selector"), children: /* @__PURE__ */ jsx2(
|
|
295
|
+
Select2,
|
|
296
|
+
{
|
|
297
|
+
id: "page-size-select",
|
|
298
|
+
name: "page-size",
|
|
299
|
+
value: String(pageSize),
|
|
300
|
+
onChange: handlePageSizeChange,
|
|
301
|
+
ariaLabel: "Rows per page",
|
|
302
|
+
size: "small",
|
|
303
|
+
children: pageSizeOptions.map((size) => /* @__PURE__ */ jsxs2("option", { value: size, children: [
|
|
304
|
+
size,
|
|
305
|
+
" per page"
|
|
306
|
+
] }, size))
|
|
307
|
+
}
|
|
308
|
+
) }),
|
|
309
|
+
totalPages > 1 && /* @__PURE__ */ jsx2("div", { className: cn("seeds-pagination-controls"), children: /* @__PURE__ */ jsxs2("div", { className: cn("seeds-pagination-page-buttons"), children: [
|
|
310
|
+
/* @__PURE__ */ jsx2(
|
|
311
|
+
"button",
|
|
312
|
+
{
|
|
313
|
+
type: "button",
|
|
314
|
+
className: cn("seeds-pagination-button"),
|
|
315
|
+
onClick: handlePrevious,
|
|
316
|
+
disabled: !canGoPrevious,
|
|
317
|
+
"aria-label": "Previous page",
|
|
318
|
+
children: /* @__PURE__ */ jsx2(Icon2, { name: "chevron-left-outline" })
|
|
319
|
+
}
|
|
320
|
+
),
|
|
321
|
+
pageNumbers.map((pageNum, index) => {
|
|
322
|
+
if (pageNum === "...") {
|
|
323
|
+
return /* @__PURE__ */ jsx2(
|
|
324
|
+
"button",
|
|
325
|
+
{
|
|
326
|
+
type: "button",
|
|
327
|
+
className: cn("seeds-pagination-button"),
|
|
328
|
+
disabled: true,
|
|
329
|
+
"aria-label": "More pages",
|
|
330
|
+
children: /* @__PURE__ */ jsx2(Icon2, { name: "ellipsis-horizontal-outline" })
|
|
331
|
+
},
|
|
332
|
+
`ellipsis-${index}`
|
|
333
|
+
);
|
|
334
|
+
}
|
|
335
|
+
const page = pageNum;
|
|
336
|
+
const isCurrentPage = page === currentPage;
|
|
337
|
+
return /* @__PURE__ */ jsx2(
|
|
338
|
+
"button",
|
|
339
|
+
{
|
|
340
|
+
type: "button",
|
|
341
|
+
className: cn("seeds-pagination-button", {
|
|
342
|
+
"seeds-pagination-button-selected": isCurrentPage
|
|
343
|
+
}),
|
|
344
|
+
onClick: () => onPageChange(page - 1),
|
|
345
|
+
disabled: isCurrentPage,
|
|
346
|
+
"aria-label": `Page ${page}`,
|
|
347
|
+
"aria-current": isCurrentPage ? "page" : void 0,
|
|
348
|
+
children: page
|
|
349
|
+
},
|
|
350
|
+
page
|
|
351
|
+
);
|
|
352
|
+
}),
|
|
353
|
+
/* @__PURE__ */ jsx2(
|
|
354
|
+
"button",
|
|
355
|
+
{
|
|
356
|
+
type: "button",
|
|
357
|
+
className: cn("seeds-pagination-button"),
|
|
358
|
+
onClick: handleNext,
|
|
359
|
+
disabled: !canGoNext,
|
|
360
|
+
"aria-label": "Next page",
|
|
361
|
+
children: /* @__PURE__ */ jsx2(Icon2, { name: "chevron-right-outline" })
|
|
362
|
+
}
|
|
363
|
+
)
|
|
364
|
+
] }) })
|
|
365
|
+
] });
|
|
366
|
+
};
|
|
367
|
+
|
|
368
|
+
// src/PaginationHybrid.tsx
|
|
369
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
370
|
+
var PaginationHybrid = (props) => {
|
|
371
|
+
if (hasStyledProps(props)) {
|
|
372
|
+
return /* @__PURE__ */ jsx3(PaginationStyled, { ...props });
|
|
373
|
+
}
|
|
374
|
+
return /* @__PURE__ */ jsx3(PaginationTailwind, { ...props });
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
// src/Pagination.tsx
|
|
378
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
379
|
+
var Pagination = (props) => /* @__PURE__ */ jsx4(PaginationHybrid, { ...props });
|
|
380
|
+
Pagination.displayName = "Pagination";
|
|
381
|
+
|
|
209
382
|
// src/PaginationTypes.ts
|
|
210
383
|
import "react";
|
|
211
384
|
var PAGE_SIZE_OPTIONS_STANDARD = [10, 25, 50, 100];
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Pagination.tsx","../../src/styles.ts","../../src/PaginationTypes.ts"],"sourcesContent":["import * as React from \"react\";\nimport { Select } from \"@sproutsocial/seeds-react-select\";\nimport { Icon } from \"@sproutsocial/seeds-react-icon\";\nimport type { TypePaginationConfig } from \"./PaginationTypes\";\nimport {\n StyledPaginationContainer,\n StyledPaginationControls,\n StyledPaginationInfo,\n StyledPageSizeSelector,\n StyledPageButtons,\n StyledPaginationButton,\n} from \"./styles\";\n\ninterface PaginationProps {\n paginationConfig: TypePaginationConfig;\n currentPageIndex: number;\n pageSize: number;\n totalRows: number;\n onPageChange: (pageIndex: number) => void;\n onPageSizeChange: (pageSize: number) => void;\n}\n\nexport const Pagination = ({\n paginationConfig,\n currentPageIndex,\n pageSize,\n totalRows,\n onPageChange,\n onPageSizeChange,\n}: PaginationProps) => {\n const { displayType, pageSizeOptions, tableCountFunction } = paginationConfig;\n\n // Calculate pagination values\n const totalPages = Math.ceil(totalRows / pageSize);\n const currentPage = currentPageIndex + 1; // Convert 0-based to 1-based for display\n const startRow = totalRows === 0 ? 0 : currentPageIndex * pageSize + 1;\n const endRow = Math.min((currentPageIndex + 1) * pageSize, totalRows);\n\n const canGoPrevious = currentPageIndex > 0;\n const canGoNext = currentPageIndex < totalPages - 1;\n\n const handlePrevious = () => {\n if (canGoPrevious) {\n onPageChange(currentPageIndex - 1);\n }\n };\n\n const handleNext = () => {\n if (canGoNext) {\n onPageChange(currentPageIndex + 1);\n }\n };\n\n const handlePageSizeChange = (e: React.SyntheticEvent<HTMLSelectElement>) => {\n const newPageSize = Number(e.currentTarget.value);\n onPageSizeChange(newPageSize);\n // Reset to first page when page size changes\n onPageChange(0);\n };\n\n // Generate page number buttons using web-app-core's algorithm\n const getPageNumbers = () => {\n const pages: (number | string)[] = [];\n const size = paginationConfig.size || \"default\";\n\n // Configuration for how many pages to show around current page\n const NUM_PAGE_LOWER = size === \"mini\" ? 0 : 1;\n const NUM_PAGE_UPPER = size === \"mini\" ? 0 : 2;\n\n // If number of pages is small enough, show all the page tokens without ellipsis\n if (totalPages <= 5 + NUM_PAGE_LOWER + NUM_PAGE_UPPER) {\n for (let i = 1; i <= totalPages; i++) {\n pages.push(i);\n }\n } else {\n // Add first page\n pages.push(1);\n\n // Add ellipsis at the beginning if needed\n if (currentPage > 3 + NUM_PAGE_LOWER) {\n pages.push(\"...\");\n }\n\n // Add pages in the middle\n let start: number;\n let end: number; // inclusive index\n\n // If near beginning - Show number of pages before ending ellipsis\n if (currentPage <= 3 + NUM_PAGE_LOWER) {\n start = 2;\n end = 3 + NUM_PAGE_LOWER + NUM_PAGE_UPPER;\n } else if (currentPage > totalPages - (3 + NUM_PAGE_UPPER)) {\n // If near end - Show number of pages after starting ellipsis\n start = totalPages - (2 + NUM_PAGE_LOWER + NUM_PAGE_UPPER);\n end = totalPages - 1;\n } else {\n // If in the middle - Show number of pages between two ellipses\n start = currentPage - NUM_PAGE_LOWER;\n end = currentPage + NUM_PAGE_UPPER;\n }\n\n for (let i = start; i <= end; i++) {\n pages.push(i);\n }\n\n // Add a final ellipsis if necessary\n if (currentPage < totalPages - (2 + NUM_PAGE_UPPER)) {\n pages.push(\"...\");\n }\n\n // Add the last page number\n pages.push(totalPages);\n }\n\n return pages;\n };\n\n const pageNumbers = getPageNumbers();\n\n if (totalPages <= 1 && !pageSizeOptions) {\n // No pagination needed if only one page and no page size options\n return null;\n }\n\n return (\n <StyledPaginationContainer>\n <StyledPaginationInfo>\n {tableCountFunction({\n startNum: startRow,\n endNum: endRow,\n totalRowCount: totalRows,\n })}\n </StyledPaginationInfo>\n {/* Page size selector */}\n {pageSizeOptions && displayType === \"dropdown\" && (\n <StyledPageSizeSelector>\n <Select\n id=\"page-size-select\"\n name=\"page-size\"\n value={String(pageSize)}\n onChange={handlePageSizeChange}\n ariaLabel=\"Rows per page\"\n size=\"small\"\n >\n {pageSizeOptions.map((size) => (\n <option key={size} value={size}>\n {size} per page\n </option>\n ))}\n </Select>\n </StyledPageSizeSelector>\n )}\n\n {/* TODO: Add inline page size selector for displayType === 'inline' */}\n\n {/* Page navigation controls */}\n {totalPages > 1 && (\n <StyledPaginationControls>\n <StyledPageButtons>\n <StyledPaginationButton\n onClick={handlePrevious}\n disabled={!canGoPrevious}\n aria-label=\"Previous page\"\n >\n <Icon name=\"chevron-left-outline\" />\n </StyledPaginationButton>\n\n {pageNumbers.map((pageNum, index) => {\n if (pageNum === \"...\") {\n return (\n <StyledPaginationButton\n key={`ellipsis-${index}`}\n disabled\n aria-label=\"More pages\"\n >\n <Icon name=\"ellipsis-horizontal-outline\" />\n </StyledPaginationButton>\n );\n }\n\n const page = pageNum as number;\n const isCurrentPage = page === currentPage;\n\n return (\n <StyledPaginationButton\n key={page}\n onClick={() => onPageChange(page - 1)}\n disabled={isCurrentPage}\n aria-label={`Page ${page}`}\n aria-current={isCurrentPage ? \"page\" : undefined}\n isSelected={isCurrentPage}\n >\n {page}\n </StyledPaginationButton>\n );\n })}\n\n <StyledPaginationButton\n onClick={handleNext}\n disabled={!canGoNext}\n aria-label=\"Next page\"\n >\n <Icon name=\"chevron-right-outline\" />\n </StyledPaginationButton>\n </StyledPageButtons>\n </StyledPaginationControls>\n )}\n </StyledPaginationContainer>\n );\n};\n","import styled from \"styled-components\";\nimport { Text } from \"@sproutsocial/seeds-react-text\";\n\n// Pagination Styles\nexport const StyledPaginationContainer = styled.div`\n ${(props) => props.theme.typography[200]}\n display: flex;\n align-items: center;\n gap: ${(props) => props.theme.space[300]};\n margin-top: ${(props) => props.theme.space[400]};\n flex-wrap: wrap;\n`;\n\nexport const StyledPaginationControls = styled.div`\n display: flex;\n align-items: center;\n margin-left: auto;\n`;\n\nexport const StyledPaginationInfo = styled(Text)`\n white-space: nowrap;\n`;\n\nexport const StyledPageSizeSelector = styled.div`\n display: flex;\n align-items: center;\n gap: ${(props) => props.theme.space[300]};\n`;\n\nexport const StyledPageButtons = styled.div`\n display: inline-flex;\n flex-flow: row wrap;\n background-clip: padding-box;\n border: 1px solid\n ${(props) => props.theme.colors.button.secondary.border.base};\n border-radius: ${(props) => props.theme.radii.outer};\n padding: ${(props) => props.theme.space[100]};\n background: transparent;\n`;\n\nexport const StyledPaginationButton = styled.button<{ isSelected?: boolean }>`\n min-width: calc(${(props) => props.theme.space[500]} + 4px);\n min-height: calc(${(props) => props.theme.space[500]} + 2px);\n padding: calc(${(props) => props.theme.space[350]} - 6px);\n line-height: ${(props) => props.theme.space[400]};\n font-weight: ${(props) => props.theme.fontWeights.semibold};\n background-color: ${(props) =>\n props.isSelected\n ? props.theme.colors.button.secondary.background.active\n : \"transparent\"};\n color: ${(props) =>\n props.isSelected\n ? props.theme.colors.text.inverse\n : props.theme.colors.text.body};\n border: none;\n border-radius: ${(props) => props.theme.radii.inner};\n cursor: pointer;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n\n &:hover:not(:disabled) {\n color: ${(props) =>\n props.isSelected ? props.theme.colors.text.inverse : undefined};\n background-color: ${(props) =>\n props.isSelected\n ? props.theme.colors.button.secondary.background.active\n : props.theme.colors.listItem.background.hover};\n }\n\n &:disabled {\n cursor: default;\n opacity: ${(props) => (props.isSelected ? 1 : 0.5)};\n }\n`;\n","import * as React from \"react\";\n\n/**\n * Standard page size option sets for pagination.\n * Export these constants to maintain consistency across tables.\n */\nconst PAGE_SIZE_OPTIONS_STANDARD = [10, 25, 50, 100] as const;\nconst PAGE_SIZE_OPTIONS_COMPACT = [5, 10, 20] as const;\nconst PAGE_SIZE_OPTIONS_LARGE = [50, 100, 200, 500] as const;\n\nexport const PAGE_SIZE_OPTIONS = {\n STANDARD: PAGE_SIZE_OPTIONS_STANDARD,\n COMPACT: PAGE_SIZE_OPTIONS_COMPACT,\n LARGE: PAGE_SIZE_OPTIONS_LARGE,\n};\n\n/**\n * Allowed page size option sets.\n * Use one of the predefined PAGE_SIZE_OPTIONS for consistency.\n */\nexport type TypeAllowedPageSizeOptions =\n | typeof PAGE_SIZE_OPTIONS_STANDARD\n | typeof PAGE_SIZE_OPTIONS_COMPACT\n | typeof PAGE_SIZE_OPTIONS_LARGE;\n\n/**\n * Configuration for pagination controls with page navigation and size selection.\n *\n * @example\n * ```tsx\n * <Pagination\n * paginationConfig={{\n * initialPageSize: 25,\n * displayType: 'dropdown',\n * pageSizeOptions: PAGE_SIZE_OPTIONS.STANDARD,\n * tableCountFunction: ({ startNum, endNum, totalRowCount }) =>\n * `${startNum}-${endNum} of ${totalRowCount}`\n * }}\n * currentPageIndex={0}\n * pageSize={25}\n * totalRows={100}\n * onPageChange={(index) => console.log('Page:', index)}\n * onPageSizeChange={(size) => console.log('Page size:', size)}\n * />\n * ```\n */\nexport interface TypePaginationConfig {\n /**\n * Initial number of rows per page.\n * @default 10\n */\n initialPageSize: number;\n /**\n * Function that returns the intl for displaying the table counts underneath a DataTable\n */\n tableCountFunction: (args: {\n startNum: number;\n endNum: number;\n totalRowCount: number;\n }) => React.ReactNode;\n /**\n * Display mode for page size selector.\n * - 'dropdown': Shows page size selector as a dropdown\n * Only used when pageSizeOptions is provided.\n * @default 'dropdown'\n */\n displayType?: \"dropdown\";\n /**\n * Optional array of page size options for the selector.\n * If not provided, page size selection will not be available.\n * Use PAGE_SIZE_OPTIONS constants for consistency.\n *\n * @example\n * pageSizeOptions: PAGE_SIZE_OPTIONS.STANDARD // [10, 25, 50, 100]\n */\n pageSizeOptions?: TypeAllowedPageSizeOptions;\n /**\n * Size variant for page number display.\n * - 'default': Shows current page ±1-2 pages (more visible pages)\n * - 'mini': Shows only current page (fewer visible pages)\n * @default 'default'\n */\n size?: \"default\" | \"mini\";\n}\n"],"mappings":";AAAA,OAAuB;AACvB,SAAS,cAAc;AACvB,SAAS,YAAY;;;ACFrB,OAAO,YAAY;AACnB,SAAS,YAAY;AAGd,IAAM,4BAA4B,OAAO;AAAA,IAC5C,CAAC,UAAU,MAAM,MAAM,WAAW,GAAG,CAAC;AAAA;AAAA;AAAA,SAGjC,CAAC,UAAU,MAAM,MAAM,MAAM,GAAG,CAAC;AAAA,gBAC1B,CAAC,UAAU,MAAM,MAAM,MAAM,GAAG,CAAC;AAAA;AAAA;AAI1C,IAAM,2BAA2B,OAAO;AAAA;AAAA;AAAA;AAAA;AAMxC,IAAM,uBAAuB,OAAO,IAAI;AAAA;AAAA;AAIxC,IAAM,yBAAyB,OAAO;AAAA;AAAA;AAAA,SAGpC,CAAC,UAAU,MAAM,MAAM,MAAM,GAAG,CAAC;AAAA;AAGnC,IAAM,oBAAoB,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,MAKlC,CAAC,UAAU,MAAM,MAAM,OAAO,OAAO,UAAU,OAAO,IAAI;AAAA,mBAC7C,CAAC,UAAU,MAAM,MAAM,MAAM,KAAK;AAAA,aACxC,CAA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A,QAQP;AAAA,MAEJ,CAAC;AAAA,MAED;AAAA,QAAC;AAAA;AAAA,UACC,SAAS;AAAA,UACT,UAAU,CAAC;AAAA,UACX,cAAW;AAAA,UAEX,8BAAC,QAAK,MAAK,yBAAwB;AAAA;AAAA,MACrC;AAAA,OACF,GACF;AAAA,KAEJ;AAEJ;;;AEjNA,OAAuB;AAMvB,IAAM,6BAA6B,CAAC,IAAI,IAAI,IAAI,GAAG;AACnD,IAAM,4BAA4B,CAAC,GAAG,IAAI,EAAE;AAC5C,IAAM,0BAA0B,CAAC,IAAI,KAAK,KAAK,GAAG;AAE3C,IAAM,oBAAoB;AAAA,EAC/B,UAAU;AAAA,EACV,SAAS;AAAA,EACT,OAAO;AACT;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/PaginationHybrid.tsx","../../src/PaginationStyled.tsx","../../src/usePaginationModel.ts","../../src/styles.ts","../../src/PaginationTailwind.tsx","../../src/Pagination.tsx","../../src/PaginationTypes.ts"],"sourcesContent":["/**\n * Hybrid Pagination component.\n * Routes between the Tailwind implementation (preferred) and the\n * styled-components implementation (for consumers using system props).\n */\n\nimport { hasStyledProps } from \"@sproutsocial/seeds-react-system-props\";\nimport { PaginationStyled } from \"./PaginationStyled\";\nimport { PaginationTailwind } from \"./PaginationTailwind\";\nimport type { PaginationProps } from \"./PaginationTypes\";\n\nexport const PaginationHybrid = (props: PaginationProps) => {\n // Pagination exposes domain props plus an optional className, none of which\n // are styled-system props, so hasStyledProps is effectively always false; the\n // styled-components branch is retained as a pattern-conformance fallback.\n if (hasStyledProps(props)) {\n return <PaginationStyled {...props} />;\n }\n return <PaginationTailwind {...props} />;\n};\n","/**\n * Styled-components implementation of the Pagination component.\n * Composes the styled sub-components from styles.ts. Retained for backward\n * compatibility (system props / styled() extension) via PaginationHybrid.\n */\n\nimport { Select } from \"@sproutsocial/seeds-react-select\";\nimport { Icon } from \"@sproutsocial/seeds-react-icon\";\nimport type { PaginationProps } from \"./PaginationTypes\";\nimport { usePaginationModel } from \"./usePaginationModel\";\nimport {\n StyledPaginationContainer,\n StyledPaginationControls,\n StyledPaginationInfo,\n StyledPageSizeSelector,\n StyledPageButtons,\n StyledPaginationButton,\n} from \"./styles\";\n\nexport const PaginationStyled = (props: PaginationProps) => {\n const { pageSize, totalRows, onPageChange, className } = props;\n const {\n displayType,\n pageSizeOptions,\n tableCountFunction,\n totalPages,\n currentPage,\n startRow,\n endRow,\n canGoPrevious,\n canGoNext,\n handlePrevious,\n handleNext,\n handlePageSizeChange,\n pageNumbers,\n } = usePaginationModel(props);\n\n if (totalPages <= 1 && !pageSizeOptions) {\n // No pagination needed if only one page and no page size options\n return null;\n }\n\n return (\n <StyledPaginationContainer className={className}>\n <StyledPaginationInfo>\n {tableCountFunction({\n startNum: startRow,\n endNum: endRow,\n totalRowCount: totalRows,\n })}\n </StyledPaginationInfo>\n {/* Page size selector */}\n {pageSizeOptions && displayType === \"dropdown\" && (\n <StyledPageSizeSelector>\n <Select\n id=\"page-size-select\"\n name=\"page-size\"\n value={String(pageSize)}\n onChange={handlePageSizeChange}\n ariaLabel=\"Rows per page\"\n size=\"small\"\n >\n {pageSizeOptions.map((size) => (\n <option key={size} value={size}>\n {size} per page\n </option>\n ))}\n </Select>\n </StyledPageSizeSelector>\n )}\n\n {/* TODO: Add inline page size selector for displayType === 'inline' */}\n\n {/* Page navigation controls */}\n {totalPages > 1 && (\n <StyledPaginationControls>\n <StyledPageButtons>\n <StyledPaginationButton\n onClick={handlePrevious}\n disabled={!canGoPrevious}\n aria-label=\"Previous page\"\n >\n <Icon name=\"chevron-left-outline\" />\n </StyledPaginationButton>\n\n {pageNumbers.map((pageNum, index) => {\n if (pageNum === \"...\") {\n return (\n <StyledPaginationButton\n key={`ellipsis-${index}`}\n disabled\n aria-label=\"More pages\"\n >\n <Icon name=\"ellipsis-horizontal-outline\" />\n </StyledPaginationButton>\n );\n }\n\n const page = pageNum as number;\n const isCurrentPage = page === currentPage;\n\n return (\n <StyledPaginationButton\n key={page}\n onClick={() => onPageChange(page - 1)}\n disabled={isCurrentPage}\n aria-label={`Page ${page}`}\n aria-current={isCurrentPage ? \"page\" : undefined}\n isSelected={isCurrentPage}\n >\n {page}\n </StyledPaginationButton>\n );\n })}\n\n <StyledPaginationButton\n onClick={handleNext}\n disabled={!canGoNext}\n aria-label=\"Next page\"\n >\n <Icon name=\"chevron-right-outline\" />\n </StyledPaginationButton>\n </StyledPageButtons>\n </StyledPaginationControls>\n )}\n </StyledPaginationContainer>\n );\n};\n","/**\n * Presentation-agnostic Pagination model: page math, the page-number token\n * list, and the event handlers consumed identically by PaginationTailwind and\n * PaginationStyled. Contains NO rendering — the JSX and the `return null` guard\n * stay in each component — so the two implementations cannot drift apart. Call\n * it unconditionally at the top of each component, before any early return.\n */\n\nimport * as React from \"react\";\nimport type { PaginationProps } from \"./PaginationTypes\";\n\nexport const usePaginationModel = ({\n paginationConfig,\n currentPageIndex,\n pageSize,\n totalRows,\n onPageChange,\n onPageSizeChange,\n}: PaginationProps) => {\n const { displayType, pageSizeOptions, tableCountFunction } = paginationConfig;\n\n // Calculate pagination values\n const totalPages = Math.ceil(totalRows / pageSize);\n const currentPage = currentPageIndex + 1; // Convert 0-based to 1-based for display\n const startRow = totalRows === 0 ? 0 : currentPageIndex * pageSize + 1;\n const endRow = Math.min((currentPageIndex + 1) * pageSize, totalRows);\n\n const canGoPrevious = currentPageIndex > 0;\n const canGoNext = currentPageIndex < totalPages - 1;\n\n const handlePrevious = () => {\n if (canGoPrevious) {\n onPageChange(currentPageIndex - 1);\n }\n };\n\n const handleNext = () => {\n if (canGoNext) {\n onPageChange(currentPageIndex + 1);\n }\n };\n\n const handlePageSizeChange = (e: React.SyntheticEvent<HTMLSelectElement>) => {\n const newPageSize = Number(e.currentTarget.value);\n onPageSizeChange(newPageSize);\n // Reset to first page when page size changes\n onPageChange(0);\n };\n\n // Generate page number buttons using web-app-core's algorithm\n const getPageNumbers = () => {\n const pages: (number | string)[] = [];\n const size = paginationConfig.size || \"default\";\n\n // Configuration for how many pages to show around current page\n const NUM_PAGE_LOWER = size === \"mini\" ? 0 : 1;\n const NUM_PAGE_UPPER = size === \"mini\" ? 0 : 2;\n\n // If number of pages is small enough, show all the page tokens without ellipsis\n if (totalPages <= 5 + NUM_PAGE_LOWER + NUM_PAGE_UPPER) {\n for (let i = 1; i <= totalPages; i++) {\n pages.push(i);\n }\n } else {\n // Add first page\n pages.push(1);\n\n // Add ellipsis at the beginning if needed\n if (currentPage > 3 + NUM_PAGE_LOWER) {\n pages.push(\"...\");\n }\n\n // Add pages in the middle\n let start: number;\n let end: number; // inclusive index\n\n // If near beginning - Show number of pages before ending ellipsis\n if (currentPage <= 3 + NUM_PAGE_LOWER) {\n start = 2;\n end = 3 + NUM_PAGE_LOWER + NUM_PAGE_UPPER;\n } else if (currentPage > totalPages - (3 + NUM_PAGE_UPPER)) {\n // If near end - Show number of pages after starting ellipsis\n start = totalPages - (2 + NUM_PAGE_LOWER + NUM_PAGE_UPPER);\n end = totalPages - 1;\n } else {\n // If in the middle - Show number of pages between two ellipses\n start = currentPage - NUM_PAGE_LOWER;\n end = currentPage + NUM_PAGE_UPPER;\n }\n\n for (let i = start; i <= end; i++) {\n pages.push(i);\n }\n\n // Add a final ellipsis if necessary\n if (currentPage < totalPages - (2 + NUM_PAGE_UPPER)) {\n pages.push(\"...\");\n }\n\n // Add the last page number\n pages.push(totalPages);\n }\n\n return pages;\n };\n\n const pageNumbers = getPageNumbers();\n\n return {\n displayType,\n pageSizeOptions,\n tableCountFunction,\n totalPages,\n currentPage,\n startRow,\n endRow,\n canGoPrevious,\n canGoNext,\n handlePrevious,\n handleNext,\n handlePageSizeChange,\n pageNumbers,\n };\n};\n","import styled from \"styled-components\";\nimport { Text } from \"@sproutsocial/seeds-react-text\";\n\n// Pagination Styles\nexport const StyledPaginationContainer = styled.div`\n ${(props) => props.theme.typography[200]}\n display: flex;\n align-items: center;\n gap: ${(props) => props.theme.space[300]};\n margin-top: ${(props) => props.theme.space[400]};\n flex-wrap: wrap;\n`;\n\nexport const StyledPaginationControls = styled.div`\n display: flex;\n align-items: center;\n margin-left: auto;\n`;\n\nexport const StyledPaginationInfo = styled(Text)`\n white-space: nowrap;\n`;\n\nexport const StyledPageSizeSelector = styled.div`\n display: flex;\n align-items: center;\n gap: ${(props) => props.theme.space[300]};\n`;\n\nexport const StyledPageButtons = styled.div`\n display: inline-flex;\n flex-flow: row wrap;\n background-clip: padding-box;\n border: 1px solid\n ${(props) => props.theme.colors.button.secondary.border.base};\n border-radius: ${(props) => props.theme.radii.outer};\n padding: ${(props) => props.theme.space[100]};\n background: transparent;\n`;\n\nexport const StyledPaginationButton = styled.button<{ isSelected?: boolean }>`\n min-width: calc(${(props) => props.theme.space[500]} + 4px);\n min-height: calc(${(props) => props.theme.space[500]} + 2px);\n padding: calc(${(props) => props.theme.space[350]} - 6px);\n line-height: ${(props) => props.theme.space[400]};\n font-weight: ${(props) => props.theme.fontWeights.semibold};\n background-color: ${(props) =>\n props.isSelected\n ? props.theme.colors.button.secondary.background.active\n : \"transparent\"};\n color: ${(props) =>\n props.isSelected\n ? props.theme.colors.text.inverse\n : props.theme.colors.text.body};\n border: none;\n border-radius: ${(props) => props.theme.radii.inner};\n cursor: pointer;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n\n &:hover:not(:disabled) {\n color: ${(props) =>\n props.isSelected ? props.theme.colors.text.inverse : undefined};\n background-color: ${(props) =>\n props.isSelected\n ? props.theme.colors.button.secondary.background.active\n : props.theme.colors.listItem.background.hover};\n }\n\n &:disabled {\n cursor: default;\n opacity: ${(props) => (props.isSelected ? 1 : 0.5)};\n }\n`;\n","/**\n * Tailwind/CSS implementation of the Pagination component.\n * Uses Seeds pagination CSS classes from pagination.css.\n */\n\nimport { Select } from \"@sproutsocial/seeds-react-select\";\nimport { Icon } from \"@sproutsocial/seeds-react-icon\";\nimport { Text } from \"@sproutsocial/seeds-react-text\";\nimport type { PaginationProps } from \"./PaginationTypes\";\nimport { usePaginationModel } from \"./usePaginationModel\";\n\n// Utility for merging class names properly\nfunction cn(\n ...inputs: (string | undefined | null | false | Record<string, boolean>)[]\n): string {\n const classes: string[] = [];\n\n for (const input of inputs) {\n if (!input) continue;\n\n if (typeof input === \"string\") {\n classes.push(input);\n } else if (typeof input === \"object\") {\n for (const [key, value] of Object.entries(input)) {\n if (value) {\n classes.push(key);\n }\n }\n }\n }\n\n return classes.join(\" \");\n}\n\nexport const PaginationTailwind = (props: PaginationProps) => {\n const { pageSize, totalRows, onPageChange, className } = props;\n const {\n displayType,\n pageSizeOptions,\n tableCountFunction,\n totalPages,\n currentPage,\n startRow,\n endRow,\n canGoPrevious,\n canGoNext,\n handlePrevious,\n handleNext,\n handlePageSizeChange,\n pageNumbers,\n } = usePaginationModel(props);\n\n if (totalPages <= 1 && !pageSizeOptions) {\n // No pagination needed if only one page and no page size options\n return null;\n }\n\n return (\n <div className={cn(\"seeds-pagination-container\", className)}>\n <Text className={cn(\"seeds-pagination-info\")}>\n {tableCountFunction({\n startNum: startRow,\n endNum: endRow,\n totalRowCount: totalRows,\n })}\n </Text>\n {/* Page size selector */}\n {pageSizeOptions && displayType === \"dropdown\" && (\n <div className={cn(\"seeds-pagination-page-size-selector\")}>\n <Select\n id=\"page-size-select\"\n name=\"page-size\"\n value={String(pageSize)}\n onChange={handlePageSizeChange}\n ariaLabel=\"Rows per page\"\n size=\"small\"\n >\n {pageSizeOptions.map((size) => (\n <option key={size} value={size}>\n {size} per page\n </option>\n ))}\n </Select>\n </div>\n )}\n\n {/* TODO: Add inline page size selector for displayType === 'inline' */}\n\n {/* Page navigation controls */}\n {totalPages > 1 && (\n <div className={cn(\"seeds-pagination-controls\")}>\n <div className={cn(\"seeds-pagination-page-buttons\")}>\n <button\n type=\"button\"\n className={cn(\"seeds-pagination-button\")}\n onClick={handlePrevious}\n disabled={!canGoPrevious}\n aria-label=\"Previous page\"\n >\n <Icon name=\"chevron-left-outline\" />\n </button>\n\n {pageNumbers.map((pageNum, index) => {\n if (pageNum === \"...\") {\n return (\n <button\n type=\"button\"\n key={`ellipsis-${index}`}\n className={cn(\"seeds-pagination-button\")}\n disabled\n aria-label=\"More pages\"\n >\n <Icon name=\"ellipsis-horizontal-outline\" />\n </button>\n );\n }\n\n const page = pageNum as number;\n const isCurrentPage = page === currentPage;\n\n return (\n <button\n type=\"button\"\n key={page}\n className={cn(\"seeds-pagination-button\", {\n \"seeds-pagination-button-selected\": isCurrentPage,\n })}\n onClick={() => onPageChange(page - 1)}\n disabled={isCurrentPage}\n aria-label={`Page ${page}`}\n aria-current={isCurrentPage ? \"page\" : undefined}\n >\n {page}\n </button>\n );\n })}\n\n <button\n type=\"button\"\n className={cn(\"seeds-pagination-button\")}\n onClick={handleNext}\n disabled={!canGoNext}\n aria-label=\"Next page\"\n >\n <Icon name=\"chevron-right-outline\" />\n </button>\n </div>\n </div>\n )}\n </div>\n );\n};\n","import { PaginationHybrid } from \"./PaginationHybrid\";\nimport type { PaginationProps } from \"./PaginationTypes\";\n\n/**\n * Pagination component. Automatically routes between the Tailwind implementation\n * (preferred) and the styled-components implementation (for consumers using\n * system props or styled() extension).\n *\n * Defined as a self-named component (rather than a bare re-export of\n * PaginationHybrid) so the `react-docgen` props-docs generation in the Publish\n * pipeline has a suitable component definition to analyze.\n */\nexport const Pagination = (props: PaginationProps) => (\n <PaginationHybrid {...props} />\n);\n\nPagination.displayName = \"Pagination\";\n","import * as React from \"react\";\n\n/**\n * Standard page size option sets for pagination.\n * Export these constants to maintain consistency across tables.\n */\nconst PAGE_SIZE_OPTIONS_STANDARD = [10, 25, 50, 100] as const;\nconst PAGE_SIZE_OPTIONS_COMPACT = [5, 10, 20] as const;\nconst PAGE_SIZE_OPTIONS_LARGE = [50, 100, 200, 500] as const;\n\nexport const PAGE_SIZE_OPTIONS = {\n STANDARD: PAGE_SIZE_OPTIONS_STANDARD,\n COMPACT: PAGE_SIZE_OPTIONS_COMPACT,\n LARGE: PAGE_SIZE_OPTIONS_LARGE,\n};\n\n/**\n * Allowed page size option sets.\n * Use one of the predefined PAGE_SIZE_OPTIONS for consistency.\n */\nexport type TypeAllowedPageSizeOptions =\n | typeof PAGE_SIZE_OPTIONS_STANDARD\n | typeof PAGE_SIZE_OPTIONS_COMPACT\n | typeof PAGE_SIZE_OPTIONS_LARGE;\n\n/**\n * Configuration for pagination controls with page navigation and size selection.\n *\n * @example\n * ```tsx\n * <Pagination\n * paginationConfig={{\n * initialPageSize: 25,\n * displayType: 'dropdown',\n * pageSizeOptions: PAGE_SIZE_OPTIONS.STANDARD,\n * tableCountFunction: ({ startNum, endNum, totalRowCount }) =>\n * `${startNum}-${endNum} of ${totalRowCount}`\n * }}\n * currentPageIndex={0}\n * pageSize={25}\n * totalRows={100}\n * onPageChange={(index) => console.log('Page:', index)}\n * onPageSizeChange={(size) => console.log('Page size:', size)}\n * />\n * ```\n */\n/**\n * Props for the Pagination component.\n */\nexport interface PaginationProps {\n paginationConfig: TypePaginationConfig;\n currentPageIndex: number;\n pageSize: number;\n totalRows: number;\n onPageChange: (pageIndex: number) => void;\n onPageSizeChange: (pageSize: number) => void;\n /**\n * Optional class name applied to the root container. Lets consumers layer\n * Tailwind utility overrides (e.g. `mx-200`, `p-300`) on top of the component\n * styles. Because `className` is not a styled-system prop, providing it keeps\n * the component on the Tailwind rendering path.\n */\n className?: string;\n}\n\nexport interface TypePaginationConfig {\n /**\n * Initial number of rows per page.\n * @default 10\n */\n initialPageSize: number;\n /**\n * Function that returns the intl for displaying the table counts underneath a DataTable\n */\n tableCountFunction: (args: {\n startNum: number;\n endNum: number;\n totalRowCount: number;\n }) => React.ReactNode;\n /**\n * Display mode for page size selector.\n * - 'dropdown': Shows page size selector as a dropdown\n * Only used when pageSizeOptions is provided.\n * @default 'dropdown'\n */\n displayType?: \"dropdown\";\n /**\n * Optional array of page size options for the selector.\n * If not provided, page size selection will not be available.\n * Use PAGE_SIZE_OPTIONS constants for consistency.\n *\n * @example\n * pageSizeOptions: PAGE_SIZE_OPTIONS.STANDARD // [10, 25, 50, 100]\n */\n pageSizeOptions?: TypeAllowedPageSizeOptions;\n /**\n * Size variant for page number display.\n * - 'default': Shows current page ±1-2 pages (more visible pages)\n * - 'mini': Shows only current page (fewer visible pages)\n * @default 'default'\n */\n size?: \"default\" | \"mini\";\n}\n"],"mappings":";AAMA,SAAS,sBAAsB;;;ACA/B,SAAS,cAAc;AACvB,SAAS,YAAY;;;ACCrB,OAAuB;AAGhB,IAAM,qBAAqB,CAAC;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAuB;AACrB,QAAM,EAAE,aAAa,iBAAiB,mBAAmB,IAAI;AAG7D,QAAM,aAAa,KAAK,KAAK,YAAY,QAAQ;AACjD,QAAM,cAAc,mBAAmB;AACvC,QAAM,WAAW,cAAc,IAAI,IAAI,mBAAmB,WAAW;AACrE,QAAM,SAAS,KAAK,KAAK,mBAAmB,KAAK,UAAU,SAAS;AAEpE,QAAM,gBAAgB,mBAAmB;AACzC,QAAM,YAAY,mBAAmB,aAAa;AAElD,QAAM,iBAAiB,MAAM;AAC3B,QAAI,eAAe;AACjB,mBAAa,mBAAmB,CAAC;AAAA,IACnC;AAAA,EACF;AAEA,QAAM,aAAa,MAAM;AACvB,QAAI,WAAW;AACb,mBAAa,mBAAmB,CAAC;AAAA,IACnC;AAAA,EACF;AAEA,QAAM,uBAAuB,CAAC,MAA+C;AAC3E,UAAM,cAAc,OAAO,EAAE,cAAc,KAAK;AAChD,qBAAiB,WAAW;AAE5B,iBAAa,CAAC;AAAA,EAChB;AAGA,QAAM,iBAAiB,MAAM;AAC3B,UAAM,QAA6B,CAAC;AACpC,UAAM,OAAO,iBAAiB,QAAQ;AAGtC,UAAM,iBAAiB,SAAS,SAAS,IAAI;AAC7C,UAAM,iBAAiB,SAAS,SAAS,IAAI;AAG7C,QAAI,cAAc,IAAI,iBAAiB,gBAAgB;AACrD,eAAS,IAAI,GAAG,KAAK,YAAY,KAAK;AACpC,cAA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,YAEL,WAAW,GAAG,2BAA2B;AAAA,cACvC,oCAAoC;AAAA,YACtC,CAAC;AAAA,YACD,SAAS,MAAM,aAAa,OAAO,CAAC;AAAA,YACpC,UAAU;AAAA,YACV,cAAY,QAAQ,IAAI;AAAA,YACxB,gBAAc,gBAAgB,SAAS;AAAA,YAEtC;AAAA;AAAA,UATI;AAAA,QAUP;AAAA,MAEJ,CAAC;AAAA,MAED,gBAAAA;AAAA,QAAC;AAAA;AAAA,UACC,MAAK;AAAA,UACL,WAAW,GAAG,yBAAyB;AAAA,UACvC,SAAS;AAAA,UACT,UAAU,CAAC;AAAA,UACX,cAAW;AAAA,UAEX,0BAAAA,KAACI,OAAA,EAAK,MAAK,yBAAwB;AAAA;AAAA,MACrC;AAAA,OACF,GACF;AAAA,KAEJ;AAEJ;;;AJvIW,gBAAAC,YAAA;AALJ,IAAM,mBAAmB,CAAC,UAA2B;AAI1D,MAAI,eAAe,KAAK,GAAG;AACzB,WAAO,gBAAAA,KAAC,oBAAkB,GAAG,OAAO;AAAA,EACtC;AACA,SAAO,gBAAAA,KAAC,sBAAoB,GAAG,OAAO;AACxC;;;AKNE,gBAAAC,YAAA;AADK,IAAM,aAAa,CAAC,UACzB,gBAAAA,KAAC,oBAAkB,GAAG,OAAO;AAG/B,WAAW,cAAc;;;AChBzB,OAAuB;AAMvB,IAAM,6BAA6B,CAAC,IAAI,IAAI,IAAI,GAAG;AACnD,IAAM,4BAA4B,CAAC,GAAG,IAAI,EAAE;AAC5C,IAAM,0BAA0B,CAAC,IAAI,KAAK,KAAK,GAAG;AAE3C,IAAM,oBAAoB;AAAA,EAC/B,UAAU;AAAA,EACV,SAAS;AAAA,EACT,OAAO;AACT;","names":["Select","Icon","Text","jsx","jsxs","Text","Select","Icon","jsx","jsx"]}
|
package/dist/index.d.mts
CHANGED
|
@@ -39,6 +39,24 @@ type TypeAllowedPageSizeOptions = typeof PAGE_SIZE_OPTIONS_STANDARD | typeof PAG
|
|
|
39
39
|
* />
|
|
40
40
|
* ```
|
|
41
41
|
*/
|
|
42
|
+
/**
|
|
43
|
+
* Props for the Pagination component.
|
|
44
|
+
*/
|
|
45
|
+
interface PaginationProps {
|
|
46
|
+
paginationConfig: TypePaginationConfig;
|
|
47
|
+
currentPageIndex: number;
|
|
48
|
+
pageSize: number;
|
|
49
|
+
totalRows: number;
|
|
50
|
+
onPageChange: (pageIndex: number) => void;
|
|
51
|
+
onPageSizeChange: (pageSize: number) => void;
|
|
52
|
+
/**
|
|
53
|
+
* Optional class name applied to the root container. Lets consumers layer
|
|
54
|
+
* Tailwind utility overrides (e.g. `mx-200`, `p-300`) on top of the component
|
|
55
|
+
* styles. Because `className` is not a styled-system prop, providing it keeps
|
|
56
|
+
* the component on the Tailwind rendering path.
|
|
57
|
+
*/
|
|
58
|
+
className?: string;
|
|
59
|
+
}
|
|
42
60
|
interface TypePaginationConfig {
|
|
43
61
|
/**
|
|
44
62
|
* Initial number of rows per page.
|
|
@@ -78,14 +96,18 @@ interface TypePaginationConfig {
|
|
|
78
96
|
size?: "default" | "mini";
|
|
79
97
|
}
|
|
80
98
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
99
|
+
/**
|
|
100
|
+
* Pagination component. Automatically routes between the Tailwind implementation
|
|
101
|
+
* (preferred) and the styled-components implementation (for consumers using
|
|
102
|
+
* system props or styled() extension).
|
|
103
|
+
*
|
|
104
|
+
* Defined as a self-named component (rather than a bare re-export of
|
|
105
|
+
* PaginationHybrid) so the `react-docgen` props-docs generation in the Publish
|
|
106
|
+
* pipeline has a suitable component definition to analyze.
|
|
107
|
+
*/
|
|
108
|
+
declare const Pagination: {
|
|
109
|
+
(props: PaginationProps): react_jsx_runtime.JSX.Element;
|
|
110
|
+
displayName: string;
|
|
111
|
+
};
|
|
90
112
|
|
|
91
|
-
export { PAGE_SIZE_OPTIONS, Pagination, type TypeAllowedPageSizeOptions, type TypePaginationConfig };
|
|
113
|
+
export { PAGE_SIZE_OPTIONS, Pagination, type PaginationProps, type TypeAllowedPageSizeOptions, type TypePaginationConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -39,6 +39,24 @@ type TypeAllowedPageSizeOptions = typeof PAGE_SIZE_OPTIONS_STANDARD | typeof PAG
|
|
|
39
39
|
* />
|
|
40
40
|
* ```
|
|
41
41
|
*/
|
|
42
|
+
/**
|
|
43
|
+
* Props for the Pagination component.
|
|
44
|
+
*/
|
|
45
|
+
interface PaginationProps {
|
|
46
|
+
paginationConfig: TypePaginationConfig;
|
|
47
|
+
currentPageIndex: number;
|
|
48
|
+
pageSize: number;
|
|
49
|
+
totalRows: number;
|
|
50
|
+
onPageChange: (pageIndex: number) => void;
|
|
51
|
+
onPageSizeChange: (pageSize: number) => void;
|
|
52
|
+
/**
|
|
53
|
+
* Optional class name applied to the root container. Lets consumers layer
|
|
54
|
+
* Tailwind utility overrides (e.g. `mx-200`, `p-300`) on top of the component
|
|
55
|
+
* styles. Because `className` is not a styled-system prop, providing it keeps
|
|
56
|
+
* the component on the Tailwind rendering path.
|
|
57
|
+
*/
|
|
58
|
+
className?: string;
|
|
59
|
+
}
|
|
42
60
|
interface TypePaginationConfig {
|
|
43
61
|
/**
|
|
44
62
|
* Initial number of rows per page.
|
|
@@ -78,14 +96,18 @@ interface TypePaginationConfig {
|
|
|
78
96
|
size?: "default" | "mini";
|
|
79
97
|
}
|
|
80
98
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
99
|
+
/**
|
|
100
|
+
* Pagination component. Automatically routes between the Tailwind implementation
|
|
101
|
+
* (preferred) and the styled-components implementation (for consumers using
|
|
102
|
+
* system props or styled() extension).
|
|
103
|
+
*
|
|
104
|
+
* Defined as a self-named component (rather than a bare re-export of
|
|
105
|
+
* PaginationHybrid) so the `react-docgen` props-docs generation in the Publish
|
|
106
|
+
* pipeline has a suitable component definition to analyze.
|
|
107
|
+
*/
|
|
108
|
+
declare const Pagination: {
|
|
109
|
+
(props: PaginationProps): react_jsx_runtime.JSX.Element;
|
|
110
|
+
displayName: string;
|
|
111
|
+
};
|
|
90
112
|
|
|
91
|
-
export { PAGE_SIZE_OPTIONS, Pagination, type TypeAllowedPageSizeOptions, type TypePaginationConfig };
|
|
113
|
+
export { PAGE_SIZE_OPTIONS, Pagination, type PaginationProps, type TypeAllowedPageSizeOptions, type TypePaginationConfig };
|