@patternfly/react-core 6.0.0-prerelease.1 → 6.0.0-prerelease.11
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 +56 -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/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/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/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/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/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/Content/Content.d.ts +2 -0
- package/dist/esm/components/Content/Content.d.ts.map +1 -1
- package/dist/esm/components/Content/Content.js +2 -2
- package/dist/esm/components/Content/Content.js.map +1 -1
- package/dist/esm/components/EmptyState/EmptyState.d.ts +1 -1
- package/dist/esm/components/EmptyState/EmptyState.d.ts.map +1 -1
- package/dist/esm/components/EmptyState/EmptyStateHeader.d.ts +1 -1
- package/dist/esm/components/EmptyState/EmptyStateHeader.d.ts.map +1 -1
- package/dist/esm/components/EmptyState/EmptyStateHeader.js +2 -2
- package/dist/esm/components/EmptyState/EmptyStateHeader.js.map +1 -1
- package/dist/esm/components/MenuToggle/MenuToggle.d.ts +2 -0
- package/dist/esm/components/MenuToggle/MenuToggle.d.ts.map +1 -1
- package/dist/esm/components/MenuToggle/MenuToggle.js +3 -2
- package/dist/esm/components/MenuToggle/MenuToggle.js.map +1 -1
- package/dist/esm/components/Slider/Slider.d.ts.map +1 -1
- package/dist/esm/components/Slider/Slider.js +1 -1
- package/dist/esm/components/Slider/Slider.js.map +1 -1
- package/dist/esm/components/TextInputGroup/TextInputGroup.d.ts +2 -0
- package/dist/esm/components/TextInputGroup/TextInputGroup.d.ts.map +1 -1
- package/dist/esm/components/TextInputGroup/TextInputGroup.js +3 -3
- package/dist/esm/components/TextInputGroup/TextInputGroup.js.map +1 -1
- package/dist/esm/components/TextInputGroup/TextInputGroupIcon.d.ts +11 -0
- package/dist/esm/components/TextInputGroup/TextInputGroupIcon.d.ts.map +1 -0
- package/dist/esm/components/TextInputGroup/TextInputGroupIcon.js +10 -0
- package/dist/esm/components/TextInputGroup/TextInputGroupIcon.js.map +1 -0
- package/dist/esm/components/TextInputGroup/TextInputGroupMain.d.ts.map +1 -1
- package/dist/esm/components/TextInputGroup/TextInputGroupMain.js +7 -3
- package/dist/esm/components/TextInputGroup/TextInputGroupMain.js.map +1 -1
- package/dist/js/components/Content/Content.d.ts +2 -0
- package/dist/js/components/Content/Content.d.ts.map +1 -1
- package/dist/js/components/Content/Content.js +2 -2
- package/dist/js/components/Content/Content.js.map +1 -1
- package/dist/js/components/EmptyState/EmptyState.d.ts +1 -1
- package/dist/js/components/EmptyState/EmptyState.d.ts.map +1 -1
- package/dist/js/components/EmptyState/EmptyStateHeader.d.ts +1 -1
- package/dist/js/components/EmptyState/EmptyStateHeader.d.ts.map +1 -1
- package/dist/js/components/EmptyState/EmptyStateHeader.js +2 -2
- package/dist/js/components/EmptyState/EmptyStateHeader.js.map +1 -1
- package/dist/js/components/MenuToggle/MenuToggle.d.ts +2 -0
- package/dist/js/components/MenuToggle/MenuToggle.d.ts.map +1 -1
- package/dist/js/components/MenuToggle/MenuToggle.js +3 -2
- package/dist/js/components/MenuToggle/MenuToggle.js.map +1 -1
- package/dist/js/components/Slider/Slider.d.ts.map +1 -1
- package/dist/js/components/Slider/Slider.js +1 -1
- package/dist/js/components/Slider/Slider.js.map +1 -1
- package/dist/js/components/TextInputGroup/TextInputGroup.d.ts +2 -0
- package/dist/js/components/TextInputGroup/TextInputGroup.d.ts.map +1 -1
- package/dist/js/components/TextInputGroup/TextInputGroup.js +3 -3
- package/dist/js/components/TextInputGroup/TextInputGroup.js.map +1 -1
- package/dist/js/components/TextInputGroup/TextInputGroupIcon.d.ts +11 -0
- package/dist/js/components/TextInputGroup/TextInputGroupIcon.d.ts.map +1 -0
- package/dist/js/components/TextInputGroup/TextInputGroupIcon.js +14 -0
- package/dist/js/components/TextInputGroup/TextInputGroupIcon.js.map +1 -0
- package/dist/js/components/TextInputGroup/TextInputGroupMain.d.ts.map +1 -1
- package/dist/js/components/TextInputGroup/TextInputGroupMain.js +7 -3
- package/dist/js/components/TextInputGroup/TextInputGroupMain.js.map +1 -1
- package/dist/styles/base-no-reset.css +5 -5
- package/dist/styles/base.css +5 -5
- package/dist/umd/assets/{output-BBI9yTrj.css → output-Cfe9wm8X.css} +6401 -6292
- package/dist/umd/react-core.min.js +4 -4
- package/helpers/package.json +1 -1
- package/layouts/package.json +1 -1
- package/next/package.json +1 -1
- package/package.json +8 -8
- package/src/components/Content/Content.tsx +4 -0
- package/src/components/Content/__tests__/Content.test.tsx +24 -0
- package/src/components/Content/examples/Content.md +8 -0
- package/src/components/Content/examples/ContentEditorial.tsx +24 -0
- package/src/components/EmptyState/EmptyState.tsx +1 -1
- package/src/components/EmptyState/EmptyStateHeader.tsx +6 -4
- package/src/components/EmptyState/__tests__/EmptyState.test.tsx +5 -0
- package/src/components/MenuToggle/MenuToggle.tsx +5 -0
- package/src/components/MenuToggle/__tests__/MenuToggle.test.tsx +5 -0
- package/src/components/MenuToggle/examples/MenuToggle.md +15 -7
- package/src/components/MenuToggle/examples/MenuTogglePlaceholder.tsx +6 -0
- package/src/components/Slider/Slider.tsx +6 -1
- package/src/components/TextInputGroup/TextInputGroup.tsx +5 -1
- package/src/components/TextInputGroup/TextInputGroupIcon.tsx +25 -0
- package/src/components/TextInputGroup/TextInputGroupMain.tsx +6 -2
- package/src/components/TextInputGroup/__tests__/TextInputGroup.test.tsx +26 -4
- package/src/components/TextInputGroup/__tests__/TextInputGroupMain.test.tsx +10 -0
- package/src/components/TextInputGroup/examples/TextInputGroup.md +12 -0
- package/src/components/TextInputGroup/examples/TextInputGroupWithStatus.tsx +66 -0
- package/src/components/TreeView/examples/TreeViewWithActionItems.tsx +1 -1
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.0.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.0.0-prerelease.10","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.0.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.0.0-prerelease.10","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.0.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.0.0-prerelease.10","private":true}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "6.0.0-prerelease.
|
|
3
|
+
"version": "6.0.0-prerelease.11",
|
|
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",
|
|
@@ -46,15 +46,15 @@
|
|
|
46
46
|
"subpaths": "node ../../scripts/exportSubpaths.mjs --config subpaths.config.json"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@patternfly/react-icons": "^6.0.0-prerelease.
|
|
50
|
-
"@patternfly/react-styles": "^6.0.0-prerelease.
|
|
51
|
-
"@patternfly/react-tokens": "^6.0.0-prerelease.
|
|
52
|
-
"focus-trap": "7.
|
|
49
|
+
"@patternfly/react-icons": "^6.0.0-prerelease.4",
|
|
50
|
+
"@patternfly/react-styles": "^6.0.0-prerelease.3",
|
|
51
|
+
"@patternfly/react-tokens": "^6.0.0-prerelease.3",
|
|
52
|
+
"focus-trap": "7.6.0",
|
|
53
53
|
"react-dropzone": "^14.2.3",
|
|
54
|
-
"tslib": "^2.
|
|
54
|
+
"tslib": "^2.7.0"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@patternfly/patternfly": "6.0.0-
|
|
57
|
+
"@patternfly/patternfly": "6.0.0-prerelease.5",
|
|
58
58
|
"case-anything": "^2.1.13",
|
|
59
59
|
"css": "^3.0.0",
|
|
60
60
|
"fs-extra": "^11.2.0"
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"react": "^17 || ^18",
|
|
64
64
|
"react-dom": "^17 || ^18"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "ab1735b515616effcc6bdff25ce301e15cf5e764"
|
|
67
67
|
}
|
|
@@ -53,6 +53,8 @@ export interface ContentProps extends React.HTMLProps<HTMLElement>, OUIAProps {
|
|
|
53
53
|
isPlainList?: boolean;
|
|
54
54
|
/** Flag to indicate the link (or all links within the content) has visited styles applied if the browser determines the link has been visited. */
|
|
55
55
|
isVisitedLink?: boolean;
|
|
56
|
+
/** Flag to indicate the content has editorial styling. This styling increases the font size of body text and small text by one tier, increasing body text to large and small text to the previous body text size. */
|
|
57
|
+
isEditorial?: boolean;
|
|
56
58
|
/** Value to overwrite the randomly generated data-ouia-component-id. */
|
|
57
59
|
ouiaId?: number | string;
|
|
58
60
|
/** Set the value of data-ouia-safe. Only set to true when the component is in a static state, i.e. no animations are occurring. At all other times, this value must be false. */
|
|
@@ -89,6 +91,7 @@ export const Content: React.FunctionComponent<ContentProps> = ({
|
|
|
89
91
|
isVisitedLink = false,
|
|
90
92
|
ouiaId,
|
|
91
93
|
ouiaSafe = true,
|
|
94
|
+
isEditorial = false,
|
|
92
95
|
...props
|
|
93
96
|
}: ContentProps) => {
|
|
94
97
|
const wrappingComponent = component ?? 'div';
|
|
@@ -106,6 +109,7 @@ export const Content: React.FunctionComponent<ContentProps> = ({
|
|
|
106
109
|
componentStyles[wrappingComponent],
|
|
107
110
|
isList && isPlainList && styles.modifiers.plain,
|
|
108
111
|
isVisitedLink && styles.modifiers.visited,
|
|
112
|
+
isEditorial && styles.modifiers.editorial,
|
|
109
113
|
className
|
|
110
114
|
)}
|
|
111
115
|
>
|
|
@@ -264,6 +264,30 @@ test('Renders with inherited element props spread to the component', () => {
|
|
|
264
264
|
expect(screen.getByText('Test')).toHaveAccessibleName('Test label');
|
|
265
265
|
});
|
|
266
266
|
|
|
267
|
+
test(`Renders without class name ${styles.modifiers.editorial} by default`, () => {
|
|
268
|
+
render(<Content>Test</Content>);
|
|
269
|
+
expect(screen.getByText('Test')).not.toHaveClass('pf-m-editorial');
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
test(`Renders with class name ${styles.modifiers.editorial} when isEditorial = true`, () => {
|
|
273
|
+
render(<Content isEditorial>Test</Content>);
|
|
274
|
+
expect(screen.getByText('Test')).toHaveClass('pf-m-editorial');
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
test(`Renders with class name ${styles.modifiers.editorial} when isEditorial = true and component is specified`, () => {
|
|
278
|
+
render(
|
|
279
|
+
<Content component="h1" isEditorial>
|
|
280
|
+
Test
|
|
281
|
+
</Content>
|
|
282
|
+
);
|
|
283
|
+
expect(screen.getByText('Test')).toHaveClass('pf-m-editorial');
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
test(`Renders without class name ${styles.modifiers.editorial} when isEditorial = false`, () => {
|
|
287
|
+
render(<Content isEditorial={false}>Test</Content>);
|
|
288
|
+
expect(screen.getByText('Test')).not.toHaveClass('pf-m-editorial');
|
|
289
|
+
});
|
|
290
|
+
|
|
267
291
|
test('Matches the snapshot', () => {
|
|
268
292
|
const { asFragment } = render(<Content ouiaId="ouia-id">Test</Content>);
|
|
269
293
|
expect(asFragment()).toMatchSnapshot();
|
|
@@ -62,3 +62,11 @@ HTML elements wrapped by `<Content>` are styled by the content component.
|
|
|
62
62
|
```ts file="./ContentVisited.tsx"
|
|
63
63
|
|
|
64
64
|
```
|
|
65
|
+
|
|
66
|
+
### Editorial content
|
|
67
|
+
|
|
68
|
+
Editorial styling increases the font size of body text and small text by 1 tier, where body text becomes "lg" and small text becomes "md". To applying editorial styling, use `isEditorial`.
|
|
69
|
+
|
|
70
|
+
```ts file="./ContentEditorial.tsx"
|
|
71
|
+
|
|
72
|
+
```
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Content, ContentVariants } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
export const ContentEditorial: React.FunctionComponent = () => (
|
|
5
|
+
<>
|
|
6
|
+
<Content component={ContentVariants.h1} isEditorial>
|
|
7
|
+
Example of editorial content via components
|
|
8
|
+
</Content>
|
|
9
|
+
<Content component={ContentVariants.p} isEditorial>
|
|
10
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla accumsan, metus ultrices eleifend gravida, nulla
|
|
11
|
+
nunc varius lectus, nec rutrum justo nibh eu lectus. Ut vulputate semper dui. Fusce erat odio, sollicitudin vel
|
|
12
|
+
erat vel, interdum mattis neque. Sub works as well!
|
|
13
|
+
</Content>
|
|
14
|
+
<br />
|
|
15
|
+
<Content isEditorial>
|
|
16
|
+
<h1>Example of editorial content via wrapper</h1>
|
|
17
|
+
<p>
|
|
18
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla accumsan, metus ultrices eleifend gravida, nulla
|
|
19
|
+
nunc varius lectus, nec rutrum justo nibh eu lectus. Ut vulputate semper dui. Fusce erat odio, sollicitudin vel
|
|
20
|
+
erat vel, interdum mattis neque. Sub works as well!
|
|
21
|
+
</p>
|
|
22
|
+
</Content>
|
|
23
|
+
</>
|
|
24
|
+
);
|
|
@@ -36,7 +36,7 @@ export interface EmptyStateProps extends React.HTMLProps<HTMLDivElement> {
|
|
|
36
36
|
/** Additional classes added to the title inside empty state header */
|
|
37
37
|
titleClassName?: string;
|
|
38
38
|
/** Text of the title inside empty state header, will be wrapped in headingLevel */
|
|
39
|
-
titleText
|
|
39
|
+
titleText?: React.ReactNode;
|
|
40
40
|
/** Empty state icon element to be rendered. Can also be a spinner component */
|
|
41
41
|
icon?: React.ComponentType<any>;
|
|
42
42
|
/** The heading level to use, default is h1 */
|
|
@@ -18,7 +18,7 @@ export interface EmptyStateHeaderProps extends React.HTMLProps<HTMLDivElement> {
|
|
|
18
18
|
/** Additional classes added to the title inside empty state header */
|
|
19
19
|
titleClassName?: string;
|
|
20
20
|
/** Text of the title inside empty state header, will be wrapped in headingLevel */
|
|
21
|
-
titleText
|
|
21
|
+
titleText?: React.ReactNode;
|
|
22
22
|
/** Empty state icon element to be rendered. Can also be a spinner component */
|
|
23
23
|
icon?: React.ComponentType<any>;
|
|
24
24
|
/** The heading level to use, default is h1 */
|
|
@@ -35,9 +35,11 @@ export const EmptyStateHeader: React.FunctionComponent<EmptyStateHeaderProps> =
|
|
|
35
35
|
}: EmptyStateHeaderProps) => (
|
|
36
36
|
<div className={css(`${styles.emptyState}__header`, className)} {...props}>
|
|
37
37
|
{Icon && <EmptyStateIcon icon={Icon} />}
|
|
38
|
-
|
|
39
|
-
<
|
|
40
|
-
|
|
38
|
+
{titleText && (
|
|
39
|
+
<div className={css(`${styles.emptyState}__title`)}>
|
|
40
|
+
<HeadingLevel className={css(styles.emptyStateTitleText, titleClassName)}>{titleText}</HeadingLevel>
|
|
41
|
+
</div>
|
|
42
|
+
)}
|
|
41
43
|
</div>
|
|
42
44
|
);
|
|
43
45
|
|
|
@@ -92,6 +92,11 @@ describe('EmptyState', () => {
|
|
|
92
92
|
expect(screen.getByRole('heading', { level: 3, name: 'Empty state' })).toHaveClass(styles.emptyStateTitleText);
|
|
93
93
|
});
|
|
94
94
|
|
|
95
|
+
test('title is not rendered when titleText is not passed', () => {
|
|
96
|
+
render(<EmptyStateHeader headingLevel="h3" />);
|
|
97
|
+
expect(screen.queryByRole('heading', { level: 3 })).not.toBeInTheDocument();
|
|
98
|
+
});
|
|
99
|
+
|
|
95
100
|
test('Footer', () => {
|
|
96
101
|
render(<EmptyStateFooter className="custom-empty-state-footer" data-testid="actions-test-id" />);
|
|
97
102
|
expect(screen.getByTestId('actions-test-id')).toHaveClass('custom-empty-state-footer');
|
|
@@ -49,6 +49,8 @@ export interface MenuToggleProps
|
|
|
49
49
|
isFullHeight?: boolean;
|
|
50
50
|
/** Flag indicating the toggle takes up the full width of its parent */
|
|
51
51
|
isFullWidth?: boolean;
|
|
52
|
+
/** Flag indicating the toggle contains placeholder text */
|
|
53
|
+
isPlaceholder?: boolean;
|
|
52
54
|
/** Object used to configure a split button menu toggle */
|
|
53
55
|
splitButtonOptions?: SplitButtonOptions;
|
|
54
56
|
/** Variant styles of the menu toggle */
|
|
@@ -85,6 +87,7 @@ class MenuToggleBase extends React.Component<MenuToggleProps, MenuToggleState> {
|
|
|
85
87
|
isDisabled: false,
|
|
86
88
|
isFullWidth: false,
|
|
87
89
|
isFullHeight: false,
|
|
90
|
+
isPlaceholder: false,
|
|
88
91
|
size: 'default',
|
|
89
92
|
ouiaSafe: true
|
|
90
93
|
};
|
|
@@ -103,6 +106,7 @@ class MenuToggleBase extends React.Component<MenuToggleProps, MenuToggleState> {
|
|
|
103
106
|
isDisabled,
|
|
104
107
|
isFullHeight,
|
|
105
108
|
isFullWidth,
|
|
109
|
+
isPlaceholder,
|
|
106
110
|
splitButtonOptions,
|
|
107
111
|
variant,
|
|
108
112
|
status,
|
|
@@ -179,6 +183,7 @@ class MenuToggleBase extends React.Component<MenuToggleProps, MenuToggleState> {
|
|
|
179
183
|
isFullHeight && styles.modifiers.fullHeight,
|
|
180
184
|
isFullWidth && styles.modifiers.fullWidth,
|
|
181
185
|
isDisabled && styles.modifiers.disabled,
|
|
186
|
+
isPlaceholder && styles.modifiers.placeholder,
|
|
182
187
|
size === MenuToggleSize.sm && styles.modifiers.small,
|
|
183
188
|
className
|
|
184
189
|
);
|
|
@@ -100,4 +100,9 @@ describe('menu toggle', () => {
|
|
|
100
100
|
await user.click(screen.getByRole(`button`) as Element);
|
|
101
101
|
expect(mockClick).toHaveBeenCalled();
|
|
102
102
|
});
|
|
103
|
+
|
|
104
|
+
test(`Renders with class ${styles.modifiers.placeholder} when isPlaceholder is passed`, () => {
|
|
105
|
+
render(<MenuToggle isPlaceholder>Toggle</MenuToggle>);
|
|
106
|
+
expect(screen.getByRole('button')).toHaveClass(styles.modifiers.placeholder);
|
|
107
|
+
});
|
|
103
108
|
});
|
|
@@ -215,19 +215,19 @@ Variant styling can be applied to split button toggles to adjust their appearanc
|
|
|
215
215
|
|
|
216
216
|
### Split toggle with labeled checkbox
|
|
217
217
|
|
|
218
|
-
|
|
218
|
+
You can allow users to select a toggle checkbox by clicking either the checkbox or the text label.
|
|
219
219
|
|
|
220
|
-
|
|
220
|
+
To link a split toggle label to the toggle's checkbox, pass both the label and the `<MenuToggleCheckbox>` component to `splitButtonOptions`.
|
|
221
221
|
|
|
222
|
-
```
|
|
222
|
+
```ts file='MenuToggleSplitButtonCheckboxWithText.tsx'
|
|
223
223
|
|
|
224
|
-
|
|
224
|
+
```
|
|
225
225
|
|
|
226
|
-
|
|
226
|
+
### Split toggle with checkbox and toggle text
|
|
227
227
|
|
|
228
|
-
To
|
|
228
|
+
To link a split toggle label to the toggle button itself, pass the label to the `<MenuToggle>` component, instead of `splitButtonOptions`.
|
|
229
229
|
|
|
230
|
-
```ts file='
|
|
230
|
+
```ts file='MenuToggleSplitButtonCheckboxWithToggleText.tsx'
|
|
231
231
|
|
|
232
232
|
```
|
|
233
233
|
|
|
@@ -296,3 +296,11 @@ When the status value is "warning" or "danger", you must include helper text tha
|
|
|
296
296
|
```ts file='MenuToggleStatus.tsx'
|
|
297
297
|
|
|
298
298
|
```
|
|
299
|
+
|
|
300
|
+
### Placeholder text in toggle
|
|
301
|
+
|
|
302
|
+
To indicate the toggle contains placeholder text, pass the `isPlaceholder` property to the `MenuToggle`.
|
|
303
|
+
|
|
304
|
+
```ts file='MenuTogglePlaceholder.tsx'
|
|
305
|
+
|
|
306
|
+
```
|
|
@@ -474,7 +474,12 @@ export const Slider: React.FunctionComponent<SliderProps> = ({
|
|
|
474
474
|
</div>
|
|
475
475
|
)}
|
|
476
476
|
{hasTooltipOverThumb ? (
|
|
477
|
-
<Tooltip
|
|
477
|
+
<Tooltip
|
|
478
|
+
className={css('pf-v6-m-tabular-nums')}
|
|
479
|
+
triggerRef={thumbRef}
|
|
480
|
+
entryDelay={0}
|
|
481
|
+
content={findAriaTextValue()}
|
|
482
|
+
>
|
|
478
483
|
{thumbComponent}
|
|
479
484
|
</Tooltip>
|
|
480
485
|
) : (
|
|
@@ -11,6 +11,8 @@ export interface TextInputGroupProps extends React.HTMLProps<HTMLDivElement> {
|
|
|
11
11
|
isDisabled?: boolean;
|
|
12
12
|
/** Flag to indicate the toggle has no border or background */
|
|
13
13
|
isPlain?: boolean;
|
|
14
|
+
/** Status variant of the text input group. */
|
|
15
|
+
validated?: 'success' | 'warning' | 'error';
|
|
14
16
|
/** @hide A reference object to attach to the input box */
|
|
15
17
|
innerRef?: React.RefObject<any>;
|
|
16
18
|
}
|
|
@@ -24,6 +26,7 @@ export const TextInputGroup: React.FunctionComponent<TextInputGroupProps> = ({
|
|
|
24
26
|
className,
|
|
25
27
|
isDisabled,
|
|
26
28
|
isPlain,
|
|
29
|
+
validated,
|
|
27
30
|
innerRef,
|
|
28
31
|
...props
|
|
29
32
|
}: TextInputGroupProps) => {
|
|
@@ -31,13 +34,14 @@ export const TextInputGroup: React.FunctionComponent<TextInputGroupProps> = ({
|
|
|
31
34
|
const textInputGroupRef = innerRef || ref;
|
|
32
35
|
|
|
33
36
|
return (
|
|
34
|
-
<TextInputGroupContext.Provider value={{ isDisabled }}>
|
|
37
|
+
<TextInputGroupContext.Provider value={{ isDisabled, validated }}>
|
|
35
38
|
<div
|
|
36
39
|
ref={textInputGroupRef}
|
|
37
40
|
className={css(
|
|
38
41
|
styles.textInputGroup,
|
|
39
42
|
isDisabled && styles.modifiers.disabled,
|
|
40
43
|
isPlain && styles.modifiers.plain,
|
|
44
|
+
validated && styles.modifiers[validated],
|
|
41
45
|
className
|
|
42
46
|
)}
|
|
43
47
|
{...props}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import styles from '@patternfly/react-styles/css/components/TextInputGroup/text-input-group';
|
|
3
|
+
import { css } from '@patternfly/react-styles';
|
|
4
|
+
|
|
5
|
+
export interface TextInputGroupIconProps extends React.HTMLProps<HTMLSpanElement> {
|
|
6
|
+
/** Content rendered inside the text input group utilities div */
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
/** Additional classes applied to the text input group utilities container */
|
|
9
|
+
className?: string;
|
|
10
|
+
/** Flag indicating if the icon is a status icon and should inherit status styling. */
|
|
11
|
+
isStatus?: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const TextInputGroupIcon: React.FunctionComponent<TextInputGroupIconProps> = ({
|
|
15
|
+
children,
|
|
16
|
+
className,
|
|
17
|
+
isStatus,
|
|
18
|
+
...props
|
|
19
|
+
}: TextInputGroupIconProps) => (
|
|
20
|
+
<span className={css(styles.textInputGroupIcon, isStatus && styles.modifiers.status, className)} {...props}>
|
|
21
|
+
{children}
|
|
22
|
+
</span>
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
TextInputGroupIcon.displayName = 'TextInputGroupIcon';
|
|
@@ -2,6 +2,8 @@ import * as React from 'react';
|
|
|
2
2
|
import styles from '@patternfly/react-styles/css/components/TextInputGroup/text-input-group';
|
|
3
3
|
import { css } from '@patternfly/react-styles';
|
|
4
4
|
import { TextInputGroupContext } from './TextInputGroup';
|
|
5
|
+
import { TextInputGroupIcon } from './TextInputGroupIcon';
|
|
6
|
+
import { statusIcons, ValidatedOptions } from '../../helpers';
|
|
5
7
|
|
|
6
8
|
export interface TextInputGroupMainProps extends Omit<React.HTMLProps<HTMLDivElement>, 'onChange'> {
|
|
7
9
|
/** Content rendered inside the text input group main div */
|
|
@@ -78,9 +80,10 @@ const TextInputGroupMainBase: React.FunctionComponent<TextInputGroupMainProps> =
|
|
|
78
80
|
inputId,
|
|
79
81
|
...props
|
|
80
82
|
}: TextInputGroupMainProps) => {
|
|
81
|
-
const { isDisabled } = React.useContext(TextInputGroupContext);
|
|
83
|
+
const { isDisabled, validated } = React.useContext(TextInputGroupContext);
|
|
82
84
|
const ref = React.useRef(null);
|
|
83
85
|
const textInputGroupInputInputRef = innerRef || ref;
|
|
86
|
+
const StatusIcon = statusIcons[validated === ValidatedOptions.error ? 'danger' : validated];
|
|
84
87
|
|
|
85
88
|
const handleChange = (event: React.FormEvent<HTMLInputElement>) => {
|
|
86
89
|
onChange(event, event.currentTarget.value);
|
|
@@ -100,7 +103,7 @@ const TextInputGroupMainBase: React.FunctionComponent<TextInputGroupMainProps> =
|
|
|
100
103
|
id={inputId}
|
|
101
104
|
/>
|
|
102
105
|
)}
|
|
103
|
-
{icon && <
|
|
106
|
+
{icon && <TextInputGroupIcon>{icon}</TextInputGroupIcon>}
|
|
104
107
|
<input
|
|
105
108
|
ref={textInputGroupInputInputRef}
|
|
106
109
|
type={type}
|
|
@@ -119,6 +122,7 @@ const TextInputGroupMainBase: React.FunctionComponent<TextInputGroupMainProps> =
|
|
|
119
122
|
{...(isExpanded !== undefined && { 'aria-expanded': isExpanded })}
|
|
120
123
|
{...(ariaControls && { 'aria-controls': ariaControls })}
|
|
121
124
|
/>
|
|
125
|
+
{validated && <TextInputGroupIcon isStatus>{<StatusIcon aria-hidden="true" />}</TextInputGroupIcon>}
|
|
122
126
|
</span>
|
|
123
127
|
</div>
|
|
124
128
|
);
|
|
@@ -34,20 +34,42 @@ describe('TextInputGroup', () => {
|
|
|
34
34
|
expect(inputGroup).toHaveClass('custom-class');
|
|
35
35
|
});
|
|
36
36
|
|
|
37
|
-
it(
|
|
37
|
+
it(`does not render with the ${styles.modifiers.disabled} class when not disabled`, () => {
|
|
38
38
|
render(<TextInputGroup>Test</TextInputGroup>);
|
|
39
39
|
|
|
40
40
|
const inputGroup = screen.getByText('Test');
|
|
41
41
|
|
|
42
|
-
expect(inputGroup).not.toHaveClass(
|
|
42
|
+
expect(inputGroup).not.toHaveClass(styles.modifiers.disabled);
|
|
43
43
|
});
|
|
44
44
|
|
|
45
|
-
it(
|
|
45
|
+
it(`renders with the ${styles.modifiers.disabled} class when disabled`, () => {
|
|
46
46
|
render(<TextInputGroup isDisabled>Test</TextInputGroup>);
|
|
47
47
|
|
|
48
48
|
const inputGroup = screen.getByText('Test');
|
|
49
49
|
|
|
50
|
-
expect(inputGroup).toHaveClass(
|
|
50
|
+
expect(inputGroup).toHaveClass(styles.modifiers.disabled);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it(`renders with class ${styles.modifiers.success} when validated="success"`, () => {
|
|
54
|
+
render(<TextInputGroup validated="success">Test</TextInputGroup>);
|
|
55
|
+
|
|
56
|
+
const inputGroup = screen.getByText('Test');
|
|
57
|
+
|
|
58
|
+
expect(inputGroup).toHaveClass(styles.modifiers.success);
|
|
59
|
+
});
|
|
60
|
+
it(`renders with class ${styles.modifiers.warning} when validated="warning"`, () => {
|
|
61
|
+
render(<TextInputGroup validated="warning">Test</TextInputGroup>);
|
|
62
|
+
|
|
63
|
+
const inputGroup = screen.getByText('Test');
|
|
64
|
+
|
|
65
|
+
expect(inputGroup).toHaveClass(styles.modifiers.warning);
|
|
66
|
+
});
|
|
67
|
+
it(`renders with class ${styles.modifiers.error} when validated="error"`, () => {
|
|
68
|
+
render(<TextInputGroup validated="error">Test</TextInputGroup>);
|
|
69
|
+
|
|
70
|
+
const inputGroup = screen.getByText('Test');
|
|
71
|
+
|
|
72
|
+
expect(inputGroup).toHaveClass(styles.modifiers.error);
|
|
51
73
|
});
|
|
52
74
|
|
|
53
75
|
it('passes isDisabled=false to children via a context when isDisabled prop is not passed', () => {
|
|
@@ -242,6 +242,16 @@ describe('TextInputGroupMain', () => {
|
|
|
242
242
|
expect(hintInput).toBeVisible();
|
|
243
243
|
});
|
|
244
244
|
|
|
245
|
+
it(`Renders status icon with class ${styles.modifiers.status} when a validated prop is passed`, () => {
|
|
246
|
+
render(
|
|
247
|
+
<TextInputGroupContext.Provider value={{ validated: 'success' }}>
|
|
248
|
+
<TextInputGroupMain />
|
|
249
|
+
</TextInputGroupContext.Provider>
|
|
250
|
+
);
|
|
251
|
+
|
|
252
|
+
expect(screen.getByRole('textbox').nextElementSibling).toHaveClass(styles.modifiers.status);
|
|
253
|
+
});
|
|
254
|
+
|
|
245
255
|
it('does not call onChange callback when the input does not change', () => {
|
|
246
256
|
const onChangeMock = jest.fn();
|
|
247
257
|
|
|
@@ -13,19 +13,31 @@ import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
|
|
|
13
13
|
### Basic
|
|
14
14
|
|
|
15
15
|
```ts file="./TextInputGroupBasic.tsx"
|
|
16
|
+
|
|
16
17
|
```
|
|
17
18
|
|
|
18
19
|
### Disabled
|
|
19
20
|
|
|
20
21
|
```ts file="./TextInputGroupDisabled.tsx"
|
|
22
|
+
|
|
21
23
|
```
|
|
22
24
|
|
|
23
25
|
### Utilities and icon
|
|
24
26
|
|
|
25
27
|
```ts file="./TextInputGroupUtilitiesAndIcon.tsx"
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### With validation
|
|
32
|
+
|
|
33
|
+
You can add a validation status to a `<TextInputGroup>` by passing the `validated` property with a value of either "success", "warning", or "error".
|
|
34
|
+
|
|
35
|
+
```ts file="./TextInputGroupWithStatus.tsx"
|
|
36
|
+
|
|
26
37
|
```
|
|
27
38
|
|
|
28
39
|
### Filters
|
|
29
40
|
|
|
30
41
|
```ts file="./TextInputGroupFilters.tsx"
|
|
42
|
+
|
|
31
43
|
```
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
TextInputGroup,
|
|
4
|
+
TextInputGroupMain,
|
|
5
|
+
TextInputGroupUtilities,
|
|
6
|
+
Button,
|
|
7
|
+
ValidatedOptions,
|
|
8
|
+
Flex,
|
|
9
|
+
FlexItem
|
|
10
|
+
} from '@patternfly/react-core';
|
|
11
|
+
import SearchIcon from '@patternfly/react-icons/dist/esm/icons/search-icon';
|
|
12
|
+
import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
|
|
13
|
+
|
|
14
|
+
export const TextInputGroupWithStatus: React.FunctionComponent = () => {
|
|
15
|
+
const [successValue, setSuccessValue] = React.useState('Success validation');
|
|
16
|
+
const [warningValue, setWarningValue] = React.useState('Warning validation with custom non-status icon at start');
|
|
17
|
+
const [errorValue, setErrorValue] = React.useState(
|
|
18
|
+
'Error validation with custom non-status icon at start and utilities'
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
/** show the input clearing button only when the input is not empty */
|
|
22
|
+
const showClearButton = !!errorValue;
|
|
23
|
+
|
|
24
|
+
/** render the utilities component only when a component it contains is being rendered */
|
|
25
|
+
const showUtilities = showClearButton;
|
|
26
|
+
|
|
27
|
+
/** callback for clearing the text input */
|
|
28
|
+
const clearInput = () => {
|
|
29
|
+
setErrorValue('');
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<Flex direction={{ default: 'column' }} rowGap={{ default: 'rowGapSm' }}>
|
|
34
|
+
<FlexItem>
|
|
35
|
+
<TextInputGroup validated={ValidatedOptions.success}>
|
|
36
|
+
<TextInputGroupMain value={successValue} onChange={(_event, value) => setSuccessValue(value)} />
|
|
37
|
+
</TextInputGroup>
|
|
38
|
+
</FlexItem>
|
|
39
|
+
<FlexItem>
|
|
40
|
+
<TextInputGroup validated={ValidatedOptions.warning}>
|
|
41
|
+
<TextInputGroupMain
|
|
42
|
+
icon={<SearchIcon />}
|
|
43
|
+
value={warningValue}
|
|
44
|
+
onChange={(_event, value) => setWarningValue(value)}
|
|
45
|
+
/>
|
|
46
|
+
</TextInputGroup>
|
|
47
|
+
</FlexItem>
|
|
48
|
+
<FlexItem>
|
|
49
|
+
<TextInputGroup validated={ValidatedOptions.error}>
|
|
50
|
+
<TextInputGroupMain
|
|
51
|
+
icon={<SearchIcon />}
|
|
52
|
+
value={errorValue}
|
|
53
|
+
onChange={(_event, value) => setErrorValue(value)}
|
|
54
|
+
/>
|
|
55
|
+
{showUtilities && (
|
|
56
|
+
<TextInputGroupUtilities>
|
|
57
|
+
{showClearButton && (
|
|
58
|
+
<Button variant="plain" onClick={clearInput} aria-label="Clear button and input" icon={<TimesIcon />} />
|
|
59
|
+
)}
|
|
60
|
+
</TextInputGroupUtilities>
|
|
61
|
+
)}
|
|
62
|
+
</TextInputGroup>
|
|
63
|
+
</FlexItem>
|
|
64
|
+
</Flex>
|
|
65
|
+
);
|
|
66
|
+
};
|
|
@@ -14,7 +14,7 @@ import EllipsisVIcon from '@patternfly/react-icons/dist/esm/icons/ellipsis-v-ico
|
|
|
14
14
|
|
|
15
15
|
export const TreeViewWithActionItems: React.FunctionComponent = () => {
|
|
16
16
|
const [activeItems, setActiveItems] = React.useState<TreeViewDataItem[]>();
|
|
17
|
-
const [isOpen, setIsOpen] = React.useState<boolean>();
|
|
17
|
+
const [isOpen, setIsOpen] = React.useState<boolean>(false);
|
|
18
18
|
|
|
19
19
|
const onSelect = (_event: React.MouseEvent, treeViewItem: TreeViewDataItem) => {
|
|
20
20
|
// Ignore folders for selection
|