@patternfly/react-table 6.4.0-prerelease.1 → 6.4.0-prerelease.2
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 +6 -0
- package/components/package.json +1 -1
- package/deprecated/package.json +1 -1
- package/dist/dynamic/components/Table/package.json +1 -1
- package/dist/dynamic/components/Table/utils/decorators/package.json +1 -1
- package/dist/dynamic/components/Table/utils/package.json +1 -1
- package/dist/dynamic/deprecated/components/Table/base/package.json +1 -1
- package/dist/dynamic/deprecated/components/Table/package.json +1 -1
- package/dist/dynamic/deprecated/components/package.json +1 -1
- package/dist/esm/components/Table/Th.d.ts +2 -0
- package/dist/esm/components/Table/Th.d.ts.map +1 -1
- package/dist/esm/components/Table/Th.js +5 -5
- package/dist/esm/components/Table/Th.js.map +1 -1
- package/dist/js/components/Table/Th.d.ts +2 -0
- package/dist/js/components/Table/Th.d.ts.map +1 -1
- package/dist/js/components/Table/Th.js +4 -4
- package/dist/js/components/Table/Th.js.map +1 -1
- package/dist/umd/assets/{output-E0JqtRXk.css → output-D2xECikI.css} +5793 -5793
- package/dist/umd/react-table.min.js +1 -1
- package/package.json +2 -2
- package/src/components/Table/Th.tsx +4 -0
- package/src/components/Table/__tests__/Th.test.tsx +26 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-table",
|
|
3
|
-
"version": "6.4.0-prerelease.
|
|
3
|
+
"version": "6.4.0-prerelease.2",
|
|
4
4
|
"description": "This library provides a set of React table components for use with the PatternFly 4",
|
|
5
5
|
"main": "dist/js/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"react": "^17 || ^18 || ^19",
|
|
52
52
|
"react-dom": "^17 || ^18 || ^19"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "263c48569fb00a9db5bed9ea471e46ef0773887d"
|
|
55
55
|
}
|
|
@@ -65,6 +65,8 @@ export interface ThProps
|
|
|
65
65
|
* content, such as a "select all" checkbox or "expand all" toggle.
|
|
66
66
|
*/
|
|
67
67
|
'aria-label'?: string;
|
|
68
|
+
/** @hide Beta prop, internal use only. Additional content to render in the column header, appended to the end of the header content. */
|
|
69
|
+
additionalContent?: React.ReactNode;
|
|
68
70
|
}
|
|
69
71
|
|
|
70
72
|
const ThBase: React.FunctionComponent<ThProps> = ({
|
|
@@ -94,6 +96,7 @@ const ThBase: React.FunctionComponent<ThProps> = ({
|
|
|
94
96
|
isSubheader = false,
|
|
95
97
|
screenReaderText,
|
|
96
98
|
'aria-label': ariaLabel,
|
|
99
|
+
additionalContent,
|
|
97
100
|
...props
|
|
98
101
|
}: ThProps) => {
|
|
99
102
|
const { variant } = useContext(TableContext);
|
|
@@ -241,6 +244,7 @@ const ThBase: React.FunctionComponent<ThProps> = ({
|
|
|
241
244
|
>
|
|
242
245
|
{transformedChildren ||
|
|
243
246
|
(screenReaderText && <span className={accessibilityStyles.screenReader}>{screenReaderText}</span>)}
|
|
247
|
+
{additionalContent && additionalContent}
|
|
244
248
|
</MergedComponent>
|
|
245
249
|
);
|
|
246
250
|
|
|
@@ -28,3 +28,29 @@ test('Renders with screen reader text when screenReaderText is passed in', () =>
|
|
|
28
28
|
|
|
29
29
|
expect(screen.getByRole('columnheader')).toHaveTextContent('Test');
|
|
30
30
|
});
|
|
31
|
+
|
|
32
|
+
test('Does not render with additional content by default', () => {
|
|
33
|
+
render(<Th />);
|
|
34
|
+
|
|
35
|
+
expect(screen.getByRole('columnheader')).toBeEmptyDOMElement();
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
test('Render with additional content when additionalContent is passed in', () => {
|
|
39
|
+
render(<Th additionalContent={<div>Extra</div>}>Test</Th>);
|
|
40
|
+
|
|
41
|
+
expect(screen.getByRole('columnheader')).toHaveTextContent('Extra');
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
test('Additional content renders after children when additionalContent is passed in', () => {
|
|
45
|
+
render(
|
|
46
|
+
<Th additionalContent={<div>Extra</div>}>
|
|
47
|
+
<div>Test</div>
|
|
48
|
+
</Th>
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
const th = screen.getByRole('columnheader');
|
|
52
|
+
const thChildren = th.children;
|
|
53
|
+
|
|
54
|
+
expect(thChildren.item(0)?.textContent).toEqual('Test');
|
|
55
|
+
expect(thChildren.item(1)?.textContent).toEqual('Extra');
|
|
56
|
+
});
|