@patternfly/react-core 4.227.6 → 4.227.9
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 +24 -0
- package/dist/esm/components/Menu/MenuItem.d.ts +3 -1
- package/dist/esm/components/Menu/MenuItem.d.ts.map +1 -1
- package/dist/esm/components/Menu/MenuItem.js +2 -2
- package/dist/esm/components/Menu/MenuItem.js.map +1 -1
- package/dist/esm/components/MenuToggle/MenuToggle.d.ts +6 -12
- package/dist/esm/components/MenuToggle/MenuToggle.d.ts.map +1 -1
- package/dist/esm/components/MenuToggle/MenuToggle.js +12 -8
- package/dist/esm/components/MenuToggle/MenuToggle.js.map +1 -1
- package/dist/esm/components/TextInputGroup/TextInputGroup.d.ts +2 -0
- package/dist/esm/components/TextInputGroup/TextInputGroup.d.ts.map +1 -1
- package/dist/esm/components/TextInputGroup/TextInputGroup.js +2 -2
- package/dist/esm/components/TextInputGroup/TextInputGroup.js.map +1 -1
- package/dist/esm/components/TextInputGroup/TextInputGroupMain.d.ts +1 -1
- package/dist/esm/components/TextInputGroup/TextInputGroupMain.d.ts.map +1 -1
- package/dist/js/components/Menu/MenuItem.d.ts +3 -1
- package/dist/js/components/Menu/MenuItem.d.ts.map +1 -1
- package/dist/js/components/Menu/MenuItem.js +2 -2
- package/dist/js/components/Menu/MenuItem.js.map +1 -1
- package/dist/js/components/MenuToggle/MenuToggle.d.ts +6 -12
- package/dist/js/components/MenuToggle/MenuToggle.d.ts.map +1 -1
- package/dist/js/components/MenuToggle/MenuToggle.js +12 -8
- package/dist/js/components/MenuToggle/MenuToggle.js.map +1 -1
- package/dist/js/components/TextInputGroup/TextInputGroup.d.ts +2 -0
- package/dist/js/components/TextInputGroup/TextInputGroup.d.ts.map +1 -1
- package/dist/js/components/TextInputGroup/TextInputGroup.js +2 -2
- package/dist/js/components/TextInputGroup/TextInputGroup.js.map +1 -1
- package/dist/js/components/TextInputGroup/TextInputGroupMain.d.ts +1 -1
- package/dist/js/components/TextInputGroup/TextInputGroupMain.d.ts.map +1 -1
- package/dist/umd/react-core.css +46 -49
- package/dist/umd/react-core.js +17 -12
- package/dist/umd/react-core.min.css +84 -87
- package/dist/umd/react-core.min.js +5 -5
- package/package.json +6 -6
- package/src/components/Menu/MenuItem.tsx +4 -0
- package/src/components/MenuToggle/MenuToggle.tsx +63 -25
- package/src/components/Page/examples/Page.md +10 -615
- package/src/components/Page/examples/PageCenteredSection.tsx +76 -0
- package/src/components/Page/examples/PageGroupSection.tsx +106 -0
- package/src/components/Page/examples/PageHorizontalNav.tsx +43 -0
- package/src/components/Page/examples/PageMainSectionPadding.tsx +72 -0
- package/src/components/Page/examples/PageTertiaryNav.tsx +42 -0
- package/src/components/Page/examples/PageUncontrolledNav.tsx +53 -0
- package/src/components/Page/examples/PageVerticalNav.tsx +65 -0
- package/src/components/Page/examples/PageVerticalNavUsingPageHeaderComponent.tsx +44 -0
- package/src/components/Page/examples/PageWithOrWithoutFill.tsx +67 -0
- package/src/components/Pagination/examples/Pagination.md +8 -355
- package/src/components/Pagination/examples/PaginationBottom.tsx +33 -0
- package/src/components/Pagination/examples/PaginationCompact.tsx +33 -0
- package/src/components/Pagination/examples/PaginationDisabled.tsx +33 -0
- package/src/components/Pagination/examples/PaginationIndeterminate.tsx +40 -0
- package/src/components/Pagination/examples/PaginationNoItems.tsx +32 -0
- package/src/components/Pagination/examples/PaginationOnePage.tsx +32 -0
- package/src/components/Pagination/examples/PaginationSticky.tsx +81 -0
- package/src/components/Pagination/examples/PaginationTop.tsx +32 -0
- package/src/components/Switch/examples/Switch.md +6 -153
- package/src/components/Switch/examples/SwitchBasic.tsx +20 -0
- package/src/components/Switch/examples/SwitchCheckedWithLabel.tsx +22 -0
- package/src/components/Switch/examples/SwitchDisabled.tsx +28 -0
- package/src/components/Switch/examples/SwitchReversed.tsx +21 -0
- package/src/components/Switch/examples/SwitchUncontrolled.tsx +14 -0
- package/src/components/Switch/examples/SwitchWithoutLabel.tsx +12 -0
- package/src/components/TextInputGroup/TextInputGroup.tsx +9 -1
- package/src/components/TextInputGroup/TextInputGroupMain.tsx +1 -1
- package/src/demos/ComposableMenu/ComposableMenu.md +8 -0
- package/src/demos/ComposableMenu/examples/ComposableTypeaheadSelect.tsx +196 -0
|
@@ -10,389 +10,42 @@ ouia: true
|
|
|
10
10
|
|
|
11
11
|
### Top
|
|
12
12
|
|
|
13
|
-
```
|
|
14
|
-
import React from 'react';
|
|
15
|
-
import { Pagination, PaginationVariant } from '@patternfly/react-core';
|
|
16
|
-
|
|
17
|
-
class PaginationTop extends React.Component {
|
|
18
|
-
constructor(props) {
|
|
19
|
-
super(props);
|
|
20
|
-
this.state = {
|
|
21
|
-
page: 1,
|
|
22
|
-
perPage: 20
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
this.onSetPage = (_event, pageNumber) => {
|
|
26
|
-
this.setState({
|
|
27
|
-
page: pageNumber
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
this.onPerPageSelect = (_event, perPage, page) => {
|
|
32
|
-
this.setState({
|
|
33
|
-
page, perPage
|
|
34
|
-
});
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
render() {
|
|
39
|
-
return (
|
|
40
|
-
<Pagination
|
|
41
|
-
perPageComponent="button"
|
|
42
|
-
itemCount={523}
|
|
43
|
-
perPage={this.state.perPage}
|
|
44
|
-
page={this.state.page}
|
|
45
|
-
onSetPage={this.onSetPage}
|
|
46
|
-
widgetId="pagination-options-menu-top"
|
|
47
|
-
onPerPageSelect={this.onPerPageSelect}
|
|
48
|
-
/>
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
13
|
+
```ts file="./PaginationTop.tsx"
|
|
52
14
|
```
|
|
53
15
|
|
|
54
16
|
### Bottom
|
|
55
17
|
|
|
56
|
-
```
|
|
57
|
-
import React from 'react';
|
|
58
|
-
import { Pagination, PaginationVariant } from '@patternfly/react-core';
|
|
59
|
-
|
|
60
|
-
class PaginationBottom extends React.Component {
|
|
61
|
-
constructor(props) {
|
|
62
|
-
super(props);
|
|
63
|
-
this.state = {
|
|
64
|
-
page: 1
|
|
65
|
-
};
|
|
66
|
-
this.onSetPage = (_event, pageNumber) => {
|
|
67
|
-
this.setState({
|
|
68
|
-
page: pageNumber
|
|
69
|
-
});
|
|
70
|
-
};
|
|
71
|
-
this.onPerPageSelect = (_event, perPage, page) => {
|
|
72
|
-
this.setState({
|
|
73
|
-
page, perPage
|
|
74
|
-
});
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
render() {
|
|
79
|
-
return (
|
|
80
|
-
<Pagination
|
|
81
|
-
perPageComponent="button"
|
|
82
|
-
itemCount={333}
|
|
83
|
-
widgetId="pagination-options-menu-bottom"
|
|
84
|
-
perPage={this.state.perPage}
|
|
85
|
-
page={this.state.page}
|
|
86
|
-
variant={PaginationVariant.bottom}
|
|
87
|
-
onSetPage={this.onSetPage}
|
|
88
|
-
onPerPageSelect={this.onPerPageSelect}
|
|
89
|
-
/>
|
|
90
|
-
);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
18
|
+
```ts file="./PaginationBottom.tsx"
|
|
93
19
|
```
|
|
94
20
|
|
|
95
21
|
### Indeterminate
|
|
96
22
|
|
|
97
23
|
By not passing `itemCount` and passing `toggleTemplate` you can customize the toggle with text.
|
|
98
24
|
|
|
99
|
-
```
|
|
100
|
-
import React from 'react';
|
|
101
|
-
import { Pagination } from '@patternfly/react-core';
|
|
102
|
-
|
|
103
|
-
PaginationIndeterminate = () => {
|
|
104
|
-
const [page, setPage] = React.useState(1);
|
|
105
|
-
const [perPage, setPerPage] = React.useState(20);
|
|
106
|
-
|
|
107
|
-
const onSetPage = (_event, pageNumber) => setPage(pageNumber);
|
|
108
|
-
const onPerPageSelect = (_event, perPage) => setPerPage(perPage);
|
|
109
|
-
|
|
110
|
-
return (
|
|
111
|
-
<Pagination
|
|
112
|
-
perPageComponent="button"
|
|
113
|
-
toggleTemplate={({ firstIndex, lastIndex }) => (
|
|
114
|
-
<React.Fragment>
|
|
115
|
-
<b>
|
|
116
|
-
{firstIndex} - {lastIndex}
|
|
117
|
-
</b>
|
|
118
|
-
of
|
|
119
|
-
<b>many</b>
|
|
120
|
-
</React.Fragment>
|
|
121
|
-
)}
|
|
122
|
-
widgetId="pagination-indeterminate"
|
|
123
|
-
perPage={perPage}
|
|
124
|
-
page={page}
|
|
125
|
-
onSetPage={onSetPage}
|
|
126
|
-
onPerPageSelect={onPerPageSelect}
|
|
127
|
-
/>
|
|
128
|
-
);
|
|
129
|
-
};
|
|
25
|
+
```ts file="./PaginationIndeterminate.tsx"
|
|
130
26
|
```
|
|
131
27
|
|
|
132
28
|
### Disabled
|
|
133
29
|
|
|
134
|
-
```
|
|
135
|
-
import React from 'react';
|
|
136
|
-
import { Pagination, PaginationVariant } from '@patternfly/react-core';
|
|
137
|
-
|
|
138
|
-
class PaginationDisabled extends React.Component {
|
|
139
|
-
constructor(props) {
|
|
140
|
-
super(props);
|
|
141
|
-
this.state = {
|
|
142
|
-
page: 1,
|
|
143
|
-
perPage: 20
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
this.onSetPage = (_event, pageNumber) => {
|
|
147
|
-
this.setState({
|
|
148
|
-
page: pageNumber
|
|
149
|
-
});
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
this.onPerPageSelect = (_event, perPage, page) => {
|
|
153
|
-
this.setState({
|
|
154
|
-
page, perPage
|
|
155
|
-
});
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
render() {
|
|
160
|
-
return (
|
|
161
|
-
<Pagination
|
|
162
|
-
perPageComponent="button"
|
|
163
|
-
itemCount={523}
|
|
164
|
-
perPage={this.state.perPage}
|
|
165
|
-
page={this.state.page}
|
|
166
|
-
onSetPage={this.onSetPage}
|
|
167
|
-
widgetId="pagination-options-menu-top"
|
|
168
|
-
onPerPageSelect={this.onPerPageSelect}
|
|
169
|
-
isDisabled
|
|
170
|
-
/>
|
|
171
|
-
);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
30
|
+
```ts file="./PaginationDisabled.tsx"
|
|
174
31
|
```
|
|
175
32
|
|
|
176
33
|
### No items
|
|
177
34
|
|
|
178
|
-
```
|
|
179
|
-
import React from 'react';
|
|
180
|
-
import { Pagination, PaginationVariant } from '@patternfly/react-core';
|
|
181
|
-
|
|
182
|
-
class PaginationTop extends React.Component {
|
|
183
|
-
constructor(props) {
|
|
184
|
-
super(props);
|
|
185
|
-
this.state = {
|
|
186
|
-
page: 1,
|
|
187
|
-
perPage: 20
|
|
188
|
-
};
|
|
189
|
-
|
|
190
|
-
this.onSetPage = (_event, pageNumber) => {
|
|
191
|
-
this.setState({
|
|
192
|
-
page: pageNumber
|
|
193
|
-
});
|
|
194
|
-
};
|
|
195
|
-
|
|
196
|
-
this.onPerPageSelect = (_event, perPage, page) => {
|
|
197
|
-
this.setState({
|
|
198
|
-
page, perPage
|
|
199
|
-
});
|
|
200
|
-
};
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
render() {
|
|
204
|
-
return (
|
|
205
|
-
<Pagination
|
|
206
|
-
perPageComponent="button"
|
|
207
|
-
itemCount={0}
|
|
208
|
-
perPage={this.state.perPage}
|
|
209
|
-
page={this.state.page}
|
|
210
|
-
onSetPage={this.onSetPage}
|
|
211
|
-
widgetId="pagination-options-menu-top"
|
|
212
|
-
onPerPageSelect={this.onPerPageSelect}
|
|
213
|
-
/>
|
|
214
|
-
);
|
|
215
|
-
}
|
|
216
|
-
}
|
|
35
|
+
```ts file="./PaginationNoItems.tsx"
|
|
217
36
|
```
|
|
218
37
|
|
|
219
38
|
### One page
|
|
220
39
|
|
|
221
|
-
```
|
|
222
|
-
import React from 'react';
|
|
223
|
-
import { Pagination, PaginationVariant } from '@patternfly/react-core';
|
|
224
|
-
|
|
225
|
-
class PaginationTop extends React.Component {
|
|
226
|
-
constructor(props) {
|
|
227
|
-
super(props);
|
|
228
|
-
this.state = {
|
|
229
|
-
page: 1,
|
|
230
|
-
perPage: 20
|
|
231
|
-
};
|
|
232
|
-
|
|
233
|
-
this.onSetPage = (_event, pageNumber) => {
|
|
234
|
-
this.setState({
|
|
235
|
-
page: pageNumber
|
|
236
|
-
});
|
|
237
|
-
};
|
|
238
|
-
|
|
239
|
-
this.onPerPageSelect = (_event, perPage, page) => {
|
|
240
|
-
this.setState({
|
|
241
|
-
page, perPage
|
|
242
|
-
});
|
|
243
|
-
};
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
render() {
|
|
247
|
-
return (
|
|
248
|
-
<Pagination
|
|
249
|
-
perPageComponent="button"
|
|
250
|
-
itemCount={15}
|
|
251
|
-
perPage={this.state.perPage}
|
|
252
|
-
page={this.state.page}
|
|
253
|
-
onSetPage={this.onSetPage}
|
|
254
|
-
widgetId="pagination-options-menu-top"
|
|
255
|
-
onPerPageSelect={this.onPerPageSelect}
|
|
256
|
-
/>
|
|
257
|
-
);
|
|
258
|
-
}
|
|
259
|
-
}
|
|
40
|
+
```ts file="./PaginationOnePage.tsx"
|
|
260
41
|
```
|
|
261
42
|
|
|
262
43
|
### Compact
|
|
263
44
|
|
|
264
|
-
```
|
|
265
|
-
import React from 'react';
|
|
266
|
-
import { Pagination, PaginationVariant } from '@patternfly/react-core';
|
|
267
|
-
|
|
268
|
-
class PaginationTop extends React.Component {
|
|
269
|
-
constructor(props) {
|
|
270
|
-
super(props);
|
|
271
|
-
this.state = {
|
|
272
|
-
page: 1,
|
|
273
|
-
perPage: 20
|
|
274
|
-
};
|
|
275
|
-
|
|
276
|
-
this.onSetPage = (_event, pageNumber) => {
|
|
277
|
-
this.setState({
|
|
278
|
-
page: pageNumber
|
|
279
|
-
});
|
|
280
|
-
};
|
|
281
|
-
|
|
282
|
-
this.onPerPageSelect = (_event, perPage, page) => {
|
|
283
|
-
this.setState({
|
|
284
|
-
page, perPage
|
|
285
|
-
});
|
|
286
|
-
};
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
render() {
|
|
290
|
-
return (
|
|
291
|
-
<Pagination
|
|
292
|
-
perPageComponent="button"
|
|
293
|
-
itemCount={523}
|
|
294
|
-
perPage={this.state.perPage}
|
|
295
|
-
page={this.state.page}
|
|
296
|
-
onSetPage={this.onSetPage}
|
|
297
|
-
widgetId="pagination-options-menu-top"
|
|
298
|
-
onPerPageSelect={this.onPerPageSelect}
|
|
299
|
-
isCompact
|
|
300
|
-
/>
|
|
301
|
-
);
|
|
302
|
-
}
|
|
303
|
-
}
|
|
45
|
+
```ts file="./PaginationCompact.tsx"
|
|
304
46
|
```
|
|
305
47
|
|
|
306
48
|
### Sticky
|
|
307
49
|
|
|
308
|
-
```
|
|
309
|
-
import React from 'react';
|
|
310
|
-
import { Pagination, PaginationVariant, Gallery, GalleryItem, Card, CardBody } from '@patternfly/react-core';
|
|
311
|
-
|
|
312
|
-
class PaginationSticky extends React.Component {
|
|
313
|
-
constructor(props) {
|
|
314
|
-
super(props);
|
|
315
|
-
this.state = {
|
|
316
|
-
page: 1,
|
|
317
|
-
perPage: 20,
|
|
318
|
-
isTopSticky: true
|
|
319
|
-
};
|
|
320
|
-
|
|
321
|
-
this.onToggleSticky = () => {
|
|
322
|
-
this.setState({
|
|
323
|
-
isTopSticky: !this.state.isTopSticky
|
|
324
|
-
});
|
|
325
|
-
};
|
|
326
|
-
|
|
327
|
-
this.onSetPage = (_event, pageNumber) => {
|
|
328
|
-
this.setState({
|
|
329
|
-
page: pageNumber
|
|
330
|
-
});
|
|
331
|
-
};
|
|
332
|
-
|
|
333
|
-
this.onPerPageSelect = (_event, perPage, page) => {
|
|
334
|
-
this.setState({
|
|
335
|
-
page, perPage
|
|
336
|
-
});
|
|
337
|
-
};
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
render() {
|
|
341
|
-
return (
|
|
342
|
-
<div>
|
|
343
|
-
{this.state.isTopSticky && (
|
|
344
|
-
<React.Fragment>
|
|
345
|
-
<Pagination
|
|
346
|
-
perPageComponent="button"
|
|
347
|
-
itemCount={523}
|
|
348
|
-
perPage={this.state.perPage}
|
|
349
|
-
page={this.state.page}
|
|
350
|
-
onSetPage={this.onSetPage}
|
|
351
|
-
widgetId="pagination-options-menu-top"
|
|
352
|
-
onPerPageSelect={this.onPerPageSelect}
|
|
353
|
-
isSticky
|
|
354
|
-
>
|
|
355
|
-
<button onClick={this.onToggleSticky}>Toggle to bottom position</button>
|
|
356
|
-
</Pagination>
|
|
357
|
-
<Gallery hasGutter>
|
|
358
|
-
{Array.apply(0, Array(40)).map((x, i) => (
|
|
359
|
-
<GalleryItem key={i}>
|
|
360
|
-
<Card>
|
|
361
|
-
<CardBody>This is a card</CardBody>
|
|
362
|
-
</Card>
|
|
363
|
-
</GalleryItem>
|
|
364
|
-
))}
|
|
365
|
-
</Gallery>
|
|
366
|
-
</React.Fragment>
|
|
367
|
-
)}
|
|
368
|
-
{!this.state.isTopSticky && (
|
|
369
|
-
<React.Fragment>
|
|
370
|
-
<Gallery hasGutter>
|
|
371
|
-
{Array.apply(0, Array(40)).map((x, i) => (
|
|
372
|
-
<GalleryItem key={i}>
|
|
373
|
-
<Card>
|
|
374
|
-
<CardBody>This is a card</CardBody>
|
|
375
|
-
</Card>
|
|
376
|
-
</GalleryItem>
|
|
377
|
-
))}
|
|
378
|
-
</Gallery>
|
|
379
|
-
<Pagination
|
|
380
|
-
perPageComponent="button"
|
|
381
|
-
itemCount={523}
|
|
382
|
-
perPage={this.state.perPage}
|
|
383
|
-
page={this.state.page}
|
|
384
|
-
onSetPage={this.onSetPage}
|
|
385
|
-
widgetId="pagination-options-menu-top"
|
|
386
|
-
onPerPageSelect={this.onPerPageSelect}
|
|
387
|
-
isSticky
|
|
388
|
-
variant={PaginationVariant.bottom}
|
|
389
|
-
>
|
|
390
|
-
<button onClick={this.onToggleSticky}>Toggle to top position</button>
|
|
391
|
-
</Pagination>
|
|
392
|
-
</React.Fragment>
|
|
393
|
-
)}
|
|
394
|
-
</div>
|
|
395
|
-
);
|
|
396
|
-
}
|
|
397
|
-
}
|
|
50
|
+
```ts isFullscreen file="./PaginationSticky.tsx"
|
|
398
51
|
```
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Pagination, PaginationVariant } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
export const PaginationBottom: React.FunctionComponent = () => {
|
|
5
|
+
const [page, setPage] = React.useState(1);
|
|
6
|
+
const [perPage, setPerPage] = React.useState(10);
|
|
7
|
+
|
|
8
|
+
const onSetPage = (_event: React.MouseEvent | React.KeyboardEvent | MouseEvent, newPage: number) => {
|
|
9
|
+
setPage(newPage);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const onPerPageSelect = (
|
|
13
|
+
_event: React.MouseEvent | React.KeyboardEvent | MouseEvent,
|
|
14
|
+
newPerPage: number,
|
|
15
|
+
newPage: number
|
|
16
|
+
) => {
|
|
17
|
+
setPerPage(newPerPage);
|
|
18
|
+
setPage(newPage);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<Pagination
|
|
23
|
+
perPageComponent="button"
|
|
24
|
+
itemCount={333}
|
|
25
|
+
widgetId="pagination-options-menu-bottom"
|
|
26
|
+
perPage={perPage}
|
|
27
|
+
page={page}
|
|
28
|
+
variant={PaginationVariant.bottom}
|
|
29
|
+
onSetPage={onSetPage}
|
|
30
|
+
onPerPageSelect={onPerPageSelect}
|
|
31
|
+
/>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Pagination } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
export const PaginationCompact: React.FunctionComponent = () => {
|
|
5
|
+
const [page, setPage] = React.useState(1);
|
|
6
|
+
const [perPage, setPerPage] = React.useState(20);
|
|
7
|
+
|
|
8
|
+
const onSetPage = (_event: React.MouseEvent | React.KeyboardEvent | MouseEvent, newPage: number) => {
|
|
9
|
+
setPage(newPage);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const onPerPageSelect = (
|
|
13
|
+
_event: React.MouseEvent | React.KeyboardEvent | MouseEvent,
|
|
14
|
+
newPerPage: number,
|
|
15
|
+
newPage: number
|
|
16
|
+
) => {
|
|
17
|
+
setPerPage(newPerPage);
|
|
18
|
+
setPage(newPage);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<Pagination
|
|
23
|
+
perPageComponent="button"
|
|
24
|
+
itemCount={523}
|
|
25
|
+
perPage={perPage}
|
|
26
|
+
page={page}
|
|
27
|
+
onSetPage={onSetPage}
|
|
28
|
+
widgetId="pagination-options-menu-top"
|
|
29
|
+
onPerPageSelect={onPerPageSelect}
|
|
30
|
+
isCompact
|
|
31
|
+
/>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Pagination } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
export const PaginationDisabled: React.FunctionComponent = () => {
|
|
5
|
+
const [page, setPage] = React.useState(1);
|
|
6
|
+
const [perPage, setPerPage] = React.useState(20);
|
|
7
|
+
|
|
8
|
+
const onSetPage = (_event: React.MouseEvent | React.KeyboardEvent | MouseEvent, newPage: number) => {
|
|
9
|
+
setPage(newPage);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const onPerPageSelect = (
|
|
13
|
+
_event: React.MouseEvent | React.KeyboardEvent | MouseEvent,
|
|
14
|
+
newPerPage: number,
|
|
15
|
+
newPage: number
|
|
16
|
+
) => {
|
|
17
|
+
setPerPage(newPerPage);
|
|
18
|
+
setPage(newPage);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<Pagination
|
|
23
|
+
perPageComponent="button"
|
|
24
|
+
itemCount={523}
|
|
25
|
+
perPage={perPage}
|
|
26
|
+
page={page}
|
|
27
|
+
onSetPage={onSetPage}
|
|
28
|
+
widgetId="pagination-options-menu-top"
|
|
29
|
+
onPerPageSelect={onPerPageSelect}
|
|
30
|
+
isDisabled
|
|
31
|
+
/>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Pagination } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
export const PaginationIndeterminate: React.FunctionComponent = () => {
|
|
5
|
+
const [page, setPage] = React.useState(1);
|
|
6
|
+
const [perPage, setPerPage] = React.useState(20);
|
|
7
|
+
|
|
8
|
+
const onSetPage = (_event: React.MouseEvent | React.KeyboardEvent | MouseEvent, newPage: number) => {
|
|
9
|
+
setPage(newPage);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const onPerPageSelect = (
|
|
13
|
+
_event: React.MouseEvent | React.KeyboardEvent | MouseEvent,
|
|
14
|
+
newPerPage: number,
|
|
15
|
+
newPage: number
|
|
16
|
+
) => {
|
|
17
|
+
setPerPage(newPerPage);
|
|
18
|
+
setPage(newPage);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<Pagination
|
|
23
|
+
perPageComponent="button"
|
|
24
|
+
toggleTemplate={({ firstIndex, lastIndex }) => (
|
|
25
|
+
<React.Fragment>
|
|
26
|
+
<b>
|
|
27
|
+
{firstIndex} - {lastIndex}
|
|
28
|
+
</b>
|
|
29
|
+
of
|
|
30
|
+
<b>many</b>
|
|
31
|
+
</React.Fragment>
|
|
32
|
+
)}
|
|
33
|
+
widgetId="pagination-indeterminate"
|
|
34
|
+
perPage={perPage}
|
|
35
|
+
page={page}
|
|
36
|
+
onSetPage={onSetPage}
|
|
37
|
+
onPerPageSelect={onPerPageSelect}
|
|
38
|
+
/>
|
|
39
|
+
);
|
|
40
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Pagination } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
export const PaginationNoItems: React.FunctionComponent = () => {
|
|
5
|
+
const [page, setPage] = React.useState(1);
|
|
6
|
+
const [perPage, setPerPage] = React.useState(20);
|
|
7
|
+
|
|
8
|
+
const onSetPage = (_event: React.MouseEvent | React.KeyboardEvent | MouseEvent, newPage: number) => {
|
|
9
|
+
setPage(newPage);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const onPerPageSelect = (
|
|
13
|
+
_event: React.MouseEvent | React.KeyboardEvent | MouseEvent,
|
|
14
|
+
newPerPage: number,
|
|
15
|
+
newPage: number
|
|
16
|
+
) => {
|
|
17
|
+
setPerPage(newPerPage);
|
|
18
|
+
setPage(newPage);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<Pagination
|
|
23
|
+
perPageComponent="button"
|
|
24
|
+
itemCount={0}
|
|
25
|
+
perPage={perPage}
|
|
26
|
+
page={page}
|
|
27
|
+
onSetPage={onSetPage}
|
|
28
|
+
widgetId="pagination-options-menu-top"
|
|
29
|
+
onPerPageSelect={onPerPageSelect}
|
|
30
|
+
/>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Pagination } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
export const PaginationOnePage: React.FunctionComponent = () => {
|
|
5
|
+
const [page, setPage] = React.useState(1);
|
|
6
|
+
const [perPage, setPerPage] = React.useState(20);
|
|
7
|
+
|
|
8
|
+
const onSetPage = (_event: React.MouseEvent | React.KeyboardEvent | MouseEvent, newPage: number) => {
|
|
9
|
+
setPage(newPage);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const onPerPageSelect = (
|
|
13
|
+
_event: React.MouseEvent | React.KeyboardEvent | MouseEvent,
|
|
14
|
+
newPerPage: number,
|
|
15
|
+
newPage: number
|
|
16
|
+
) => {
|
|
17
|
+
setPerPage(newPerPage);
|
|
18
|
+
setPage(newPage);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<Pagination
|
|
23
|
+
perPageComponent="button"
|
|
24
|
+
itemCount={15}
|
|
25
|
+
perPage={perPage}
|
|
26
|
+
page={page}
|
|
27
|
+
onSetPage={onSetPage}
|
|
28
|
+
widgetId="pagination-options-menu-top"
|
|
29
|
+
onPerPageSelect={onPerPageSelect}
|
|
30
|
+
/>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Pagination, PaginationVariant, Gallery, GalleryItem, Card, CardBody } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
export const PaginationSticky: React.FunctionComponent = () => {
|
|
5
|
+
const [page, setPage] = React.useState(1);
|
|
6
|
+
const [perPage, setPerPage] = React.useState(20);
|
|
7
|
+
const [isTopSticky, setIsTopSticky] = React.useState(true);
|
|
8
|
+
|
|
9
|
+
const onToggleSticky = () => {
|
|
10
|
+
setIsTopSticky(prev => !prev);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const onSetPage = (_event: React.MouseEvent | React.KeyboardEvent | MouseEvent, newPage: number) => {
|
|
14
|
+
setPage(newPage);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const onPerPageSelect = (
|
|
18
|
+
_event: React.MouseEvent | React.KeyboardEvent | MouseEvent,
|
|
19
|
+
newPerPage: number,
|
|
20
|
+
newPage: number
|
|
21
|
+
) => {
|
|
22
|
+
setPerPage(newPerPage);
|
|
23
|
+
setPage(newPage);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<div>
|
|
28
|
+
{isTopSticky && (
|
|
29
|
+
<React.Fragment>
|
|
30
|
+
<Pagination
|
|
31
|
+
perPageComponent="button"
|
|
32
|
+
itemCount={523}
|
|
33
|
+
perPage={perPage}
|
|
34
|
+
page={page}
|
|
35
|
+
onSetPage={onSetPage}
|
|
36
|
+
widgetId="pagination-options-menu-top"
|
|
37
|
+
onPerPageSelect={onPerPageSelect}
|
|
38
|
+
isSticky
|
|
39
|
+
>
|
|
40
|
+
<button onClick={onToggleSticky}>Toggle to bottom position</button>
|
|
41
|
+
</Pagination>
|
|
42
|
+
<Gallery hasGutter>
|
|
43
|
+
{Array.apply(0, Array(40)).map((x, i) => (
|
|
44
|
+
<GalleryItem key={i}>
|
|
45
|
+
<Card>
|
|
46
|
+
<CardBody>This is a card</CardBody>
|
|
47
|
+
</Card>
|
|
48
|
+
</GalleryItem>
|
|
49
|
+
))}
|
|
50
|
+
</Gallery>
|
|
51
|
+
</React.Fragment>
|
|
52
|
+
)}
|
|
53
|
+
{!isTopSticky && (
|
|
54
|
+
<React.Fragment>
|
|
55
|
+
<Gallery hasGutter>
|
|
56
|
+
{Array.apply(0, Array(40)).map((x, i) => (
|
|
57
|
+
<GalleryItem key={i}>
|
|
58
|
+
<Card>
|
|
59
|
+
<CardBody>This is a card</CardBody>
|
|
60
|
+
</Card>
|
|
61
|
+
</GalleryItem>
|
|
62
|
+
))}
|
|
63
|
+
</Gallery>
|
|
64
|
+
<Pagination
|
|
65
|
+
perPageComponent="button"
|
|
66
|
+
itemCount={523}
|
|
67
|
+
perPage={perPage}
|
|
68
|
+
page={page}
|
|
69
|
+
onSetPage={onSetPage}
|
|
70
|
+
widgetId="pagination-options-menu-top"
|
|
71
|
+
onPerPageSelect={onPerPageSelect}
|
|
72
|
+
isSticky
|
|
73
|
+
variant={PaginationVariant.bottom}
|
|
74
|
+
>
|
|
75
|
+
<button onClick={onToggleSticky}>Toggle to top position</button>
|
|
76
|
+
</Pagination>
|
|
77
|
+
</React.Fragment>
|
|
78
|
+
)}
|
|
79
|
+
</div>
|
|
80
|
+
);
|
|
81
|
+
};
|