@patternfly/react-core 4.227.5 → 4.227.8

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 (33) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/umd/react-core.css +756 -756
  3. package/package.json +5 -5
  4. package/src/components/Page/examples/Page.md +10 -615
  5. package/src/components/Page/examples/PageCenteredSection.tsx +76 -0
  6. package/src/components/Page/examples/PageGroupSection.tsx +106 -0
  7. package/src/components/Page/examples/PageHorizontalNav.tsx +43 -0
  8. package/src/components/Page/examples/PageMainSectionPadding.tsx +72 -0
  9. package/src/components/Page/examples/PageTertiaryNav.tsx +42 -0
  10. package/src/components/Page/examples/PageUncontrolledNav.tsx +53 -0
  11. package/src/components/Page/examples/PageVerticalNav.tsx +65 -0
  12. package/src/components/Page/examples/PageVerticalNavUsingPageHeaderComponent.tsx +44 -0
  13. package/src/components/Page/examples/PageWithOrWithoutFill.tsx +67 -0
  14. package/src/components/Pagination/examples/Pagination.md +8 -355
  15. package/src/components/Pagination/examples/PaginationBottom.tsx +33 -0
  16. package/src/components/Pagination/examples/PaginationCompact.tsx +33 -0
  17. package/src/components/Pagination/examples/PaginationDisabled.tsx +33 -0
  18. package/src/components/Pagination/examples/PaginationIndeterminate.tsx +40 -0
  19. package/src/components/Pagination/examples/PaginationNoItems.tsx +32 -0
  20. package/src/components/Pagination/examples/PaginationOnePage.tsx +32 -0
  21. package/src/components/Pagination/examples/PaginationSticky.tsx +81 -0
  22. package/src/components/Pagination/examples/PaginationTop.tsx +32 -0
  23. package/src/components/Spinner/examples/Spinner.md +3 -21
  24. package/src/components/Spinner/examples/SpinnerBasic.tsx +4 -0
  25. package/src/components/Spinner/examples/SpinnerCustomSize.tsx +6 -0
  26. package/src/components/Spinner/examples/SpinnerSizeVariations.tsx +11 -0
  27. package/src/components/Switch/examples/Switch.md +6 -153
  28. package/src/components/Switch/examples/SwitchBasic.tsx +20 -0
  29. package/src/components/Switch/examples/SwitchCheckedWithLabel.tsx +22 -0
  30. package/src/components/Switch/examples/SwitchDisabled.tsx +28 -0
  31. package/src/components/Switch/examples/SwitchReversed.tsx +21 -0
  32. package/src/components/Switch/examples/SwitchUncontrolled.tsx +14 -0
  33. package/src/components/Switch/examples/SwitchWithoutLabel.tsx +12 -0
@@ -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,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
+ );
@@ -10,177 +10,30 @@ ouia: true
10
10
 
11
11
  ### Basic
12
12
 
13
- ```js
14
- import React from 'react';
15
- import { Switch } from '@patternfly/react-core';
16
-
17
- class SimpleSwitch extends React.Component {
18
- constructor(props) {
19
- super(props);
20
- this.state = {
21
- isChecked: true
22
- };
23
- this.handleChange = isChecked => {
24
- this.setState({ isChecked });
25
- };
26
- }
27
-
28
- render() {
29
- const { isChecked } = this.state;
30
- return (
31
- <Switch
32
- id="simple-switch"
33
- label="Message when on"
34
- labelOff="Message when off"
35
- isChecked={isChecked}
36
- onChange={this.handleChange}
37
- />
38
- );
39
- }
40
- }
13
+ ```ts file="./SwitchBasic.tsx"
41
14
  ```
42
15
 
43
16
  ### Reversed Layout
44
17
 
45
- ```js
46
- import React from 'react';
47
- import { Switch } from '@patternfly/react-core';
48
-
49
- class ReversedSwitch extends React.Component {
50
- constructor(props) {
51
- super(props);
52
- this.state = {
53
- isChecked: true
54
- };
55
- this.handleChange = isChecked => {
56
- this.setState({ isChecked });
57
- };
58
- }
59
-
60
- render() {
61
- const { isChecked } = this.state;
62
- return (
63
- <Switch
64
- id="reversed-switch"
65
- label="Message when on"
66
- labelOff="Message when off"
67
- isChecked={isChecked}
68
- onChange={this.handleChange}
69
- isReversed
70
- />
71
- );
72
- }
73
- }
18
+ ```ts file="./SwitchReversed.tsx"
74
19
  ```
75
20
 
76
21
  ### Without label
77
22
 
78
- ```js
79
- import React from 'react';
80
- import { Switch } from '@patternfly/react-core';
81
-
82
- class NoLabelSwitch extends React.Component {
83
- constructor(props) {
84
- super(props);
85
- this.state = {
86
- isChecked: true
87
- };
88
- this.handleChange = isChecked => {
89
- this.setState({ isChecked });
90
- };
91
- }
92
-
93
- render() {
94
- const { isChecked } = this.state;
95
- return (
96
- <Switch id="no-label-switch-on" aria-label="Message when on" isChecked={isChecked} onChange={this.handleChange} />
97
- );
98
- }
99
- }
23
+ ```ts file="./SwitchWithoutLabel.tsx"
100
24
  ```
101
25
 
102
26
  ### Checked with label
103
27
 
104
- ```js
105
- import React from 'react';
106
- import { Switch } from '@patternfly/react-core';
107
-
108
- class CheckedWithLabelSwitch extends React.Component {
109
- constructor(props) {
110
- super(props);
111
- this.state = {
112
- isChecked: true
113
- };
114
- this.handleChange = isChecked => {
115
- this.setState({ isChecked });
116
- };
117
- }
118
-
119
- render() {
120
- const { isChecked } = this.state;
121
- return (
122
- <Switch
123
- label="Message when on"
124
- labelOff="Message when off"
125
- id="checked-with-label-switch-on"
126
- aria-label="Message when on"
127
- isChecked={isChecked}
128
- hasCheckIcon
129
- onChange={this.handleChange}
130
- />
131
- );
132
- }
133
- }
28
+ ```ts file="./SwitchCheckedWithLabel.tsx"
134
29
  ```
135
30
 
136
31
  ### Disabled
137
32
 
138
- ```js
139
- import React from 'react';
140
- import { Switch } from '@patternfly/react-core';
141
-
142
- <React.Fragment>
143
- <Switch
144
- id="disabled-switch-on"
145
- aria-label="Message when on"
146
- label="Message when on"
147
- labelOff="Message when off"
148
- isChecked
149
- isDisabled
150
- />
151
- <br />
152
- <Switch
153
- id="disabled-switch-off"
154
- aria-label="Message when on"
155
- label="Message when on"
156
- labelOff="Message when off"
157
- isChecked={false}
158
- isDisabled
159
- />
160
- <br />
161
- <Switch id="disabled-no-label-switch-on" aria-label="Message when on" isChecked isDisabled />
162
- <br />
163
- <Switch id="disabled-no-label-switch-off" aria-label="Message when on" isChecked={false} isDisabled />
164
- </React.Fragment>;
33
+ ```ts file="./SwitchDisabled.tsx"
165
34
  ```
166
35
 
167
36
  ### Uncontrolled
168
37
 
169
- ```js
170
- import React from 'react';
171
- import { Switch } from '@patternfly/react-core';
172
-
173
- <React.Fragment>
174
- <Switch
175
- id="uncontrolled-switch-no-label"
176
- aria-label="An uncontrolled switch with no label"
177
- defaultChecked={false}
178
- />
179
- <br />
180
- <Switch
181
- id="uncontrolled-switch-with-label"
182
- label="An uncontrolled switch"
183
- defaultChecked={false}
184
- />
185
- </React.Fragment>;
38
+ ```ts file="./SwitchUncontrolled.tsx"
186
39
  ```
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import { Switch } from '@patternfly/react-core';
3
+
4
+ export const SwitchBasic: React.FunctionComponent = () => {
5
+ const [isChecked, setIsChecked] = React.useState<boolean>(true);
6
+
7
+ const handleChange = (checked: boolean, _event: React.FormEvent<HTMLInputElement>) => {
8
+ setIsChecked(checked);
9
+ };
10
+
11
+ return (
12
+ <Switch
13
+ id="simple-switch"
14
+ label="Message when on"
15
+ labelOff="Message when off"
16
+ isChecked={isChecked}
17
+ onChange={handleChange}
18
+ />
19
+ );
20
+ };
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import { Switch } from '@patternfly/react-core';
3
+
4
+ export const SwitchCheckedWithLabel: React.FunctionComponent = () => {
5
+ const [isChecked, setIsChecked] = React.useState<boolean>(true);
6
+
7
+ const handleChange = (checked: boolean, _event: React.FormEvent<HTMLInputElement>) => {
8
+ setIsChecked(checked);
9
+ };
10
+
11
+ return (
12
+ <Switch
13
+ label="Message when on"
14
+ labelOff="Message when off"
15
+ id="checked-with-label-switch-on"
16
+ aria-label="Message when on"
17
+ isChecked={isChecked}
18
+ hasCheckIcon
19
+ onChange={handleChange}
20
+ />
21
+ );
22
+ };
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ import { Switch } from '@patternfly/react-core';
3
+
4
+ export const SwitchDisabled: React.FunctionComponent = () => (
5
+ <React.Fragment>
6
+ <Switch
7
+ id="disabled-switch-on"
8
+ aria-label="Message when on"
9
+ label="Message when on"
10
+ labelOff="Message when off"
11
+ isChecked
12
+ isDisabled
13
+ />
14
+ <br />
15
+ <Switch
16
+ id="disabled-switch-off"
17
+ aria-label="Message when on"
18
+ label="Message when on"
19
+ labelOff="Message when off"
20
+ isChecked={false}
21
+ isDisabled
22
+ />
23
+ <br />
24
+ <Switch id="disabled-no-label-switch-on" aria-label="Message when on" isChecked isDisabled />
25
+ <br />
26
+ <Switch id="disabled-no-label-switch-off" aria-label="Message when on" isChecked={false} isDisabled />
27
+ </React.Fragment>
28
+ );
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import { Switch } from '@patternfly/react-core';
3
+
4
+ export const SwitchReversed: React.FunctionComponent = () => {
5
+ const [isChecked, setIsChecked] = React.useState<boolean>(true);
6
+
7
+ const handleChange = (checked: boolean, _event: React.FormEvent<HTMLInputElement>) => {
8
+ setIsChecked(checked);
9
+ };
10
+
11
+ return (
12
+ <Switch
13
+ id="reversed-switch"
14
+ label="Message when on"
15
+ labelOff="Message when off"
16
+ isChecked={isChecked}
17
+ onChange={handleChange}
18
+ isReversed
19
+ />
20
+ );
21
+ };
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import { Switch } from '@patternfly/react-core';
3
+
4
+ export const SwitchUncontrolled: React.FunctionComponent = () => (
5
+ <React.Fragment>
6
+ <Switch
7
+ id="uncontrolled-switch-no-label"
8
+ aria-label="An uncontrolled switch with no label"
9
+ defaultChecked={false}
10
+ />
11
+ <br />
12
+ <Switch id="uncontrolled-switch-with-label" label="An uncontrolled switch" defaultChecked={false} />
13
+ </React.Fragment>
14
+ );
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { Switch } from '@patternfly/react-core';
3
+
4
+ export const SwitchWithoutLabel: React.FunctionComponent = () => {
5
+ const [isChecked, setIsChecked] = React.useState<boolean>(true);
6
+
7
+ const handleChange = (checked: boolean, _event: React.FormEvent<HTMLInputElement>) => {
8
+ setIsChecked(checked);
9
+ };
10
+
11
+ return <Switch id="no-label-switch-on" aria-label="Message when on" isChecked={isChecked} onChange={handleChange} />;
12
+ };