@patternfly/react-core 6.5.0-prerelease.24 → 6.5.0-prerelease.26
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 +12 -0
- package/components/package.json +1 -1
- package/deprecated/package.json +1 -1
- package/dist/dynamic/components/AboutModal/package.json +1 -1
- package/dist/dynamic/components/Accordion/package.json +1 -1
- package/dist/dynamic/components/ActionList/package.json +1 -1
- package/dist/dynamic/components/Alert/package.json +1 -1
- package/dist/dynamic/components/Avatar/package.json +1 -1
- package/dist/dynamic/components/BackToTop/package.json +1 -1
- package/dist/dynamic/components/Backdrop/package.json +1 -1
- package/dist/dynamic/components/BackgroundImage/package.json +1 -1
- package/dist/dynamic/components/Badge/package.json +1 -1
- package/dist/dynamic/components/Banner/package.json +1 -1
- package/dist/dynamic/components/Brand/package.json +1 -1
- package/dist/dynamic/components/Breadcrumb/package.json +1 -1
- package/dist/dynamic/components/Button/package.json +1 -1
- package/dist/dynamic/components/CalendarMonth/package.json +1 -1
- package/dist/dynamic/components/Card/package.json +1 -1
- package/dist/dynamic/components/Checkbox/package.json +1 -1
- package/dist/dynamic/components/ClipboardCopy/package.json +1 -1
- package/dist/dynamic/components/CodeBlock/package.json +1 -1
- package/dist/dynamic/components/Compass/package.json +1 -1
- package/dist/dynamic/components/Content/package.json +1 -1
- package/dist/dynamic/components/DataList/package.json +1 -1
- package/dist/dynamic/components/DatePicker/package.json +1 -1
- package/dist/dynamic/components/DescriptionList/package.json +1 -1
- package/dist/dynamic/components/Divider/package.json +1 -1
- package/dist/dynamic/components/Drawer/package.json +1 -1
- package/dist/dynamic/components/Dropdown/package.json +1 -1
- package/dist/dynamic/components/DualListSelector/package.json +1 -1
- package/dist/dynamic/components/EmptyState/package.json +1 -1
- package/dist/dynamic/components/ExpandableSection/package.json +1 -1
- package/dist/dynamic/components/FileUpload/package.json +1 -1
- package/dist/dynamic/components/Form/package.json +1 -1
- package/dist/dynamic/components/FormSelect/package.json +1 -1
- package/dist/dynamic/components/HelperText/package.json +1 -1
- package/dist/dynamic/components/Hero/package.json +1 -1
- package/dist/dynamic/components/Hint/package.json +1 -1
- package/dist/dynamic/components/Icon/package.json +1 -1
- package/dist/dynamic/components/InputGroup/package.json +1 -1
- package/dist/dynamic/components/JumpLinks/package.json +1 -1
- package/dist/dynamic/components/Label/package.json +1 -1
- package/dist/dynamic/components/List/package.json +1 -1
- package/dist/dynamic/components/LoginPage/package.json +1 -1
- package/dist/dynamic/components/Masthead/package.json +1 -1
- package/dist/dynamic/components/Menu/package.json +1 -1
- package/dist/dynamic/components/MenuToggle/package.json +1 -1
- package/dist/dynamic/components/Modal/package.json +1 -1
- package/dist/dynamic/components/MultipleFileUpload/package.json +1 -1
- package/dist/dynamic/components/Nav/package.json +1 -1
- package/dist/dynamic/components/NotificationBadge/package.json +1 -1
- package/dist/dynamic/components/NotificationDrawer/package.json +1 -1
- package/dist/dynamic/components/NumberInput/package.json +1 -1
- package/dist/dynamic/components/OverflowMenu/package.json +1 -1
- package/dist/dynamic/components/Page/package.json +1 -1
- package/dist/dynamic/components/Pagination/package.json +1 -1
- package/dist/dynamic/components/Panel/package.json +1 -1
- package/dist/dynamic/components/Popover/package.json +1 -1
- package/dist/dynamic/components/Progress/package.json +1 -1
- package/dist/dynamic/components/ProgressStepper/package.json +1 -1
- package/dist/dynamic/components/Radio/package.json +1 -1
- package/dist/dynamic/components/SearchInput/package.json +1 -1
- package/dist/dynamic/components/Select/package.json +1 -1
- package/dist/dynamic/components/Sidebar/package.json +1 -1
- package/dist/dynamic/components/SimpleList/package.json +1 -1
- package/dist/dynamic/components/Skeleton/package.json +1 -1
- package/dist/dynamic/components/SkipToContent/package.json +1 -1
- package/dist/dynamic/components/Slider/package.json +1 -1
- package/dist/dynamic/components/Spinner/package.json +1 -1
- package/dist/dynamic/components/Switch/package.json +1 -1
- package/dist/dynamic/components/Tabs/package.json +1 -1
- package/dist/dynamic/components/TextArea/package.json +1 -1
- package/dist/dynamic/components/TextInput/package.json +1 -1
- package/dist/dynamic/components/TextInputGroup/package.json +1 -1
- package/dist/dynamic/components/TimePicker/package.json +1 -1
- package/dist/dynamic/components/Timestamp/package.json +1 -1
- package/dist/dynamic/components/Title/package.json +1 -1
- package/dist/dynamic/components/ToggleGroup/package.json +1 -1
- package/dist/dynamic/components/Toolbar/package.json +1 -1
- package/dist/dynamic/components/Tooltip/package.json +1 -1
- package/dist/dynamic/components/TreeView/package.json +1 -1
- package/dist/dynamic/components/Truncate/package.json +1 -1
- package/dist/dynamic/components/Wizard/hooks/package.json +1 -1
- package/dist/dynamic/components/Wizard/package.json +1 -1
- package/dist/dynamic/deprecated/components/Chip/package.json +1 -1
- package/dist/dynamic/deprecated/components/DragDrop/package.json +1 -1
- package/dist/dynamic/deprecated/components/DualListSelector/package.json +1 -1
- package/dist/dynamic/deprecated/components/Modal/package.json +1 -1
- package/dist/dynamic/deprecated/components/Tile/package.json +1 -1
- package/dist/dynamic/deprecated/components/Wizard/package.json +1 -1
- package/dist/dynamic/deprecated/components/package.json +1 -1
- package/dist/dynamic/helpers/AnimationsProvider/AnimationsProvider/package.json +1 -1
- package/dist/dynamic/helpers/AnimationsProvider/package.json +1 -1
- package/dist/dynamic/helpers/FocusTrap/FocusTrap/package.json +1 -1
- package/dist/dynamic/helpers/GenerateId/GenerateId/package.json +1 -1
- package/dist/dynamic/helpers/KeyboardHandler/package.json +1 -1
- package/dist/dynamic/helpers/OUIA/ouia/package.json +1 -1
- package/dist/dynamic/helpers/Popper/Popper/package.json +1 -1
- package/dist/dynamic/helpers/constants/package.json +1 -1
- package/dist/dynamic/helpers/datetimeUtils/package.json +1 -1
- package/dist/dynamic/helpers/fileUtils/package.json +1 -1
- package/dist/dynamic/helpers/htmlConstants/package.json +1 -1
- package/dist/dynamic/helpers/package.json +1 -1
- package/dist/dynamic/helpers/resizeObserver/package.json +1 -1
- package/dist/dynamic/helpers/typeUtils/package.json +1 -1
- package/dist/dynamic/helpers/useInterval/package.json +1 -1
- package/dist/dynamic/helpers/useIsomorphicLayout/package.json +1 -1
- package/dist/dynamic/helpers/useUnmountEffect/package.json +1 -1
- package/dist/dynamic/helpers/util/package.json +1 -1
- package/dist/dynamic/layouts/Bullseye/package.json +1 -1
- package/dist/dynamic/layouts/Flex/package.json +1 -1
- package/dist/dynamic/layouts/Gallery/package.json +1 -1
- package/dist/dynamic/layouts/Grid/package.json +1 -1
- package/dist/dynamic/layouts/Level/package.json +1 -1
- package/dist/dynamic/layouts/Split/package.json +1 -1
- package/dist/dynamic/layouts/Stack/package.json +1 -1
- package/dist/dynamic/styles/package.json +1 -1
- package/dist/esm/components/ClipboardCopy/ClipboardCopy.d.ts +8 -0
- package/dist/esm/components/ClipboardCopy/ClipboardCopy.d.ts.map +1 -1
- package/dist/esm/components/ClipboardCopy/ClipboardCopy.js +4 -2
- package/dist/esm/components/ClipboardCopy/ClipboardCopy.js.map +1 -1
- package/dist/esm/components/Label/Label.js +1 -1
- package/dist/esm/components/Label/Label.js.map +1 -1
- package/dist/js/components/ClipboardCopy/ClipboardCopy.d.ts +8 -0
- package/dist/js/components/ClipboardCopy/ClipboardCopy.d.ts.map +1 -1
- package/dist/js/components/ClipboardCopy/ClipboardCopy.js +4 -2
- package/dist/js/components/ClipboardCopy/ClipboardCopy.js.map +1 -1
- package/dist/js/components/Label/Label.js +1 -1
- package/dist/js/components/Label/Label.js.map +1 -1
- package/dist/umd/assets/{output-BbsSnXfK.css → output-BOKd1GXO.css} +18528 -18528
- package/dist/umd/react-core.min.js +2 -2
- package/helpers/package.json +1 -1
- package/layouts/package.json +1 -1
- package/next/package.json +1 -1
- package/package.json +2 -2
- package/src/components/ClipboardCopy/ClipboardCopy.tsx +16 -1
- package/src/components/ClipboardCopy/__tests__/ClipboardCopy.test.tsx +72 -0
- package/src/components/ClipboardCopy/__tests__/__snapshots__/ClipboardCopy.test.tsx.snap +1 -1
- package/src/components/Dropdown/examples/Dropdown.md +13 -1
- package/src/components/Dropdown/examples/DropdownWithSplit.tsx +97 -0
- package/src/components/Label/Label.tsx +1 -1
- package/src/demos/Banner.md +2 -139
- package/src/demos/DateTimePicker.md +2 -86
- package/src/demos/JumpLinks.md +2 -129
- package/src/demos/ProgressDemo.md +2 -65
- package/src/demos/ProgressStepperDemo.md +1 -72
- package/src/demos/Tabs.md +6 -417
- package/src/demos/examples/Banner/BannerBasicSticky.tsx +55 -0
- package/src/demos/examples/Banner/BannerTopBottom.tsx +81 -0
- package/src/demos/examples/DateTimePicker/DateTimeRangePicker.tsx +93 -0
- package/src/demos/examples/JumpLinks/JumpLinksScrollspy.tsx +125 -0
- package/src/demos/examples/JumpLinks/{JumpLinksWithDrawer.js → JumpLinksWithDrawer.tsx} +1 -1
- package/src/demos/examples/Progress/ProgressBasic.tsx +32 -0
- package/src/demos/examples/Progress/ProgressWithOnlyIncreasing.tsx +33 -0
- package/src/demos/examples/ProgressStepper/ProgressStepperBasic.tsx +72 -0
- package/src/demos/examples/Tabs/TabsOpen.tsx +185 -0
- package/src/demos/examples/Tabs/TabsOpenWithSecondaryTabs.tsx +228 -0
- package/src/layouts/Gallery/examples/Gallery.md +8 -99
- package/src/layouts/Gallery/examples/GalleryAdjustingMaxWidths.tsx +21 -0
- package/src/layouts/Gallery/examples/GalleryAdjustingMinMaxWidths.tsx +25 -0
- package/src/layouts/Gallery/examples/GalleryAdjustingMinWidths.tsx +22 -0
- package/src/layouts/Gallery/examples/GalleryAlternativeComponents.tsx +11 -0
- package/src/layouts/Gallery/examples/GalleryBasic.tsx +14 -0
- package/src/layouts/Gallery/examples/GalleryWithGutters.tsx +12 -0
package/src/demos/JumpLinks.md
CHANGED
|
@@ -21,134 +21,7 @@ JumpLinks has a scrollspy built-in to make your implementation easier. When impl
|
|
|
21
21
|
|
|
22
22
|
This demo expands on the previous to show the JumpLinks in a vertical layout with subsections. It scrolls the [Page](/components/page)'s `mainContainerId` with an `offset` calculated based on the height of the masthead and the nav list when it appears above the content. The headings are given a tab index to allow the jump links to focus on them.
|
|
23
23
|
|
|
24
|
-
```
|
|
25
|
-
import { useEffect, useState } from 'react';
|
|
26
|
-
import {
|
|
27
|
-
PageSection,
|
|
28
|
-
JumpLinks,
|
|
29
|
-
JumpLinksItem,
|
|
30
|
-
JumpLinksList,
|
|
31
|
-
PageGroup,
|
|
32
|
-
Sidebar,
|
|
33
|
-
SidebarContent,
|
|
34
|
-
SidebarPanel,
|
|
35
|
-
Switch,
|
|
36
|
-
Title,
|
|
37
|
-
Content,
|
|
38
|
-
getResizeObserver
|
|
39
|
-
} from '@patternfly/react-core';
|
|
40
|
-
import { DashboardWrapper } from '@patternfly/react-core/dist/js/demos/DashboardWrapper';
|
|
41
|
-
import mastheadStyles from '@patternfly/react-styles/css/components/Masthead/masthead';
|
|
42
|
-
|
|
43
|
-
ScrollspyH2 = () => {
|
|
44
|
-
const headings = [1, 2, 3, 4, 5];
|
|
45
|
-
|
|
46
|
-
const [isVertical, setIsVertical] = useState(true);
|
|
47
|
-
const [offsetHeight, setOffsetHeight] = useState(10);
|
|
48
|
-
const offsetForPadding = 10;
|
|
49
|
-
let masthead;
|
|
50
|
-
|
|
51
|
-
// Update offset based on the masthead and jump links nav heights.
|
|
52
|
-
useEffect(() => {
|
|
53
|
-
masthead = document.getElementsByClassName(mastheadStyles.masthead)[0];
|
|
54
|
-
|
|
55
|
-
if (isVertical) {
|
|
56
|
-
setOffsetHeight(masthead.offsetHeight + offsetForPadding);
|
|
57
|
-
} else {
|
|
58
|
-
// Append jump links nav height to the masthead height when value exists.
|
|
59
|
-
const jumpLinksHeaderHeight = document.getElementsByClassName('pf-m-sticky')[0].offsetHeight;
|
|
60
|
-
jumpLinksHeaderHeight && setOffsetHeight(masthead.offsetHeight + jumpLinksHeaderHeight + offsetForPadding);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}, [isVertical]);
|
|
65
|
-
|
|
66
|
-
getResizeObserver(
|
|
67
|
-
document.getElementsByClassName(mastheadStyles.masthead)[0],
|
|
68
|
-
() => {
|
|
69
|
-
if (isVertical) {
|
|
70
|
-
setOffsetHeight(masthead.offsetHeight + offsetForPadding);
|
|
71
|
-
} else {
|
|
72
|
-
// Append jump links nav height to the masthead height when value exists.
|
|
73
|
-
const jumpLinksHeaderHeight = document.getElementsByClassName('pf-m-sticky')[0].offsetHeight;
|
|
74
|
-
jumpLinksHeaderHeight && setOffsetHeight(masthead.offsetHeight + jumpLinksHeaderHeight + offsetForPadding);
|
|
75
|
-
}
|
|
76
|
-
},
|
|
77
|
-
true
|
|
78
|
-
);
|
|
79
|
-
|
|
80
|
-
return (
|
|
81
|
-
<DashboardWrapper breadcrumb={null} mainContainerId="scrollable-element">
|
|
82
|
-
<PageSection aria-labelledby='main-title'>
|
|
83
|
-
<Title headingLevel="h1" size="2xl" id='main-title'>
|
|
84
|
-
Main title
|
|
85
|
-
</Title>
|
|
86
|
-
<Switch
|
|
87
|
-
id="is-vertical"
|
|
88
|
-
label="Vertical jump links"
|
|
89
|
-
isChecked={isVertical}
|
|
90
|
-
onChange={(_event, check) => setIsVertical(check)}
|
|
91
|
-
/>
|
|
92
|
-
</PageSection>
|
|
93
|
-
<PageSection padding={{ default: 'noPadding' }} >
|
|
94
|
-
<Sidebar hasGutter orientation={!isVertical && 'stack'}>
|
|
95
|
-
<SidebarPanel variant="sticky">
|
|
96
|
-
<PageSection aria-label='Jump links navigation'>
|
|
97
|
-
<JumpLinks
|
|
98
|
-
isVertical={isVertical}
|
|
99
|
-
isCentered={!isVertical}
|
|
100
|
-
label="Jump to section"
|
|
101
|
-
scrollableSelector=".pf-v6-c-page__main-container"
|
|
102
|
-
offset={offsetHeight}
|
|
103
|
-
expandable={{ default: isVertical ? 'expandable' : 'nonExpandable', md: 'nonExpandable' }}
|
|
104
|
-
isExpanded
|
|
105
|
-
>
|
|
106
|
-
{headings.map(i => (
|
|
107
|
-
<JumpLinksItem key={i} href={`#heading-${i}`}>
|
|
108
|
-
{`Heading ${i}`}
|
|
109
|
-
<JumpLinksList></JumpLinksList>
|
|
110
|
-
</JumpLinksItem>
|
|
111
|
-
))}
|
|
112
|
-
</JumpLinks>
|
|
113
|
-
</PageSection>
|
|
114
|
-
</SidebarPanel>
|
|
115
|
-
<SidebarContent hasNoBackground>
|
|
116
|
-
<PageSection aria-label='Main content'>
|
|
117
|
-
<Content>
|
|
118
|
-
{headings.map(i => (
|
|
119
|
-
<div key={i} style={{ maxWidth: '800px', marginBottom: '32px' }}>
|
|
120
|
-
<h2 id={`heading-${i}`} tabIndex={-1}>
|
|
121
|
-
{`Heading ${i}`}
|
|
122
|
-
</h2>
|
|
123
|
-
<p>
|
|
124
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut
|
|
125
|
-
labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
|
|
126
|
-
nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit
|
|
127
|
-
esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt
|
|
128
|
-
in culpa qui officia deserunt mollit anim id est laborum.
|
|
129
|
-
</p>
|
|
130
|
-
<br />
|
|
131
|
-
<p>
|
|
132
|
-
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum
|
|
133
|
-
deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non
|
|
134
|
-
provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum
|
|
135
|
-
fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta
|
|
136
|
-
nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus,
|
|
137
|
-
omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis
|
|
138
|
-
debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non
|
|
139
|
-
recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus
|
|
140
|
-
maiores alias consequatur aut perferendis doloribus asperiores repellat.
|
|
141
|
-
</p>
|
|
142
|
-
</div>
|
|
143
|
-
))}
|
|
144
|
-
</Content>
|
|
145
|
-
</PageSection>
|
|
146
|
-
</SidebarContent>
|
|
147
|
-
</Sidebar>
|
|
148
|
-
</PageSection>
|
|
149
|
-
</DashboardWrapper>
|
|
150
|
-
);
|
|
151
|
-
};
|
|
24
|
+
```ts file="examples/JumpLinks/JumpLinksScrollspy.tsx" isFullscreen
|
|
152
25
|
```
|
|
153
26
|
|
|
154
27
|
### With drawer
|
|
@@ -157,5 +30,5 @@ This demo shows how jump links can be used in combination with a drawer.
|
|
|
157
30
|
|
|
158
31
|
This demo uses a `scrollableRef` prop on the JumpLinks component, which is a React ref to the `DrawerContent` component.
|
|
159
32
|
|
|
160
|
-
```
|
|
33
|
+
```ts file="examples/JumpLinks/JumpLinksWithDrawer.tsx" isFullscreen
|
|
161
34
|
```
|
|
@@ -9,77 +9,14 @@ import accessibilityStyles from '@patternfly/react-styles/css/utilities/Accessib
|
|
|
9
9
|
|
|
10
10
|
### Basic
|
|
11
11
|
|
|
12
|
-
```
|
|
13
|
-
import { useState } from 'react';
|
|
14
|
-
import { Progress, Button, Stack, StackItem } from '@patternfly/react-core';
|
|
15
|
-
import accessibilityStyles from '@patternfly/react-styles/css/utilities/Accessibility/accessibility';
|
|
16
|
-
|
|
17
|
-
ProgressStepperDemo = () => {
|
|
18
|
-
const [currentValue, setCurrentValue] = useState(0);
|
|
19
|
-
|
|
20
|
-
const onProgressUpdate = (nextValue) => {
|
|
21
|
-
setCurrentValue(nextValue);
|
|
22
|
-
};
|
|
12
|
+
```ts file="examples/Progress/ProgressBasic.tsx"
|
|
23
13
|
|
|
24
|
-
return (
|
|
25
|
-
<Stack>
|
|
26
|
-
<StackItem>
|
|
27
|
-
<Button onClick={() => onProgressUpdate(currentValue - 10)} isDisabled={currentValue === 0}>
|
|
28
|
-
Decrease value
|
|
29
|
-
</Button>{' '}
|
|
30
|
-
<Button onClick={() => onProgressUpdate(currentValue + 10)} isDisabled={currentValue === 100}>
|
|
31
|
-
Increase value
|
|
32
|
-
</Button>
|
|
33
|
-
<br />
|
|
34
|
-
<br />
|
|
35
|
-
</StackItem>
|
|
36
|
-
<StackItem>
|
|
37
|
-
<div className={accessibilityStyles.screenReader} aria-live="polite">
|
|
38
|
-
{`Progress value is ${currentValue}%.`}
|
|
39
|
-
</div>
|
|
40
|
-
<Progress value={currentValue} title="Title" />
|
|
41
|
-
</StackItem>
|
|
42
|
-
</Stack>
|
|
43
|
-
);
|
|
44
|
-
};
|
|
45
14
|
```
|
|
46
15
|
|
|
47
16
|
### With only increasing progress
|
|
48
17
|
|
|
49
18
|
Sometimes a progress bar should only show increases to progress state. In this case, before the next value is set it should be checked against the current progress. The `Decrease progress` button attempts to set a lower progress value, simulating an update to a progress state that isn't desired, but won't change the progress state due to this check.
|
|
50
19
|
|
|
51
|
-
```
|
|
52
|
-
import { useState } from 'react';
|
|
53
|
-
import { Progress, Button, Stack, StackItem } from '@patternfly/react-core';
|
|
54
|
-
|
|
55
|
-
ProgressStepperDemo = () => {
|
|
56
|
-
const [currentValue, setCurrentValue] = useState(0);
|
|
57
|
-
|
|
58
|
-
const onProgressUpdate = (nextValue) => {
|
|
59
|
-
if (nextValue > currentValue) {
|
|
60
|
-
setCurrentValue(nextValue);
|
|
61
|
-
}
|
|
62
|
-
};
|
|
20
|
+
```ts file="examples/Progress/ProgressWithOnlyIncreasing.tsx"
|
|
63
21
|
|
|
64
|
-
return (
|
|
65
|
-
<Stack>
|
|
66
|
-
<StackItem>
|
|
67
|
-
<Button onClick={() => onProgressUpdate(currentValue - 10)} isDisabled={currentValue === 0}>
|
|
68
|
-
Decrease value
|
|
69
|
-
</Button>{' '}
|
|
70
|
-
<Button onClick={() => onProgressUpdate(currentValue + 10)} isDisabled={currentValue === 100}>
|
|
71
|
-
Increase value
|
|
72
|
-
</Button>
|
|
73
|
-
<br />
|
|
74
|
-
<br />
|
|
75
|
-
</StackItem>
|
|
76
|
-
<StackItem>
|
|
77
|
-
<div className={accessibilityStyles.screenReader} aria-live="polite">
|
|
78
|
-
{`Progress value is ${currentValue}%.`}
|
|
79
|
-
</div>
|
|
80
|
-
<Progress value={currentValue} title="Title" />
|
|
81
|
-
</StackItem>
|
|
82
|
-
</Stack>
|
|
83
|
-
);
|
|
84
|
-
};
|
|
85
22
|
```
|
|
@@ -10,77 +10,6 @@ import accessibilityStyles from '@patternfly/react-styles/css/utilities/Accessib
|
|
|
10
10
|
|
|
11
11
|
### Basic
|
|
12
12
|
|
|
13
|
-
```
|
|
14
|
-
import { useState } from 'react';
|
|
15
|
-
import { ProgressStepper, ProgressStep, Button, Stack, StackItem } from '@patternfly/react-core';
|
|
16
|
-
import accessibilityStyles from '@patternfly/react-styles/css/utilities/Accessibility/accessibility';
|
|
17
|
-
|
|
18
|
-
ProgressStepperDemo = () => {
|
|
19
|
-
const [currentStep, setCurrentStep] = useState(0);
|
|
20
|
-
|
|
21
|
-
const steps = [
|
|
22
|
-
{ title: 'First step', id: 'step1' },
|
|
23
|
-
{ title: 'Second step', id: 'step2' },
|
|
24
|
-
{ title: 'Third step', id: 'step3' },
|
|
25
|
-
{ title: 'Fourth step', id: 'step4' },
|
|
26
|
-
{ title: 'Fifth step', id: 'step5' }
|
|
27
|
-
];
|
|
28
|
-
|
|
29
|
-
const onStepForward = event => {
|
|
30
|
-
const next = currentStep + 1;
|
|
31
|
-
setCurrentStep(next <= 5 ? next : 4);
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const onStepBack = event => {
|
|
35
|
-
const next = currentStep - 1;
|
|
36
|
-
setCurrentStep(next > 0 ? next : 0);
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
return (
|
|
40
|
-
<Stack>
|
|
41
|
-
<StackItem>
|
|
42
|
-
<Button onClick={onStepBack} isDisabled={currentStep === 0}>
|
|
43
|
-
Step back
|
|
44
|
-
</Button>{' '}
|
|
45
|
-
<Button onClick={onStepForward} isDisabled={currentStep === 5}>
|
|
46
|
-
Step forward
|
|
47
|
-
</Button>
|
|
48
|
-
<br />
|
|
49
|
-
<br />
|
|
50
|
-
</StackItem>
|
|
51
|
-
<StackItem>
|
|
52
|
-
<div className={accessibilityStyles.screenReader} aria-live="polite">
|
|
53
|
-
{steps[currentStep] && `On ${steps[currentStep].title}.`}
|
|
54
|
-
{steps[currentStep - 1] && `${steps[currentStep - 1].title} was successful.`}
|
|
55
|
-
</div>
|
|
56
|
-
<ProgressStepper>
|
|
57
|
-
{steps.map((step, index) => {
|
|
58
|
-
let variant = 'pending';
|
|
59
|
-
let ariaLabel = 'pending step';
|
|
60
|
-
if (index < currentStep) {
|
|
61
|
-
variant = 'success';
|
|
62
|
-
ariaLabel = 'completed step, step with success';
|
|
63
|
-
} else if (index === currentStep) {
|
|
64
|
-
variant = 'info';
|
|
65
|
-
ariaLabel = 'current step';
|
|
66
|
-
}
|
|
13
|
+
```ts file="examples/ProgressStepper/ProgressStepperBasic.tsx"
|
|
67
14
|
|
|
68
|
-
return (
|
|
69
|
-
<ProgressStep
|
|
70
|
-
id={index}
|
|
71
|
-
titleId={step.id}
|
|
72
|
-
key={index}
|
|
73
|
-
variant={variant}
|
|
74
|
-
isCurrent={index === currentStep}
|
|
75
|
-
aria-label={ariaLabel}
|
|
76
|
-
>
|
|
77
|
-
{step.title}
|
|
78
|
-
</ProgressStep>
|
|
79
|
-
);
|
|
80
|
-
})}
|
|
81
|
-
</ProgressStepper>
|
|
82
|
-
</StackItem>
|
|
83
|
-
</Stack>
|
|
84
|
-
);
|
|
85
|
-
};
|
|
86
15
|
```
|