@patternfly/react-core 4.191.1 → 4.191.5

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,41 @@
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.191.5 (2022-01-20)
7
+
8
+ **Note:** Version bump only for package @patternfly/react-core
9
+
10
+
11
+
12
+
13
+
14
+ ## 4.191.4 (2022-01-19)
15
+
16
+ **Note:** Version bump only for package @patternfly/react-core
17
+
18
+
19
+
20
+
21
+
22
+ ## 4.191.3 (2022-01-19)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * **examples:** amend row index in tree table examples ([#6830](https://github.com/patternfly/patternfly-react/issues/6830)) ([e676fb1](https://github.com/patternfly/patternfly-react/commit/e676fb1171618e957a4564af31c15ca6e3800507)), closes [#6719](https://github.com/patternfly/patternfly-react/issues/6719)
28
+
29
+
30
+
31
+
32
+
33
+ ## 4.191.2 (2022-01-19)
34
+
35
+ **Note:** Version bump only for package @patternfly/react-core
36
+
37
+
38
+
39
+
40
+
6
41
  ## 4.191.1 (2022-01-19)
7
42
 
8
43
  **Note:** Version bump only for package @patternfly/react-core
@@ -1305,6 +1305,40 @@ textarea.pf-c-form-control {
1305
1305
  display: block;
1306
1306
  }
1307
1307
 
1308
+ .pf-c-badge {
1309
+ --pf-c-badge--BorderRadius: var(--pf-global--BorderRadius--lg);
1310
+ --pf-c-badge--FontSize: var(--pf-global--FontSize--xs);
1311
+ --pf-c-badge--FontWeight: var(--pf-global--FontWeight--bold);
1312
+ --pf-c-badge--PaddingRight: var(--pf-global--spacer--sm);
1313
+ --pf-c-badge--PaddingLeft: var(--pf-global--spacer--sm);
1314
+ --pf-c-badge--Color: var(--pf-global--Color--dark-100);
1315
+ --pf-c-badge--MinWidth: var(--pf-global--spacer--xl);
1316
+ --pf-c-badge--m-read--BackgroundColor: var(--pf-global--BackgroundColor--200);
1317
+ --pf-c-badge--m-read--Color: var(--pf-global--Color--dark-100);
1318
+ --pf-c-badge--m-unread--BackgroundColor: var(--pf-global--primary-color--100);
1319
+ --pf-c-badge--m-unread--Color: var(--pf-global--Color--light-100);
1320
+ display: inline-block;
1321
+ min-width: var(--pf-c-badge--MinWidth);
1322
+ padding-right: var(--pf-c-badge--PaddingRight);
1323
+ padding-left: var(--pf-c-badge--PaddingLeft);
1324
+ font-size: var(--pf-c-badge--FontSize);
1325
+ font-weight: var(--pf-c-badge--FontWeight);
1326
+ color: var(--pf-c-badge--Color);
1327
+ text-align: center;
1328
+ background-color: var(--pf-c-badge--BackgroundColor);
1329
+ border-radius: var(--pf-c-badge--BorderRadius);
1330
+ }
1331
+
1332
+ .pf-c-badge.pf-m-read {
1333
+ --pf-c-badge--Color: var(--pf-c-badge--m-read--Color);
1334
+ --pf-c-badge--BackgroundColor: var(--pf-c-badge--m-read--BackgroundColor);
1335
+ }
1336
+
1337
+ .pf-c-badge.pf-m-unread {
1338
+ --pf-c-badge--Color: var(--pf-c-badge--m-unread--Color);
1339
+ --pf-c-badge--BackgroundColor: var(--pf-c-badge--m-unread--BackgroundColor);
1340
+ }
1341
+
1308
1342
  .pf-c-banner.pf-m-warning, .pf-c-banner.pf-m-info {
1309
1343
  --pf-global--Color--100: var(--pf-global--Color--dark-100);
1310
1344
  --pf-global--Color--200: var(--pf-global--Color--dark-200);
@@ -1446,40 +1480,6 @@ textarea.pf-c-form-control {
1446
1480
  cursor: not-allowed;
1447
1481
  }
1448
1482
 
1449
- .pf-c-badge {
1450
- --pf-c-badge--BorderRadius: var(--pf-global--BorderRadius--lg);
1451
- --pf-c-badge--FontSize: var(--pf-global--FontSize--xs);
1452
- --pf-c-badge--FontWeight: var(--pf-global--FontWeight--bold);
1453
- --pf-c-badge--PaddingRight: var(--pf-global--spacer--sm);
1454
- --pf-c-badge--PaddingLeft: var(--pf-global--spacer--sm);
1455
- --pf-c-badge--Color: var(--pf-global--Color--dark-100);
1456
- --pf-c-badge--MinWidth: var(--pf-global--spacer--xl);
1457
- --pf-c-badge--m-read--BackgroundColor: var(--pf-global--BackgroundColor--200);
1458
- --pf-c-badge--m-read--Color: var(--pf-global--Color--dark-100);
1459
- --pf-c-badge--m-unread--BackgroundColor: var(--pf-global--primary-color--100);
1460
- --pf-c-badge--m-unread--Color: var(--pf-global--Color--light-100);
1461
- display: inline-block;
1462
- min-width: var(--pf-c-badge--MinWidth);
1463
- padding-right: var(--pf-c-badge--PaddingRight);
1464
- padding-left: var(--pf-c-badge--PaddingLeft);
1465
- font-size: var(--pf-c-badge--FontSize);
1466
- font-weight: var(--pf-c-badge--FontWeight);
1467
- color: var(--pf-c-badge--Color);
1468
- text-align: center;
1469
- background-color: var(--pf-c-badge--BackgroundColor);
1470
- border-radius: var(--pf-c-badge--BorderRadius);
1471
- }
1472
-
1473
- .pf-c-badge.pf-m-read {
1474
- --pf-c-badge--Color: var(--pf-c-badge--m-read--Color);
1475
- --pf-c-badge--BackgroundColor: var(--pf-c-badge--m-read--BackgroundColor);
1476
- }
1477
-
1478
- .pf-c-badge.pf-m-unread {
1479
- --pf-c-badge--Color: var(--pf-c-badge--m-unread--Color);
1480
- --pf-c-badge--BackgroundColor: var(--pf-c-badge--m-unread--BackgroundColor);
1481
- }
1482
-
1483
1483
  .pf-c-breadcrumb {
1484
1484
  --pf-c-breadcrumb__item--FontSize: var(--pf-global--FontSize--sm);
1485
1485
  --pf-c-breadcrumb__item--LineHeight: var(--pf-global--LineHeight--sm);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/react-core",
3
- "version": "4.191.1",
3
+ "version": "4.191.5",
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.42.1",
38
- "@patternfly/react-styles": "^4.41.1",
39
- "@patternfly/react-tokens": "^4.43.1",
37
+ "@patternfly/react-icons": "^4.42.5",
38
+ "@patternfly/react-styles": "^4.41.5",
39
+ "@patternfly/react-tokens": "^4.43.5",
40
40
  "focus-trap": "6.2.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": "13a78694693eff5ddb5d00903c1382ae54469c17"
63
+ "gitHead": "1728bd68aa2936b792031a8bdfc83cb5256f2128"
64
64
  }
@@ -17,350 +17,65 @@ import { Link } from '@reach/router';
17
17
 
18
18
  ### Variations
19
19
 
20
- ```js
21
- import React from 'react';
22
- import { Button } from '@patternfly/react-core';
23
- import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
24
- import PlusCircleIcon from '@patternfly/react-icons/dist/esm/icons/plus-circle-icon';
25
- import ExternalLinkSquareAltIcon from '@patternfly/react-icons/dist/esm/icons/external-link-square-alt-icon';
26
- import CopyIcon from '@patternfly/react-icons/dist/esm/icons/copy-icon';
27
-
28
- <React.Fragment>
29
- <Button variant="primary">Primary</Button>{' '}
30
- <Button variant="secondary">Secondary</Button>{' '}
31
- <Button variant="secondary" isDanger>
32
- Danger Secondary
33
- </Button>{' '}
34
- <Button variant="tertiary">Tertiary</Button>{' '}
35
- <Button variant="danger">Danger</Button>{' '}
36
- <Button variant="warning">Warning</Button>
37
- <br />
38
- <br />
39
- <Button variant="link" icon={<PlusCircleIcon />}>
40
- Link
41
- </Button>{' '}
42
- <Button variant="link" icon={<ExternalLinkSquareAltIcon />} iconPosition="right">
43
- Link
44
- </Button>{' '}
45
- <Button variant="link" isInline>
46
- Inline link
47
- </Button>{' '}
48
- <Button variant="link" isDanger>
49
- Danger link
50
- </Button>
51
- <br />
52
- <br />
53
- <Button variant="plain" aria-label="Action">
54
- <TimesIcon />
55
- </Button>
56
- <br />
57
- <br />
58
- <Button variant="control">Control</Button>{' '}
59
- <Button variant="control" aria-label="Copy">
60
- <CopyIcon />
61
- </Button>
62
- </React.Fragment>;
20
+ ```ts file="./ButtonVariations.tsx"
63
21
  ```
64
22
 
65
23
  ### Disabled
66
24
 
67
- ```js
68
- import React from 'react';
69
- import { Button } from '@patternfly/react-core';
70
- import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
71
- import PlusCircleIcon from '@patternfly/react-icons/dist/esm/icons/plus-circle-icon';
72
-
73
- <React.Fragment>
74
- <Button isDisabled>Primary disabled</Button>{' '}
75
- <Button isDisabled>Secondary disabled</Button>{' '}
76
- <Button variant="secondary" isDanger isDisabled>
77
- Danger secondary disabled
78
- </Button>{' '}
79
- <Button isDisabled variant="tertiary">
80
- Tertiary disabled
81
- </Button>{' '}
82
- <Button isDisabled variant="danger">
83
- Danger disabled
84
- </Button>{' '}
85
- <Button isDisabled variant="warning">
86
- Warning disabled
87
- </Button>
88
- <br />
89
- <br />
90
- <Button isDisabled variant="link" icon={<PlusCircleIcon />}>
91
- Link disabled
92
- </Button>{' '}
93
- <Button isDisabled variant="link" isInline>
94
- Inline link disabled
95
- </Button>{' '}
96
- <Button variant="link" isDanger isDisabled>
97
- Danger link disabled
98
- </Button>{' '}
99
- <Button isDisabled variant="plain" aria-label="Action">
100
- <TimesIcon />
101
- </Button>{' '}
102
- <Button isDisabled variant="control">
103
- Control disabled
104
- </Button>
105
- </React.Fragment>;
25
+ ```ts file="./ButtonDisabled.tsx"
106
26
  ```
107
27
 
108
28
  ### Aria disabled
109
29
 
110
- ```js
111
- import React from 'react';
112
- import { Button } from '@patternfly/react-core';
113
- import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
114
- import PlusCircleIcon from '@patternfly/react-icons/dist/esm/icons/plus-circle-icon';
115
-
116
- <React.Fragment>
117
- <Button isAriaDisabled>Primary aria disabled</Button>{' '}
118
- <Button isAriaDisabled>Secondary aria disabled</Button>{' '}
119
- <Button variant="secondary" isDanger isAriaDisabled>
120
- Danger secondary aria disabled
121
- </Button>{' '}
122
- <Button isAriaDisabled variant="tertiary">
123
- Tertiary aria disabled
124
- </Button>{' '}
125
- <Button isAriaDisabled variant="danger">
126
- Danger disabled
127
- </Button>{' '}
128
- <Button isAriaDisabled variant="warning">
129
- Warning disabled
130
- </Button>
131
- <br />
132
- <br />
133
- <Button isAriaDisabled variant="link" icon={<PlusCircleIcon />}>
134
- Link aria disabled
135
- </Button>{' '}
136
- <Button isAriaDisabled variant="link" isInline>
137
- Inline link aria disabled
138
- </Button>{' '}
139
- <Button variant="link" isDanger isAriaDisabled>
140
- Danger link disabled
141
- </Button>{' '}
142
- <Button isAriaDisabled variant="plain" aria-label="Action">
143
- <TimesIcon />
144
- </Button>{' '}
145
- <Button isAriaDisabled variant="control">
146
- Control aria disabled
147
- </Button>
148
- </React.Fragment>;
30
+ ```ts file="./ButtonAriaDisabled.tsx"
149
31
  ```
150
32
 
151
33
  ### Aria disabled button with tooltip
152
34
 
153
- ```js
154
- import React from 'react';
155
- import { Button, Tooltip } from '@patternfly/react-core';
156
-
157
- <Tooltip content="Aria-disabled buttons are like disabled buttons, but focusable. Allows for tooltip support.">
158
- <Button isAriaDisabled variant="secondary">
159
- Secondary button to core docs
160
- </Button>
161
- </Tooltip>;
35
+ ```ts file="./ButtonAriaDisabledTooltip.tsx"
162
36
  ```
163
37
 
164
38
  ### Aria disabled link as button with tooltip
165
39
 
166
- ```js
167
- import React from 'react';
168
- import { Button, Tooltip } from '@patternfly/react-core';
169
-
170
- <Tooltip content="Aria-disabled link as button with tooltip">
171
- <Button component="a" isAriaDisabled href="https://pf4.patternfly.org/" target="_blank" variant="tertiary">
172
- Tertiary link as button to core docs
173
- </Button>
174
- </Tooltip>;
40
+ ```ts file="./ButtonAriaDisabledLinkTooltip.tsx"
175
41
  ```
176
42
 
177
43
  ### Links as buttons
178
44
 
179
- ```js
180
- import React from 'react';
181
- import { Button } from '@patternfly/react-core';
182
-
183
- <React.Fragment>
184
- <Button component="a" href="https://pf4.patternfly.org/" target="_blank" variant="primary">
185
- Link to core docs
186
- </Button>{' '}
187
- <Button component="a" href="https://pf4.patternfly.org/" target="_blank" variant="secondary">
188
- Secondary link to core docs
189
- </Button>{' '}
190
- <Button isDisabled component="a" href="https://pf4.patternfly.org/" target="_blank" variant="tertiary">
191
- Tertiary link to core docs
192
- </Button>{' '}
193
- <Button component="a" href="https://pf4.patternfly.org/contribution/#modifiers" variant="link">
194
- Jump to modifiers in contribution guidelines
195
- </Button>
196
- </React.Fragment>;
45
+ ```ts file="./ButtonLinks.tsx"
197
46
  ```
198
47
 
199
48
  ### Inline link as span
200
49
 
201
- ```js
202
- import React from 'react';
203
- import { Button } from '@patternfly/react-core';
204
-
205
- InlineLinkAsSpan = () => {
206
- const handleKeydown = evt => {
207
- const { keyCode } = evt;
208
- const isEnterOrSpaceKey = keyCode === 13 || keyCode === 32;
209
-
210
- if (isEnterOrSpaceKey) {
211
- evt.preventDefault();
212
- alert(`${keyCode === 13 ? 'Enter' : 'Space'} key default behavior stopped by onKeyDown`);
213
- }
214
- };
215
-
216
- return (
217
- <>
218
- <p>
219
- Lorem ipsum dolor sit amet, consectetur adipiscing elit.
220
- <Button variant="link" isInline component="span">
221
- This is long button text that needs to be a span so that it will wrap inline with the text around it.
222
- </Button> Sed hendrerit nisi in cursus maximus. Ut malesuada nisi turpis, in condimentum velit elementum non.
223
- </p>
224
-
225
- <br />
226
-
227
- <p>
228
- Note that using a <b>span</b> as a button does not fire the <b>onclick</b> event for Enter or Space keys.
229
- <Button variant="link" isInline component="span" onKeyDown={handleKeydown}>
230
- An <b>onKeyDown</b> event listener is needed for Enter and Space key presses to prevent their default behavior
231
- and trigger your code.
232
- </Button> Pressing the Enter or Space keys on the inline link as span above demonstrates this by triggering an alert.
233
- </p>
234
- </>
235
- );
236
- };
50
+ ```ts file="./ButtonInlineSpanLink.tsx"
237
51
  ```
238
52
 
239
53
  ### Block level
240
54
 
241
- ```js
242
- import React from 'react';
243
- import { Button } from '@patternfly/react-core';
244
-
245
- <Button isBlock>Block level button</Button>;
55
+ ```ts file="./ButtonBlock.tsx"
246
56
  ```
247
57
 
248
58
  ### Types
249
59
 
250
- ```js
251
- import React from 'react';
252
- import { Button } from '@patternfly/react-core';
253
-
254
- <React.Fragment>
255
- <Button type="submit">Submit</Button> <Button type="reset">Reset</Button> <Button>Default</Button>
256
- </React.Fragment>;
60
+ ```ts file="./ButtonTypes.tsx"
257
61
  ```
258
62
 
259
63
  ### Small
260
64
 
261
- ```js
262
- import React from 'react';
263
- import { Button } from '@patternfly/react-core';
264
-
265
- <React.Fragment>
266
- <Button variant="primary" isSmall>
267
- Primary
268
- </Button>{' '}
269
- <Button variant="secondary" isSmall>
270
- Secondary
271
- </Button>{' '}
272
- <Button variant="tertiary" isSmall>
273
- Tertiary
274
- </Button>{' '}
275
- <Button variant="danger" isSmall>
276
- Danger
277
- </Button>{' '}
278
- <Button variant="warning" isSmall>
279
- Warning
280
- </Button>
281
- <br />
282
- <br />
283
- </React.Fragment>;
65
+ ```ts file="./ButtonSmall.tsx"
284
66
  ```
285
67
 
286
68
  ### Call to action
287
69
 
288
- ```js
289
- import React from 'react';
290
- import { Button } from '@patternfly/react-core';
291
- import ArrowRightIcon from '@patternfly/react-icons/dist/esm/icons/arrow-right-icon';
292
-
293
- <React.Fragment>
294
- <Button variant="primary" isLarge>
295
- Call to action
296
- </Button>{' '}
297
- <Button variant="secondary" isLarge>
298
- Call to action
299
- </Button>{' '}
300
- <Button variant="tertiary" isLarge>
301
- Call to action
302
- </Button>{' '}
303
- <Button variant="link" isLarge>
304
- Call to action <ArrowRightIcon />
305
- </Button>
306
- <br />
307
- <br />
308
- </React.Fragment>;
70
+ ```ts file="./ButtonCallToAction.tsx"
309
71
  ```
310
72
 
311
73
  ### Progress
312
74
 
313
- ```js
314
- import React from 'react';
315
- import { Button } from '@patternfly/react-core';
316
-
317
- ButtonProgressVariants = () => {
318
- const [isPrimaryLoading, setIsPrimaryLoading] = React.useState(true);
319
- const [isSecondaryLoading, setIsSecondaryLoading] = React.useState(true);
320
- const extraPrimaryProps = {};
321
- if (isPrimaryLoading) {
322
- extraPrimaryProps.spinnerAriaValueText = 'Loading';
323
- }
324
- const extraSecondaryProps = {};
325
- if (isSecondaryLoading) {
326
- extraSecondaryProps.spinnerAriaValueText = 'Loading';
327
- }
328
-
329
- return (
330
- <React.Fragment>
331
- <Button
332
- spinnerAriaValueText={isPrimaryLoading ? 'Loading' : undefined}
333
- isLoading={isPrimaryLoading}
334
- variant="primary"
335
- onClick={() => setIsPrimaryLoading(!isPrimaryLoading)}
336
- {...extraPrimaryProps}
337
- >
338
- {isPrimaryLoading ? 'Click to stop loading' : 'Click to start loading'}
339
- </Button>{' '}
340
- <Button
341
- spinnerAriaValueText={isSecondaryLoading ? 'Loading' : undefined}
342
- isLoading={isSecondaryLoading}
343
- variant="secondary"
344
- onClick={() => setIsSecondaryLoading(!isSecondaryLoading)}
345
- {...extraSecondaryProps}
346
- >
347
- {isSecondaryLoading ? 'Click to stop loading' : 'Click to start loading'}
348
- </Button>
349
- <br />
350
- <br />
351
- </React.Fragment>
352
- );
353
- };
75
+ ```ts file="./ButtonProgress.tsx"
354
76
  ```
355
77
 
356
78
  ### Router link
357
- ```js
358
- import React from 'react';
359
- import { Button } from '@patternfly/react-core';
360
- import { Link } from '@reach/router';
361
79
 
362
- <Button variant="link" component={props => <Link {...props} to="#"/>}>
363
- Router link
364
- </Button>
80
+ ```ts file="./ButtonRouterLink.tsx"
365
81
  ```
366
-
@@ -0,0 +1,43 @@
1
+ import React from 'react';
2
+ import { Button, Flex } from '@patternfly/react-core';
3
+ import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
4
+ import PlusCircleIcon from '@patternfly/react-icons/dist/esm/icons/plus-circle-icon';
5
+
6
+ export const ButtonAriaDisabled: React.FunctionComponent = () => (
7
+ <Flex direction={{ default: 'column' }}>
8
+ <Flex>
9
+ <Button isAriaDisabled>Primary aria disabled</Button>
10
+ <Button isAriaDisabled>Secondary aria disabled</Button>
11
+ <Button variant="secondary" isDanger isAriaDisabled>
12
+ Danger secondary aria disabled
13
+ </Button>
14
+ <Button isAriaDisabled variant="tertiary">
15
+ Tertiary aria disabled
16
+ </Button>
17
+ <Button isAriaDisabled variant="danger">
18
+ Danger disabled
19
+ </Button>
20
+ <Button isAriaDisabled variant="warning">
21
+ Warning disabled
22
+ </Button>
23
+ </Flex>
24
+
25
+ <Flex>
26
+ <Button isAriaDisabled variant="link" icon={<PlusCircleIcon />}>
27
+ Link aria disabled
28
+ </Button>
29
+ <Button isAriaDisabled variant="link" isInline>
30
+ Inline link aria disabled
31
+ </Button>
32
+ <Button variant="link" isDanger isAriaDisabled>
33
+ Danger link disabled
34
+ </Button>
35
+ <Button isAriaDisabled variant="plain" aria-label="Action">
36
+ <TimesIcon />
37
+ </Button>
38
+ <Button isAriaDisabled variant="control">
39
+ Control aria disabled
40
+ </Button>
41
+ </Flex>
42
+ </Flex>
43
+ );
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { Button, Tooltip } from '@patternfly/react-core';
3
+
4
+ export const ButtonAriaDisabledLinkTooltip: React.FunctionComponent = () => (
5
+ <Tooltip content="Aria-disabled link as button with tooltip">
6
+ <Button component="a" isAriaDisabled href="https://pf4.patternfly.org/" target="_blank" variant="tertiary">
7
+ Tertiary link as button to core docs
8
+ </Button>
9
+ </Tooltip>
10
+ );
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { Button, Tooltip } from '@patternfly/react-core';
3
+
4
+ export const ButtonAriaDisabledTooltip: React.FunctionComponent = () => (
5
+ <Tooltip content="Aria-disabled buttons are like disabled buttons, but focusable. Allows for tooltip support.">
6
+ <Button isAriaDisabled variant="secondary">
7
+ Secondary button to core docs
8
+ </Button>
9
+ </Tooltip>
10
+ );
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { Button } from '@patternfly/react-core';
3
+
4
+ export const ButtonBlock: React.FunctionComponent = () => <Button isBlock>Block level button</Button>;
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import { Button, Flex } from '@patternfly/react-core';
3
+ import ArrowRightIcon from '@patternfly/react-icons/dist/esm/icons/arrow-right-icon';
4
+
5
+ export const ButtonCallToAction: React.FunctionComponent = () => (
6
+ <Flex>
7
+ <Button variant="primary" isLarge>
8
+ Call to action
9
+ </Button>
10
+ <Button variant="secondary" isLarge>
11
+ Call to action
12
+ </Button>
13
+ <Button variant="tertiary" isLarge>
14
+ Call to action
15
+ </Button>
16
+ <Button variant="link" isLarge>
17
+ Call to action <ArrowRightIcon />
18
+ </Button>
19
+ </Flex>
20
+ );
@@ -0,0 +1,43 @@
1
+ import React from 'react';
2
+ import { Button, Flex } from '@patternfly/react-core';
3
+ import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
4
+ import PlusCircleIcon from '@patternfly/react-icons/dist/esm/icons/plus-circle-icon';
5
+
6
+ export const ButtonDisabled: React.FunctionComponent = () => (
7
+ <Flex direction={{ default: 'column' }}>
8
+ <Flex>
9
+ <Button isDisabled>Primary disabled</Button>
10
+ <Button isDisabled>Secondary disabled</Button>
11
+ <Button variant="secondary" isDanger isDisabled>
12
+ Danger secondary disabled
13
+ </Button>
14
+ <Button isDisabled variant="tertiary">
15
+ Tertiary disabled
16
+ </Button>
17
+ <Button isDisabled variant="danger">
18
+ Danger disabled
19
+ </Button>
20
+ <Button isDisabled variant="warning">
21
+ Warning disabled
22
+ </Button>
23
+ </Flex>
24
+
25
+ <Flex>
26
+ <Button isDisabled variant="link" icon={<PlusCircleIcon />}>
27
+ Link disabled
28
+ </Button>
29
+ <Button isDisabled variant="link" isInline>
30
+ Inline link disabled
31
+ </Button>
32
+ <Button variant="link" isDanger isDisabled>
33
+ Danger link disabled
34
+ </Button>
35
+ <Button isDisabled variant="plain" aria-label="Action">
36
+ <TimesIcon />
37
+ </Button>
38
+ <Button isDisabled variant="control">
39
+ Control disabled
40
+ </Button>
41
+ </Flex>
42
+ </Flex>
43
+ );
@@ -0,0 +1,36 @@
1
+ import React from 'react';
2
+ import { Button } from '@patternfly/react-core';
3
+
4
+ const handleKeydown = (event: React.KeyboardEvent<HTMLButtonElement>) => {
5
+ const { key } = event;
6
+ const isEnterKey: boolean = key === 'Enter';
7
+ const isEnterOrSpaceKey: boolean = isEnterKey || key === 'Space';
8
+
9
+ if (isEnterOrSpaceKey) {
10
+ event.preventDefault();
11
+ alert(`${isEnterKey ? 'Enter' : 'Space'} key default behavior stopped by onKeyDown`);
12
+ }
13
+ };
14
+
15
+ export const ButtonInlineSpanLink: React.FunctionComponent = () => (
16
+ <>
17
+ <p>
18
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit.
19
+ <Button variant="link" isInline component="span">
20
+ This is long button text that needs to be a span so that it will wrap inline with the text around it.
21
+ </Button>
22
+ Sed hendrerit nisi in cursus maximus. Ut malesuada nisi turpis, in condimentum velit elementum non.
23
+ </p>
24
+
25
+ <br />
26
+
27
+ <p>
28
+ Note that using a <b>span</b> as a button does not fire the <b>onclick</b> event for Enter or Space keys.
29
+ <Button variant="link" isInline component="span" onKeyDown={handleKeydown}>
30
+ An <b>onKeyDown</b> event listener is needed for Enter and Space key presses to prevent their default behavior
31
+ and trigger your code.
32
+ </Button>
33
+ Pressing the Enter or Space keys on the inline link as span above demonstrates this by triggering an alert.
34
+ </p>
35
+ </>
36
+ );
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import { Button, Flex } from '@patternfly/react-core';
3
+
4
+ export const ButtonLinks: React.FunctionComponent = () => (
5
+ <Flex>
6
+ <Button component="a" href="https://pf4.patternfly.org/" target="_blank" variant="primary">
7
+ Link to core docs
8
+ </Button>
9
+ <Button component="a" href="https://pf4.patternfly.org/" target="_blank" variant="secondary">
10
+ Secondary link to core docs
11
+ </Button>
12
+ <Button isDisabled component="a" href="https://pf4.patternfly.org/" target="_blank" variant="tertiary">
13
+ Tertiary link to core docs
14
+ </Button>
15
+ <Button component="a" href="https://pf4.patternfly.org/contribution/#modifiers" variant="link">
16
+ Jump to modifiers in contribution guidelines
17
+ </Button>
18
+ </Flex>
19
+ );
@@ -0,0 +1,29 @@
1
+ import React from 'react';
2
+ import { Button, Flex } from '@patternfly/react-core';
3
+
4
+ export const ButtonProgress: React.FunctionComponent = () => {
5
+ const [isPrimaryLoading, setIsPrimaryLoading] = React.useState<boolean>(true);
6
+ const [isSecondaryLoading, setIsSecondaryLoading] = React.useState<boolean>(true);
7
+
8
+ return (
9
+ <Flex>
10
+ <Button
11
+ isLoading={isPrimaryLoading}
12
+ variant="primary"
13
+ onClick={() => setIsPrimaryLoading(!isPrimaryLoading)}
14
+ {...(isPrimaryLoading && { spinnerAriaValueText: 'Loading' })}
15
+ >
16
+ {isPrimaryLoading ? 'Click to stop loading' : 'Click to start loading'}
17
+ </Button>
18
+
19
+ <Button
20
+ isLoading={isSecondaryLoading}
21
+ variant="secondary"
22
+ onClick={() => setIsSecondaryLoading(!isSecondaryLoading)}
23
+ {...(isSecondaryLoading && { spinnerAriaValueText: 'Loading' })}
24
+ >
25
+ {isSecondaryLoading ? 'Click to stop loading' : 'Click to start loading'}
26
+ </Button>
27
+ </Flex>
28
+ );
29
+ };
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { Button } from '@patternfly/react-core';
3
+ import { Link } from '@reach/router';
4
+
5
+ export const ButtonRouterLink: React.FunctionComponent = () => (
6
+ <Button variant="link" component={(props: any) => <Link {...props} to="#" />}>
7
+ Router link
8
+ </Button>
9
+ );
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import { Button, Flex } from '@patternfly/react-core';
3
+
4
+ export const ButtonSmall: React.FunctionComponent = () => (
5
+ <Flex>
6
+ <Button variant="primary" isSmall>
7
+ Primary
8
+ </Button>
9
+ <Button variant="secondary" isSmall>
10
+ Secondary
11
+ </Button>
12
+ <Button variant="tertiary" isSmall>
13
+ Tertiary
14
+ </Button>
15
+ <Button variant="danger" isSmall>
16
+ Danger
17
+ </Button>
18
+ <Button variant="warning" isSmall>
19
+ Warning
20
+ </Button>
21
+ </Flex>
22
+ );
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { Button, Flex } from '@patternfly/react-core';
3
+
4
+ export const ButtonTypes: React.FunctionComponent = () => (
5
+ <Flex>
6
+ <Button type="submit">Submit</Button>
7
+ <Button type="reset">Reset</Button>
8
+ <Button>Default</Button>
9
+ </Flex>
10
+ );
@@ -0,0 +1,47 @@
1
+ import React from 'react';
2
+ import { Button, Flex } from '@patternfly/react-core';
3
+ import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
4
+ import PlusCircleIcon from '@patternfly/react-icons/dist/esm/icons/plus-circle-icon';
5
+ import ExternalLinkSquareAltIcon from '@patternfly/react-icons/dist/esm/icons/external-link-square-alt-icon';
6
+ import CopyIcon from '@patternfly/react-icons/dist/esm/icons/copy-icon';
7
+
8
+ export const ButtonVariations: React.FunctionComponent = () => (
9
+ <Flex direction={{ default: 'column' }} alignItems={{ default: 'alignItemsFlexStart' }}>
10
+ <Flex>
11
+ <Button variant="primary">Primary</Button>
12
+ <Button variant="secondary">Secondary</Button>
13
+ <Button variant="secondary" isDanger>
14
+ Danger Secondary
15
+ </Button>
16
+ <Button variant="tertiary">Tertiary</Button>
17
+ <Button variant="danger">Danger</Button>
18
+ <Button variant="warning">Warning</Button>
19
+ </Flex>
20
+
21
+ <Flex>
22
+ <Button variant="link" icon={<PlusCircleIcon />}>
23
+ Link
24
+ </Button>
25
+ <Button variant="link" icon={<ExternalLinkSquareAltIcon />} iconPosition="right">
26
+ Link
27
+ </Button>
28
+ <Button variant="link" isInline>
29
+ Inline link
30
+ </Button>
31
+ <Button variant="link" isDanger>
32
+ Danger link
33
+ </Button>
34
+ </Flex>
35
+
36
+ <Button variant="plain" aria-label="Action">
37
+ <TimesIcon />
38
+ </Button>
39
+
40
+ <Flex>
41
+ <Button variant="control">Control</Button>
42
+ <Button variant="control" aria-label="Copy">
43
+ <CopyIcon />
44
+ </Button>
45
+ </Flex>
46
+ </Flex>
47
+ );
package/src/demos/Tabs.md CHANGED
@@ -444,9 +444,16 @@ TabsOpenWithSecondaryTabsDemo = () => {
444
444
  ```
445
445
 
446
446
  ### Nested tabs
447
+
447
448
  ```js isFullscreen file="./Tabs/NestedTabsDemo.js"
448
449
  ```
449
450
 
450
451
  ### Tables and tabs
452
+
451
453
  ```js isFullscreen file="./examples/Tabs/TabsAndTable.tsx"
452
454
  ```
455
+
456
+ ### Modal tabs
457
+
458
+ ```js isFullscreen file="./examples/Tabs/ModalTabs.tsx"
459
+ ```
@@ -0,0 +1,142 @@
1
+ import React from 'react';
2
+ import DashboardWrapper from '../DashboardWrapper';
3
+ import {
4
+ PageSection,
5
+ TextContent,
6
+ Text,
7
+ Gallery,
8
+ Card,
9
+ CardBody,
10
+ CardTitle,
11
+ PageSectionVariants,
12
+ Modal,
13
+ ModalVariant,
14
+ Tab,
15
+ Tabs,
16
+ TabTitleText,
17
+ List,
18
+ ListItem,
19
+ Grid,
20
+ GridItem,
21
+ TabContent
22
+ } from '@patternfly/react-core';
23
+
24
+ interface Product {
25
+ id: number;
26
+ name: string;
27
+ description: string;
28
+ }
29
+
30
+ const products: Product[] = [
31
+ {
32
+ id: 0,
33
+ name: 'PatternFly',
34
+ description: 'PatternFly is a community project that promotes design commonality and improves user experience.'
35
+ },
36
+ {
37
+ id: 1,
38
+ name: 'ActiveMQ',
39
+ description:
40
+ 'The ActiveMQ component allows messages to be sent to a JMS Queue or Topic; or messages to be consumed from a JMS Queue or Topic using Apache ActiveMQ.'
41
+ },
42
+ {
43
+ id: 2,
44
+ name: 'Apache Spark',
45
+ description: 'This documentation page covers the Apache Spark component for the Apache Camel.'
46
+ }
47
+ ];
48
+
49
+ export const ModalTabs: React.FunctionComponent = () => {
50
+ const [isModalOpen, setIsModalOpen] = React.useState(false);
51
+ const [selectedProduct, setSelectedProduct] = React.useState<Product>();
52
+ const [activeTabKey, setActiveTabKey] = React.useState<string | number>(0);
53
+
54
+ const onCardClick = React.useCallback(
55
+ (product: Product) => () => {
56
+ setSelectedProduct(product);
57
+ setIsModalOpen(true);
58
+ },
59
+ []
60
+ );
61
+
62
+ const onCardKeyPress = React.useCallback(
63
+ (product: Product) => (event: React.KeyboardEvent<HTMLElement>) => {
64
+ if (event.key === 'Enter' || event.key === ' ') {
65
+ onCardClick(product)();
66
+ }
67
+ },
68
+ []
69
+ );
70
+
71
+ const closeModal = React.useCallback(() => {
72
+ setSelectedProduct(undefined);
73
+ setIsModalOpen(false);
74
+ setActiveTabKey(0);
75
+ }, []);
76
+
77
+ const onTabSelect = React.useCallback(
78
+ (_event: React.MouseEvent<HTMLElement, MouseEvent>, tabIndex: string | number) => setActiveTabKey(tabIndex),
79
+ []
80
+ );
81
+
82
+ return (
83
+ <React.Fragment>
84
+ <DashboardWrapper mainContainerId="main-content-card-view-default-nav" breadcrumb={null}>
85
+ <PageSection variant={PageSectionVariants.light}>
86
+ <TextContent>
87
+ <Text component="h1">Projects</Text>
88
+ <Text component="p">Click any project card to view Tabs within Modals.</Text>
89
+ </TextContent>
90
+ </PageSection>
91
+ <PageSection isFilled>
92
+ <Gallery hasGutter>
93
+ {products.map(product => (
94
+ <Card
95
+ isSelectable
96
+ isSelectableRaised
97
+ isCompact
98
+ key={product.id}
99
+ onClick={onCardClick(product)}
100
+ onKeyPress={onCardKeyPress(product)}
101
+ >
102
+ <CardTitle>{product.name}</CardTitle>
103
+ <CardBody>{product.description}</CardBody>
104
+ </Card>
105
+ ))}
106
+ </Gallery>
107
+ </PageSection>
108
+ </DashboardWrapper>
109
+
110
+ {selectedProduct && (
111
+ <Modal variant={ModalVariant.small} title={selectedProduct.name} isOpen={isModalOpen} onClose={closeModal}>
112
+ <Grid hasGutter>
113
+ <GridItem>
114
+ <Tabs activeKey={activeTabKey} onSelect={onTabSelect} isSecondary>
115
+ <Tab eventKey={0} tabContentId="details-tab" title={<TabTitleText>Details</TabTitleText>} />
116
+ <Tab eventKey={1} tabContentId="doc-tab" title={<TabTitleText>Documentation</TabTitleText>} />
117
+ </Tabs>
118
+ </GridItem>
119
+ <GridItem>
120
+ <TabContent eventKey={0} id="details-tab" hidden={activeTabKey !== 0}>
121
+ {selectedProduct.description}
122
+ </TabContent>
123
+ <TabContent eventKey={1} id="doc-tab" hidden={activeTabKey !== 1}>
124
+ <List>
125
+ <ListItem>
126
+ <a>Doc link 1</a>
127
+ </ListItem>
128
+ <ListItem>
129
+ <a>Doc link 2</a>
130
+ </ListItem>
131
+ <ListItem>
132
+ <a>Doc link 3</a>
133
+ </ListItem>
134
+ </List>
135
+ </TabContent>
136
+ </GridItem>
137
+ </Grid>
138
+ </Modal>
139
+ )}
140
+ </React.Fragment>
141
+ );
142
+ };