@tempoxyz/ds 0.3.10 → 0.3.11
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/docs/AGENTS.md +9 -0
- package/dist/docs/components/accordion.md +489 -0
- package/dist/docs/components/address-card.md +147 -0
- package/dist/docs/components/agent-logo.md +194 -0
- package/dist/docs/components/alert-dialog.md +631 -0
- package/dist/docs/components/alert.md +448 -0
- package/dist/docs/components/amount-input.md +305 -0
- package/dist/docs/components/amount.md +794 -0
- package/dist/docs/components/app-shell.md +559 -0
- package/dist/docs/components/asset-chip.md +294 -0
- package/dist/docs/components/autocomplete.md +619 -0
- package/dist/docs/components/avatar.md +321 -0
- package/dist/docs/components/badge.md +339 -0
- package/dist/docs/components/badged-logo.md +116 -0
- package/dist/docs/components/banner.md +379 -0
- package/dist/docs/components/bar-chart.md +208 -0
- package/dist/docs/components/breadcrumbs.md +380 -0
- package/dist/docs/components/button-group.md +286 -0
- package/dist/docs/components/button.md +650 -0
- package/dist/docs/components/calendar.md +375 -0
- package/dist/docs/components/callout.md +96 -0
- package/dist/docs/components/checkbox-group.md +521 -0
- package/dist/docs/components/checkbox.md +467 -0
- package/dist/docs/components/choice-group.md +516 -0
- package/dist/docs/components/choicebox.md +641 -0
- package/dist/docs/components/code.md +100 -0
- package/dist/docs/components/combobox.md +939 -0
- package/dist/docs/components/container.md +257 -0
- package/dist/docs/components/copy-button.md +642 -0
- package/dist/docs/components/date-picker.md +514 -0
- package/dist/docs/components/dialog.md +1332 -0
- package/dist/docs/components/drawer.md +966 -0
- package/dist/docs/components/empty.md +340 -0
- package/dist/docs/components/field.md +570 -0
- package/dist/docs/components/fieldset.md +398 -0
- package/dist/docs/components/frame.md +434 -0
- package/dist/docs/components/gauge.md +299 -0
- package/dist/docs/components/get-started-visual.md +117 -0
- package/dist/docs/components/grid.md +288 -0
- package/dist/docs/components/hero-visual.md +155 -0
- package/dist/docs/components/hex.md +487 -0
- package/dist/docs/components/icon-tile.md +292 -0
- package/dist/docs/components/identicon.md +371 -0
- package/dist/docs/components/inline.md +233 -0
- package/dist/docs/components/inset.md +225 -0
- package/dist/docs/components/kbd.md +423 -0
- package/dist/docs/components/list-group.md +981 -0
- package/dist/docs/components/loading-dots.md +237 -0
- package/dist/docs/components/menu.md +934 -0
- package/dist/docs/components/native-select.md +204 -0
- package/dist/docs/components/network-logo.md +248 -0
- package/dist/docs/components/number-field.md +543 -0
- package/dist/docs/components/otp-field.md +616 -0
- package/dist/docs/components/pagination.md +516 -0
- package/dist/docs/components/popover.md +544 -0
- package/dist/docs/components/progress.md +388 -0
- package/dist/docs/components/qr.md +314 -0
- package/dist/docs/components/radio-group.md +528 -0
- package/dist/docs/components/secret-value.md +406 -0
- package/dist/docs/components/select.md +751 -0
- package/dist/docs/components/separator.md +379 -0
- package/dist/docs/components/sidebar-menu.md +922 -0
- package/dist/docs/components/skeleton.md +517 -0
- package/dist/docs/components/slider.md +539 -0
- package/dist/docs/components/snippet.md +424 -0
- package/dist/docs/components/spinner.md +216 -0
- package/dist/docs/components/split-bar.md +139 -0
- package/dist/docs/components/split-button.md +464 -0
- package/dist/docs/components/stack.md +299 -0
- package/dist/docs/components/status-chip.md +226 -0
- package/dist/docs/components/status-indicator.md +119 -0
- package/dist/docs/components/status-row.md +174 -0
- package/dist/docs/components/stepper.md +451 -0
- package/dist/docs/components/success-hero.md +157 -0
- package/dist/docs/components/surface.md +639 -0
- package/dist/docs/components/switch.md +472 -0
- package/dist/docs/components/table.md +967 -0
- package/dist/docs/components/tabs.md +627 -0
- package/dist/docs/components/tempo-logo.md +185 -0
- package/dist/docs/components/text-input.md +624 -0
- package/dist/docs/components/textarea.md +352 -0
- package/dist/docs/components/toast.md +535 -0
- package/dist/docs/components/token-logo.md +371 -0
- package/dist/docs/components/token.md +247 -0
- package/dist/docs/components/tooltip.md +490 -0
- package/dist/docs/components/verification-code.md +116 -0
- package/dist/docs/components/visual.md +249 -0
- package/dist/docs/components.md +203 -0
- package/dist/docs/foundations/accessibility.md +377 -0
- package/dist/docs/foundations/agents.md +150 -0
- package/dist/docs/foundations/color.md +522 -0
- package/dist/docs/foundations/content/tone.md +194 -0
- package/dist/docs/foundations/content/voice.md +194 -0
- package/dist/docs/foundations/content/writing-style.md +406 -0
- package/dist/docs/foundations/iconography.md +282 -0
- package/dist/docs/foundations/intent.md +360 -0
- package/dist/docs/foundations/layout.md +508 -0
- package/dist/docs/foundations/linter.md +296 -0
- package/dist/docs/foundations/motion.md +151 -0
- package/dist/docs/foundations/radius-and-padding.md +86 -0
- package/dist/docs/foundations/typography.md +266 -0
- package/dist/docs/index.md +137 -0
- package/dist/docs/introduction/faq.md +132 -0
- package/dist/docs/introduction/getting-started.md +377 -0
- package/dist/docs/patterns/blockchain-values.md +709 -0
- package/dist/docs/patterns/dashboards.md +638 -0
- package/dist/docs/patterns/destructive-actions.md +626 -0
- package/dist/docs/patterns/empty-states.md +612 -0
- package/dist/docs/patterns/errors-and-validation.md +808 -0
- package/dist/docs/patterns/feedback-and-status.md +518 -0
- package/dist/docs/patterns/forms.md +679 -0
- package/dist/docs/patterns/loading.md +630 -0
- package/dist/docs/patterns/navigation.md +397 -0
- package/dist/docs/patterns/payments.md +765 -0
- package/dist/docs/patterns/responsive-layout.md +997 -0
- package/dist/docs/patterns/tables-and-lists.md +964 -0
- package/dist/docs/products/tempo-console.md +671 -0
- package/dist/docs/products/tempo-performance.md +437 -0
- package/dist/docs/products/tempo-wallet.md +438 -0
- package/package.json +1 -1
|
@@ -0,0 +1,516 @@
|
|
|
1
|
+
# Pagination
|
|
2
|
+
|
|
3
|
+
Moves between pages of a long list.
|
|
4
|
+
|
|
5
|
+
[View source and API](https://github.com/tempoxyz/ds/blob/main/src/web/components/Pagination.tsx)
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
Pagination renders a navigation landmark with links to each page of a list, plus previous and next steps.
|
|
10
|
+
|
|
11
|
+
## Examples
|
|
12
|
+
|
|
13
|
+
### Basic
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import { Pagination } from '@tempoxyz/ds'
|
|
17
|
+
|
|
18
|
+
function Pages(props: { current: number; size?: Pagination.Props['size'] }) {
|
|
19
|
+
return (
|
|
20
|
+
<Pagination size={props.size}>
|
|
21
|
+
<Pagination.Previous disabled={props.current === 1} href="#" />
|
|
22
|
+
<Pagination.Page current={props.current === 1} href="#">
|
|
23
|
+
1
|
|
24
|
+
</Pagination.Page>
|
|
25
|
+
<Pagination.Ellipsis />
|
|
26
|
+
<Pagination.Page current={props.current === 4} href="#">
|
|
27
|
+
4
|
|
28
|
+
</Pagination.Page>
|
|
29
|
+
<Pagination.Ellipsis />
|
|
30
|
+
<Pagination.Page current={props.current === 9} href="#">
|
|
31
|
+
9
|
|
32
|
+
</Pagination.Page>
|
|
33
|
+
<Pagination.Next disabled={props.current === 9} href="#" />
|
|
34
|
+
</Pagination>
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function Demo() {
|
|
39
|
+
return <Pages current={4} />
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Pagination/Basic.tsx)
|
|
44
|
+
|
|
45
|
+
### Size
|
|
46
|
+
|
|
47
|
+
Set `size` to `small`, `medium` (default), or `large`.
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
import { Pagination, Stack } from '@tempoxyz/ds'
|
|
51
|
+
|
|
52
|
+
function Pages(props: { current: number; size?: Pagination.Props['size'] }) {
|
|
53
|
+
return (
|
|
54
|
+
<Pagination size={props.size}>
|
|
55
|
+
<Pagination.Previous disabled={props.current === 1} href="#" />
|
|
56
|
+
<Pagination.Page current={props.current === 1} href="#">
|
|
57
|
+
1
|
|
58
|
+
</Pagination.Page>
|
|
59
|
+
<Pagination.Ellipsis />
|
|
60
|
+
<Pagination.Page current={props.current === 4} href="#">
|
|
61
|
+
4
|
|
62
|
+
</Pagination.Page>
|
|
63
|
+
<Pagination.Ellipsis />
|
|
64
|
+
<Pagination.Page current={props.current === 9} href="#">
|
|
65
|
+
9
|
|
66
|
+
</Pagination.Page>
|
|
67
|
+
<Pagination.Next disabled={props.current === 9} href="#" />
|
|
68
|
+
</Pagination>
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function Demo() {
|
|
73
|
+
return (
|
|
74
|
+
<Stack gap="16">
|
|
75
|
+
<Pages current={4} size="small" />
|
|
76
|
+
<Pages current={4} size="medium" />
|
|
77
|
+
<Pages current={4} size="large" />
|
|
78
|
+
</Stack>
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Pagination/Size.tsx)
|
|
84
|
+
|
|
85
|
+
### Current
|
|
86
|
+
|
|
87
|
+
Set `current` on exactly one `Pagination.Page`. `Pagination.Previous` and `Pagination.Next` take `disabled` at either end.
|
|
88
|
+
|
|
89
|
+
```tsx
|
|
90
|
+
import { Pagination, Stack } from '@tempoxyz/ds'
|
|
91
|
+
|
|
92
|
+
function Pages(props: { current: number; size?: Pagination.Props['size'] }) {
|
|
93
|
+
return (
|
|
94
|
+
<Pagination size={props.size}>
|
|
95
|
+
<Pagination.Previous disabled={props.current === 1} href="#" />
|
|
96
|
+
<Pagination.Page current={props.current === 1} href="#">
|
|
97
|
+
1
|
|
98
|
+
</Pagination.Page>
|
|
99
|
+
<Pagination.Ellipsis />
|
|
100
|
+
<Pagination.Page current={props.current === 4} href="#">
|
|
101
|
+
4
|
|
102
|
+
</Pagination.Page>
|
|
103
|
+
<Pagination.Ellipsis />
|
|
104
|
+
<Pagination.Page current={props.current === 9} href="#">
|
|
105
|
+
9
|
|
106
|
+
</Pagination.Page>
|
|
107
|
+
<Pagination.Next disabled={props.current === 9} href="#" />
|
|
108
|
+
</Pagination>
|
|
109
|
+
)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export function Demo() {
|
|
113
|
+
return (
|
|
114
|
+
<Stack gap="16">
|
|
115
|
+
<Pages current={1} />
|
|
116
|
+
<Pages current={4} />
|
|
117
|
+
<Pages current={9} />
|
|
118
|
+
</Stack>
|
|
119
|
+
)
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Pagination/Current.tsx)
|
|
124
|
+
|
|
125
|
+
## Anatomy
|
|
126
|
+
|
|
127
|
+
Import the component and assemble its parts.
|
|
128
|
+
|
|
129
|
+
```tsx
|
|
130
|
+
import { Pagination } from '@tempoxyz/ds'
|
|
131
|
+
|
|
132
|
+
<Pagination>
|
|
133
|
+
<Pagination.Previous />
|
|
134
|
+
<Pagination.Page />
|
|
135
|
+
<Pagination.Ellipsis />
|
|
136
|
+
<Pagination.Next />
|
|
137
|
+
</Pagination>
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Guidelines
|
|
141
|
+
|
|
142
|
+
### When to Use
|
|
143
|
+
|
|
144
|
+
* Split long lists that people scan, sort, and revisit, such as transaction history or webhook deliveries.
|
|
145
|
+
* Paginate tables where position matters, such as a shared link to page 3.
|
|
146
|
+
|
|
147
|
+
### When Not to Use
|
|
148
|
+
|
|
149
|
+
* Use a `secondary` [Button](/docs/components/button) labelled Load more at the end of a feed, such as wallet Activity.
|
|
150
|
+
* Use [Stepper](/docs/components/stepper) for progress through a flow.
|
|
151
|
+
* Use [Tabs](/docs/components/tabs) to split a list by category, such as Incoming and Outgoing.
|
|
152
|
+
* Use a [Table](/docs/components/table) or [ListGroup](/docs/components/list-group) without pagination when the list fits on one screen.
|
|
153
|
+
|
|
154
|
+
### Choose Pagination or Load More
|
|
155
|
+
|
|
156
|
+
* **Pagination (Tables and logs):** Each page has a URL, readers jump to any page, and the footer stays reachable.
|
|
157
|
+
* **Load More (Feeds):** New items append below the last one. The footer is reachable after each load.
|
|
158
|
+
|
|
159
|
+
Avoid infinite scroll on the web. It pushes the footer out of reach and gives keyboard users no stopping point.
|
|
160
|
+
|
|
161
|
+
### Link Every Page
|
|
162
|
+
|
|
163
|
+
Give each `Pagination.Page` an `href` with its number. Links then survive a reload, open in a new tab, and work with Back. Pass `render` to use your router's link.
|
|
164
|
+
|
|
165
|
+
**Do:** Put the page number in the URL, such as `?page=3`.
|
|
166
|
+
|
|
167
|
+
```tsx
|
|
168
|
+
/**
|
|
169
|
+
* Do example for "Link Every Page" on the Pagination page.
|
|
170
|
+
* Put the page number in the URL, such as `?page=3`.
|
|
171
|
+
* @module
|
|
172
|
+
*/
|
|
173
|
+
import { Pagination, style } from '@tempoxyz/ds'
|
|
174
|
+
|
|
175
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
176
|
+
export function Demo() {
|
|
177
|
+
return (
|
|
178
|
+
<div {...styles.page()}>
|
|
179
|
+
<span {...styles.address()}>console.tempo.xyz/activity?page=3</span>
|
|
180
|
+
<Pagination size="small">
|
|
181
|
+
<Pagination.Previous href="#" />
|
|
182
|
+
<Pagination.Page href="#">2</Pagination.Page>
|
|
183
|
+
<Pagination.Page current href="#">
|
|
184
|
+
3
|
|
185
|
+
</Pagination.Page>
|
|
186
|
+
<Pagination.Page href="#">4</Pagination.Page>
|
|
187
|
+
<Pagination.Next href="#" />
|
|
188
|
+
</Pagination>
|
|
189
|
+
</div>
|
|
190
|
+
)
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
namespace styles {
|
|
194
|
+
export const address = style({
|
|
195
|
+
backgroundColor: 'container.regular',
|
|
196
|
+
borderRadius: 'full',
|
|
197
|
+
color: 'content.secondary',
|
|
198
|
+
cornerShape: 'round',
|
|
199
|
+
paddingBlock: '4',
|
|
200
|
+
paddingInline: '12',
|
|
201
|
+
typography: 'body.b3',
|
|
202
|
+
})
|
|
203
|
+
|
|
204
|
+
export const page = style({
|
|
205
|
+
alignItems: 'flex-start',
|
|
206
|
+
display: 'flex',
|
|
207
|
+
flexDirection: 'column',
|
|
208
|
+
rowGap: '16',
|
|
209
|
+
})
|
|
210
|
+
}
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
**Don't:** Change pages without changing the URL.
|
|
214
|
+
|
|
215
|
+
```tsx
|
|
216
|
+
/**
|
|
217
|
+
* Don't example for "Link Every Page" on the Pagination page.
|
|
218
|
+
* Don't change pages without changing the URL.
|
|
219
|
+
* @module
|
|
220
|
+
*/
|
|
221
|
+
import { Pagination, style } from '@tempoxyz/ds'
|
|
222
|
+
|
|
223
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
224
|
+
export function Demo() {
|
|
225
|
+
return (
|
|
226
|
+
<div {...styles.page()}>
|
|
227
|
+
<span {...styles.address()}>console.tempo.xyz/activity</span>
|
|
228
|
+
<Pagination size="small">
|
|
229
|
+
<Pagination.Previous href="#" />
|
|
230
|
+
<Pagination.Page href="#">2</Pagination.Page>
|
|
231
|
+
<Pagination.Page current href="#">
|
|
232
|
+
3
|
|
233
|
+
</Pagination.Page>
|
|
234
|
+
<Pagination.Page href="#">4</Pagination.Page>
|
|
235
|
+
<Pagination.Next href="#" />
|
|
236
|
+
</Pagination>
|
|
237
|
+
</div>
|
|
238
|
+
)
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
namespace styles {
|
|
242
|
+
export const address = style({
|
|
243
|
+
backgroundColor: 'container.regular',
|
|
244
|
+
borderRadius: 'full',
|
|
245
|
+
color: 'content.secondary',
|
|
246
|
+
cornerShape: 'round',
|
|
247
|
+
paddingBlock: '4',
|
|
248
|
+
paddingInline: '12',
|
|
249
|
+
typography: 'body.b3',
|
|
250
|
+
})
|
|
251
|
+
|
|
252
|
+
export const page = style({
|
|
253
|
+
alignItems: 'flex-start',
|
|
254
|
+
display: 'flex',
|
|
255
|
+
flexDirection: 'column',
|
|
256
|
+
rowGap: '16',
|
|
257
|
+
})
|
|
258
|
+
}
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
### Truncate Long Ranges
|
|
262
|
+
|
|
263
|
+
* **Always show:** The first, last, and current pages.
|
|
264
|
+
* **Skipped ranges:** Replace each with a `Pagination.Ellipsis`.
|
|
265
|
+
* **Limit:** Keep about seven page items, with the current page's neighbors when there is room.
|
|
266
|
+
|
|
267
|
+
**Do:** Keep the first and last pages around the current one.
|
|
268
|
+
|
|
269
|
+
```tsx
|
|
270
|
+
/**
|
|
271
|
+
* Do example for "Truncate Long Ranges" on the Pagination page.
|
|
272
|
+
* Keep the first and last pages around the current one.
|
|
273
|
+
* @module
|
|
274
|
+
*/
|
|
275
|
+
import { Pagination } from '@tempoxyz/ds'
|
|
276
|
+
|
|
277
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
278
|
+
export function Demo() {
|
|
279
|
+
return (
|
|
280
|
+
<Pagination size="small">
|
|
281
|
+
<Pagination.Previous href="#" />
|
|
282
|
+
<Pagination.Page href="#">1</Pagination.Page>
|
|
283
|
+
<Pagination.Ellipsis />
|
|
284
|
+
<Pagination.Page href="#">4</Pagination.Page>
|
|
285
|
+
<Pagination.Page current href="#">
|
|
286
|
+
5
|
|
287
|
+
</Pagination.Page>
|
|
288
|
+
<Pagination.Page href="#">6</Pagination.Page>
|
|
289
|
+
<Pagination.Ellipsis />
|
|
290
|
+
<Pagination.Page href="#">49</Pagination.Page>
|
|
291
|
+
<Pagination.Next href="#" />
|
|
292
|
+
</Pagination>
|
|
293
|
+
)
|
|
294
|
+
}
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
**Don't:** Show only the pages next to the current one.
|
|
298
|
+
|
|
299
|
+
```tsx
|
|
300
|
+
/**
|
|
301
|
+
* Don't example for "Truncate Long Ranges" on the Pagination page.
|
|
302
|
+
* Don't show only the pages next to the current one.
|
|
303
|
+
* @module
|
|
304
|
+
*/
|
|
305
|
+
import { Pagination } from '@tempoxyz/ds'
|
|
306
|
+
|
|
307
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
308
|
+
export function Demo() {
|
|
309
|
+
return (
|
|
310
|
+
<Pagination size="small">
|
|
311
|
+
<Pagination.Previous href="#" />
|
|
312
|
+
<Pagination.Page href="#">4</Pagination.Page>
|
|
313
|
+
<Pagination.Page current href="#">
|
|
314
|
+
5
|
|
315
|
+
</Pagination.Page>
|
|
316
|
+
<Pagination.Page href="#">6</Pagination.Page>
|
|
317
|
+
<Pagination.Next href="#" />
|
|
318
|
+
</Pagination>
|
|
319
|
+
)
|
|
320
|
+
}
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
### Keep Previous and Next in Place
|
|
324
|
+
|
|
325
|
+
Render `Pagination.Previous` and `Pagination.Next` on every page. Set `disabled` at either end instead of removing them, so the page links do not shift.
|
|
326
|
+
|
|
327
|
+
**Do:** Disable Previous on the first page.
|
|
328
|
+
|
|
329
|
+
```tsx
|
|
330
|
+
/**
|
|
331
|
+
* Do example for "Keep Previous and Next in Place" on the Pagination page.
|
|
332
|
+
* Disable Previous on the first page.
|
|
333
|
+
* @module
|
|
334
|
+
*/
|
|
335
|
+
import { Pagination } from '@tempoxyz/ds'
|
|
336
|
+
|
|
337
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
338
|
+
export function Demo() {
|
|
339
|
+
return (
|
|
340
|
+
<Pagination size="small">
|
|
341
|
+
<Pagination.Previous disabled />
|
|
342
|
+
<Pagination.Page current href="#">
|
|
343
|
+
1
|
|
344
|
+
</Pagination.Page>
|
|
345
|
+
<Pagination.Page href="#">2</Pagination.Page>
|
|
346
|
+
<Pagination.Page href="#">3</Pagination.Page>
|
|
347
|
+
<Pagination.Next href="#" />
|
|
348
|
+
</Pagination>
|
|
349
|
+
)
|
|
350
|
+
}
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
**Don't:** Remove Previous, which moves every page link when it returns.
|
|
354
|
+
|
|
355
|
+
```tsx
|
|
356
|
+
/**
|
|
357
|
+
* Don't example for "Keep Previous and Next in Place" on the Pagination page.
|
|
358
|
+
* Don't remove Previous, which moves every page link when it returns.
|
|
359
|
+
* @module
|
|
360
|
+
*/
|
|
361
|
+
import { Pagination } from '@tempoxyz/ds'
|
|
362
|
+
|
|
363
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
364
|
+
export function Demo() {
|
|
365
|
+
return (
|
|
366
|
+
<Pagination size="small">
|
|
367
|
+
<Pagination.Page current href="#">
|
|
368
|
+
1
|
|
369
|
+
</Pagination.Page>
|
|
370
|
+
<Pagination.Page href="#">2</Pagination.Page>
|
|
371
|
+
<Pagination.Page href="#">3</Pagination.Page>
|
|
372
|
+
<Pagination.Next href="#" />
|
|
373
|
+
</Pagination>
|
|
374
|
+
)
|
|
375
|
+
}
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
### Show the Range You're Viewing
|
|
379
|
+
|
|
380
|
+
Place a count beside the control, directly below its list.
|
|
381
|
+
|
|
382
|
+
**Do:** Show the rows on screen and the total, such as Showing 51–75 of 1,204 transactions.
|
|
383
|
+
|
|
384
|
+
```tsx
|
|
385
|
+
/**
|
|
386
|
+
* Do example for "Show the Range You're Viewing" on the Pagination page.
|
|
387
|
+
* Show the rows on screen and the total, such as Showing 51–75 of 1,204 transactions.
|
|
388
|
+
* @module
|
|
389
|
+
*/
|
|
390
|
+
import { Pagination, style } from '@tempoxyz/ds'
|
|
391
|
+
|
|
392
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
393
|
+
export function Demo() {
|
|
394
|
+
return (
|
|
395
|
+
<div {...styles.row()}>
|
|
396
|
+
<span {...styles.count()}>Showing 51–75 of 1,204 transactions</span>
|
|
397
|
+
<Pagination size="small">
|
|
398
|
+
<Pagination.Previous href="#" />
|
|
399
|
+
<Pagination.Page href="#">2</Pagination.Page>
|
|
400
|
+
<Pagination.Page current href="#">
|
|
401
|
+
3
|
|
402
|
+
</Pagination.Page>
|
|
403
|
+
<Pagination.Page href="#">4</Pagination.Page>
|
|
404
|
+
<Pagination.Next href="#" />
|
|
405
|
+
</Pagination>
|
|
406
|
+
</div>
|
|
407
|
+
)
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
namespace styles {
|
|
411
|
+
export const count = style({ color: 'content.secondary', typography: 'body.b3' })
|
|
412
|
+
|
|
413
|
+
export const row = style({
|
|
414
|
+
alignItems: 'center',
|
|
415
|
+
display: 'flex',
|
|
416
|
+
flexWrap: 'wrap',
|
|
417
|
+
gap: '12',
|
|
418
|
+
justifyContent: 'space-between',
|
|
419
|
+
width: '100% !custom',
|
|
420
|
+
})
|
|
421
|
+
}
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
**Don't:** Show page numbers without the count.
|
|
425
|
+
|
|
426
|
+
```tsx
|
|
427
|
+
/**
|
|
428
|
+
* Don't example for "Show the Range You're Viewing" on the Pagination page.
|
|
429
|
+
* Don't show page numbers without the count.
|
|
430
|
+
* @module
|
|
431
|
+
*/
|
|
432
|
+
import { Pagination, style } from '@tempoxyz/ds'
|
|
433
|
+
|
|
434
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
435
|
+
export function Demo() {
|
|
436
|
+
return (
|
|
437
|
+
<div {...styles.row()}>
|
|
438
|
+
<Pagination size="small">
|
|
439
|
+
<Pagination.Previous href="#" />
|
|
440
|
+
<Pagination.Page href="#">2</Pagination.Page>
|
|
441
|
+
<Pagination.Page current href="#">
|
|
442
|
+
3
|
|
443
|
+
</Pagination.Page>
|
|
444
|
+
<Pagination.Page href="#">4</Pagination.Page>
|
|
445
|
+
<Pagination.Next href="#" />
|
|
446
|
+
</Pagination>
|
|
447
|
+
</div>
|
|
448
|
+
)
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
namespace styles {
|
|
452
|
+
export const row = style({
|
|
453
|
+
alignItems: 'center',
|
|
454
|
+
display: 'flex',
|
|
455
|
+
flexWrap: 'wrap',
|
|
456
|
+
gap: '12',
|
|
457
|
+
justifyContent: 'space-between',
|
|
458
|
+
width: '100% !custom',
|
|
459
|
+
})
|
|
460
|
+
}
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
### Match Size to the List
|
|
464
|
+
|
|
465
|
+
* **Small (32px):** Under dense tables, like Tempo Performance runs.
|
|
466
|
+
* **Medium (40px):** The default.
|
|
467
|
+
* **Large (56px):** Touch-first layouts.
|
|
468
|
+
|
|
469
|
+
## Content
|
|
470
|
+
|
|
471
|
+
* **Steps:** Keep the default Previous and Next. If children replace them, keep both descriptive, such as Newer and Older.
|
|
472
|
+
* **Count:** Name the rows of the list, such as transactions or deliveries.
|
|
473
|
+
* **Numbers:** Use numerals, and group the digits of large totals, such as 1,204.
|
|
474
|
+
|
|
475
|
+
## Accessibility
|
|
476
|
+
|
|
477
|
+
The current page and disabled steps carry ARIA states.
|
|
478
|
+
|
|
479
|
+
### Semantics
|
|
480
|
+
|
|
481
|
+
* **Root (navigation):** A landmark named "Pagination" that wraps a list of pages.
|
|
482
|
+
* **Parts (li):** Each part is a list item. Pages and steps render links by default.
|
|
483
|
+
* **Current Page (aria-current):** Set by `current`. Screen readers announce the page as current.
|
|
484
|
+
* **Disabled Steps (aria-disabled):** Renders as text and leaves the tab order. With `render`, it keeps your element.
|
|
485
|
+
* **Pagination.Ellipsis:** Plain text that takes no focus. The chevron icons are hidden from assistive technology.
|
|
486
|
+
|
|
487
|
+
### Keyboard
|
|
488
|
+
|
|
489
|
+
* **Move Between Links (Tab):** Moves through the links in order. Skips ellipses and disabled steps without `render`.
|
|
490
|
+
* **Follow a Link (Enter):** Follows the focused link.
|
|
491
|
+
|
|
492
|
+
### Your Responsibilities
|
|
493
|
+
|
|
494
|
+
* **Mark One Current Page (current):** Set it on exactly one page.
|
|
495
|
+
* **Block Disabled Custom Links (render):** For a custom disabled step, block navigation and remove it from the tab order yourself.
|
|
496
|
+
* **Name Each Pagination (aria-label):** If a page holds more than one, give each a distinct name, such as "Deliveries pagination".
|
|
497
|
+
* **Name Page Links (SC 2.4.4):** Consider an `aria-label` such as "Page 4". A bare number means little out of context.
|
|
498
|
+
* **Handle In-Place Loads:** After a client-side page change, move focus to the start of the results, such as the heading.
|
|
499
|
+
|
|
500
|
+
## Related
|
|
501
|
+
|
|
502
|
+
[Table](/docs/components/table)
|
|
503
|
+
|
|
504
|
+
Use for the rows you paginate.
|
|
505
|
+
|
|
506
|
+
[ListGroup](/docs/components/list-group)
|
|
507
|
+
|
|
508
|
+
Use for lists of records.
|
|
509
|
+
|
|
510
|
+
[Button](/docs/components/button)
|
|
511
|
+
|
|
512
|
+
Use for a Load more action.
|
|
513
|
+
|
|
514
|
+
[Tables and Lists](/docs/patterns/tables-and-lists)
|
|
515
|
+
|
|
516
|
+
Covers sorting, filtering, and paging data.
|