@patternfly/react-core 4.159.1 → 4.160.3
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 +38 -0
- package/dist/esm/components/ProgressStepper/ProgressStep.d.ts +19 -0
- package/dist/esm/components/ProgressStepper/ProgressStep.d.ts.map +1 -0
- package/dist/esm/components/ProgressStepper/ProgressStep.js +40 -0
- package/dist/esm/components/ProgressStepper/ProgressStep.js.map +1 -0
- package/dist/esm/components/ProgressStepper/ProgressStepper.d.ts +15 -0
- package/dist/esm/components/ProgressStepper/ProgressStepper.d.ts.map +1 -0
- package/dist/esm/components/ProgressStepper/ProgressStepper.js +10 -0
- package/dist/esm/components/ProgressStepper/ProgressStepper.js.map +1 -0
- package/dist/esm/components/ProgressStepper/index.d.ts +3 -0
- package/dist/esm/components/ProgressStepper/index.d.ts.map +1 -0
- package/dist/esm/components/ProgressStepper/index.js +3 -0
- package/dist/esm/components/ProgressStepper/index.js.map +1 -0
- package/dist/esm/components/index.d.ts +1 -0
- package/dist/esm/components/index.d.ts.map +1 -1
- package/dist/esm/components/index.js +1 -0
- package/dist/esm/components/index.js.map +1 -1
- package/dist/js/components/ProgressStepper/ProgressStep.d.ts +19 -0
- package/dist/js/components/ProgressStepper/ProgressStep.d.ts.map +1 -0
- package/dist/js/components/ProgressStepper/ProgressStep.js +44 -0
- package/dist/js/components/ProgressStepper/ProgressStep.js.map +1 -0
- package/dist/js/components/ProgressStepper/ProgressStepper.d.ts +15 -0
- package/dist/js/components/ProgressStepper/ProgressStepper.d.ts.map +1 -0
- package/dist/js/components/ProgressStepper/ProgressStepper.js +14 -0
- package/dist/js/components/ProgressStepper/ProgressStepper.js.map +1 -0
- package/dist/js/components/ProgressStepper/index.d.ts +3 -0
- package/dist/js/components/ProgressStepper/index.d.ts.map +1 -0
- package/dist/js/components/ProgressStepper/index.js +6 -0
- package/dist/js/components/ProgressStepper/index.js.map +1 -0
- package/dist/js/components/index.d.ts +1 -0
- package/dist/js/components/index.d.ts.map +1 -1
- package/dist/js/components/index.js +1 -0
- package/dist/js/components/index.js.map +1 -1
- package/dist/umd/react-core.css +12350 -7232
- package/dist/umd/react-core.js +2534 -2832
- package/dist/umd/react-core.min.css +12927 -7809
- package/dist/umd/react-core.min.js +7 -6
- package/package.json +12 -12
- package/src/components/Page/examples/Page.md +1 -1
- package/src/components/ProgressStepper/ProgressStep.tsx +90 -0
- package/src/components/ProgressStepper/ProgressStepper.tsx +40 -0
- package/src/components/ProgressStepper/__tests__/ProgressStepper.test.tsx +107 -0
- package/src/components/ProgressStepper/__tests__/__snapshots__/ProgressStepper.test.tsx.snap +836 -0
- package/src/components/ProgressStepper/examples/ProgressStepper.md +330 -0
- package/src/components/ProgressStepper/index.ts +2 -0
- package/src/components/index.ts +1 -0
- package/src/demos/ProgressStepperDemo.md +82 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.160.3",
|
|
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,31 +34,31 @@
|
|
|
34
34
|
"generate": "node scripts/copyStyles.js"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@patternfly/react-icons": "^4.12.
|
|
38
|
-
"@patternfly/react-styles": "^4.12.
|
|
39
|
-
"@patternfly/react-tokens": "^4.13.
|
|
37
|
+
"@patternfly/react-icons": "^4.12.2",
|
|
38
|
+
"@patternfly/react-styles": "^4.12.2",
|
|
39
|
+
"@patternfly/react-tokens": "^4.13.3",
|
|
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.
|
|
47
|
-
"@rollup/plugin-commonjs": "^
|
|
48
|
-
"@rollup/plugin-node-resolve": "^
|
|
49
|
-
"@rollup/plugin-replace": "^
|
|
46
|
+
"@patternfly/patternfly": "4.144.2",
|
|
47
|
+
"@rollup/plugin-commonjs": "^21.0.0",
|
|
48
|
+
"@rollup/plugin-node-resolve": "^13.0.0",
|
|
49
|
+
"@rollup/plugin-replace": "^3.0.0",
|
|
50
50
|
"css": "^2.2.3",
|
|
51
51
|
"fs-extra": "^6.0.1",
|
|
52
52
|
"glob": "^7.1.2",
|
|
53
53
|
"rimraf": "^2.6.2",
|
|
54
|
-
"rollup": "^2.
|
|
55
|
-
"rollup-plugin-scss": "^
|
|
56
|
-
"rollup-plugin-terser": "^
|
|
54
|
+
"rollup": "^2.58.0",
|
|
55
|
+
"rollup-plugin-scss": "^3.0.0",
|
|
56
|
+
"rollup-plugin-terser": "^7.0.0",
|
|
57
57
|
"typescript": "^4.0.0"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
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": "50c0a19e48eeec8da901698794b3fc60824d6cc5"
|
|
64
64
|
}
|
|
@@ -128,7 +128,7 @@ HorizontalPage = () => {
|
|
|
128
128
|
);
|
|
129
129
|
|
|
130
130
|
const Header = (
|
|
131
|
-
<Masthead
|
|
131
|
+
<Masthead inset={{ default: 'insetXs' }}>
|
|
132
132
|
<MastheadMain>
|
|
133
133
|
<MastheadBrand href="https://patternfly.org" onClick={() => console.log('clicked logo')} target="_blank">
|
|
134
134
|
Logo
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import styles from '@patternfly/react-styles/css/components/ProgressStepper/progress-stepper';
|
|
3
|
+
import { css } from '@patternfly/react-styles';
|
|
4
|
+
import CheckCircleIcon from '@patternfly/react-icons/dist/esm/icons/check-circle-icon';
|
|
5
|
+
import ResourcesFullIcon from '@patternfly/react-icons/dist/esm/icons/resources-full-icon';
|
|
6
|
+
import ExclamationTriangleIcon from '@patternfly/react-icons/dist/esm/icons/exclamation-triangle-icon';
|
|
7
|
+
import ExclamationCircleIcon from '@patternfly/react-icons/dist/esm/icons/exclamation-circle-icon';
|
|
8
|
+
|
|
9
|
+
export interface ProgressStepProps
|
|
10
|
+
extends React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement> {
|
|
11
|
+
/** Content rendered inside the progress step. */
|
|
12
|
+
children?: React.ReactNode;
|
|
13
|
+
/** Additional classes applied to the progress step container. */
|
|
14
|
+
className?: string;
|
|
15
|
+
/** Variant of the progress step. Each variant has a default icon. */
|
|
16
|
+
variant?: 'default' | 'success' | 'info' | 'pending' | 'warning' | 'danger';
|
|
17
|
+
/** Flag indicating the progress step is the current step. */
|
|
18
|
+
isCurrent?: boolean;
|
|
19
|
+
/** Custom icon of a progress step. Will override default icons provided by the variant. */
|
|
20
|
+
icon?: React.ReactNode;
|
|
21
|
+
/** Description text of a progress step. */
|
|
22
|
+
description?: string;
|
|
23
|
+
/** ID of the title of the progress step. */
|
|
24
|
+
titleId?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const variantIcons = {
|
|
28
|
+
default: undefined as any,
|
|
29
|
+
pending: undefined as any,
|
|
30
|
+
success: <CheckCircleIcon />,
|
|
31
|
+
info: <ResourcesFullIcon />,
|
|
32
|
+
warning: <ExclamationTriangleIcon />,
|
|
33
|
+
danger: <ExclamationCircleIcon />
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const variantStyle = {
|
|
37
|
+
default: '',
|
|
38
|
+
info: styles.modifiers.info,
|
|
39
|
+
success: styles.modifiers.success,
|
|
40
|
+
pending: styles.modifiers.pending,
|
|
41
|
+
warning: styles.modifiers.warning,
|
|
42
|
+
danger: styles.modifiers.danger
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const ProgressStep: React.FunctionComponent<ProgressStepProps> = ({
|
|
46
|
+
children,
|
|
47
|
+
className,
|
|
48
|
+
variant,
|
|
49
|
+
isCurrent,
|
|
50
|
+
description,
|
|
51
|
+
icon,
|
|
52
|
+
titleId,
|
|
53
|
+
...props
|
|
54
|
+
}: ProgressStepProps) => {
|
|
55
|
+
const _icon = icon !== undefined ? icon : variantIcons[variant];
|
|
56
|
+
|
|
57
|
+
if (props.id === undefined || titleId === undefined) {
|
|
58
|
+
/* eslint-disable no-console */
|
|
59
|
+
console.warn(
|
|
60
|
+
'ProgressStep: The titleId and id properties are required to make this component accessible, and one or both of these properties are missing.'
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<li
|
|
66
|
+
className={css(
|
|
67
|
+
styles.progressStepperStep,
|
|
68
|
+
variantStyle[variant],
|
|
69
|
+
isCurrent && styles.modifiers.current,
|
|
70
|
+
className
|
|
71
|
+
)}
|
|
72
|
+
{...props}
|
|
73
|
+
>
|
|
74
|
+
<div className={css(styles.progressStepperStepConnector)}>
|
|
75
|
+
<span className={css(styles.progressStepperStepIcon)}>{_icon && _icon}</span>
|
|
76
|
+
</div>
|
|
77
|
+
<div className={css(styles.progressStepperStepMain)}>
|
|
78
|
+
<div
|
|
79
|
+
className={css(styles.progressStepperStepTitle)}
|
|
80
|
+
id={titleId}
|
|
81
|
+
{...(props.id !== undefined && titleId !== undefined && { 'aria-labelledby': `${props.id} ${titleId}` })}
|
|
82
|
+
>
|
|
83
|
+
{children}
|
|
84
|
+
</div>
|
|
85
|
+
{description && <div className={css(styles.progressStepperStepDescription)}>{description}</div>}
|
|
86
|
+
</div>
|
|
87
|
+
</li>
|
|
88
|
+
);
|
|
89
|
+
};
|
|
90
|
+
ProgressStep.displayName = 'ProgressStep';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import styles from '@patternfly/react-styles/css/components/ProgressStepper/progress-stepper';
|
|
3
|
+
import { css } from '@patternfly/react-styles';
|
|
4
|
+
|
|
5
|
+
export interface ProgressStepperProps
|
|
6
|
+
extends React.DetailedHTMLProps<React.OlHTMLAttributes<HTMLOListElement>, HTMLOListElement> {
|
|
7
|
+
/** Content rendered inside the progress stepper. */
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
/** Additional classes applied to the progress stepper container. */
|
|
10
|
+
className?: string;
|
|
11
|
+
/** Flag indicating the progress stepper should be centered. */
|
|
12
|
+
isCenterAligned?: boolean;
|
|
13
|
+
/** Flag indicating the progress stepper has a vertical layout. */
|
|
14
|
+
isVertical?: boolean;
|
|
15
|
+
/** Flag indicating the progress stepper should be rendered compactly. */
|
|
16
|
+
isCompact?: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const ProgressStepper: React.FunctionComponent<ProgressStepperProps> = ({
|
|
20
|
+
children,
|
|
21
|
+
className,
|
|
22
|
+
isCenterAligned,
|
|
23
|
+
isVertical,
|
|
24
|
+
isCompact,
|
|
25
|
+
...props
|
|
26
|
+
}: ProgressStepperProps) => (
|
|
27
|
+
<ol
|
|
28
|
+
className={css(
|
|
29
|
+
styles.progressStepper,
|
|
30
|
+
isCenterAligned && styles.modifiers.center,
|
|
31
|
+
isVertical && styles.modifiers.vertical,
|
|
32
|
+
isCompact && styles.modifiers.compact,
|
|
33
|
+
className
|
|
34
|
+
)}
|
|
35
|
+
{...props}
|
|
36
|
+
>
|
|
37
|
+
{children}
|
|
38
|
+
</ol>
|
|
39
|
+
);
|
|
40
|
+
ProgressStepper.displayName = 'ProgressStepper';
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { mount } from 'enzyme';
|
|
3
|
+
import { ProgressStepper } from '../ProgressStepper';
|
|
4
|
+
import { ProgressStep } from '../ProgressStep';
|
|
5
|
+
import InProgressIcon from '@patternfly/react-icons/dist/esm/icons/in-progress-icon';
|
|
6
|
+
|
|
7
|
+
describe('ProgressStepper', () => {
|
|
8
|
+
test('renders content', () => {
|
|
9
|
+
const view = mount(
|
|
10
|
+
<ProgressStepper>
|
|
11
|
+
<ProgressStep>First</ProgressStep>
|
|
12
|
+
<ProgressStep>Second</ProgressStep>
|
|
13
|
+
<ProgressStep>Third</ProgressStep>
|
|
14
|
+
</ProgressStepper>
|
|
15
|
+
);
|
|
16
|
+
expect(view).toMatchSnapshot();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
test('gets custom class and id', () => {
|
|
20
|
+
const view = mount(
|
|
21
|
+
<ProgressStepper className="custom-class" id="test-id">
|
|
22
|
+
<ProgressStep>First</ProgressStep>
|
|
23
|
+
<ProgressStep>Second</ProgressStep>
|
|
24
|
+
<ProgressStep>Third</ProgressStep>
|
|
25
|
+
</ProgressStepper>
|
|
26
|
+
);
|
|
27
|
+
expect(view).toMatchSnapshot();
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
test('renders vertically', () => {
|
|
31
|
+
const view = mount(
|
|
32
|
+
<ProgressStepper isVertical>
|
|
33
|
+
<ProgressStep>First</ProgressStep>
|
|
34
|
+
<ProgressStep>Second</ProgressStep>
|
|
35
|
+
<ProgressStep>Third</ProgressStep>
|
|
36
|
+
</ProgressStepper>
|
|
37
|
+
);
|
|
38
|
+
expect(view).toMatchSnapshot();
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
test('renders compact', () => {
|
|
42
|
+
const view = mount(
|
|
43
|
+
<ProgressStepper isCompact>
|
|
44
|
+
<ProgressStep>First</ProgressStep>
|
|
45
|
+
<ProgressStep>Second</ProgressStep>
|
|
46
|
+
<ProgressStep>Third</ProgressStep>
|
|
47
|
+
</ProgressStepper>
|
|
48
|
+
);
|
|
49
|
+
expect(view).toMatchSnapshot();
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
test('renders center aligned', () => {
|
|
53
|
+
const view = mount(
|
|
54
|
+
<ProgressStepper isCenterAligned>
|
|
55
|
+
<ProgressStep>First</ProgressStep>
|
|
56
|
+
<ProgressStep>Second</ProgressStep>
|
|
57
|
+
<ProgressStep>Third</ProgressStep>
|
|
58
|
+
</ProgressStepper>
|
|
59
|
+
);
|
|
60
|
+
expect(view).toMatchSnapshot();
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
describe('ProgressStep', () => {
|
|
65
|
+
test('renders content', () => {
|
|
66
|
+
const view = mount(<ProgressStep>Title</ProgressStep>);
|
|
67
|
+
expect(view).toMatchSnapshot();
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
Object.values(['default', 'success', 'info', 'pending', 'warning', 'danger']).forEach(variant => {
|
|
71
|
+
test(`renders ${variant} variant`, () => {
|
|
72
|
+
const view = mount(
|
|
73
|
+
<ProgressStep
|
|
74
|
+
variant={variant as 'default' | 'success' | 'info' | 'pending' | 'warning' | 'danger'}
|
|
75
|
+
aria-label={variant}
|
|
76
|
+
>
|
|
77
|
+
{variant} step
|
|
78
|
+
</ProgressStep>
|
|
79
|
+
);
|
|
80
|
+
expect(view).toMatchSnapshot();
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
test('renders current', () => {
|
|
85
|
+
const view = mount(<ProgressStep isCurrent>Title</ProgressStep>);
|
|
86
|
+
expect(view).toMatchSnapshot();
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
test('renders custom icon', () => {
|
|
90
|
+
const view = mount(<ProgressStep icon={<InProgressIcon />}>Title</ProgressStep>);
|
|
91
|
+
expect(view).toMatchSnapshot();
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
test('renders custom null icon - removing default from variant', () => {
|
|
95
|
+
const view = mount(
|
|
96
|
+
<ProgressStep icon={null} variant="success">
|
|
97
|
+
Title
|
|
98
|
+
</ProgressStep>
|
|
99
|
+
);
|
|
100
|
+
expect(view).toMatchSnapshot();
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
test('renders description', () => {
|
|
104
|
+
const view = mount(<ProgressStep description="This is a description">Title</ProgressStep>);
|
|
105
|
+
expect(view).toMatchSnapshot();
|
|
106
|
+
});
|
|
107
|
+
});
|