@patternfly/react-core 6.5.0-prerelease.2 → 6.5.0-prerelease.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 +11 -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/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/ExpandableSection/ExpandableSection.d.ts +4 -2
- package/dist/esm/components/ExpandableSection/ExpandableSection.d.ts.map +1 -1
- package/dist/esm/components/ExpandableSection/ExpandableSection.js +2 -1
- package/dist/esm/components/ExpandableSection/ExpandableSection.js.map +1 -1
- package/dist/esm/components/Page/Page.d.ts.map +1 -1
- package/dist/esm/components/Page/Page.js +1 -0
- package/dist/esm/components/Page/Page.js.map +1 -1
- package/dist/esm/components/Page/PageContext.d.ts +1 -0
- package/dist/esm/components/Page/PageContext.d.ts.map +1 -1
- package/dist/esm/components/Page/PageContext.js +1 -0
- package/dist/esm/components/Page/PageContext.js.map +1 -1
- package/dist/esm/components/Page/PageSidebar.js +2 -2
- package/dist/esm/components/Page/PageSidebar.js.map +1 -1
- package/dist/esm/components/Progress/Progress.d.ts +2 -0
- package/dist/esm/components/Progress/Progress.d.ts.map +1 -1
- package/dist/esm/components/Progress/Progress.js +2 -2
- package/dist/esm/components/Progress/Progress.js.map +1 -1
- package/dist/esm/components/Progress/ProgressContainer.d.ts +2 -0
- package/dist/esm/components/Progress/ProgressContainer.d.ts.map +1 -1
- package/dist/esm/components/Progress/ProgressContainer.js +2 -2
- package/dist/esm/components/Progress/ProgressContainer.js.map +1 -1
- package/dist/js/components/ExpandableSection/ExpandableSection.d.ts +4 -2
- package/dist/js/components/ExpandableSection/ExpandableSection.d.ts.map +1 -1
- package/dist/js/components/ExpandableSection/ExpandableSection.js +2 -1
- package/dist/js/components/ExpandableSection/ExpandableSection.js.map +1 -1
- package/dist/js/components/Page/Page.d.ts.map +1 -1
- package/dist/js/components/Page/Page.js +1 -0
- package/dist/js/components/Page/Page.js.map +1 -1
- package/dist/js/components/Page/PageContext.d.ts +1 -0
- package/dist/js/components/Page/PageContext.d.ts.map +1 -1
- package/dist/js/components/Page/PageContext.js +1 -0
- package/dist/js/components/Page/PageContext.js.map +1 -1
- package/dist/js/components/Page/PageSidebar.js +2 -2
- package/dist/js/components/Page/PageSidebar.js.map +1 -1
- package/dist/js/components/Progress/Progress.d.ts +2 -0
- package/dist/js/components/Progress/Progress.d.ts.map +1 -1
- package/dist/js/components/Progress/Progress.js +2 -2
- package/dist/js/components/Progress/Progress.js.map +1 -1
- package/dist/js/components/Progress/ProgressContainer.d.ts +2 -0
- package/dist/js/components/Progress/ProgressContainer.d.ts.map +1 -1
- package/dist/js/components/Progress/ProgressContainer.js +2 -2
- package/dist/js/components/Progress/ProgressContainer.js.map +1 -1
- package/dist/umd/assets/{output-DxVGusJA.css → output-b6v4lKPy.css} +18465 -18465
- package/dist/umd/react-core.min.js +3 -3
- 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/ExpandableSection/ExpandableSection.tsx +8 -3
- package/src/components/ExpandableSection/__tests__/ExpandableSection.test.tsx +34 -0
- package/src/components/ExpandableSection/examples/ExpandableSection.md +8 -0
- package/src/components/ExpandableSection/examples/ExpandableSectionUncontrolledDynamicToggleFunction.tsx +13 -0
- package/src/components/Page/Page.tsx +1 -0
- package/src/components/Page/PageContext.tsx +2 -0
- package/src/components/Page/PageSidebar.tsx +2 -2
- package/src/components/Page/__tests__/Generated/__snapshots__/PageSidebar.test.tsx.snap +1 -1
- package/src/components/Page/__tests__/__snapshots__/Page.test.tsx.snap +12 -12
- package/src/components/Progress/Progress.tsx +4 -0
- package/src/components/Progress/ProgressContainer.tsx +5 -2
- package/src/components/Progress/__tests__/Generated/ProgressContainer.test.tsx +1 -0
- package/src/components/Progress/__tests__/Progress.test.tsx +32 -0
- package/src/components/Progress/examples/Progress.md +2 -14
- package/src/components/Progress/examples/ProgressInteractiveFailure.tsx +55 -0
- package/src/components/Progress/examples/ProgressFailureWithoutMeasure.tsx +0 -5
- package/src/components/Progress/examples/ProgressInsideSuccess.tsx +0 -10
- package/src/components/Progress/examples/ProgressOutsideFailure.tsx +0 -10
package/helpers/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@patternfly/react-core-helpers","main":"../dist/js/helpers/index.js","module":"../dist/esm/helpers/index.js","typings":"../dist/esm/helpers/index.d.ts","version":"6.5.0-prerelease.
|
|
1
|
+
{"name":"@patternfly/react-core-helpers","main":"../dist/js/helpers/index.js","module":"../dist/esm/helpers/index.js","typings":"../dist/esm/helpers/index.d.ts","version":"6.5.0-prerelease.2","private":true}
|
package/layouts/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@patternfly/react-core-layouts","main":"../dist/js/layouts/index.js","module":"../dist/esm/layouts/index.js","typings":"../dist/esm/layouts/index.d.ts","version":"6.5.0-prerelease.
|
|
1
|
+
{"name":"@patternfly/react-core-layouts","main":"../dist/js/layouts/index.js","module":"../dist/esm/layouts/index.js","typings":"../dist/esm/layouts/index.d.ts","version":"6.5.0-prerelease.2","private":true}
|
package/next/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@patternfly/react-core-next","main":"../dist/js/next/index.js","module":"../dist/esm/next/index.js","typings":"../dist/esm/next/index.d.ts","version":"6.5.0-prerelease.
|
|
1
|
+
{"name":"@patternfly/react-core-next","main":"../dist/js/next/index.js","module":"../dist/esm/next/index.js","typings":"../dist/esm/next/index.d.ts","version":"6.5.0-prerelease.2","private":true}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "6.5.0-prerelease.
|
|
3
|
+
"version": "6.5.0-prerelease.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",
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"react": "^17 || ^18 || ^19",
|
|
64
64
|
"react-dom": "^17 || ^18 || ^19"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "40a5015cf1eb4730bda9c5c15e328f6d544bc857"
|
|
67
67
|
}
|
|
@@ -44,8 +44,10 @@ export interface ExpandableSectionProps extends Omit<React.HTMLProps<HTMLDivElem
|
|
|
44
44
|
* use the onToggle property of the expandable section toggle sub-component.
|
|
45
45
|
*/
|
|
46
46
|
onToggle?: (event: React.MouseEvent, isExpanded: boolean) => void;
|
|
47
|
-
/** React node that appears in the attached toggle in place of the toggleText property.
|
|
48
|
-
|
|
47
|
+
/** React node that appears in the attached toggle in place of the toggleText property.
|
|
48
|
+
* Can also be a function that receives the expanded state and returns a React node.
|
|
49
|
+
*/
|
|
50
|
+
toggleContent?: React.ReactNode | ((isExpanded: boolean) => React.ReactNode);
|
|
49
51
|
/** Text that appears in the attached toggle. */
|
|
50
52
|
toggleText?: string;
|
|
51
53
|
/** Text that appears in the attached toggle when collapsed (will override toggleText if
|
|
@@ -246,6 +248,9 @@ class ExpandableSection extends Component<ExpandableSectionProps, ExpandableSect
|
|
|
246
248
|
propOrStateIsExpanded
|
|
247
249
|
);
|
|
248
250
|
|
|
251
|
+
const computedToggleContent =
|
|
252
|
+
typeof toggleContent === 'function' ? toggleContent(propOrStateIsExpanded) : toggleContent;
|
|
253
|
+
|
|
249
254
|
const expandableToggle = !isDetached && (
|
|
250
255
|
<div className={`${styles.expandableSection}__toggle`}>
|
|
251
256
|
<Button
|
|
@@ -265,7 +270,7 @@ class ExpandableSection extends Component<ExpandableSectionProps, ExpandableSect
|
|
|
265
270
|
aria-label={toggleAriaLabel}
|
|
266
271
|
aria-labelledby={toggleAriaLabelledBy}
|
|
267
272
|
>
|
|
268
|
-
{
|
|
273
|
+
{computedToggleContent || computedToggleText}
|
|
269
274
|
</Button>
|
|
270
275
|
</div>
|
|
271
276
|
);
|
|
@@ -208,3 +208,37 @@ test('Renders with aria-labelledby when toggleAriaLabelledBy is passed', () => {
|
|
|
208
208
|
|
|
209
209
|
expect(screen.getByRole('button')).toHaveAccessibleName('Test label');
|
|
210
210
|
});
|
|
211
|
+
test('Renders toggleContent as a function in uncontrolled mode (collapsed)', () => {
|
|
212
|
+
render(
|
|
213
|
+
<ExpandableSection toggleContent={(isExpanded) => (isExpanded ? 'Hide details' : 'Show details')}>
|
|
214
|
+
Test content
|
|
215
|
+
</ExpandableSection>
|
|
216
|
+
);
|
|
217
|
+
|
|
218
|
+
expect(screen.getByRole('button', { name: 'Show details' })).toBeInTheDocument();
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
test('Renders toggleContent as a function in uncontrolled mode (expanded after click)', async () => {
|
|
222
|
+
const user = userEvent.setup();
|
|
223
|
+
|
|
224
|
+
render(
|
|
225
|
+
<ExpandableSection toggleContent={(isExpanded) => (isExpanded ? 'Hide details' : 'Show details')}>
|
|
226
|
+
Test content
|
|
227
|
+
</ExpandableSection>
|
|
228
|
+
);
|
|
229
|
+
|
|
230
|
+
const button = screen.getByRole('button', { name: 'Show details' });
|
|
231
|
+
await user.click(button);
|
|
232
|
+
|
|
233
|
+
expect(screen.getByRole('button', { name: 'Hide details' })).toBeInTheDocument();
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
test('Renders toggleContent as a function in controlled mode', () => {
|
|
237
|
+
render(
|
|
238
|
+
<ExpandableSection isExpanded={true} toggleContent={(isExpanded) => (isExpanded ? 'Collapse' : 'Expand')}>
|
|
239
|
+
Test content
|
|
240
|
+
</ExpandableSection>
|
|
241
|
+
);
|
|
242
|
+
|
|
243
|
+
expect(screen.getByRole('button', { name: 'Collapse' })).toBeInTheDocument();
|
|
244
|
+
});
|
|
@@ -28,6 +28,14 @@ import CheckCircleIcon from '@patternfly/react-icons/dist/esm/icons/check-circle
|
|
|
28
28
|
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
+
### Uncontrolled with dynamic toggle content (function)
|
|
32
|
+
|
|
33
|
+
Use `toggleContent` as a function to dynamically render different content based on the expanded state without managing state yourself.
|
|
34
|
+
|
|
35
|
+
```ts file="ExpandableSectionUncontrolledDynamicToggleFunction.tsx"
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
|
|
31
39
|
### Detached
|
|
32
40
|
|
|
33
41
|
When passing the `isDetached` property into `<ExpandableSection>`, you must also manually pass in the same `toggleId` and `contentId` properties to both `<ExpandableSection>` and `<ExpandableSectionToggle>`. This will link the content to the toggle via ARIA attributes.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ExpandableSection } from '@patternfly/react-core';
|
|
2
|
+
|
|
3
|
+
export const ExpandableSectionUncontrolledDynamicToggleFunction: React.FunctionComponent = () => (
|
|
4
|
+
<ExpandableSection
|
|
5
|
+
toggleContent={(isExpanded) =>
|
|
6
|
+
isExpanded
|
|
7
|
+
? 'Show less uncontrolled dynamic toggle example content'
|
|
8
|
+
: 'Show more uncontrolled dynamic toggle example content'
|
|
9
|
+
}
|
|
10
|
+
>
|
|
11
|
+
This content is visible only when the component is expanded.
|
|
12
|
+
</ExpandableSection>
|
|
13
|
+
);
|
|
@@ -266,6 +266,7 @@ class Page extends Component<PageProps, PageState> {
|
|
|
266
266
|
isManagedSidebar,
|
|
267
267
|
onSidebarToggle: mobileView ? this.onSidebarToggleMobile : this.onSidebarToggleDesktop,
|
|
268
268
|
isSidebarOpen: mobileView ? mobileIsSidebarOpen : desktopIsSidebarOpen,
|
|
269
|
+
isMobile: mobileView,
|
|
269
270
|
width,
|
|
270
271
|
height,
|
|
271
272
|
getBreakpoint,
|
|
@@ -6,6 +6,7 @@ export interface PageContextProps {
|
|
|
6
6
|
isManagedSidebar: boolean;
|
|
7
7
|
onSidebarToggle: () => void;
|
|
8
8
|
isSidebarOpen: boolean;
|
|
9
|
+
isMobile: boolean;
|
|
9
10
|
width: number;
|
|
10
11
|
height: number;
|
|
11
12
|
getBreakpoint: (width: number | null) => 'default' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';
|
|
@@ -16,6 +17,7 @@ export const pageContextDefaults: PageContextProps = {
|
|
|
16
17
|
isManagedSidebar: false,
|
|
17
18
|
isSidebarOpen: false,
|
|
18
19
|
onSidebarToggle: () => null,
|
|
20
|
+
isMobile: false,
|
|
19
21
|
width: null,
|
|
20
22
|
height: null,
|
|
21
23
|
getBreakpoint,
|
|
@@ -35,7 +35,7 @@ export const PageSidebar: React.FunctionComponent<PageSidebarProps> = ({
|
|
|
35
35
|
...props
|
|
36
36
|
}: PageSidebarProps) => (
|
|
37
37
|
<PageContextConsumer>
|
|
38
|
-
{({ isManagedSidebar, isSidebarOpen: managedIsNavOpen }
|
|
38
|
+
{({ isManagedSidebar, isSidebarOpen: managedIsNavOpen, isMobile }) => {
|
|
39
39
|
const sidebarOpen = isManagedSidebar ? managedIsNavOpen : isSidebarOpen;
|
|
40
40
|
|
|
41
41
|
return (
|
|
@@ -43,7 +43,7 @@ export const PageSidebar: React.FunctionComponent<PageSidebarProps> = ({
|
|
|
43
43
|
id={id}
|
|
44
44
|
className={css(
|
|
45
45
|
styles.pageSidebar,
|
|
46
|
-
sidebarOpen && styles.modifiers.expanded,
|
|
46
|
+
sidebarOpen && isMobile && styles.modifiers.expanded,
|
|
47
47
|
!sidebarOpen && styles.modifiers.collapsed,
|
|
48
48
|
className
|
|
49
49
|
)}
|
|
@@ -12,7 +12,7 @@ exports[`Page Check dark page against snapshot 1`] = `
|
|
|
12
12
|
/>
|
|
13
13
|
<div
|
|
14
14
|
aria-hidden="false"
|
|
15
|
-
class="pf-v6-c-page__sidebar
|
|
15
|
+
class="pf-v6-c-page__sidebar"
|
|
16
16
|
id="page-sidebar"
|
|
17
17
|
>
|
|
18
18
|
<div
|
|
@@ -55,7 +55,7 @@ exports[`Page Check page horizontal layout example against snapshot 1`] = `
|
|
|
55
55
|
/>
|
|
56
56
|
<div
|
|
57
57
|
aria-hidden="false"
|
|
58
|
-
class="pf-v6-c-page__sidebar
|
|
58
|
+
class="pf-v6-c-page__sidebar"
|
|
59
59
|
id="page-sidebar"
|
|
60
60
|
/>
|
|
61
61
|
<div
|
|
@@ -92,7 +92,7 @@ exports[`Page Check page to verify breadcrumb is created - PageBreadcrumb syntax
|
|
|
92
92
|
/>
|
|
93
93
|
<div
|
|
94
94
|
aria-hidden="false"
|
|
95
|
-
class="pf-v6-c-page__sidebar
|
|
95
|
+
class="pf-v6-c-page__sidebar"
|
|
96
96
|
id="page-sidebar"
|
|
97
97
|
/>
|
|
98
98
|
<div
|
|
@@ -237,7 +237,7 @@ exports[`Page Check page to verify breadcrumb is created 1`] = `
|
|
|
237
237
|
/>
|
|
238
238
|
<div
|
|
239
239
|
aria-hidden="false"
|
|
240
|
-
class="pf-v6-c-page__sidebar
|
|
240
|
+
class="pf-v6-c-page__sidebar"
|
|
241
241
|
id="page-sidebar"
|
|
242
242
|
/>
|
|
243
243
|
<div
|
|
@@ -386,7 +386,7 @@ exports[`Page Check page to verify grouped nav and breadcrumb - new components s
|
|
|
386
386
|
/>
|
|
387
387
|
<div
|
|
388
388
|
aria-hidden="false"
|
|
389
|
-
class="pf-v6-c-page__sidebar
|
|
389
|
+
class="pf-v6-c-page__sidebar"
|
|
390
390
|
id="page-sidebar"
|
|
391
391
|
/>
|
|
392
392
|
<div
|
|
@@ -629,7 +629,7 @@ exports[`Page Check page to verify grouped nav and breadcrumb - old / props synt
|
|
|
629
629
|
/>
|
|
630
630
|
<div
|
|
631
631
|
aria-hidden="false"
|
|
632
|
-
class="pf-v6-c-page__sidebar
|
|
632
|
+
class="pf-v6-c-page__sidebar"
|
|
633
633
|
id="page-sidebar"
|
|
634
634
|
/>
|
|
635
635
|
<div
|
|
@@ -913,7 +913,7 @@ exports[`Page Check page to verify skip to content points to main content region
|
|
|
913
913
|
/>
|
|
914
914
|
<div
|
|
915
915
|
aria-hidden="false"
|
|
916
|
-
class="pf-v6-c-page__sidebar
|
|
916
|
+
class="pf-v6-c-page__sidebar"
|
|
917
917
|
id="page-sidebar"
|
|
918
918
|
/>
|
|
919
919
|
<div
|
|
@@ -1063,7 +1063,7 @@ exports[`Page Check page vertical layout example against snapshot 1`] = `
|
|
|
1063
1063
|
/>
|
|
1064
1064
|
<div
|
|
1065
1065
|
aria-hidden="false"
|
|
1066
|
-
class="pf-v6-c-page__sidebar
|
|
1066
|
+
class="pf-v6-c-page__sidebar"
|
|
1067
1067
|
id="page-sidebar"
|
|
1068
1068
|
>
|
|
1069
1069
|
<div
|
|
@@ -1106,7 +1106,7 @@ exports[`Page Sticky bottom breadcrumb on all height breakpoints - PageBreadcrum
|
|
|
1106
1106
|
/>
|
|
1107
1107
|
<div
|
|
1108
1108
|
aria-hidden="false"
|
|
1109
|
-
class="pf-v6-c-page__sidebar
|
|
1109
|
+
class="pf-v6-c-page__sidebar"
|
|
1110
1110
|
id="page-sidebar"
|
|
1111
1111
|
/>
|
|
1112
1112
|
<div
|
|
@@ -1251,7 +1251,7 @@ exports[`Page Verify sticky bottom breadcrumb on all height breakpoints 1`] = `
|
|
|
1251
1251
|
/>
|
|
1252
1252
|
<div
|
|
1253
1253
|
aria-hidden="false"
|
|
1254
|
-
class="pf-v6-c-page__sidebar
|
|
1254
|
+
class="pf-v6-c-page__sidebar"
|
|
1255
1255
|
id="page-sidebar"
|
|
1256
1256
|
/>
|
|
1257
1257
|
<div
|
|
@@ -1400,7 +1400,7 @@ exports[`Page Verify sticky top breadcrumb on all height breakpoints - PageBread
|
|
|
1400
1400
|
/>
|
|
1401
1401
|
<div
|
|
1402
1402
|
aria-hidden="false"
|
|
1403
|
-
class="pf-v6-c-page__sidebar
|
|
1403
|
+
class="pf-v6-c-page__sidebar"
|
|
1404
1404
|
id="page-sidebar"
|
|
1405
1405
|
/>
|
|
1406
1406
|
<div
|
|
@@ -1545,7 +1545,7 @@ exports[`Page Verify sticky top breadcrumb on all height breakpoints 1`] = `
|
|
|
1545
1545
|
/>
|
|
1546
1546
|
<div
|
|
1547
1547
|
aria-hidden="false"
|
|
1548
|
-
class="pf-v6-c-page__sidebar
|
|
1548
|
+
class="pf-v6-c-page__sidebar"
|
|
1549
1549
|
id="page-sidebar"
|
|
1550
1550
|
/>
|
|
1551
1551
|
<div
|
|
@@ -48,6 +48,8 @@ export interface ProgressProps extends Omit<React.HTMLProps<HTMLDivElement>, 'si
|
|
|
48
48
|
* We recommend the helper text component as it was designed for this purpose.
|
|
49
49
|
*/
|
|
50
50
|
helperText?: React.ReactNode;
|
|
51
|
+
/** Flag indicating whether the status icon should be hidden, helpful when space is limited (such as within table cells). When set to true, you must ensure the context of the status is provided in another way, such as via the progress measure. */
|
|
52
|
+
hideStatusIcon?: boolean;
|
|
51
53
|
}
|
|
52
54
|
|
|
53
55
|
class Progress extends Component<ProgressProps> {
|
|
@@ -94,6 +96,7 @@ class Progress extends Component<ProgressProps> {
|
|
|
94
96
|
'aria-labelledby': ariaLabelledBy,
|
|
95
97
|
'aria-describedby': ariaDescribedBy,
|
|
96
98
|
helperText,
|
|
99
|
+
hideStatusIcon,
|
|
97
100
|
...props
|
|
98
101
|
} = this.props;
|
|
99
102
|
|
|
@@ -151,6 +154,7 @@ class Progress extends Component<ProgressProps> {
|
|
|
151
154
|
isTitleTruncated={isTitleTruncated}
|
|
152
155
|
tooltipPosition={tooltipPosition}
|
|
153
156
|
helperText={helperText}
|
|
157
|
+
hideStatusIcon={hideStatusIcon}
|
|
154
158
|
/>
|
|
155
159
|
</div>
|
|
156
160
|
);
|
|
@@ -58,6 +58,8 @@ export interface ProgressContainerProps extends Omit<React.HTMLProps<HTMLDivElem
|
|
|
58
58
|
* We recommend the helper text component as it was designed for this purpose.
|
|
59
59
|
*/
|
|
60
60
|
helperText?: React.ReactNode;
|
|
61
|
+
/** Hide the status icon, helpful when space is limited (such as within table cells) */
|
|
62
|
+
hideStatusIcon?: boolean;
|
|
61
63
|
}
|
|
62
64
|
|
|
63
65
|
const variantToIcon = {
|
|
@@ -76,9 +78,10 @@ export const ProgressContainer: React.FunctionComponent<ProgressContainerProps>
|
|
|
76
78
|
measureLocation = ProgressMeasureLocation.top,
|
|
77
79
|
isTitleTruncated = false,
|
|
78
80
|
tooltipPosition,
|
|
79
|
-
helperText
|
|
81
|
+
helperText,
|
|
82
|
+
hideStatusIcon = false
|
|
80
83
|
}: ProgressContainerProps) => {
|
|
81
|
-
const StatusIcon = variantToIcon.hasOwnProperty(variant) && variantToIcon[variant];
|
|
84
|
+
const StatusIcon = !hideStatusIcon && variantToIcon.hasOwnProperty(variant) && variantToIcon[variant];
|
|
82
85
|
const [tooltip, setTooltip] = useState('');
|
|
83
86
|
const titleRef = useRef(null);
|
|
84
87
|
const updateTooltip = (event: any) => {
|
|
@@ -108,3 +108,35 @@ test('Renders passed helper text', () => {
|
|
|
108
108
|
|
|
109
109
|
expect(screen.getByText('Test helper text')).toBeVisible();
|
|
110
110
|
});
|
|
111
|
+
|
|
112
|
+
describe('hideStatusIcon prop behavior', () => {
|
|
113
|
+
test('shows status icon by default when hideStatusIcon is not set', () => {
|
|
114
|
+
render(<Progress id="default-status-icon-test" value={100} variant="success" />);
|
|
115
|
+
|
|
116
|
+
expect(screen.getByRole('img', { hidden: true })).toBeInTheDocument();
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
test('hides status icon when hideStatusIcon flag is set with success variant', () => {
|
|
120
|
+
render(<Progress id="hide-icon-success" value={100} variant="success" hideStatusIcon />);
|
|
121
|
+
|
|
122
|
+
expect(screen.queryByRole('img', { hidden: true })).not.toBeInTheDocument();
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
test('hides status icon when hideStatusIcon flag is set with danger variant', () => {
|
|
126
|
+
render(<Progress id="hide-icon-danger" value={50} variant="danger" hideStatusIcon />);
|
|
127
|
+
|
|
128
|
+
expect(screen.queryByRole('img', { hidden: true })).not.toBeInTheDocument();
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
test('hides status icon when hideStatusIcon flag is set with warning variant', () => {
|
|
132
|
+
render(<Progress id="hide-icon-warning" value={75} variant="warning" hideStatusIcon />);
|
|
133
|
+
|
|
134
|
+
expect(screen.queryByRole('img', { hidden: true })).not.toBeInTheDocument();
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
test('shows status icon when hideStatusIcon is explicitly false', () => {
|
|
138
|
+
render(<Progress id="show-icon-success" value={100} variant="success" hideStatusIcon={false} />);
|
|
139
|
+
|
|
140
|
+
expect(screen.getByRole('img', { hidden: true })).toBeInTheDocument();
|
|
141
|
+
});
|
|
142
|
+
});
|
|
@@ -107,20 +107,8 @@ When conveying status, you should ensure:
|
|
|
107
107
|
|
|
108
108
|
```
|
|
109
109
|
|
|
110
|
-
###
|
|
110
|
+
### Interactive status icon and measure location
|
|
111
111
|
|
|
112
|
-
```ts file="./
|
|
113
|
-
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
### Outside failure
|
|
117
|
-
|
|
118
|
-
```ts file="./ProgressOutsideFailure.tsx"
|
|
119
|
-
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
### Failure without measure
|
|
123
|
-
|
|
124
|
-
```ts file="./ProgressFailureWithoutMeasure.tsx"
|
|
112
|
+
```ts file="./ProgressInteractiveFailure.tsx"
|
|
125
113
|
|
|
126
114
|
```
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Progress,
|
|
4
|
+
ProgressMeasureLocation,
|
|
5
|
+
ProgressVariant,
|
|
6
|
+
Radio,
|
|
7
|
+
Checkbox,
|
|
8
|
+
Form,
|
|
9
|
+
FormGroup
|
|
10
|
+
} from '@patternfly/react-core';
|
|
11
|
+
|
|
12
|
+
export const ProgressInteractiveFailure: React.FunctionComponent = () => {
|
|
13
|
+
const [measureLocation, setMeasureLocation] = useState<ProgressMeasureLocation>(ProgressMeasureLocation.inside);
|
|
14
|
+
const [hideStatusIcon, setHideStatusIcon] = useState<boolean>(false);
|
|
15
|
+
|
|
16
|
+
const measureLocationOptions = [
|
|
17
|
+
{ value: ProgressMeasureLocation.inside, label: 'Inside' },
|
|
18
|
+
{ value: ProgressMeasureLocation.outside, label: 'Outside' },
|
|
19
|
+
{ value: ProgressMeasureLocation.top, label: 'Top' },
|
|
20
|
+
{ value: ProgressMeasureLocation.none, label: 'None' }
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<Form>
|
|
25
|
+
<FormGroup fieldId="measure-location" label="Measure location">
|
|
26
|
+
{measureLocationOptions.map((option) => (
|
|
27
|
+
<Radio
|
|
28
|
+
key={option.value}
|
|
29
|
+
id={`measure-location-${option.value}`}
|
|
30
|
+
name="measure-location"
|
|
31
|
+
label={option.label}
|
|
32
|
+
value={option.value}
|
|
33
|
+
isChecked={measureLocation === option.value}
|
|
34
|
+
onChange={() => setMeasureLocation(option.value)}
|
|
35
|
+
/>
|
|
36
|
+
))}
|
|
37
|
+
</FormGroup>
|
|
38
|
+
<FormGroup fieldId="hide-status-icon">
|
|
39
|
+
<Checkbox
|
|
40
|
+
id="hide-status-icon"
|
|
41
|
+
label="Hide status icon"
|
|
42
|
+
isChecked={hideStatusIcon}
|
|
43
|
+
onChange={(_, checked) => setHideStatusIcon(checked)}
|
|
44
|
+
/>
|
|
45
|
+
</FormGroup>
|
|
46
|
+
<Progress
|
|
47
|
+
value={33}
|
|
48
|
+
title="Title"
|
|
49
|
+
measureLocation={measureLocation}
|
|
50
|
+
variant={ProgressVariant.danger}
|
|
51
|
+
hideStatusIcon={hideStatusIcon}
|
|
52
|
+
/>
|
|
53
|
+
</Form>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { Progress, ProgressMeasureLocation, ProgressVariant } from '@patternfly/react-core';
|
|
2
|
-
|
|
3
|
-
export const ProgressFailureWithoutMeasure: React.FunctionComponent = () => (
|
|
4
|
-
<Progress value={33} title="Title" measureLocation={ProgressMeasureLocation.none} variant={ProgressVariant.danger} />
|
|
5
|
-
);
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Progress, ProgressMeasureLocation, ProgressVariant } from '@patternfly/react-core';
|
|
2
|
-
|
|
3
|
-
export const ProgressInsideSuccess: React.FunctionComponent = () => (
|
|
4
|
-
<Progress
|
|
5
|
-
value={100}
|
|
6
|
-
title="Title"
|
|
7
|
-
measureLocation={ProgressMeasureLocation.inside}
|
|
8
|
-
variant={ProgressVariant.success}
|
|
9
|
-
/>
|
|
10
|
-
);
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Progress, ProgressMeasureLocation, ProgressVariant } from '@patternfly/react-core';
|
|
2
|
-
|
|
3
|
-
export const ProgressOutsideFailure: React.FunctionComponent = () => (
|
|
4
|
-
<Progress
|
|
5
|
-
value={33}
|
|
6
|
-
title="Title"
|
|
7
|
-
measureLocation={ProgressMeasureLocation.outside}
|
|
8
|
-
variant={ProgressVariant.danger}
|
|
9
|
-
/>
|
|
10
|
-
);
|