@patternfly/react-core 4.203.1 → 4.205.0
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 +30 -0
- package/dist/esm/components/Form/Form.d.ts +3 -1
- package/dist/esm/components/Form/Form.d.ts.map +1 -1
- package/dist/esm/components/Form/Form.js +4 -2
- package/dist/esm/components/Form/Form.js.map +1 -1
- package/dist/esm/components/ProgressStepper/ProgressStep.d.ts +3 -5
- package/dist/esm/components/ProgressStepper/ProgressStep.d.ts.map +1 -1
- package/dist/esm/components/ProgressStepper/ProgressStep.js +6 -6
- package/dist/esm/components/ProgressStepper/ProgressStep.js.map +1 -1
- package/dist/esm/components/Switch/Switch.d.ts +7 -5
- package/dist/esm/components/Switch/Switch.d.ts.map +1 -1
- package/dist/esm/components/Switch/Switch.js +3 -1
- package/dist/esm/components/Switch/Switch.js.map +1 -1
- package/dist/js/components/Form/Form.d.ts +3 -1
- package/dist/js/components/Form/Form.d.ts.map +1 -1
- package/dist/js/components/Form/Form.js +4 -2
- package/dist/js/components/Form/Form.js.map +1 -1
- package/dist/js/components/ProgressStepper/ProgressStep.d.ts +3 -5
- package/dist/js/components/ProgressStepper/ProgressStep.d.ts.map +1 -1
- package/dist/js/components/ProgressStepper/ProgressStep.js +7 -6
- package/dist/js/components/ProgressStepper/ProgressStep.js.map +1 -1
- package/dist/js/components/Switch/Switch.d.ts +7 -5
- package/dist/js/components/Switch/Switch.d.ts.map +1 -1
- package/dist/js/components/Switch/Switch.js +3 -1
- package/dist/js/components/Switch/Switch.js.map +1 -1
- package/dist/umd/react-core.css +102 -14
- package/dist/umd/react-core.js +18 -9
- package/dist/umd/react-core.min.css +255 -167
- package/dist/umd/react-core.min.js +4 -4
- package/package.json +6 -6
- package/src/components/Form/Form.tsx +11 -2
- package/src/components/ProgressStepper/ProgressStep.tsx +10 -15
- package/src/components/ProgressStepper/__tests__/ProgressStepper.test.tsx +1 -1
- package/src/components/ProgressStepper/examples/ProgressStepper.md +13 -20
- package/src/components/Switch/Switch.tsx +13 -5
- package/src/components/Switch/examples/Switch.md +64 -5
- package/src/components/Toolbar/examples/Toolbar.md +7 -39
- package/src/demos/Tabs.md +6 -1
- package/src/demos/examples/DashboardWrapper.js +16 -2
- package/src/demos/examples/Tabs/GrayTabs.tsx +2 -8
- package/src/demos/examples/Tabs/ModalTabs.tsx +1 -1
- package/src/demos/{Tabs/NestedTabsDemo.js → examples/Tabs/NestedTabs.tsx} +12 -13
- package/src/demos/examples/Tabs/NestedUnindentedTabs.tsx +174 -0
- package/src/demos/examples/Tabs/TabsAndTable.tsx +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.205.0",
|
|
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,16 +34,16 @@
|
|
|
34
34
|
"generate": "node scripts/copyStyles.js"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@patternfly/react-icons": "^4.
|
|
38
|
-
"@patternfly/react-styles": "^4.
|
|
39
|
-
"@patternfly/react-tokens": "^4.
|
|
37
|
+
"@patternfly/react-icons": "^4.56.0",
|
|
38
|
+
"@patternfly/react-styles": "^4.55.0",
|
|
39
|
+
"@patternfly/react-tokens": "^4.57.0",
|
|
40
40
|
"focus-trap": "6.2.2",
|
|
41
41
|
"react-dropzone": "9.0.0",
|
|
42
42
|
"tippy.js": "5.1.2",
|
|
43
43
|
"tslib": "^2.0.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@patternfly/patternfly": "4.
|
|
46
|
+
"@patternfly/patternfly": "4.190.0",
|
|
47
47
|
"@rollup/plugin-commonjs": "^21.0.0",
|
|
48
48
|
"@rollup/plugin-node-resolve": "^13.0.0",
|
|
49
49
|
"@rollup/plugin-replace": "^3.0.0",
|
|
@@ -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": "
|
|
63
|
+
"gitHead": "aad64697166a03d35c3e711df51f25ec0d517623"
|
|
64
64
|
}
|
|
@@ -9,8 +9,10 @@ export interface FormProps extends React.HTMLProps<HTMLFormElement> {
|
|
|
9
9
|
className?: string;
|
|
10
10
|
/** Sets the Form to horizontal. */
|
|
11
11
|
isHorizontal?: boolean;
|
|
12
|
-
/**
|
|
12
|
+
/** Limits the max-width of the form. */
|
|
13
13
|
isWidthLimited?: boolean;
|
|
14
|
+
/** Sets a custom max-width for the form. */
|
|
15
|
+
maxWidth?: string;
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
export const Form: React.FunctionComponent<FormProps> = ({
|
|
@@ -18,15 +20,22 @@ export const Form: React.FunctionComponent<FormProps> = ({
|
|
|
18
20
|
className = '',
|
|
19
21
|
isHorizontal = false,
|
|
20
22
|
isWidthLimited = false,
|
|
23
|
+
maxWidth = '',
|
|
21
24
|
...props
|
|
22
25
|
}: FormProps) => (
|
|
23
26
|
<form
|
|
24
27
|
noValidate
|
|
28
|
+
{...(maxWidth && {
|
|
29
|
+
style: {
|
|
30
|
+
'--pf-c-form--m-limit-width--MaxWidth': maxWidth,
|
|
31
|
+
...props.style
|
|
32
|
+
} as React.CSSProperties
|
|
33
|
+
})}
|
|
25
34
|
{...props}
|
|
26
35
|
className={css(
|
|
27
36
|
styles.form,
|
|
28
37
|
isHorizontal && styles.modifiers.horizontal,
|
|
29
|
-
isWidthLimited && styles.modifiers.limitWidth,
|
|
38
|
+
(isWidthLimited || maxWidth) && styles.modifiers.limitWidth,
|
|
30
39
|
className
|
|
31
40
|
)}
|
|
32
41
|
>
|
|
@@ -22,13 +22,11 @@ export interface ProgressStepProps
|
|
|
22
22
|
description?: string;
|
|
23
23
|
/** ID of the title of the progress step. */
|
|
24
24
|
titleId?: string;
|
|
25
|
-
/** Popover for a progress step. */
|
|
26
|
-
popover?: React.ReactNode;
|
|
27
|
-
/** @hide Forwarded reference to title container */
|
|
28
|
-
innerRef?: React.Ref<any>;
|
|
29
25
|
/** Accessible label for the progress step. Should communicate all information being communicated by the progress
|
|
30
26
|
* step's icon, including the variant and the completed status. */
|
|
31
27
|
'aria-label'?: string;
|
|
28
|
+
/** Forwards the step ref to rendered function. Use this prop to add a popover to the step.*/
|
|
29
|
+
popoverRender?: (stepRef: React.RefObject<any>) => React.ReactNode;
|
|
32
30
|
}
|
|
33
31
|
|
|
34
32
|
const variantIcons = {
|
|
@@ -49,7 +47,7 @@ const variantStyle = {
|
|
|
49
47
|
danger: styles.modifiers.danger
|
|
50
48
|
};
|
|
51
49
|
|
|
52
|
-
const
|
|
50
|
+
export const ProgressStep: React.FunctionComponent<ProgressStepProps> = ({
|
|
53
51
|
children,
|
|
54
52
|
className,
|
|
55
53
|
variant,
|
|
@@ -57,13 +55,13 @@ const ProgressStepBase: React.FunctionComponent<ProgressStepProps> = ({
|
|
|
57
55
|
description,
|
|
58
56
|
icon,
|
|
59
57
|
titleId,
|
|
60
|
-
popover,
|
|
61
|
-
innerRef,
|
|
62
58
|
'aria-label': ariaLabel,
|
|
59
|
+
popoverRender,
|
|
63
60
|
...props
|
|
64
61
|
}: ProgressStepProps) => {
|
|
65
62
|
const _icon = icon !== undefined ? icon : variantIcons[variant];
|
|
66
|
-
const Component =
|
|
63
|
+
const Component = popoverRender !== undefined ? 'span' : 'div';
|
|
64
|
+
const stepRef = React.useRef();
|
|
67
65
|
|
|
68
66
|
if (props.id === undefined || titleId === undefined) {
|
|
69
67
|
/* eslint-disable no-console */
|
|
@@ -89,14 +87,14 @@ const ProgressStepBase: React.FunctionComponent<ProgressStepProps> = ({
|
|
|
89
87
|
</div>
|
|
90
88
|
<div className={css(styles.progressStepperStepMain)}>
|
|
91
89
|
<Component
|
|
92
|
-
className={css(styles.progressStepperStepTitle,
|
|
90
|
+
className={css(styles.progressStepperStepTitle, popoverRender && styles.modifiers.helpText)}
|
|
93
91
|
id={titleId}
|
|
94
|
-
ref={
|
|
95
|
-
{...(
|
|
92
|
+
ref={stepRef}
|
|
93
|
+
{...(popoverRender && { tabIndex: 0, role: 'button', type: 'button' })}
|
|
96
94
|
{...(props.id !== undefined && titleId !== undefined && { 'aria-labelledby': `${props.id} ${titleId}` })}
|
|
97
95
|
>
|
|
98
96
|
{children}
|
|
99
|
-
{
|
|
97
|
+
{popoverRender && popoverRender(stepRef)}
|
|
100
98
|
</Component>
|
|
101
99
|
{description && <div className={css(styles.progressStepperStepDescription)}>{description}</div>}
|
|
102
100
|
</div>
|
|
@@ -104,7 +102,4 @@ const ProgressStepBase: React.FunctionComponent<ProgressStepProps> = ({
|
|
|
104
102
|
);
|
|
105
103
|
};
|
|
106
104
|
|
|
107
|
-
export const ProgressStep = React.forwardRef((props: ProgressStepProps, ref: React.Ref<HTMLSpanElement>) => (
|
|
108
|
-
<ProgressStepBase innerRef={ref} {...props} />
|
|
109
|
-
));
|
|
110
105
|
ProgressStep.displayName = 'ProgressStep';
|
|
@@ -87,7 +87,7 @@ describe('ProgressStep', () => {
|
|
|
87
87
|
});
|
|
88
88
|
|
|
89
89
|
test('renders help text styling', () => {
|
|
90
|
-
const view = render(<ProgressStep
|
|
90
|
+
const view = render(<ProgressStep popoverRender={({ stepRef }) => (<div></div>)}>Title</ProgressStep>);
|
|
91
91
|
expect(view.container).toMatchSnapshot();
|
|
92
92
|
});
|
|
93
93
|
|
|
@@ -331,17 +331,13 @@ import PendingIcon from '@patternfly/react-icons/dist/esm/icons/pending-icon';
|
|
|
331
331
|
|
|
332
332
|
### With help popover
|
|
333
333
|
|
|
334
|
-
To add a popover to a progress step, set the `
|
|
334
|
+
To add a popover to a progress step, set the `popoverRender` properties on the `ProgressStep` component.
|
|
335
335
|
|
|
336
336
|
```js
|
|
337
337
|
import React from 'react';
|
|
338
338
|
import { ProgressStepper, ProgressStep, Popover } from '@patternfly/react-core';
|
|
339
339
|
|
|
340
340
|
PopoverProgressStep = () => {
|
|
341
|
-
const firstStepRef = React.useRef();
|
|
342
|
-
const secondStepRef = React.useRef();
|
|
343
|
-
const thirdStepRef = React.useRef();
|
|
344
|
-
|
|
345
341
|
return (
|
|
346
342
|
<ProgressStepper>
|
|
347
343
|
<ProgressStep
|
|
@@ -349,55 +345,52 @@ PopoverProgressStep = () => {
|
|
|
349
345
|
id="popover-step1"
|
|
350
346
|
titleId="popover-step1-title"
|
|
351
347
|
aria-label="completed step with popover, step with success"
|
|
352
|
-
|
|
348
|
+
popoverRender={( stepRef ) => (
|
|
353
349
|
<Popover
|
|
354
350
|
aria-label="First step help"
|
|
355
351
|
headerContent={<div>First step popover</div>}
|
|
356
352
|
bodyContent={<div>Additional info or help text content.</div>}
|
|
357
|
-
reference={
|
|
353
|
+
reference={stepRef}
|
|
358
354
|
position="right"
|
|
359
355
|
/>
|
|
360
|
-
|
|
361
|
-
ref={firstStepRef}
|
|
356
|
+
)}
|
|
362
357
|
>
|
|
363
|
-
First
|
|
358
|
+
First step
|
|
364
359
|
</ProgressStep>
|
|
365
360
|
<ProgressStep
|
|
366
361
|
variant="danger"
|
|
367
362
|
id="popover-step2"
|
|
368
363
|
titleId="popover-step2-title"
|
|
369
364
|
aria-label="completed step with popover, step with danger"
|
|
370
|
-
|
|
365
|
+
popoverRender={( stepRef ) => (
|
|
371
366
|
<Popover
|
|
372
367
|
aria-label="Second step help"
|
|
373
368
|
headerContent={<div>Second step popover</div>}
|
|
374
369
|
bodyContent={<div>Additional info or help text content.</div>}
|
|
375
|
-
reference={
|
|
370
|
+
reference={stepRef}
|
|
376
371
|
position="right"
|
|
377
372
|
/>
|
|
378
|
-
}
|
|
379
|
-
ref={secondStepRef}
|
|
373
|
+
)}
|
|
380
374
|
>
|
|
381
|
-
Second
|
|
375
|
+
Second step
|
|
382
376
|
</ProgressStep>
|
|
383
377
|
<ProgressStep
|
|
384
378
|
variant="info"
|
|
385
379
|
id="popover-step3"
|
|
386
380
|
titleId="popover-step3-title"
|
|
387
381
|
aria-label="step with popover"
|
|
388
|
-
|
|
382
|
+
popoverRender={(stepRef) => (
|
|
389
383
|
<Popover
|
|
390
384
|
aria-label="Third step help"
|
|
391
385
|
headerContent={<div>Third step popover</div>}
|
|
392
386
|
bodyContent={<div>Additional info or help text content.</div>}
|
|
393
|
-
reference={
|
|
387
|
+
reference={stepRef}
|
|
394
388
|
position="right"
|
|
395
389
|
/>
|
|
396
|
-
}
|
|
390
|
+
)}
|
|
397
391
|
isCurrent
|
|
398
|
-
ref={thirdStepRef}
|
|
399
392
|
>
|
|
400
|
-
Third
|
|
393
|
+
Third step
|
|
401
394
|
</ProgressStep>
|
|
402
395
|
<ProgressStep variant="pending" id="popover-step4" titleId="popover-step4-title" aria-label="pending step">
|
|
403
396
|
Fourth step
|
|
@@ -10,19 +10,21 @@ export interface SwitchProps
|
|
|
10
10
|
OUIAProps {
|
|
11
11
|
/** id for the label. */
|
|
12
12
|
id?: string;
|
|
13
|
-
/** Additional classes added to the
|
|
13
|
+
/** Additional classes added to the switch */
|
|
14
14
|
className?: string;
|
|
15
15
|
/** Text value for the label when on */
|
|
16
16
|
label?: React.ReactNode;
|
|
17
17
|
/** Text value for the label when off */
|
|
18
18
|
labelOff?: React.ReactNode;
|
|
19
|
-
/** Flag to show if the
|
|
19
|
+
/** Flag to show if the switch is checked. */
|
|
20
20
|
isChecked?: boolean;
|
|
21
|
-
/** Flag to show if the
|
|
21
|
+
/** Flag to show if the switch has a check icon. */
|
|
22
|
+
hasCheckIcon?: boolean;
|
|
23
|
+
/** Flag to show if the switch is disabled. */
|
|
22
24
|
isDisabled?: boolean;
|
|
23
|
-
/** A callback for when the
|
|
25
|
+
/** A callback for when the switch selection changes. (isChecked, event) => {} */
|
|
24
26
|
onChange?: (checked: boolean, event: React.FormEvent<HTMLInputElement>) => void;
|
|
25
|
-
/** Adds accessible text to the
|
|
27
|
+
/** Adds accessible text to the switch, and should describe the isChecked="true" state. When label is defined, aria-label should be set to the text string that is visible when isChecked is true. */
|
|
26
28
|
'aria-label'?: string;
|
|
27
29
|
/** Flag to reverse the layout of toggle and label (toggle on right). */
|
|
28
30
|
isReversed?: boolean;
|
|
@@ -61,6 +63,7 @@ export class Switch extends React.Component<SwitchProps & OUIAProps, { ouiaState
|
|
|
61
63
|
label,
|
|
62
64
|
labelOff,
|
|
63
65
|
isChecked,
|
|
66
|
+
hasCheckIcon,
|
|
64
67
|
isDisabled,
|
|
65
68
|
onChange,
|
|
66
69
|
isReversed,
|
|
@@ -96,6 +99,11 @@ export class Switch extends React.Component<SwitchProps & OUIAProps, { ouiaState
|
|
|
96
99
|
>
|
|
97
100
|
{label}
|
|
98
101
|
</span>
|
|
102
|
+
{hasCheckIcon && (
|
|
103
|
+
<div className={css(styles.switchToggleIcon)} aria-hidden="true">
|
|
104
|
+
<CheckIcon noVerticalAlign />
|
|
105
|
+
</div>
|
|
106
|
+
)}
|
|
99
107
|
<span
|
|
100
108
|
className={css(styles.switchLabel, styles.modifiers.off)}
|
|
101
109
|
id={isAriaLabelledBy ? `${this.id}-off` : null}
|
|
@@ -7,7 +7,9 @@ ouia: true
|
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## Examples
|
|
10
|
+
|
|
10
11
|
### Basic
|
|
12
|
+
|
|
11
13
|
```js
|
|
12
14
|
import React from 'react';
|
|
13
15
|
import { Switch } from '@patternfly/react-core';
|
|
@@ -39,6 +41,7 @@ class SimpleSwitch extends React.Component {
|
|
|
39
41
|
```
|
|
40
42
|
|
|
41
43
|
### Reversed Layout
|
|
44
|
+
|
|
42
45
|
```js
|
|
43
46
|
import React from 'react';
|
|
44
47
|
import { Switch } from '@patternfly/react-core';
|
|
@@ -71,6 +74,7 @@ class ReversedSwitch extends React.Component {
|
|
|
71
74
|
```
|
|
72
75
|
|
|
73
76
|
### Without label
|
|
77
|
+
|
|
74
78
|
```js
|
|
75
79
|
import React from 'react';
|
|
76
80
|
import { Switch } from '@patternfly/react-core';
|
|
@@ -95,13 +99,55 @@ class NoLabelSwitch extends React.Component {
|
|
|
95
99
|
}
|
|
96
100
|
```
|
|
97
101
|
|
|
102
|
+
### Checked with label
|
|
103
|
+
|
|
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
|
+
}
|
|
134
|
+
```
|
|
135
|
+
|
|
98
136
|
### Disabled
|
|
137
|
+
|
|
99
138
|
```js
|
|
100
139
|
import React from 'react';
|
|
101
140
|
import { Switch } from '@patternfly/react-core';
|
|
102
141
|
|
|
103
142
|
<React.Fragment>
|
|
104
|
-
<Switch
|
|
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
|
+
/>
|
|
105
151
|
<br />
|
|
106
152
|
<Switch
|
|
107
153
|
id="disabled-switch-off"
|
|
@@ -115,21 +161,34 @@ import { Switch } from '@patternfly/react-core';
|
|
|
115
161
|
<Switch id="disabled-no-label-switch-on" aria-label="Message when on" isChecked isDisabled />
|
|
116
162
|
<br />
|
|
117
163
|
<Switch id="disabled-no-label-switch-off" aria-label="Message when on" isChecked={false} isDisabled />
|
|
118
|
-
</React.Fragment
|
|
164
|
+
</React.Fragment>;
|
|
119
165
|
```
|
|
120
166
|
|
|
121
167
|
### Uncontrolled
|
|
168
|
+
|
|
122
169
|
```js
|
|
123
170
|
import React from 'react';
|
|
124
171
|
import { Switch } from '@patternfly/react-core';
|
|
125
172
|
|
|
126
173
|
<React.Fragment>
|
|
127
|
-
<Switch
|
|
174
|
+
<Switch
|
|
175
|
+
id="uncontrolled-switch-on"
|
|
176
|
+
aria-label="Message when on"
|
|
177
|
+
label="Message when on"
|
|
178
|
+
labelOff="Message when off"
|
|
179
|
+
isChecked
|
|
180
|
+
/>
|
|
128
181
|
<br />
|
|
129
|
-
<Switch
|
|
182
|
+
<Switch
|
|
183
|
+
id="uncontrolled-switch-off"
|
|
184
|
+
aria-label="Message when on"
|
|
185
|
+
label="Message when on"
|
|
186
|
+
labelOff="Message when off"
|
|
187
|
+
isChecked={false}
|
|
188
|
+
/>
|
|
130
189
|
<br />
|
|
131
190
|
<Switch id="uncontrolled-no-label-switch-on" aria-label="Message when on" isChecked />
|
|
132
191
|
<br />
|
|
133
192
|
<Switch id="uncontrolled-no-label-switch-off" aria-label="Message when on" isChecked={false} />
|
|
134
|
-
</React.Fragment
|
|
193
|
+
</React.Fragment>;
|
|
135
194
|
```
|
|
@@ -20,7 +20,7 @@ Toolbar items are individual components that can be placed inside of a toolbar.
|
|
|
20
20
|
```js
|
|
21
21
|
import React from 'react';
|
|
22
22
|
import { Toolbar, ToolbarItem, ToolbarContent } from '@patternfly/react-core';
|
|
23
|
-
import { Button,
|
|
23
|
+
import { Button, SearchInput } from '@patternfly/react-core';
|
|
24
24
|
|
|
25
25
|
class ToolbarItems extends React.Component {
|
|
26
26
|
constructor(props) {
|
|
@@ -133,7 +133,7 @@ class ToolbarSpacers extends React.Component {
|
|
|
133
133
|
|
|
134
134
|
```js
|
|
135
135
|
import React from 'react';
|
|
136
|
-
import { Toolbar, ToolbarItem,
|
|
136
|
+
import { Toolbar, ToolbarItem, ToolbarContent } from '@patternfly/react-core';
|
|
137
137
|
import { Button } from '@patternfly/react-core';
|
|
138
138
|
|
|
139
139
|
class ToolbarWidths extends React.Component {
|
|
@@ -237,16 +237,7 @@ class ToolbarSpacers extends React.Component {
|
|
|
237
237
|
|
|
238
238
|
```js
|
|
239
239
|
import React from 'react';
|
|
240
|
-
import {
|
|
241
|
-
Toolbar,
|
|
242
|
-
ToolbarItem,
|
|
243
|
-
ToolbarContent,
|
|
244
|
-
Button,
|
|
245
|
-
ButtonVariant,
|
|
246
|
-
InputGroup,
|
|
247
|
-
TextInput,
|
|
248
|
-
Checkbox
|
|
249
|
-
} from '@patternfly/react-core';
|
|
240
|
+
import { Toolbar, ToolbarItem, ToolbarContent, SearchInput, Checkbox } from '@patternfly/react-core';
|
|
250
241
|
import SearchIcon from '@patternfly/react-icons/dist/esm/icons/search-icon';
|
|
251
242
|
|
|
252
243
|
const ToolbarItems = () => {
|
|
@@ -261,12 +252,7 @@ const ToolbarItems = () => {
|
|
|
261
252
|
<Toolbar id="toolbar-spacers" inset={{ default: 'insetNone' }} isSticky={isSticky}>
|
|
262
253
|
<ToolbarContent>
|
|
263
254
|
<ToolbarItem>
|
|
264
|
-
<
|
|
265
|
-
<TextInput name="textInput1" id="textInput1" type="search" aria-label="search input example" />
|
|
266
|
-
<Button variant={ButtonVariant.control} aria-label="search button for search input">
|
|
267
|
-
<SearchIcon />
|
|
268
|
-
</Button>
|
|
269
|
-
</InputGroup>
|
|
255
|
+
<SearchInput aria-label="search input example" />
|
|
270
256
|
</ToolbarItem>
|
|
271
257
|
<ToolbarItem>
|
|
272
258
|
<Checkbox
|
|
@@ -500,15 +486,7 @@ A toggle group can be used when you want to collapse a set of items into an over
|
|
|
500
486
|
```js
|
|
501
487
|
import React from 'react';
|
|
502
488
|
import { Toolbar, ToolbarItem, ToolbarContent, ToolbarToggleGroup, ToolbarGroup } from '@patternfly/react-core';
|
|
503
|
-
import {
|
|
504
|
-
Button,
|
|
505
|
-
ButtonVariant,
|
|
506
|
-
InputGroup,
|
|
507
|
-
Select,
|
|
508
|
-
SelectOption,
|
|
509
|
-
SelectVariant,
|
|
510
|
-
SearchInput
|
|
511
|
-
} from '@patternfly/react-core';
|
|
489
|
+
import { Select, SelectOption, SelectVariant, SearchInput } from '@patternfly/react-core';
|
|
512
490
|
import FilterIcon from '@patternfly/react-icons/dist/esm/icons/filter-icon';
|
|
513
491
|
|
|
514
492
|
class ToolbarComponentMangedToggleGroup extends React.Component {
|
|
@@ -659,18 +637,10 @@ If the consumer would prefer to manage the expanded state of the toggle group fo
|
|
|
659
637
|
```js
|
|
660
638
|
import React from 'react';
|
|
661
639
|
import { Toolbar, ToolbarItem, ToolbarContent, ToolbarToggleGroup, ToolbarGroup } from '@patternfly/react-core';
|
|
662
|
-
import {
|
|
663
|
-
Button,
|
|
664
|
-
ButtonVariant,
|
|
665
|
-
InputGroup,
|
|
666
|
-
Select,
|
|
667
|
-
SelectOption,
|
|
668
|
-
SelectVariant,
|
|
669
|
-
SearchInput
|
|
670
|
-
} from '@patternfly/react-core';
|
|
640
|
+
import { Select, SelectOption, SelectVariant, SearchInput } from '@patternfly/react-core';
|
|
671
641
|
import FilterIcon from '@patternfly/react-icons/dist/esm/icons/filter-icon';
|
|
672
642
|
|
|
673
|
-
class
|
|
643
|
+
class ToolbarConsumerManagedToggleGroup extends React.Component {
|
|
674
644
|
constructor(props) {
|
|
675
645
|
super(props);
|
|
676
646
|
this.state = {
|
|
@@ -835,8 +805,6 @@ import {
|
|
|
835
805
|
} from '@patternfly/react-core';
|
|
836
806
|
import {
|
|
837
807
|
Button,
|
|
838
|
-
ButtonVariant,
|
|
839
|
-
InputGroup,
|
|
840
808
|
Select,
|
|
841
809
|
SelectOption,
|
|
842
810
|
SelectVariant,
|
package/src/demos/Tabs.md
CHANGED
|
@@ -445,7 +445,12 @@ TabsOpenWithSecondaryTabsDemo = () => {
|
|
|
445
445
|
|
|
446
446
|
### Nested tabs
|
|
447
447
|
|
|
448
|
-
```js isFullscreen file="./Tabs/
|
|
448
|
+
```js isFullscreen file="./examples/Tabs/NestedTabs.tsx"
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
### Nested, unindented tabs
|
|
452
|
+
|
|
453
|
+
```js isFullscreen file="./examples/Tabs/NestedUnindentedTabs.tsx"
|
|
449
454
|
```
|
|
450
455
|
|
|
451
456
|
### Tables and tabs
|
|
@@ -6,8 +6,11 @@ import {
|
|
|
6
6
|
NavItem,
|
|
7
7
|
NavList,
|
|
8
8
|
Page,
|
|
9
|
+
PageSection,
|
|
9
10
|
PageSidebar,
|
|
10
|
-
SkipToContent
|
|
11
|
+
SkipToContent,
|
|
12
|
+
Text,
|
|
13
|
+
TextContent
|
|
11
14
|
} from '@patternfly/react-core';
|
|
12
15
|
import DashboardHeader from './DashboardHeader';
|
|
13
16
|
|
|
@@ -21,6 +24,15 @@ export const DashboardBreadcrumb = (
|
|
|
21
24
|
</BreadcrumbItem>
|
|
22
25
|
</Breadcrumb>
|
|
23
26
|
);
|
|
27
|
+
|
|
28
|
+
export const PageTemplateTitle = (
|
|
29
|
+
<PageSection variant="light">
|
|
30
|
+
<TextContent>
|
|
31
|
+
<Text component="h1">Main title</Text>
|
|
32
|
+
<Text component="p">This is a full page demo.</Text>
|
|
33
|
+
</TextContent>
|
|
34
|
+
</PageSection>
|
|
35
|
+
);
|
|
24
36
|
export default class DashboardWrapper extends React.Component {
|
|
25
37
|
constructor(props) {
|
|
26
38
|
super(props);
|
|
@@ -45,7 +57,8 @@ export default class DashboardWrapper extends React.Component {
|
|
|
45
57
|
sidebar,
|
|
46
58
|
sidebarNavOpen,
|
|
47
59
|
onPageResize,
|
|
48
|
-
hasNoBreadcrumb
|
|
60
|
+
hasNoBreadcrumb,
|
|
61
|
+
hasPageTemplateTitle
|
|
49
62
|
} = this.props;
|
|
50
63
|
|
|
51
64
|
let renderedBreadcrumb;
|
|
@@ -92,6 +105,7 @@ export default class DashboardWrapper extends React.Component {
|
|
|
92
105
|
mainContainerId={mainContainerId ? mainContainerId : 'main-content-page-layout-default-nav'}
|
|
93
106
|
onPageResize={onPageResize}
|
|
94
107
|
>
|
|
108
|
+
{hasPageTemplateTitle && PageTemplateTitle}
|
|
95
109
|
{children}
|
|
96
110
|
</Page>
|
|
97
111
|
);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import {
|
|
3
3
|
PageSection,
|
|
4
|
-
PageSectionVariants,
|
|
5
4
|
Tabs,
|
|
6
5
|
Tab,
|
|
7
6
|
TabContent,
|
|
@@ -16,7 +15,7 @@ import {
|
|
|
16
15
|
CardBody,
|
|
17
16
|
CardHeader
|
|
18
17
|
} from '@patternfly/react-core';
|
|
19
|
-
import DashboardWrapper from '
|
|
18
|
+
import DashboardWrapper from '../DashboardWrapper';
|
|
20
19
|
|
|
21
20
|
export const GrayTabsDemo: React.FunctionComponent = () => {
|
|
22
21
|
const [activeTabKey, setActiveTabKey] = React.useState<string | number>(0);
|
|
@@ -126,12 +125,7 @@ export const GrayTabsDemo: React.FunctionComponent = () => {
|
|
|
126
125
|
);
|
|
127
126
|
|
|
128
127
|
return (
|
|
129
|
-
<DashboardWrapper
|
|
130
|
-
<PageSection isWidthLimited variant={PageSectionVariants.light}>
|
|
131
|
-
<Title headingLevel="h1" size="2xl">
|
|
132
|
-
Overview
|
|
133
|
-
</Title>
|
|
134
|
-
</PageSection>
|
|
128
|
+
<DashboardWrapper hasPageTemplateTitle>
|
|
135
129
|
<PageSection type="tabs" isWidthLimited>
|
|
136
130
|
<Tabs
|
|
137
131
|
activeKey={activeTabKey}
|
|
@@ -81,7 +81,7 @@ export const ModalTabs: React.FunctionComponent = () => {
|
|
|
81
81
|
|
|
82
82
|
return (
|
|
83
83
|
<React.Fragment>
|
|
84
|
-
<DashboardWrapper mainContainerId="main-content-card-view-default-nav"
|
|
84
|
+
<DashboardWrapper mainContainerId="main-content-card-view-default-nav">
|
|
85
85
|
<PageSection variant={PageSectionVariants.light}>
|
|
86
86
|
<TextContent>
|
|
87
87
|
<Text component="h1">Projects</Text>
|
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
Grid,
|
|
7
7
|
GridItem,
|
|
8
8
|
PageSection,
|
|
9
|
-
PageSectionVariants,
|
|
10
9
|
Tabs,
|
|
11
10
|
Tab,
|
|
12
11
|
TabContent,
|
|
@@ -16,17 +15,17 @@ import {
|
|
|
16
15
|
Flex,
|
|
17
16
|
FlexItem
|
|
18
17
|
} from '@patternfly/react-core';
|
|
19
|
-
import DashboardWrapper from '../
|
|
18
|
+
import DashboardWrapper from '../DashboardWrapper';
|
|
20
19
|
|
|
21
|
-
export const
|
|
20
|
+
export const NestedTabs: React.FunctionComponent = () => {
|
|
22
21
|
const [activeTabKey, setActiveTabKey] = React.useState(0);
|
|
23
22
|
const [activeNestedTabKey, setActiveNestedTabKey] = React.useState(10);
|
|
24
23
|
|
|
25
24
|
// Toggle currently active tab
|
|
26
|
-
const handleTabClick = (
|
|
25
|
+
const handleTabClick = (tabIndex: number) => setActiveTabKey(tabIndex);
|
|
27
26
|
|
|
28
27
|
// Toggle currently active nested tab
|
|
29
|
-
const handleNestedTabClick = (
|
|
28
|
+
const handleNestedTabClick = (tabIndex: number) => setActiveNestedTabKey(tabIndex);
|
|
30
29
|
|
|
31
30
|
const tabContent = (
|
|
32
31
|
<Grid hasGutter>
|
|
@@ -41,7 +40,7 @@ export const NestedTabsDemo = () => {
|
|
|
41
40
|
<Tabs
|
|
42
41
|
activeKey={activeNestedTabKey}
|
|
43
42
|
isSecondary
|
|
44
|
-
onSelect={handleNestedTabClick}
|
|
43
|
+
onSelect={(_event, tabIndex) => handleNestedTabClick(Number(tabIndex))}
|
|
45
44
|
id="nested-tabs-example-nested-tabs-list"
|
|
46
45
|
>
|
|
47
46
|
<Tab eventKey={10} title={<TabTitleText>Cluster</TabTitleText>} tabContentId={`tabContent${10}`} />
|
|
@@ -126,14 +125,14 @@ export const NestedTabsDemo = () => {
|
|
|
126
125
|
);
|
|
127
126
|
|
|
128
127
|
return (
|
|
129
|
-
<DashboardWrapper
|
|
130
|
-
<PageSection isWidthLimited variant={PageSectionVariants.light}>
|
|
131
|
-
<Title headingLevel="h1" size="2xl">
|
|
132
|
-
Overview
|
|
133
|
-
</Title>
|
|
134
|
-
</PageSection>
|
|
128
|
+
<DashboardWrapper hasPageTemplateTitle>
|
|
135
129
|
<PageSection type="tabs" isWidthLimited>
|
|
136
|
-
<Tabs
|
|
130
|
+
<Tabs
|
|
131
|
+
activeKey={activeTabKey}
|
|
132
|
+
onSelect={(_event, tabIndex) => handleTabClick(Number(tabIndex))}
|
|
133
|
+
usePageInsets
|
|
134
|
+
id="nested-tabs-example-tabs-list"
|
|
135
|
+
>
|
|
137
136
|
<Tab eventKey={0} title={<TabTitleText>Cluster 1</TabTitleText>} tabContentId={`tabContent${0}`} />
|
|
138
137
|
<Tab eventKey={1} title={<TabTitleText>Cluster 2</TabTitleText>} tabContentId={`tabContent${1}`} />
|
|
139
138
|
</Tabs>
|