@patternfly/react-core 5.2.0-prerelease.20 → 5.2.0-prerelease.21
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/Chip/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/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/DragDrop/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/Text/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/Tile/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/ApplicationLauncher/package.json +1 -1
- package/dist/dynamic/deprecated/components/ContextSelector/package.json +1 -1
- package/dist/dynamic/deprecated/components/Dropdown/package.json +1 -1
- package/dist/dynamic/deprecated/components/OptionsMenu/package.json +1 -1
- package/dist/dynamic/deprecated/components/PageHeader/package.json +1 -1
- package/dist/dynamic/deprecated/components/Select/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/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/favorites/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/next/components/package.json +1 -1
- package/dist/esm/components/NotificationDrawer/NotificationDrawerHeader.d.ts.map +1 -1
- package/dist/esm/components/NotificationDrawer/NotificationDrawerHeader.js +1 -1
- package/dist/esm/components/NotificationDrawer/NotificationDrawerHeader.js.map +1 -1
- package/dist/esm/components/NotificationDrawer/NotificationDrawerListItem.d.ts +2 -0
- package/dist/esm/components/NotificationDrawer/NotificationDrawerListItem.d.ts.map +1 -1
- package/dist/esm/components/NotificationDrawer/NotificationDrawerListItem.js +11 -2
- package/dist/esm/components/NotificationDrawer/NotificationDrawerListItem.js.map +1 -1
- package/dist/esm/components/TextInput/TextInput.d.ts +9 -1
- package/dist/esm/components/TextInput/TextInput.d.ts.map +1 -1
- package/dist/esm/components/TextInput/TextInput.js +6 -3
- package/dist/esm/components/TextInput/TextInput.js.map +1 -1
- package/dist/esm/components/Wizard/Wizard.d.ts +1 -1
- package/dist/esm/components/Wizard/Wizard.d.ts.map +1 -1
- package/dist/esm/components/Wizard/Wizard.js +5 -11
- package/dist/esm/components/Wizard/Wizard.js.map +1 -1
- package/dist/esm/components/Wizard/WizardBody.d.ts +1 -1
- package/dist/esm/components/Wizard/WizardBody.d.ts.map +1 -1
- package/dist/esm/components/Wizard/WizardBody.js +1 -1
- package/dist/esm/components/Wizard/WizardBody.js.map +1 -1
- package/dist/esm/components/Wizard/WizardFooter.d.ts +7 -1
- package/dist/esm/components/Wizard/WizardFooter.d.ts.map +1 -1
- package/dist/esm/components/Wizard/WizardFooter.js +4 -4
- package/dist/esm/components/Wizard/WizardFooter.js.map +1 -1
- package/dist/esm/components/Wizard/WizardNavInternal.js +2 -2
- package/dist/esm/components/Wizard/WizardNavInternal.js.map +1 -1
- package/dist/esm/components/Wizard/WizardToggle.js +1 -1
- package/dist/esm/components/Wizard/WizardToggle.js.map +1 -1
- package/dist/esm/components/Wizard/types.d.ts +3 -0
- package/dist/esm/components/Wizard/types.d.ts.map +1 -1
- package/dist/esm/components/Wizard/types.js.map +1 -1
- package/dist/esm/components/Wizard/utils.d.ts +8 -1
- package/dist/esm/components/Wizard/utils.d.ts.map +1 -1
- package/dist/esm/components/Wizard/utils.js +22 -0
- package/dist/esm/components/Wizard/utils.js.map +1 -1
- package/dist/js/components/NotificationDrawer/NotificationDrawerHeader.d.ts.map +1 -1
- package/dist/js/components/NotificationDrawer/NotificationDrawerHeader.js +1 -1
- package/dist/js/components/NotificationDrawer/NotificationDrawerHeader.js.map +1 -1
- package/dist/js/components/NotificationDrawer/NotificationDrawerListItem.d.ts +2 -0
- package/dist/js/components/NotificationDrawer/NotificationDrawerListItem.d.ts.map +1 -1
- package/dist/js/components/NotificationDrawer/NotificationDrawerListItem.js +11 -2
- package/dist/js/components/NotificationDrawer/NotificationDrawerListItem.js.map +1 -1
- package/dist/js/components/TextInput/TextInput.d.ts +9 -1
- package/dist/js/components/TextInput/TextInput.d.ts.map +1 -1
- package/dist/js/components/TextInput/TextInput.js +6 -3
- package/dist/js/components/TextInput/TextInput.js.map +1 -1
- package/dist/js/components/Wizard/Wizard.d.ts +1 -1
- package/dist/js/components/Wizard/Wizard.d.ts.map +1 -1
- package/dist/js/components/Wizard/Wizard.js +4 -10
- package/dist/js/components/Wizard/Wizard.js.map +1 -1
- package/dist/js/components/Wizard/WizardBody.d.ts +1 -1
- package/dist/js/components/Wizard/WizardBody.d.ts.map +1 -1
- package/dist/js/components/Wizard/WizardBody.js +1 -1
- package/dist/js/components/Wizard/WizardBody.js.map +1 -1
- package/dist/js/components/Wizard/WizardFooter.d.ts +7 -1
- package/dist/js/components/Wizard/WizardFooter.d.ts.map +1 -1
- package/dist/js/components/Wizard/WizardFooter.js +4 -4
- package/dist/js/components/Wizard/WizardFooter.js.map +1 -1
- package/dist/js/components/Wizard/WizardNavInternal.js +2 -2
- package/dist/js/components/Wizard/WizardNavInternal.js.map +1 -1
- package/dist/js/components/Wizard/WizardToggle.js +1 -1
- package/dist/js/components/Wizard/WizardToggle.js.map +1 -1
- package/dist/js/components/Wizard/types.d.ts +3 -0
- package/dist/js/components/Wizard/types.d.ts.map +1 -1
- package/dist/js/components/Wizard/types.js.map +1 -1
- package/dist/js/components/Wizard/utils.d.ts +8 -1
- package/dist/js/components/Wizard/utils.d.ts.map +1 -1
- package/dist/js/components/Wizard/utils.js +24 -1
- package/dist/js/components/Wizard/utils.js.map +1 -1
- 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/Divider/__tests__/Divider.test.tsx +96 -21
- package/src/components/Divider/__tests__/__snapshots__/Divider.test.tsx.snap +1 -41
- package/src/components/NotificationDrawer/NotificationDrawerHeader.tsx +3 -1
- package/src/components/NotificationDrawer/NotificationDrawerListItem.tsx +12 -0
- package/src/components/NotificationDrawer/__tests__/NotificationDrawerListItem.test.tsx +14 -1
- package/src/components/NotificationDrawer/__tests__/__snapshots__/NotificationDrawerHeader.test.tsx.snap +2 -0
- package/src/components/NotificationDrawer/__tests__/__snapshots__/NotificationDrawerListItem.test.tsx.snap +7 -1
- package/src/components/TextInput/TextInput.tsx +16 -2
- package/src/components/TextInput/__tests__/TextInput.test.tsx +9 -0
- package/src/components/TextInput/examples/TextInput.md +1 -1
- package/src/components/Wizard/Wizard.tsx +6 -18
- package/src/components/Wizard/WizardBody.tsx +2 -2
- package/src/components/Wizard/WizardFooter.tsx +20 -5
- package/src/components/Wizard/WizardNavInternal.tsx +2 -2
- package/src/components/Wizard/WizardToggle.tsx +1 -1
- package/src/components/Wizard/__tests__/Wizard.test.tsx +188 -17
- package/src/components/Wizard/__tests__/WizardBody.test.tsx +1 -1
- package/src/components/Wizard/examples/WizardGetCurrentStep.tsx +38 -4
- package/src/components/Wizard/types.tsx +4 -0
- package/src/components/Wizard/utils.ts +25 -2
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":"5.2.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":"5.2.0-prerelease.20","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":"5.2.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":"5.2.0-prerelease.20","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":"5.2.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":"5.2.0-prerelease.20","private":true}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "5.2.0-prerelease.
|
|
3
|
+
"version": "5.2.0-prerelease.21",
|
|
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",
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"react": "^17 || ^18",
|
|
72
72
|
"react-dom": "^17 || ^18"
|
|
73
73
|
},
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "4f459ebc5c316b0a6f5fe8e1405b3566ed8d24ab"
|
|
75
75
|
}
|
|
@@ -1,34 +1,109 @@
|
|
|
1
|
-
import { Divider } from '../Divider';
|
|
2
|
-
import { Flex, FlexItem } from '../../../layouts/Flex';
|
|
3
1
|
import * as React from 'react';
|
|
4
|
-
import { render } from '@testing-library/react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import { Divider } from '../Divider';
|
|
4
|
+
import styles from '@patternfly/react-styles/css/components/Divider/divider';
|
|
5
5
|
|
|
6
|
-
test(
|
|
7
|
-
|
|
8
|
-
expect(
|
|
6
|
+
test(`Renders with only the class name ${styles.divider} by default`, () => {
|
|
7
|
+
render(<Divider />);
|
|
8
|
+
expect(screen.getByRole('separator')).toHaveClass(styles.divider, { exact: true });
|
|
9
9
|
});
|
|
10
10
|
|
|
11
|
-
test('
|
|
12
|
-
|
|
13
|
-
expect(
|
|
11
|
+
test('Renders with horizontal rule by default', () => {
|
|
12
|
+
render(<Divider />);
|
|
13
|
+
expect(screen.getByRole('separator')).toContainHTML('<hr class="pf-v5-c-divider" />');
|
|
14
14
|
});
|
|
15
15
|
|
|
16
|
-
test('
|
|
17
|
-
|
|
18
|
-
expect(
|
|
16
|
+
test('Renders with element passed to component prop', () => {
|
|
17
|
+
render(<Divider component="li" />);
|
|
18
|
+
expect(screen.getByRole('separator')?.tagName).toBe('LI');
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
test('Test default orientation (vertical divider)', () => {
|
|
22
|
+
render(<Divider orientation={{ default: 'vertical' }} />);
|
|
23
|
+
expect(screen.getByRole('separator')).toHaveClass('pf-m-vertical');
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
test('Test sm orientation', () => {
|
|
27
|
+
render(<Divider orientation={{ sm: 'horizontal' }} />);
|
|
28
|
+
expect(screen.getByRole('separator')).toHaveClass('pf-m-horizontal-on-sm');
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
test('Test md orientation', () => {
|
|
32
|
+
render(<Divider orientation={{ md: 'vertical' }} />);
|
|
33
|
+
expect(screen.getByRole('separator')).toHaveClass('pf-m-vertical-on-md');
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
test('Test lg orientation', () => {
|
|
37
|
+
render(<Divider orientation={{ lg: 'horizontal' }} />);
|
|
38
|
+
expect(screen.getByRole('separator')).toHaveClass('pf-m-horizontal-on-lg');
|
|
19
39
|
});
|
|
20
40
|
|
|
21
|
-
test('
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
41
|
+
test('Test xl orientation', () => {
|
|
42
|
+
render(<Divider orientation={{ xl: 'vertical' }} />);
|
|
43
|
+
expect(screen.getByRole('separator')).toHaveClass('pf-m-vertical-on-xl');
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
test('Test 2xl orientation', () => {
|
|
47
|
+
render(<Divider orientation={{ '2xl': 'horizontal' }} />);
|
|
48
|
+
expect(screen.getByRole('separator')).toHaveClass('pf-m-horizontal-on-2xl');
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
test('Test default inset', () => {
|
|
52
|
+
render(<Divider inset={{ default: 'insetNone' }} />);
|
|
53
|
+
expect(screen.getByRole('separator')).toHaveClass('pf-m-inset-none');
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test(`Test all insets`, () => {
|
|
57
|
+
const insetValues = Object.values([
|
|
58
|
+
'insetNone',
|
|
59
|
+
'insetXs',
|
|
60
|
+
'insetSm',
|
|
61
|
+
'insetMd',
|
|
62
|
+
'insetLg',
|
|
63
|
+
'insetXl',
|
|
64
|
+
'inset2xl',
|
|
65
|
+
'inset3xl'
|
|
66
|
+
] as ['insetNone', 'insetXs', 'insetSm', 'insetMd', 'insetLg', 'insetXl', 'inset2xl', 'inset3xl']);
|
|
67
|
+
|
|
68
|
+
insetValues.forEach((insetValue) => {
|
|
69
|
+
|
|
70
|
+
const modifiers = ['none', 'xs', 'sm', 'md', 'lg', 'xl', '2xl', '3xl'];
|
|
71
|
+
|
|
72
|
+
const classValue = modifiers.forEach((modifier, index) => {
|
|
73
|
+
const smClass = `pf-m-inset-${modifier}-on-sm`;
|
|
74
|
+
const mdClass = `pf-m-inset-${modifier}-on-md`;
|
|
75
|
+
const lgClass = `pf-m-inset-${modifier}-on-lg`;
|
|
76
|
+
const xlClass = `pf-m-inset-${modifier}-on-xl`;
|
|
77
|
+
const xl2Class = `pf-m-inset-${modifier}-on-2xl`;
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
render(
|
|
25
81
|
<Divider
|
|
26
|
-
|
|
27
|
-
default:
|
|
82
|
+
inset={{
|
|
83
|
+
default: insetValue,
|
|
84
|
+
sm: insetValue,
|
|
85
|
+
md: insetValue,
|
|
86
|
+
lg: insetValue,
|
|
87
|
+
xl: insetValue,
|
|
88
|
+
'2xl': insetValue
|
|
28
89
|
}}
|
|
29
90
|
/>
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
91
|
+
);
|
|
92
|
+
});
|
|
93
|
+
const modifiers = ['none', 'xs', 'sm', 'md', 'lg', 'xl', '2xl', '3xl'];
|
|
94
|
+
|
|
95
|
+
const classValue = modifiers.forEach((modifier, index) => {
|
|
96
|
+
const smClass = `pf-m-inset-${modifier}-on-sm`;
|
|
97
|
+
const mdClass = `pf-m-inset-${modifier}-on-md`;
|
|
98
|
+
const lgClass = `pf-m-inset-${modifier}-on-lg`;
|
|
99
|
+
const xlClass = `pf-m-inset-${modifier}-on-xl`;
|
|
100
|
+
const xl2Class = `pf-m-inset-${modifier}-on-2xl`;
|
|
101
|
+
|
|
102
|
+
expect(screen.getAllByRole('separator')[index]).toHaveClass(smClass, mdClass, lgClass, xlClass, xl2Class);
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
test('Matches the snapshot', () => {
|
|
107
|
+
const { asFragment } = render(<Divider />);
|
|
33
108
|
expect(asFragment()).toMatchSnapshot();
|
|
34
109
|
});
|
|
@@ -1,49 +1,9 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`
|
|
4
|
-
<DocumentFragment>
|
|
5
|
-
<div
|
|
6
|
-
class="pf-v5-c-divider"
|
|
7
|
-
role="separator"
|
|
8
|
-
/>
|
|
9
|
-
</DocumentFragment>
|
|
10
|
-
`;
|
|
11
|
-
|
|
12
|
-
exports[`divider using hr 1`] = `
|
|
3
|
+
exports[`Matches the snapshot 1`] = `
|
|
13
4
|
<DocumentFragment>
|
|
14
5
|
<hr
|
|
15
6
|
class="pf-v5-c-divider"
|
|
16
7
|
/>
|
|
17
8
|
</DocumentFragment>
|
|
18
9
|
`;
|
|
19
|
-
|
|
20
|
-
exports[`divider using li 1`] = `
|
|
21
|
-
<DocumentFragment>
|
|
22
|
-
<li
|
|
23
|
-
class="pf-v5-c-divider"
|
|
24
|
-
role="separator"
|
|
25
|
-
/>
|
|
26
|
-
</DocumentFragment>
|
|
27
|
-
`;
|
|
28
|
-
|
|
29
|
-
exports[`vertical divider 1`] = `
|
|
30
|
-
<DocumentFragment>
|
|
31
|
-
<div
|
|
32
|
-
class="pf-v5-l-flex"
|
|
33
|
-
>
|
|
34
|
-
<div
|
|
35
|
-
class=""
|
|
36
|
-
>
|
|
37
|
-
first item
|
|
38
|
-
</div>
|
|
39
|
-
<hr
|
|
40
|
-
class="pf-v5-c-divider pf-m-vertical"
|
|
41
|
-
/>
|
|
42
|
-
<div
|
|
43
|
-
class=""
|
|
44
|
-
>
|
|
45
|
-
second item
|
|
46
|
-
</div>
|
|
47
|
-
</div>
|
|
48
|
-
</DocumentFragment>
|
|
49
|
-
`;
|
|
@@ -42,7 +42,9 @@ export const NotificationDrawerHeader: React.FunctionComponent<NotificationDrawe
|
|
|
42
42
|
{title}
|
|
43
43
|
</Text>
|
|
44
44
|
{(customText !== undefined || count !== undefined) && (
|
|
45
|
-
<span className={css(styles.notificationDrawerHeaderStatus)}
|
|
45
|
+
<span className={css(styles.notificationDrawerHeaderStatus)} aria-live="polite">
|
|
46
|
+
{customText || `${count} ${unreadText}`}
|
|
47
|
+
</span>
|
|
46
48
|
)}
|
|
47
49
|
{(children || onClose) && (
|
|
48
50
|
<div className={css(styles.notificationDrawerHeaderAction)}>
|
|
@@ -13,6 +13,8 @@ export interface NotificationDrawerListItemProps extends React.HTMLProps<HTMLLIE
|
|
|
13
13
|
isRead?: boolean;
|
|
14
14
|
/** Callback for when a list item is clicked */
|
|
15
15
|
onClick?: (event: any) => void;
|
|
16
|
+
/** Visually hidden text that conveys the current read state of the notification list item */
|
|
17
|
+
readStateScreenReaderText?: string;
|
|
16
18
|
/** Tab index for the list item */
|
|
17
19
|
tabIndex?: number;
|
|
18
20
|
/** Variant indicates the severity level */
|
|
@@ -26,6 +28,7 @@ export const NotificationDrawerListItem: React.FunctionComponent<NotificationDra
|
|
|
26
28
|
isRead = false,
|
|
27
29
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
28
30
|
onClick = (event: React.MouseEvent) => undefined as any,
|
|
31
|
+
readStateScreenReaderText,
|
|
29
32
|
tabIndex = 0,
|
|
30
33
|
variant = 'custom',
|
|
31
34
|
...props
|
|
@@ -38,6 +41,14 @@ export const NotificationDrawerListItem: React.FunctionComponent<NotificationDra
|
|
|
38
41
|
}
|
|
39
42
|
}
|
|
40
43
|
};
|
|
44
|
+
|
|
45
|
+
let readStateSRText;
|
|
46
|
+
if (readStateScreenReaderText) {
|
|
47
|
+
readStateSRText = readStateScreenReaderText;
|
|
48
|
+
} else {
|
|
49
|
+
readStateSRText = isRead ? 'read' : 'unread';
|
|
50
|
+
}
|
|
51
|
+
|
|
41
52
|
return (
|
|
42
53
|
<li
|
|
43
54
|
{...props}
|
|
@@ -52,6 +63,7 @@ export const NotificationDrawerListItem: React.FunctionComponent<NotificationDra
|
|
|
52
63
|
onClick={(e) => onClick(e)}
|
|
53
64
|
onKeyDown={onKeyDown}
|
|
54
65
|
>
|
|
66
|
+
<span className="pf-v5-screen-reader">{readStateSRText}</span>
|
|
55
67
|
{children}
|
|
56
68
|
</li>
|
|
57
69
|
);
|
|
@@ -21,8 +21,21 @@ describe('NotificationDrawerListItem', () => {
|
|
|
21
21
|
expect(screen.getByRole('listitem')).toHaveClass('pf-m-hoverable');
|
|
22
22
|
});
|
|
23
23
|
|
|
24
|
-
test('drawer list item with isRead applied', () => {
|
|
24
|
+
test('drawer list item with isRead applied and screen reader text is set to read', () => {
|
|
25
25
|
render(<NotificationDrawerListItem isRead />);
|
|
26
26
|
expect(screen.getByRole('listitem')).toHaveClass('pf-m-read');
|
|
27
|
+
expect(screen.getByRole('listitem')).toContainHTML('<span class="pf-v5-screen-reader">read</span>');
|
|
28
|
+
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
test('drawer list item has screen reader text set to unread by default', () => {
|
|
32
|
+
render(<NotificationDrawerListItem />);
|
|
33
|
+
expect(screen.getByRole('listitem')).toContainHTML('<span class="pf-v5-screen-reader">unread</span>');
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
test('drawer list item screen reader textcan be customized', () => {
|
|
37
|
+
render(<NotificationDrawerListItem readStateScreenReaderText="was read"/>);
|
|
38
|
+
expect(screen.getByRole('listitem')).toContainHTML('<span class="pf-v5-screen-reader">was read</span>');
|
|
27
39
|
});
|
|
28
40
|
});
|
|
41
|
+
|
|
@@ -15,6 +15,7 @@ exports[`NotificationDrawerHeader drawer header with count applied 1`] = `
|
|
|
15
15
|
Notifications
|
|
16
16
|
</h1>
|
|
17
17
|
<span
|
|
18
|
+
aria-live="polite"
|
|
18
19
|
class="pf-v5-c-notification-drawer__header-status"
|
|
19
20
|
>
|
|
20
21
|
2 unread
|
|
@@ -38,6 +39,7 @@ exports[`NotificationDrawerHeader drawer header with custom unread text applied
|
|
|
38
39
|
Notifications
|
|
39
40
|
</h1>
|
|
40
41
|
<span
|
|
42
|
+
aria-live="polite"
|
|
41
43
|
class="pf-v5-c-notification-drawer__header-status"
|
|
42
44
|
>
|
|
43
45
|
2 unread alerts
|
|
@@ -5,6 +5,12 @@ exports[`NotificationDrawerListItem renders with PatternFly Core styles 1`] = `
|
|
|
5
5
|
<li
|
|
6
6
|
class="pf-v5-c-notification-drawer__list-item pf-m-hoverable pf-m-custom"
|
|
7
7
|
tabindex="0"
|
|
8
|
-
|
|
8
|
+
>
|
|
9
|
+
<span
|
|
10
|
+
class="pf-v5-screen-reader"
|
|
11
|
+
>
|
|
12
|
+
unread
|
|
13
|
+
</span>
|
|
14
|
+
</li>
|
|
9
15
|
</DocumentFragment>
|
|
10
16
|
`;
|
|
@@ -26,6 +26,13 @@ export enum TextInputReadOnlyVariant {
|
|
|
26
26
|
plain = 'plain'
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
export interface TextInputExpandedObj {
|
|
30
|
+
/** Flag to apply expanded styling. */
|
|
31
|
+
isExpanded: boolean;
|
|
32
|
+
/** Id of the element that the text input is controlling expansion of. */
|
|
33
|
+
ariaControls: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
29
36
|
export interface TextInputProps
|
|
30
37
|
extends Omit<React.HTMLProps<HTMLInputElement>, 'onChange' | 'onFocus' | 'onBlur' | 'disabled' | 'ref'>,
|
|
31
38
|
OUIAProps {
|
|
@@ -33,8 +40,10 @@ export interface TextInputProps
|
|
|
33
40
|
className?: string;
|
|
34
41
|
/** Flag to show if the text input is disabled. */
|
|
35
42
|
isDisabled?: boolean;
|
|
36
|
-
/** Flag to apply expanded styling */
|
|
43
|
+
/** @deprecated Flag to apply expanded styling. expandedProps should now be used instead. */
|
|
37
44
|
isExpanded?: boolean;
|
|
45
|
+
/** Prop to apply expanded styling to the text input and link it to the element it is controlling. This should be used when the input controls a menu and that menu is expandable. */
|
|
46
|
+
expandedProps?: TextInputExpandedObj;
|
|
38
47
|
/** Sets the input as readonly and determines the readonly styling. */
|
|
39
48
|
readOnlyVariant?: 'plain' | 'default';
|
|
40
49
|
/** Flag indicating whether the input is required */
|
|
@@ -182,6 +191,7 @@ export class TextInputBase extends React.Component<TextInputProps, TextInputStat
|
|
|
182
191
|
isLeftTruncated,
|
|
183
192
|
isStartTruncated,
|
|
184
193
|
isExpanded,
|
|
194
|
+
expandedProps,
|
|
185
195
|
readOnly,
|
|
186
196
|
readOnlyVariant,
|
|
187
197
|
isRequired,
|
|
@@ -193,6 +203,9 @@ export class TextInputBase extends React.Component<TextInputProps, TextInputStat
|
|
|
193
203
|
} = this.props;
|
|
194
204
|
|
|
195
205
|
const hasStatusIcon = ['success', 'error', 'warning'].includes(validated);
|
|
206
|
+
const ariaExpandedProps = expandedProps
|
|
207
|
+
? { 'aria-expanded': expandedProps?.isExpanded, 'aria-controls': expandedProps?.ariaControls, role: 'combobox' }
|
|
208
|
+
: {};
|
|
196
209
|
|
|
197
210
|
return (
|
|
198
211
|
<span
|
|
@@ -201,7 +214,7 @@ export class TextInputBase extends React.Component<TextInputProps, TextInputStat
|
|
|
201
214
|
readOnlyVariant && styles.modifiers.readonly,
|
|
202
215
|
readOnlyVariant === 'plain' && styles.modifiers.plain,
|
|
203
216
|
isDisabled && styles.modifiers.disabled,
|
|
204
|
-
isExpanded && styles.modifiers.expanded,
|
|
217
|
+
(isExpanded || expandedProps?.isExpanded) && styles.modifiers.expanded,
|
|
205
218
|
customIcon && styles.modifiers.icon,
|
|
206
219
|
hasStatusIcon && styles.modifiers[validated as 'success' | 'warning' | 'error'],
|
|
207
220
|
className
|
|
@@ -215,6 +228,7 @@ export class TextInputBase extends React.Component<TextInputProps, TextInputStat
|
|
|
215
228
|
type={type}
|
|
216
229
|
value={this.sanitizeInputValue(value)}
|
|
217
230
|
aria-invalid={props['aria-invalid'] ? props['aria-invalid'] : validated === ValidatedOptions.error}
|
|
231
|
+
{...ariaExpandedProps}
|
|
218
232
|
required={isRequired}
|
|
219
233
|
disabled={isDisabled}
|
|
220
234
|
readOnly={!!readOnlyVariant || readOnly}
|
|
@@ -124,4 +124,13 @@ describe('TextInput', () => {
|
|
|
124
124
|
render(<TextInput isLeftTruncated aria-label="start truncated text input" />);
|
|
125
125
|
expect(trimLeftFn).toHaveBeenCalled();
|
|
126
126
|
});
|
|
127
|
+
|
|
128
|
+
test('has aria-expanded set to true when ariaProps.isExpanded is true', () => {
|
|
129
|
+
render(<TextInput expandedProps={{isExpanded: true, ariaControls: 'test'}} aria-label="isExpanded"/>);
|
|
130
|
+
|
|
131
|
+
const input = screen.getByLabelText('isExpanded');
|
|
132
|
+
expect(input).toHaveAttribute('aria-expanded', 'true');
|
|
133
|
+
expect(input).toHaveAttribute('role', 'combobox');
|
|
134
|
+
expect(input).toHaveAttribute('aria-controls', 'test');
|
|
135
|
+
});
|
|
127
136
|
});
|
|
@@ -3,7 +3,7 @@ id: Text input
|
|
|
3
3
|
section: components
|
|
4
4
|
subsection: forms
|
|
5
5
|
cssPrefix: pf-v5-c-form-control
|
|
6
|
-
propComponents: ['TextInput']
|
|
6
|
+
propComponents: ['TextInput', 'TextInputExpandedObj']
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
import CalendarIcon from '@patternfly/react-icons/dist/esm/icons/calendar-icon';
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
WizardNavType,
|
|
12
12
|
WizardStepChangeScope
|
|
13
13
|
} from './types';
|
|
14
|
-
import { buildSteps } from './utils';
|
|
14
|
+
import { buildSteps, isStepEnabled } from './utils';
|
|
15
15
|
import { useWizardContext, WizardContextProvider } from './WizardContext';
|
|
16
16
|
import { WizardToggle } from './WizardToggle';
|
|
17
17
|
import { WizardNavInternal } from './WizardNavInternal';
|
|
@@ -23,7 +23,7 @@ import { WizardNavInternal } from './WizardNavInternal';
|
|
|
23
23
|
|
|
24
24
|
export interface WizardProps extends React.HTMLProps<HTMLDivElement> {
|
|
25
25
|
/** Step components */
|
|
26
|
-
children: React.ReactNode
|
|
26
|
+
children: React.ReactNode;
|
|
27
27
|
/** Wizard header */
|
|
28
28
|
header?: React.ReactNode;
|
|
29
29
|
/** Wizard footer */
|
|
@@ -86,35 +86,23 @@ export const Wizard = ({
|
|
|
86
86
|
}, [startIndex]);
|
|
87
87
|
|
|
88
88
|
const goToNextStep = (event: React.MouseEvent<HTMLButtonElement>, steps: WizardStepType[] = initialSteps) => {
|
|
89
|
-
const newStep = steps.find(
|
|
90
|
-
(step) => step.index > activeStepIndex && !step.isHidden && !step.isDisabled && !isWizardParentStep(step)
|
|
91
|
-
);
|
|
89
|
+
const newStep = steps.find((step) => step.index > activeStepIndex && isStepEnabled(steps, step));
|
|
92
90
|
|
|
93
91
|
if (activeStepIndex >= steps.length || !newStep?.index) {
|
|
94
92
|
return onSave ? onSave(event) : onClose?.(event);
|
|
95
93
|
}
|
|
96
94
|
|
|
97
|
-
const currStep = isWizardParentStep(steps[activeStepIndex]) ? steps[activeStepIndex + 1] : steps[activeStepIndex];
|
|
98
|
-
const prevStep = steps[activeStepIndex - 1];
|
|
99
|
-
|
|
100
95
|
setActiveStepIndex(newStep?.index);
|
|
101
|
-
onStepChange?.(event,
|
|
96
|
+
onStepChange?.(event, newStep, steps[activeStepIndex - 1], WizardStepChangeScope.Next);
|
|
102
97
|
};
|
|
103
98
|
|
|
104
99
|
const goToPrevStep = (event: React.MouseEvent<HTMLButtonElement>, steps: WizardStepType[] = initialSteps) => {
|
|
105
100
|
const newStep = [...steps]
|
|
106
101
|
.reverse()
|
|
107
|
-
.find(
|
|
108
|
-
(step: WizardStepType) =>
|
|
109
|
-
step.index < activeStepIndex && !step.isHidden && !step.isDisabled && !isWizardParentStep(step)
|
|
110
|
-
);
|
|
111
|
-
const currStep = isWizardParentStep(steps[activeStepIndex - 2])
|
|
112
|
-
? steps[activeStepIndex - 3]
|
|
113
|
-
: steps[activeStepIndex - 2];
|
|
114
|
-
const prevStep = steps[activeStepIndex - 1];
|
|
102
|
+
.find((step: WizardStepType) => step.index < activeStepIndex && isStepEnabled(steps, step));
|
|
115
103
|
|
|
116
104
|
setActiveStepIndex(newStep?.index);
|
|
117
|
-
onStepChange?.(event,
|
|
105
|
+
onStepChange?.(event, newStep, steps[activeStepIndex - 1], WizardStepChangeScope.Back);
|
|
118
106
|
};
|
|
119
107
|
|
|
120
108
|
const goToStepByIndex = (
|
|
@@ -12,7 +12,7 @@ import { getResizeObserver } from '../../helpers/resizeObserver';
|
|
|
12
12
|
|
|
13
13
|
export interface WizardBodyProps {
|
|
14
14
|
/** Anything that can be rendered in the Wizard body */
|
|
15
|
-
children: React.ReactNode
|
|
15
|
+
children: React.ReactNode;
|
|
16
16
|
/** Flag to remove the default body padding */
|
|
17
17
|
hasNoPadding?: boolean;
|
|
18
18
|
/** Adds an accessible name to the wrapper element when the content overflows and renders
|
|
@@ -67,7 +67,7 @@ export const WizardBody = ({
|
|
|
67
67
|
return () => {
|
|
68
68
|
observer();
|
|
69
69
|
};
|
|
70
|
-
}, []);
|
|
70
|
+
}, [previousWidth]);
|
|
71
71
|
|
|
72
72
|
return (
|
|
73
73
|
<WrapperComponent
|
|
@@ -4,7 +4,7 @@ import { css } from '@patternfly/react-styles';
|
|
|
4
4
|
import styles from '@patternfly/react-styles/css/components/Wizard/wizard';
|
|
5
5
|
|
|
6
6
|
import { Button, ButtonVariant } from '../Button';
|
|
7
|
-
import { isCustomWizardFooter, WizardStepType } from './types';
|
|
7
|
+
import { isCustomWizardFooter, WizardFooterButtonProps, WizardStepType } from './types';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Hosts the standard structure of a footer with ties to the active step so that text for buttons can vary from step to step.
|
|
@@ -33,6 +33,12 @@ export interface WizardFooterProps {
|
|
|
33
33
|
isBackHidden?: boolean;
|
|
34
34
|
/** Flag to hide the cancel button */
|
|
35
35
|
isCancelHidden?: boolean;
|
|
36
|
+
/** Additional props for the Next button. */
|
|
37
|
+
nextButtonProps?: Omit<WizardFooterButtonProps, 'isDisabled' | 'type'>;
|
|
38
|
+
/** Additional props for the Back button. */
|
|
39
|
+
backButtonProps?: Omit<WizardFooterButtonProps, 'isDisabled'>;
|
|
40
|
+
/** Additional props for the Cancel button. */
|
|
41
|
+
cancelButtonProps?: WizardFooterButtonProps;
|
|
36
42
|
}
|
|
37
43
|
|
|
38
44
|
/**
|
|
@@ -62,22 +68,31 @@ const InternalWizardFooter = ({
|
|
|
62
68
|
isCancelHidden,
|
|
63
69
|
nextButtonText = 'Next',
|
|
64
70
|
backButtonText = 'Back',
|
|
65
|
-
cancelButtonText = 'Cancel'
|
|
71
|
+
cancelButtonText = 'Cancel',
|
|
72
|
+
nextButtonProps,
|
|
73
|
+
backButtonProps,
|
|
74
|
+
cancelButtonProps
|
|
66
75
|
}: Omit<WizardFooterProps, 'activeStep'>) => (
|
|
67
76
|
<WizardFooterWrapper>
|
|
68
77
|
{!isBackHidden && (
|
|
69
|
-
<Button variant={ButtonVariant.secondary} onClick={onBack} isDisabled={isBackDisabled}>
|
|
78
|
+
<Button variant={ButtonVariant.secondary} onClick={onBack} isDisabled={isBackDisabled} {...backButtonProps}>
|
|
70
79
|
{backButtonText}
|
|
71
80
|
</Button>
|
|
72
81
|
)}
|
|
73
82
|
|
|
74
|
-
<Button
|
|
83
|
+
<Button
|
|
84
|
+
variant={ButtonVariant.primary}
|
|
85
|
+
type="submit"
|
|
86
|
+
onClick={onNext}
|
|
87
|
+
isDisabled={isNextDisabled}
|
|
88
|
+
{...nextButtonProps}
|
|
89
|
+
>
|
|
75
90
|
{nextButtonText}
|
|
76
91
|
</Button>
|
|
77
92
|
|
|
78
93
|
{!isCancelHidden && (
|
|
79
94
|
<div className={styles.wizardFooterCancel}>
|
|
80
|
-
<Button variant={ButtonVariant.link} onClick={onClose}>
|
|
95
|
+
<Button variant={ButtonVariant.link} onClick={onClose} {...cancelButtonProps}>
|
|
81
96
|
{cancelButtonText}
|
|
82
97
|
</Button>
|
|
83
98
|
</div>
|
|
@@ -85,7 +85,7 @@ export const WizardNavInternal = ({
|
|
|
85
85
|
id={subStep.id}
|
|
86
86
|
content={subStep.name}
|
|
87
87
|
isCurrent={activeStep?.id === subStep.id}
|
|
88
|
-
isDisabled={isSubStepDisabled}
|
|
88
|
+
isDisabled={isSubStepDisabled || isStepDisabled}
|
|
89
89
|
isVisited={subStep.isVisited}
|
|
90
90
|
stepIndex={subStep.index}
|
|
91
91
|
onClick={() => goToStepByIndex(subStep.index)}
|
|
@@ -109,7 +109,7 @@ export const WizardNavInternal = ({
|
|
|
109
109
|
content={step.name}
|
|
110
110
|
isExpandable={step.isExpandable}
|
|
111
111
|
isCurrent={hasActiveChild}
|
|
112
|
-
isDisabled={!hasEnabledChildren}
|
|
112
|
+
isDisabled={!hasEnabledChildren || isStepDisabled}
|
|
113
113
|
isVisited={step.isVisited}
|
|
114
114
|
stepIndex={firstSubStepIndex}
|
|
115
115
|
onClick={() => goToStepByIndex(firstSubStepIndex)}
|
|
@@ -71,7 +71,7 @@ export const WizardToggle = ({
|
|
|
71
71
|
|
|
72
72
|
return (
|
|
73
73
|
<React.Fragment key={step.id}>
|
|
74
|
-
{activeStep?.
|
|
74
|
+
{activeStep?.id === step.id &&
|
|
75
75
|
(body || body === undefined ? <WizardBody {...body}>{children}</WizardBody> : children)}
|
|
76
76
|
|
|
77
77
|
<div key={step.id} style={{ display: 'none' }}>
|