@startupjs-ui/pagination 0.1.13 → 0.1.16
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/CHANGELOG.md +8 -0
- package/README.mdx +31 -18
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [0.1.16](https://github.com/startupjs/startupjs-ui/compare/v0.1.15...v0.1.16) (2026-02-10)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @startupjs-ui/pagination
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [0.1.13](https://github.com/startupjs/startupjs-ui/compare/v0.1.12...v0.1.13) (2026-02-03)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @startupjs-ui/pagination
|
package/README.mdx
CHANGED
|
@@ -6,7 +6,7 @@ import Pagination, { _PropsJsonSchema as PaginationPropsJsonSchema } from './ind
|
|
|
6
6
|
|
|
7
7
|
# Pagination
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Lets the user navigate through a range of pages. Supports both page-based and item-based (count/limit/skip) pagination, two-way data bindings, and customizable navigation buttons.
|
|
10
10
|
|
|
11
11
|
```jsx
|
|
12
12
|
import { Pagination } from 'startupjs-ui'
|
|
@@ -14,8 +14,9 @@ import { Pagination } from 'startupjs-ui'
|
|
|
14
14
|
|
|
15
15
|
## Simple example
|
|
16
16
|
|
|
17
|
-
- `pages`
|
|
18
|
-
- `page`
|
|
17
|
+
- `pages` -- the total number of pages
|
|
18
|
+
- `page` -- the current page (zero-based, from `0` to `pages - 1`)
|
|
19
|
+
- `onChangePage` -- called with the new page index when the user navigates
|
|
19
20
|
|
|
20
21
|
```jsx example
|
|
21
22
|
const [page, setPage] = useState(0)
|
|
@@ -32,14 +33,18 @@ return (
|
|
|
32
33
|
|
|
33
34
|
## Alternatives
|
|
34
35
|
|
|
35
|
-
|
|
36
|
-
- `limit` - count of items to display per page
|
|
37
|
-
- `skip` - count of items to skip
|
|
36
|
+
Instead of specifying pages directly, you can express pagination in terms of items:
|
|
38
37
|
|
|
39
|
-
|
|
38
|
+
- `count` -- total number of items (default `0`)
|
|
39
|
+
- `limit` -- number of items per page (default `1`)
|
|
40
|
+
- `skip` -- number of items to skip from the beginning (default `0`)
|
|
40
41
|
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
These map to the page-based props as follows:
|
|
43
|
+
|
|
44
|
+
- `count` and `limit` replace `pages` (total pages = count / limit)
|
|
45
|
+
- `limit` and `skip` replace `page` (current page = skip / limit)
|
|
46
|
+
|
|
47
|
+
The `onChangePage` callback still receives a zero-based page index, so multiply by `limit` to convert it back to a skip value.
|
|
43
48
|
|
|
44
49
|
```jsx example
|
|
45
50
|
const COUNT = 100
|
|
@@ -59,7 +64,7 @@ return (
|
|
|
59
64
|
|
|
60
65
|
## Two-way data bindings
|
|
61
66
|
|
|
62
|
-
You can use two-way data
|
|
67
|
+
You can use two-way data binding props (`$page`, `$skip`, `$limit`) in place of their corresponding value props (`page`, `skip`, `limit`). This eliminates the need for a separate `onChangePage` handler when using observable models.
|
|
63
68
|
|
|
64
69
|
```jsx example
|
|
65
70
|
const $page = $(0)
|
|
@@ -90,10 +95,12 @@ return (
|
|
|
90
95
|
|
|
91
96
|
## Buttons
|
|
92
97
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
- `
|
|
96
|
-
- `
|
|
98
|
+
Control which navigation buttons are visible:
|
|
99
|
+
|
|
100
|
+
- `showPrevButton` -- previous-page button (default `true`)
|
|
101
|
+
- `showNextButton` -- next-page button (default `true`)
|
|
102
|
+
- `showFirstButton` -- jump-to-first-page button (default `false`)
|
|
103
|
+
- `showLastButton` -- jump-to-last-page button (default `false`)
|
|
97
104
|
|
|
98
105
|
```jsx example
|
|
99
106
|
const [page, setPage] = useState(0)
|
|
@@ -114,7 +121,7 @@ return (
|
|
|
114
121
|
|
|
115
122
|
## Compact view
|
|
116
123
|
|
|
117
|
-
|
|
124
|
+
Set `variant='compact'` to display a simplified layout that shows only the current page status and navigation arrows instead of individual page buttons. The default variant is `'full'`.
|
|
118
125
|
|
|
119
126
|
```jsx example
|
|
120
127
|
const [page, setPage] = useState(0)
|
|
@@ -132,10 +139,10 @@ return (
|
|
|
132
139
|
|
|
133
140
|
## Visible pages
|
|
134
141
|
|
|
135
|
-
|
|
142
|
+
When using the default `'full'` variant, you can fine-tune which page numbers are visible:
|
|
136
143
|
|
|
137
|
-
- `boundaryCount`
|
|
138
|
-
- `siblingCount`
|
|
144
|
+
- `boundaryCount` -- number of pages always shown at the beginning and end of the range (default `1`)
|
|
145
|
+
- `siblingCount` -- number of pages shown on each side of the current page (default `1`)
|
|
139
146
|
|
|
140
147
|
```jsx example
|
|
141
148
|
const [page, setPage] = useState(5)
|
|
@@ -152,6 +159,12 @@ return (
|
|
|
152
159
|
)
|
|
153
160
|
```
|
|
154
161
|
|
|
162
|
+
## Additional props
|
|
163
|
+
|
|
164
|
+
- `style` -- custom styles applied to the root container
|
|
165
|
+
- `disabled` -- when `true`, disables all navigation buttons (default `false`)
|
|
166
|
+
- `onChangeLimit` -- called when the page size changes
|
|
167
|
+
|
|
155
168
|
## Sandbox
|
|
156
169
|
|
|
157
170
|
<Sandbox
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@startupjs-ui/pagination",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.16",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -9,14 +9,14 @@
|
|
|
9
9
|
"type": "module",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@startupjs-ui/core": "^0.1.11",
|
|
12
|
-
"@startupjs-ui/div": "^0.1.
|
|
13
|
-
"@startupjs-ui/icon": "^0.1.
|
|
14
|
-
"@startupjs-ui/span": "^0.1.
|
|
12
|
+
"@startupjs-ui/div": "^0.1.16",
|
|
13
|
+
"@startupjs-ui/icon": "^0.1.16",
|
|
14
|
+
"@startupjs-ui/span": "^0.1.16"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
17
|
"react": "*",
|
|
18
18
|
"react-native": "*",
|
|
19
19
|
"startupjs": "*"
|
|
20
20
|
},
|
|
21
|
-
"gitHead": "
|
|
21
|
+
"gitHead": "9943aa3566d5d80f5b404473906eb3c0611f9ee5"
|
|
22
22
|
}
|