@patternfly/react-core 4.227.6 → 4.227.7

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 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
+ ## 4.227.7 (2022-07-28)
7
+
8
+ **Note:** Version bump only for package @patternfly/react-core
9
+
10
+
11
+
12
+
13
+
6
14
  ## 4.227.6 (2022-07-28)
7
15
 
8
16
  **Note:** Version bump only for package @patternfly/react-core
@@ -25997,6 +25997,75 @@ label.pf-c-tree-view__node-text {
25997
25997
  --pf-l-flex--spacer: var(--pf-l-flex--spacer--4xl);
25998
25998
  }
25999
25999
  }
26000
+ .pf-l-gallery {
26001
+ --pf-l-gallery--m-gutter--GridGap: var(--pf-global--gutter);
26002
+ --pf-l-gallery--GridTemplateColumns--min: 250px;
26003
+ --pf-l-gallery--GridTemplateColumns--minmax--min: var(--pf-l-gallery--GridTemplateColumns--min);
26004
+ --pf-l-gallery--GridTemplateColumns--max: 1fr;
26005
+ --pf-l-gallery--GridTemplateColumns--minmax--max: var(--pf-l-gallery--GridTemplateColumns--max);
26006
+ --pf-l-gallery--GridTemplateColumns: repeat(auto-fill, minmax(var(--pf-l-gallery--GridTemplateColumns--minmax--min), var(--pf-l-gallery--GridTemplateColumns--minmax--max)));
26007
+ --pf-l-gallery--GridTemplateRows: auto;
26008
+ display: grid;
26009
+ grid-template-columns: var(--pf-l-gallery--GridTemplateColumns);
26010
+ grid-template-rows: var(--pf-l-gallery--GridTemplateRows);
26011
+ --pf-l-gallery--GridTemplateColumns--minmax--min: var(--pf-l-gallery--GridTemplateColumns--min);
26012
+ --pf-l-gallery--GridTemplateColumns--minmax--max: var(--pf-l-gallery--GridTemplateColumns--max);
26013
+ }
26014
+
26015
+ .pf-l-gallery.pf-m-gutter {
26016
+ grid-gap: var(--pf-l-gallery--m-gutter--GridGap);
26017
+ }
26018
+
26019
+ @media (min-width: 576px) {
26020
+ .pf-l-gallery {
26021
+ --pf-l-gallery--GridTemplateColumns--minmax--min: var(--pf-l-gallery--GridTemplateColumns--min-on-sm, var(--pf-l-gallery--GridTemplateColumns--min));
26022
+ }
26023
+ }
26024
+ @media (min-width: 768px) {
26025
+ .pf-l-gallery {
26026
+ --pf-l-gallery--GridTemplateColumns--minmax--min: var(--pf-l-gallery--GridTemplateColumns--min-on-md, var(--pf-l-gallery--GridTemplateColumns--min-on-sm, var(--pf-l-gallery--GridTemplateColumns--min)));
26027
+ }
26028
+ }
26029
+ @media (min-width: 992px) {
26030
+ .pf-l-gallery {
26031
+ --pf-l-gallery--GridTemplateColumns--minmax--min: var(--pf-l-gallery--GridTemplateColumns--min-on-lg, var(--pf-l-gallery--GridTemplateColumns--min-on-md, var(--pf-l-gallery--GridTemplateColumns--min-on-sm, var(--pf-l-gallery--GridTemplateColumns--min))));
26032
+ }
26033
+ }
26034
+ @media (min-width: 1200px) {
26035
+ .pf-l-gallery {
26036
+ --pf-l-gallery--GridTemplateColumns--minmax--min: var(--pf-l-gallery--GridTemplateColumns--min-on-xl, var(--pf-l-gallery--GridTemplateColumns--min-on-lg, var(--pf-l-gallery--GridTemplateColumns--min-on-md, var(--pf-l-gallery--GridTemplateColumns--min-on-sm, var(--pf-l-gallery--GridTemplateColumns--min)))));
26037
+ }
26038
+ }
26039
+ @media (min-width: 1450px) {
26040
+ .pf-l-gallery {
26041
+ --pf-l-gallery--GridTemplateColumns--minmax--min: var(--pf-l-gallery--GridTemplateColumns--min-on-2xl, var(--pf-l-gallery--GridTemplateColumns--min-on-xl, var(--pf-l-gallery--GridTemplateColumns--min-on-lg, var(--pf-l-gallery--GridTemplateColumns--min-on-md, var(--pf-l-gallery--GridTemplateColumns--min-on-sm, var(--pf-l-gallery--GridTemplateColumns--min))))));
26042
+ }
26043
+ }
26044
+ @media (min-width: 576px) {
26045
+ .pf-l-gallery {
26046
+ --pf-l-gallery--GridTemplateColumns--minmax--max: var(--pf-l-gallery--GridTemplateColumns--max-on-sm, var(--pf-l-gallery--GridTemplateColumns--max));
26047
+ }
26048
+ }
26049
+ @media (min-width: 768px) {
26050
+ .pf-l-gallery {
26051
+ --pf-l-gallery--GridTemplateColumns--minmax--max: var(--pf-l-gallery--GridTemplateColumns--max-on-md, var(--pf-l-gallery--GridTemplateColumns--max-on-sm, var(--pf-l-gallery--GridTemplateColumns--max)));
26052
+ }
26053
+ }
26054
+ @media (min-width: 992px) {
26055
+ .pf-l-gallery {
26056
+ --pf-l-gallery--GridTemplateColumns--minmax--max: var(--pf-l-gallery--GridTemplateColumns--max-on-lg, var(--pf-l-gallery--GridTemplateColumns--max-on-md, var(--pf-l-gallery--GridTemplateColumns--max-on-sm, var(--pf-l-gallery--GridTemplateColumns--max))));
26057
+ }
26058
+ }
26059
+ @media (min-width: 1200px) {
26060
+ .pf-l-gallery {
26061
+ --pf-l-gallery--GridTemplateColumns--minmax--max: var(--pf-l-gallery--GridTemplateColumns--max-on-xl, var(--pf-l-gallery--GridTemplateColumns--max-on-lg, var(--pf-l-gallery--GridTemplateColumns--max-on-md, var(--pf-l-gallery--GridTemplateColumns--max-on-sm, var(--pf-l-gallery--GridTemplateColumns--max)))));
26062
+ }
26063
+ }
26064
+ @media (min-width: 1450px) {
26065
+ .pf-l-gallery {
26066
+ --pf-l-gallery--GridTemplateColumns--minmax--max: var(--pf-l-gallery--GridTemplateColumns--max-on-2xl, var(--pf-l-gallery--GridTemplateColumns--max-on-xl, var(--pf-l-gallery--GridTemplateColumns--max-on-lg, var(--pf-l-gallery--GridTemplateColumns--max-on-md, var(--pf-l-gallery--GridTemplateColumns--max-on-sm, var(--pf-l-gallery--GridTemplateColumns--max))))));
26067
+ }
26068
+ }
26000
26069
  .pf-l-grid {
26001
26070
  --pf-l-grid--m-gutter--GridGap: var(--pf-global--gutter);
26002
26071
  --pf-l-grid__item--GridColumnStart: auto;
@@ -27211,75 +27280,6 @@ label.pf-c-tree-view__node-text {
27211
27280
  grid-gap: var(--pf-l-grid--m-gutter--GridGap);
27212
27281
  }
27213
27282
 
27214
- .pf-l-gallery {
27215
- --pf-l-gallery--m-gutter--GridGap: var(--pf-global--gutter);
27216
- --pf-l-gallery--GridTemplateColumns--min: 250px;
27217
- --pf-l-gallery--GridTemplateColumns--minmax--min: var(--pf-l-gallery--GridTemplateColumns--min);
27218
- --pf-l-gallery--GridTemplateColumns--max: 1fr;
27219
- --pf-l-gallery--GridTemplateColumns--minmax--max: var(--pf-l-gallery--GridTemplateColumns--max);
27220
- --pf-l-gallery--GridTemplateColumns: repeat(auto-fill, minmax(var(--pf-l-gallery--GridTemplateColumns--minmax--min), var(--pf-l-gallery--GridTemplateColumns--minmax--max)));
27221
- --pf-l-gallery--GridTemplateRows: auto;
27222
- display: grid;
27223
- grid-template-columns: var(--pf-l-gallery--GridTemplateColumns);
27224
- grid-template-rows: var(--pf-l-gallery--GridTemplateRows);
27225
- --pf-l-gallery--GridTemplateColumns--minmax--min: var(--pf-l-gallery--GridTemplateColumns--min);
27226
- --pf-l-gallery--GridTemplateColumns--minmax--max: var(--pf-l-gallery--GridTemplateColumns--max);
27227
- }
27228
-
27229
- .pf-l-gallery.pf-m-gutter {
27230
- grid-gap: var(--pf-l-gallery--m-gutter--GridGap);
27231
- }
27232
-
27233
- @media (min-width: 576px) {
27234
- .pf-l-gallery {
27235
- --pf-l-gallery--GridTemplateColumns--minmax--min: var(--pf-l-gallery--GridTemplateColumns--min-on-sm, var(--pf-l-gallery--GridTemplateColumns--min));
27236
- }
27237
- }
27238
- @media (min-width: 768px) {
27239
- .pf-l-gallery {
27240
- --pf-l-gallery--GridTemplateColumns--minmax--min: var(--pf-l-gallery--GridTemplateColumns--min-on-md, var(--pf-l-gallery--GridTemplateColumns--min-on-sm, var(--pf-l-gallery--GridTemplateColumns--min)));
27241
- }
27242
- }
27243
- @media (min-width: 992px) {
27244
- .pf-l-gallery {
27245
- --pf-l-gallery--GridTemplateColumns--minmax--min: var(--pf-l-gallery--GridTemplateColumns--min-on-lg, var(--pf-l-gallery--GridTemplateColumns--min-on-md, var(--pf-l-gallery--GridTemplateColumns--min-on-sm, var(--pf-l-gallery--GridTemplateColumns--min))));
27246
- }
27247
- }
27248
- @media (min-width: 1200px) {
27249
- .pf-l-gallery {
27250
- --pf-l-gallery--GridTemplateColumns--minmax--min: var(--pf-l-gallery--GridTemplateColumns--min-on-xl, var(--pf-l-gallery--GridTemplateColumns--min-on-lg, var(--pf-l-gallery--GridTemplateColumns--min-on-md, var(--pf-l-gallery--GridTemplateColumns--min-on-sm, var(--pf-l-gallery--GridTemplateColumns--min)))));
27251
- }
27252
- }
27253
- @media (min-width: 1450px) {
27254
- .pf-l-gallery {
27255
- --pf-l-gallery--GridTemplateColumns--minmax--min: var(--pf-l-gallery--GridTemplateColumns--min-on-2xl, var(--pf-l-gallery--GridTemplateColumns--min-on-xl, var(--pf-l-gallery--GridTemplateColumns--min-on-lg, var(--pf-l-gallery--GridTemplateColumns--min-on-md, var(--pf-l-gallery--GridTemplateColumns--min-on-sm, var(--pf-l-gallery--GridTemplateColumns--min))))));
27256
- }
27257
- }
27258
- @media (min-width: 576px) {
27259
- .pf-l-gallery {
27260
- --pf-l-gallery--GridTemplateColumns--minmax--max: var(--pf-l-gallery--GridTemplateColumns--max-on-sm, var(--pf-l-gallery--GridTemplateColumns--max));
27261
- }
27262
- }
27263
- @media (min-width: 768px) {
27264
- .pf-l-gallery {
27265
- --pf-l-gallery--GridTemplateColumns--minmax--max: var(--pf-l-gallery--GridTemplateColumns--max-on-md, var(--pf-l-gallery--GridTemplateColumns--max-on-sm, var(--pf-l-gallery--GridTemplateColumns--max)));
27266
- }
27267
- }
27268
- @media (min-width: 992px) {
27269
- .pf-l-gallery {
27270
- --pf-l-gallery--GridTemplateColumns--minmax--max: var(--pf-l-gallery--GridTemplateColumns--max-on-lg, var(--pf-l-gallery--GridTemplateColumns--max-on-md, var(--pf-l-gallery--GridTemplateColumns--max-on-sm, var(--pf-l-gallery--GridTemplateColumns--max))));
27271
- }
27272
- }
27273
- @media (min-width: 1200px) {
27274
- .pf-l-gallery {
27275
- --pf-l-gallery--GridTemplateColumns--minmax--max: var(--pf-l-gallery--GridTemplateColumns--max-on-xl, var(--pf-l-gallery--GridTemplateColumns--max-on-lg, var(--pf-l-gallery--GridTemplateColumns--max-on-md, var(--pf-l-gallery--GridTemplateColumns--max-on-sm, var(--pf-l-gallery--GridTemplateColumns--max)))));
27276
- }
27277
- }
27278
- @media (min-width: 1450px) {
27279
- .pf-l-gallery {
27280
- --pf-l-gallery--GridTemplateColumns--minmax--max: var(--pf-l-gallery--GridTemplateColumns--max-on-2xl, var(--pf-l-gallery--GridTemplateColumns--max-on-xl, var(--pf-l-gallery--GridTemplateColumns--max-on-lg, var(--pf-l-gallery--GridTemplateColumns--max-on-md, var(--pf-l-gallery--GridTemplateColumns--max-on-sm, var(--pf-l-gallery--GridTemplateColumns--max))))));
27281
- }
27282
- }
27283
27283
  .pf-l-level {
27284
27284
  --pf-l-level--m-gutter--MarginRight: var(--pf-global--gutter);
27285
27285
  display: flex;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/react-core",
3
- "version": "4.227.6",
3
+ "version": "4.227.7",
4
4
  "description": "This library provides a set of common React components for use with the PatternFly reference implementation.",
5
5
  "main": "dist/js/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -34,9 +34,9 @@
34
34
  "generate": "node scripts/copyStyles.js"
35
35
  },
36
36
  "dependencies": {
37
- "@patternfly/react-icons": "^4.78.6",
38
- "@patternfly/react-styles": "^4.77.6",
39
- "@patternfly/react-tokens": "^4.79.6",
37
+ "@patternfly/react-icons": "^4.78.7",
38
+ "@patternfly/react-styles": "^4.77.7",
39
+ "@patternfly/react-tokens": "^4.79.7",
40
40
  "focus-trap": "6.9.2",
41
41
  "react-dropzone": "9.0.0",
42
42
  "tippy.js": "5.1.2",
@@ -60,5 +60,5 @@
60
60
  "react": "^16.8.0 || ^17.0.0",
61
61
  "react-dom": "^16.8.0 || ^17.0.0"
62
62
  },
63
- "gitHead": "aff8cdef5d30d83cc8f51e62f76ff8e40e8edd2a"
63
+ "gitHead": "86dc74f93f58bd72ce6ac164e9bda25422494ca0"
64
64
  }
@@ -10,389 +10,42 @@ ouia: true
10
10
 
11
11
  ### Top
12
12
 
13
- ```js
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
- ```js
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
- ```js
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
- ```js
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
- ```js
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
- ```js
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
- ```js
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
- ```js isFullscreen
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
+ };
@@ -0,0 +1,32 @@
1
+ import React from 'react';
2
+ import { Pagination } from '@patternfly/react-core';
3
+
4
+ export const PaginationTop: 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
+ />
31
+ );
32
+ };