@patternfly/react-core 4.227.4 → 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.
Files changed (25) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/package.json +5 -5
  3. package/src/components/Pagination/examples/Pagination.md +8 -355
  4. package/src/components/Pagination/examples/PaginationBottom.tsx +33 -0
  5. package/src/components/Pagination/examples/PaginationCompact.tsx +33 -0
  6. package/src/components/Pagination/examples/PaginationDisabled.tsx +33 -0
  7. package/src/components/Pagination/examples/PaginationIndeterminate.tsx +40 -0
  8. package/src/components/Pagination/examples/PaginationNoItems.tsx +32 -0
  9. package/src/components/Pagination/examples/PaginationOnePage.tsx +32 -0
  10. package/src/components/Pagination/examples/PaginationSticky.tsx +81 -0
  11. package/src/components/Pagination/examples/PaginationTop.tsx +32 -0
  12. package/src/components/Radio/examples/Radio.md +12 -68
  13. package/src/components/Radio/examples/RadioControlled.tsx +21 -0
  14. package/src/components/Radio/examples/RadioDisabled.tsx +15 -0
  15. package/src/components/Radio/examples/RadioLabelWraps.tsx +6 -0
  16. package/src/components/Radio/examples/RadioReversed.tsx +6 -0
  17. package/src/components/Radio/examples/RadioStandaloneInput.tsx +6 -0
  18. package/src/components/Radio/examples/RadioUncontrolled.tsx +6 -0
  19. package/src/components/Radio/examples/RadioWithBody.tsx +6 -0
  20. package/src/components/Radio/examples/RadioWithDescription.tsx +11 -0
  21. package/src/components/Radio/examples/RadioWithDescriptionAndBody.tsx +12 -0
  22. package/src/components/Spinner/examples/Spinner.md +3 -21
  23. package/src/components/Spinner/examples/SpinnerBasic.tsx +4 -0
  24. package/src/components/Spinner/examples/SpinnerCustomSize.tsx +6 -0
  25. package/src/components/Spinner/examples/SpinnerSizeVariations.tsx +11 -0
package/CHANGELOG.md CHANGED
@@ -3,6 +3,30 @@
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
+
14
+ ## 4.227.6 (2022-07-28)
15
+
16
+ **Note:** Version bump only for package @patternfly/react-core
17
+
18
+
19
+
20
+
21
+
22
+ ## 4.227.5 (2022-07-27)
23
+
24
+ **Note:** Version bump only for package @patternfly/react-core
25
+
26
+
27
+
28
+
29
+
6
30
  ## 4.227.4 (2022-07-27)
7
31
 
8
32
  **Note:** Version bump only for package @patternfly/react-core
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/react-core",
3
- "version": "4.227.4",
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.4",
38
- "@patternfly/react-styles": "^4.77.4",
39
- "@patternfly/react-tokens": "^4.79.4",
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": "bf9f5697021d8b85cd20ce4c5c8899dbcf922cdd"
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
+ };
@@ -7,104 +7,48 @@ ouia: true
7
7
  ---
8
8
 
9
9
  ## Examples
10
+
10
11
  ### Controlled
11
- ```js
12
- import React from 'react';
13
- import { Radio } from '@patternfly/react-core';
14
-
15
- class ControlledRadio extends React.Component {
16
- constructor(props) {
17
- super(props);
18
- this.state = {
19
- check1: false,
20
- };
21
-
22
- this.handleChange = (_, event) => {
23
- const { value } = event.currentTarget;
24
- this.setState({ [value]: true });
25
- };
26
- }
27
-
28
- render() {
29
- return (
30
- <React.Fragment>
31
- <Radio
32
- isChecked={this.state.check1}
33
- name="radio-1"
34
- onChange={this.handleChange}
35
- label="Controlled radio"
36
- id="radio-controlled"
37
- value="check1"
38
- />
39
- </React.Fragment>
40
- );
41
- }
42
- }
12
+
13
+ ```ts file="./RadioControlled.tsx"
43
14
  ```
44
15
 
45
16
  ### Uncontrolled
46
- ```js
47
- import React from 'react';
48
- import { Radio } from '@patternfly/react-core';
49
17
 
50
- <Radio label="Uncontrolled radio example" id="radio-uncontrolled" name="radio-2" />
18
+ ```ts file="./RadioUncontrolled.tsx"
51
19
  ```
52
20
 
53
21
  ### Reversed
54
- ```js
55
- import React from 'react';
56
- import { Radio } from '@patternfly/react-core';
57
22
 
58
- <Radio isLabelBeforeButton label="Reversed radio example" id="radio-reversed" name="radio-3" />
23
+ ```ts file="./RadioReversed.tsx"
59
24
  ```
60
25
 
61
26
  ### Label wraps
62
- ```js
63
- import React from 'react';
64
- import { Radio } from '@patternfly/react-core';
65
27
 
66
- <Radio isLabelWrapped label="Label wraps input example" id="radio-label-wraps-input" name="radio-4" />
28
+ ```ts file="./RadioLabelWraps.tsx"
67
29
  ```
68
30
 
69
31
  ### Disabled
70
- ```js
71
- import React from 'react';
72
- import { Radio } from '@patternfly/react-core';
73
-
74
- <React.Fragment>
75
- <Radio id="radio-disabled" label="Disabled radio example" isDisabled name="radio-5" />
76
- <Radio id="radio-disabled-checked" defaultChecked label="Disabled and checked radio example" isDisabled name="radio-6" />
77
- </React.Fragment>
32
+
33
+ ```ts file="./RadioDisabled.tsx"
78
34
  ```
79
35
 
80
36
  ### With description
81
- ```js
82
- import React from 'react';
83
- import { Radio } from '@patternfly/react-core';
84
37
 
85
- <Radio id="radio-with-description" label="Radio with description example" description="Single-tenant cloud service hosted and managed by Red Hat that offers high-availability enterprise-grade clusters in a virtual private cloud on AWS or GCP." />
38
+ ```ts file="./RadioWithDescription.tsx"
86
39
  ```
87
40
 
88
41
  ### With body
89
- ```js
90
- import React from 'react';
91
- import { Radio } from '@patternfly/react-core';
92
42
 
93
- <Radio id="radio-with-body" label="Radio with body" body="This is where custom content goes." />
43
+ ```ts file="./RadioWithBody.tsx"
94
44
  ```
95
45
 
96
46
  ### With description and body
97
- ```js
98
- import React from 'react';
99
- import { Radio } from '@patternfly/react-core';
100
47
 
101
- <Radio id="radio-description-body" label="Radio with description and body" description="Single-tenant cloud service hosted and managed by Red Hat that offers high-availability enterprise-grade clusters in a virtual private cloud on AWS or GCP." body="This is where custom content goes." />
48
+ ```ts file="./RadioWithDescriptionAndBody.tsx"
102
49
  ```
103
50
 
104
51
  ### Standalone input
105
- ```js
106
- import React from 'react';
107
- import { Radio } from '@patternfly/react-core';
108
52
 
109
- <Radio id="radio-standalone" aria-label="Standalone input" name="exampleRadioStandalone"/>
53
+ ```ts file="./RadioStandaloneInput.tsx"
110
54
  ```
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import { Radio } from '@patternfly/react-core';
3
+
4
+ export const RadioControlled: React.FunctionComponent = () => {
5
+ const [check1, setCheck1] = React.useState(false);
6
+
7
+ const handleChange = () => {
8
+ setCheck1(true);
9
+ };
10
+ return (
11
+ <React.Fragment>
12
+ <Radio
13
+ isChecked={check1}
14
+ name="radio-1"
15
+ onChange={handleChange}
16
+ label="Controlled Radio"
17
+ id="radio-controlled"
18
+ ></Radio>
19
+ </React.Fragment>
20
+ );
21
+ };
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import { Radio } from '@patternfly/react-core';
3
+
4
+ export const RadioDisabled: React.FunctionComponent = () => (
5
+ <React.Fragment>
6
+ <Radio id="radio-disabled" label="Disabled radio example" isDisabled name="radio-5" />
7
+ <Radio
8
+ id="radio-disabled-checked"
9
+ defaultChecked
10
+ label="Disabled and checked radio example"
11
+ isDisabled
12
+ name="radio-6"
13
+ />
14
+ </React.Fragment>
15
+ );
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { Radio } from '@patternfly/react-core';
3
+
4
+ export const RadioLabelWraps: React.FunctionComponent = () => (
5
+ <Radio isLabelWrapped label="Label wraps input example" id="radio-label-wraps-input" name="radio-4" />
6
+ );
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { Radio } from '@patternfly/react-core';
3
+
4
+ export const RadioReversed: React.FunctionComponent = () => (
5
+ <Radio isLabelBeforeButton label="Reversed radio example" id="radio-reversed" name="radio-3" />
6
+ );
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { Radio } from '@patternfly/react-core';
3
+
4
+ export const RadioStandaloneInput: React.FunctionComponent = () => (
5
+ <Radio id="radio-standalone" aria-label="Standalone input" name="exampleRadioStandalone" />
6
+ );
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { Radio } from '@patternfly/react-core';
3
+
4
+ export const RadioUncontrolled: React.FunctionComponent = () => (
5
+ <Radio label="Uncontrolled radio example" id="radio-uncontrolled" name="radio-2" />
6
+ );
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { Radio } from '@patternfly/react-core';
3
+
4
+ export const RadioWithBody: React.FunctionComponent = () => (
5
+ <Radio id="radio-with-body" label="Radio with body" name="radio-8" body="This is where custom content goes." />
6
+ );
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { Radio } from '@patternfly/react-core';
3
+
4
+ export const RadioWithDescription: React.FunctionComponent = () => (
5
+ <Radio
6
+ id="radio-with-description"
7
+ label="Radio with description example"
8
+ name="radio-7"
9
+ description="Single-tenant cloud service hosted and managed by Red Hat that offers high-availability enterprise-grade clusters in a virtual private cloud on AWS or GCP."
10
+ />
11
+ );
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { Radio } from '@patternfly/react-core';
3
+
4
+ export const RadioWithDescriptionAndBody: React.FunctionComponent = () => (
5
+ <Radio
6
+ id="radio-description-body"
7
+ label="Radio with description and body"
8
+ description="Single-tenant cloud service hosted and managed by Red Hat that offers high-availability enterprise-grade clusters in a virtual private cloud on AWS or GCP."
9
+ body="This is where custom content goes."
10
+ name="radio-8"
11
+ />
12
+ );
@@ -7,31 +7,13 @@ propComponents: ['Spinner']
7
7
 
8
8
  ## Examples
9
9
  ### Basic
10
- ```js
11
- import React from 'react';
12
- import { Spinner } from '@patternfly/react-core';
13
-
14
- <Spinner isSVG aria-label="Contents of the basic example"/>
10
+ ```ts file="./SpinnerBasic.tsx"
15
11
  ```
16
12
 
17
13
  ### Size variations
18
- ```js
19
- import React from 'react';
20
- import { Spinner } from '@patternfly/react-core';
21
-
22
- <React.Fragment>
23
- <Spinner isSVG size="sm" aria-label="Contents of the small example"/>
24
- <Spinner isSVG size="md" aria-label="Contents of the medium example"/>
25
- <Spinner isSVG size="lg" aria-label="Contents of the large example"/>
26
- <Spinner isSVG size="xl" aria-label="Contents of the extra large example"/>
27
- </React.Fragment>
14
+ ```ts file="./SpinnerSizeVariations.tsx"
28
15
  ```
29
16
 
30
17
  ### Custom size
31
- ```js
32
- import React from 'react';
33
- import { Spinner } from '@patternfly/react-core';
34
-
35
- <Spinner isSVG diameter="80px" aria-label="Contents of the custom size example"/>
18
+ ```ts file="./SpinnerCustomSize.tsx"
36
19
  ```
37
-
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { Spinner } from '@patternfly/react-core';
3
+
4
+ export const SpinnerBasic: React.FunctionComponent = () => <Spinner isSVG aria-label="Contents of the basic example" />;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { Spinner } from '@patternfly/react-core';
3
+
4
+ export const SpinnerCustomSize: React.FunctionComponent = () => (
5
+ <Spinner isSVG diameter="80px" aria-label="Contents of the custom size example" />
6
+ );
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { Spinner } from '@patternfly/react-core';
3
+
4
+ export const SpinnerSizeVariations: React.FunctionComponent = () => (
5
+ <React.Fragment>
6
+ <Spinner isSVG size="sm" aria-label="Contents of the small example" />
7
+ <Spinner isSVG size="md" aria-label="Contents of the medium example" />
8
+ <Spinner isSVG size="lg" aria-label="Contents of the large example" />
9
+ <Spinner isSVG size="xl" aria-label="Contents of the extra large example" />
10
+ </React.Fragment>
11
+ );