@patternfly/react-core 4.267.3 → 4.267.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.
Files changed (30) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/esm/components/CalendarMonth/CalendarMonth.d.ts +14 -1
  3. package/dist/esm/components/CalendarMonth/CalendarMonth.d.ts.map +1 -1
  4. package/dist/esm/components/CalendarMonth/CalendarMonth.js +10 -2
  5. package/dist/esm/components/CalendarMonth/CalendarMonth.js.map +1 -1
  6. package/dist/js/components/CalendarMonth/CalendarMonth.d.ts +14 -1
  7. package/dist/js/components/CalendarMonth/CalendarMonth.d.ts.map +1 -1
  8. package/dist/js/components/CalendarMonth/CalendarMonth.js +10 -2
  9. package/dist/js/components/CalendarMonth/CalendarMonth.js.map +1 -1
  10. package/dist/umd/react-core.min.js +1 -1
  11. package/package.json +2 -2
  12. package/src/components/CalendarMonth/CalendarMonth.tsx +26 -1
  13. package/src/components/CalendarMonth/__tests__/CalendarMonth.test.tsx +9 -0
  14. package/src/components/CalendarMonth/examples/CalendarMonth.md +1 -1
  15. package/src/components/CalendarMonth/examples/CalendarMonthDateRange.tsx +19 -2
  16. package/src/components/CalendarMonth/examples/CalendarMonthSelectableDate.tsx +14 -4
  17. package/src/components/Wizard/examples/Wizard.md +14 -691
  18. package/src/components/Wizard/examples/WizardAnchorsForNavItems.tsx +42 -0
  19. package/src/components/Wizard/examples/WizardBasic.tsx +14 -0
  20. package/src/components/Wizard/examples/WizardBasicWithDisabledSteps.tsx +14 -0
  21. package/src/components/Wizard/examples/WizardEnabledOnFormValidation.tsx +139 -0
  22. package/src/components/Wizard/examples/WizardExpandableSteps.tsx +34 -0
  23. package/src/components/Wizard/examples/WizardFinished.tsx +90 -0
  24. package/src/components/Wizard/examples/WizardGetCurrentStep.tsx +33 -0
  25. package/src/components/Wizard/examples/WizardInModal.tsx +32 -0
  26. package/src/components/Wizard/examples/WizardIncrementallyEnabledSteps.tsx +61 -0
  27. package/src/components/Wizard/examples/WizardValidateOnButtonPress.tsx +204 -0
  28. package/src/components/Wizard/examples/WizardWithDrawer.tsx +126 -0
  29. package/src/components/Wizard/examples/FinishedStep.js +0 -70
  30. package/src/components/Wizard/examples/SampleForm.js +0 -59
@@ -0,0 +1,126 @@
1
+ import React from 'react';
2
+ import {
3
+ Button,
4
+ DrawerActions,
5
+ DrawerCloseButton,
6
+ DrawerColorVariant,
7
+ DrawerHead,
8
+ DrawerPanelContent,
9
+ Wizard
10
+ } from '@patternfly/react-core';
11
+
12
+ export const WizardWithDrawer: React.FunctionComponent = () => {
13
+ const [isDrawerExpanded, setIsDrawerExpanded] = React.useState(false);
14
+
15
+ const drawerRef = React.useRef<HTMLSpanElement>(null);
16
+
17
+ const onOpenClick = () => {
18
+ setIsDrawerExpanded(true);
19
+ };
20
+
21
+ const onCloseClick = () => {
22
+ setIsDrawerExpanded(false);
23
+ };
24
+
25
+ const panel1Content = (
26
+ <DrawerPanelContent widths={{ default: 'width_33' }} colorVariant={DrawerColorVariant.light200}>
27
+ <DrawerHead>
28
+ <span tabIndex={isDrawerExpanded ? 0 : -1} ref={drawerRef}>
29
+ drawer-panel-1 content
30
+ </span>
31
+ <DrawerActions>
32
+ <DrawerCloseButton onClick={onCloseClick} />
33
+ </DrawerActions>
34
+ </DrawerHead>
35
+ </DrawerPanelContent>
36
+ );
37
+
38
+ const panel2Content = (
39
+ <DrawerPanelContent widths={{ default: 'width_33' }} colorVariant={DrawerColorVariant.light200}>
40
+ <DrawerHead>
41
+ <span tabIndex={0} ref={drawerRef}>
42
+ drawer-panel-2 content
43
+ </span>
44
+ <DrawerActions>
45
+ <DrawerCloseButton onClick={onCloseClick} />
46
+ </DrawerActions>
47
+ </DrawerHead>
48
+ </DrawerPanelContent>
49
+ );
50
+
51
+ const panel3Content = (
52
+ <DrawerPanelContent widths={{ default: 'width_33' }} colorVariant={DrawerColorVariant.light200}>
53
+ <DrawerHead>
54
+ <span tabIndex={0} ref={drawerRef}>
55
+ drawer-panel-3 content
56
+ </span>
57
+ <DrawerActions>
58
+ <DrawerCloseButton onClick={onCloseClick} />
59
+ </DrawerActions>
60
+ </DrawerHead>
61
+ </DrawerPanelContent>
62
+ );
63
+
64
+ const drawerToggleButton = (
65
+ <Button isInline variant="link" onClick={onOpenClick}>
66
+ Open Drawer
67
+ </Button>
68
+ );
69
+
70
+ const steps = [
71
+ {
72
+ name: 'Information',
73
+ component: <p>Information step content</p>,
74
+ drawerPanelContent: panel1Content,
75
+ drawerToggleButton
76
+ },
77
+ {
78
+ name: 'Configuration',
79
+ steps: [
80
+ {
81
+ name: 'Substep A',
82
+ component: <p>Substep A content</p>,
83
+ drawerPanelContent: panel2Content,
84
+ drawerToggleButton
85
+ },
86
+ {
87
+ name: 'Substep B',
88
+ component: <p>Substep B content</p>,
89
+ drawerPanelContent: panel2Content,
90
+ drawerToggleButton
91
+ },
92
+ {
93
+ name: 'Substep C',
94
+ component: <p>Substep C content</p>,
95
+ drawerPanelContent: panel2Content,
96
+ drawerToggleButton
97
+ }
98
+ ]
99
+ },
100
+ {
101
+ name: 'Additional',
102
+ component: <p>Additional step content</p>,
103
+ drawerPanelContent: panel3Content,
104
+ drawerToggleButton
105
+ },
106
+ {
107
+ name: 'Review',
108
+ component: <p>Review step content</p>,
109
+ nextButtonText: 'Finish'
110
+ }
111
+ ];
112
+
113
+ const title = 'Wizard with drawer example';
114
+
115
+ return (
116
+ <React.Fragment>
117
+ <Wizard
118
+ height={400}
119
+ isDrawerExpanded={isDrawerExpanded}
120
+ hasDrawer
121
+ navAriaLabel={`${title} steps`}
122
+ steps={steps}
123
+ />
124
+ </React.Fragment>
125
+ );
126
+ };
@@ -1,70 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import {
4
- EmptyState,
5
- EmptyStateIcon,
6
- EmptyStateBody,
7
- EmptyStateSecondaryActions,
8
- Title,
9
- Progress,
10
- Button
11
- } from '@patternfly/react-core';
12
- // eslint-disable-next-line patternfly-react/import-tokens-icons
13
- import { CogsIcon } from '@patternfly/react-icons';
14
-
15
- const propTypes = {
16
- onClose: PropTypes.func.isRequired
17
- };
18
-
19
- class FinishedStep extends React.Component {
20
- constructor(props) {
21
- super(props);
22
- this.state = { percent: 0 };
23
- }
24
-
25
- tick() {
26
- if (this.state.percent < 100) {
27
- this.setState(prevState => ({
28
- percent: prevState.percent + 20
29
- }));
30
- }
31
- }
32
-
33
- componentDidMount() {
34
- this.interval = setInterval(() => this.tick(), 1000);
35
- }
36
-
37
- componentWillUnmount() {
38
- clearInterval(this.interval);
39
- }
40
-
41
- render() {
42
- const { percent } = this.state;
43
- return (
44
- <div className="pf-l-bullseye">
45
- <EmptyState variant="large">
46
- <EmptyStateIcon icon={CogsIcon} />
47
- <Title headingLevel="h4" size="lg">
48
- {percent === 100 ? 'Validation complete' : 'Validating credentials'}
49
- </Title>
50
- <EmptyStateBody>
51
- <Progress value={percent} measureLocation="outside" />
52
- </EmptyStateBody>
53
- <EmptyStateBody>
54
- Description can be used to further elaborate on the validation step, or give the user a better idea of how
55
- long the process will take.
56
- </EmptyStateBody>
57
- <EmptyStateSecondaryActions>
58
- <Button isDisabled={percent !== 100} onClick={this.props.onClose}>
59
- Log to console
60
- </Button>
61
- </EmptyStateSecondaryActions>
62
- </EmptyState>
63
- </div>
64
- );
65
- }
66
- }
67
-
68
- FinishedStep.propTypes = propTypes;
69
-
70
- export default FinishedStep;
@@ -1,59 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { Form, FormGroup, TextInput } from '@patternfly/react-core';
4
-
5
- const propTypes = {
6
- formValue: PropTypes.string,
7
- isFormValid: PropTypes.bool,
8
- onChange: PropTypes.func
9
- };
10
-
11
- const defaultProps = {
12
- formValue: '',
13
- isFormValid: false,
14
- onChange: () => undefined
15
- };
16
-
17
- class SampleForm extends React.Component {
18
- static propTypes = propTypes;
19
- static defaultProps = defaultProps;
20
-
21
- state = {
22
- value: this.props.formValue,
23
- isValid: this.props.isFormValid
24
- };
25
-
26
- handleTextInputChange = value => {
27
- const isValid = /^\d+$/.test(value);
28
- this.setState({ value, isValid });
29
- this.props.onChange && this.props.onChange(isValid, value);
30
- };
31
-
32
- render() {
33
- const { value, isValid } = this.state;
34
- const validated = isValid ? 'default' : 'error';
35
-
36
- return (
37
- <Form>
38
- <FormGroup
39
- label="Age:"
40
- type="number"
41
- helperText="Write your age in numbers."
42
- helperTextInvalid="Age has to be a number"
43
- fieldId="age"
44
- validated={validated}
45
- >
46
- <TextInput
47
- validated={validated}
48
- value={value}
49
- id="age"
50
- aria-describedby="age-helper"
51
- onChange={this.handleTextInputChange}
52
- />
53
- </FormGroup>
54
- </Form>
55
- );
56
- }
57
- }
58
-
59
- export default SampleForm;