@patternfly/react-core 4.236.0 → 4.236.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 +24 -0
- package/dist/esm/components/Alert/Alert.d.ts +2 -0
- package/dist/esm/components/Alert/Alert.d.ts.map +1 -1
- package/dist/esm/components/Alert/Alert.js +2 -2
- package/dist/esm/components/Alert/Alert.js.map +1 -1
- package/dist/esm/components/AlertGroup/AlertGroupInline.d.ts.map +1 -1
- package/dist/esm/components/AlertGroup/AlertGroupInline.js +4 -1
- package/dist/esm/components/AlertGroup/AlertGroupInline.js.map +1 -1
- package/dist/esm/components/ApplicationLauncher/ApplicationLauncher.d.ts.map +1 -1
- package/dist/esm/components/ApplicationLauncher/ApplicationLauncher.js +1 -0
- package/dist/esm/components/ApplicationLauncher/ApplicationLauncher.js.map +1 -1
- package/dist/esm/components/Tabs/OverflowTab.d.ts.map +1 -1
- package/dist/esm/components/Tabs/OverflowTab.js +1 -1
- package/dist/esm/components/Tabs/OverflowTab.js.map +1 -1
- package/dist/esm/components/Tabs/TabButton.d.ts.map +1 -1
- package/dist/esm/components/Tabs/TabButton.js +1 -1
- package/dist/esm/components/Tabs/TabButton.js.map +1 -1
- package/dist/esm/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/esm/components/Tabs/Tabs.js +2 -2
- package/dist/esm/components/Tabs/Tabs.js.map +1 -1
- package/dist/esm/components/TimePicker/TimePicker.js +2 -2
- package/dist/esm/components/TimePicker/TimePicker.js.map +1 -1
- package/dist/js/components/Alert/Alert.d.ts +2 -0
- package/dist/js/components/Alert/Alert.d.ts.map +1 -1
- package/dist/js/components/Alert/Alert.js +2 -2
- package/dist/js/components/Alert/Alert.js.map +1 -1
- package/dist/js/components/AlertGroup/AlertGroupInline.d.ts.map +1 -1
- package/dist/js/components/AlertGroup/AlertGroupInline.js +4 -1
- package/dist/js/components/AlertGroup/AlertGroupInline.js.map +1 -1
- package/dist/js/components/ApplicationLauncher/ApplicationLauncher.d.ts.map +1 -1
- package/dist/js/components/ApplicationLauncher/ApplicationLauncher.js +1 -0
- package/dist/js/components/ApplicationLauncher/ApplicationLauncher.js.map +1 -1
- package/dist/js/components/Tabs/OverflowTab.d.ts.map +1 -1
- package/dist/js/components/Tabs/OverflowTab.js +1 -1
- package/dist/js/components/Tabs/OverflowTab.js.map +1 -1
- package/dist/js/components/Tabs/TabButton.d.ts.map +1 -1
- package/dist/js/components/Tabs/TabButton.js +1 -1
- package/dist/js/components/Tabs/TabButton.js.map +1 -1
- package/dist/js/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/js/components/Tabs/Tabs.js +2 -2
- package/dist/js/components/Tabs/Tabs.js.map +1 -1
- package/dist/js/components/TimePicker/TimePicker.js +2 -2
- package/dist/js/components/TimePicker/TimePicker.js.map +1 -1
- package/dist/umd/react-core.min.css +809 -795
- package/dist/umd/react-core.min.js +2 -2
- package/package.json +6 -6
- package/src/components/Alert/Alert.tsx +4 -0
- package/src/components/AlertGroup/AlertGroupInline.tsx +3 -2
- package/src/components/ApplicationLauncher/ApplicationLauncher.tsx +1 -0
- package/src/components/Avatar/__tests__/Avatar.test.tsx +69 -3
- package/src/components/Avatar/__tests__/__snapshots__/Avatar.test.tsx.snap +3 -2
- package/src/components/LabelGroup/examples/LabelGroupEditableAdd.tsx +1 -1
- package/src/components/LabelGroup/examples/LabelGroupEditableAddDropdown.tsx +1 -1
- package/src/components/LabelGroup/examples/LabelGroupEditableAddModal.tsx +5 -5
- package/src/components/Page/examples/PageCenteredSection.tsx +1 -1
- package/src/components/Tabs/OverflowTab.tsx +1 -0
- package/src/components/Tabs/TabButton.tsx +6 -1
- package/src/components/Tabs/Tabs.tsx +2 -0
- package/src/components/Tabs/__tests__/__snapshots__/OverflowTab.test.tsx.snap +1 -0
- package/src/components/Tabs/__tests__/__snapshots__/Tab.test.tsx.snap +1 -0
- package/src/components/Tabs/__tests__/__snapshots__/TabButton.test.tsx.snap +1 -0
- package/src/components/Tabs/__tests__/__snapshots__/Tabs.test.tsx.snap +67 -0
- package/src/components/TimePicker/TimePicker.tsx +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "4.236.
|
|
3
|
+
"version": "4.236.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",
|
|
@@ -44,16 +44,16 @@
|
|
|
44
44
|
"generate": "node scripts/copyStyles.js"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@patternfly/react-icons": "^4.87.
|
|
48
|
-
"@patternfly/react-styles": "^4.86.
|
|
49
|
-
"@patternfly/react-tokens": "^4.88.
|
|
47
|
+
"@patternfly/react-icons": "^4.87.3",
|
|
48
|
+
"@patternfly/react-styles": "^4.86.3",
|
|
49
|
+
"@patternfly/react-tokens": "^4.88.3",
|
|
50
50
|
"focus-trap": "6.9.2",
|
|
51
51
|
"react-dropzone": "9.0.0",
|
|
52
52
|
"tippy.js": "5.1.2",
|
|
53
53
|
"tslib": "^2.0.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@patternfly/patternfly": "4.
|
|
56
|
+
"@patternfly/patternfly": "4.211.0",
|
|
57
57
|
"@rollup/plugin-commonjs": "^21.0.0",
|
|
58
58
|
"@rollup/plugin-node-resolve": "^13.0.0",
|
|
59
59
|
"@rollup/plugin-replace": "^3.0.0",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"react": "^16.8.0 || ^17.0.0",
|
|
71
71
|
"react-dom": "^16.8.0 || ^17.0.0"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "07d9fc8ea68e953640e5d48c8693ec6865851bf1"
|
|
74
74
|
}
|
|
@@ -73,6 +73,8 @@ export interface AlertProps extends Omit<React.HTMLProps<HTMLDivElement>, 'actio
|
|
|
73
73
|
isExpandable?: boolean;
|
|
74
74
|
/** Adds accessible text to the alert Toggle */
|
|
75
75
|
toggleAriaLabel?: string;
|
|
76
|
+
/** Uniquely identifies the alert */
|
|
77
|
+
id?: string;
|
|
76
78
|
}
|
|
77
79
|
|
|
78
80
|
export const Alert: React.FunctionComponent<AlertProps> = ({
|
|
@@ -100,6 +102,7 @@ export const Alert: React.FunctionComponent<AlertProps> = ({
|
|
|
100
102
|
toggleAriaLabel = `${capitalize(variant)} alert details`,
|
|
101
103
|
onMouseEnter = () => {},
|
|
102
104
|
onMouseLeave = () => {},
|
|
105
|
+
id,
|
|
103
106
|
...props
|
|
104
107
|
}: AlertProps) => {
|
|
105
108
|
const ouiaProps = useOUIAProps(Alert.displayName, ouiaId, ouiaSafe, variant);
|
|
@@ -211,6 +214,7 @@ export const Alert: React.FunctionComponent<AlertProps> = ({
|
|
|
211
214
|
})}
|
|
212
215
|
onMouseEnter={myOnMouseEnter}
|
|
213
216
|
onMouseLeave={myOnMouseLeave}
|
|
217
|
+
id={id}
|
|
214
218
|
{...props}
|
|
215
219
|
>
|
|
216
220
|
{isExpandable && (
|
|
@@ -2,6 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { css } from '@patternfly/react-styles';
|
|
3
3
|
import styles from '@patternfly/react-styles/css/components/AlertGroup/alert-group';
|
|
4
4
|
import { AlertGroupProps } from './AlertGroup';
|
|
5
|
+
import { AlertProps } from '../Alert';
|
|
5
6
|
|
|
6
7
|
export const AlertGroupInline: React.FunctionComponent<AlertGroupProps> = ({
|
|
7
8
|
className,
|
|
@@ -18,8 +19,8 @@ export const AlertGroupInline: React.FunctionComponent<AlertGroupProps> = ({
|
|
|
18
19
|
className={css(styles.alertGroup, className, isToast ? styles.modifiers.toast : '')}
|
|
19
20
|
{...rest}
|
|
20
21
|
>
|
|
21
|
-
{React.Children.toArray(children).map((
|
|
22
|
-
<li key={index}>{
|
|
22
|
+
{React.Children.toArray(children).map((alert, index) => (
|
|
23
|
+
<li key={(alert as React.ReactElement<AlertProps>).props?.id || index}>{alert}</li>
|
|
23
24
|
))}
|
|
24
25
|
{overflowMessage && (
|
|
25
26
|
<li>
|
|
@@ -70,6 +70,7 @@ export class ApplicationLauncher extends React.Component<ApplicationLauncherProp
|
|
|
70
70
|
isDisabled: false,
|
|
71
71
|
direction: DropdownDirection.down,
|
|
72
72
|
favorites: [] as string[],
|
|
73
|
+
items: [] as React.ReactNode[],
|
|
73
74
|
isOpen: false,
|
|
74
75
|
position: DropdownPosition.left,
|
|
75
76
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
@@ -1,8 +1,74 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
3
|
import { Avatar } from '../Avatar';
|
|
4
4
|
|
|
5
|
-
test('simple avatar', () => {
|
|
6
|
-
|
|
5
|
+
test('Renders simple avatar', () => {
|
|
6
|
+
render(
|
|
7
|
+
<div data-testid="avatar">
|
|
8
|
+
<Avatar alt="avatar" />
|
|
9
|
+
</div>
|
|
10
|
+
);
|
|
11
|
+
expect(screen.getByTestId('avatar').firstChild).toBeVisible();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
test('Renders without any modifier class when border and size props are not passed', () => {
|
|
15
|
+
render(<Avatar alt="avatar" />);
|
|
16
|
+
expect(screen.getByRole('img')).toHaveClass('pf-c-avatar', { exact: true });
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
test('Renders with class name pf-m-light when "light" is passed as border prop', () => {
|
|
20
|
+
render(<Avatar alt="avatar" border="light" />);
|
|
21
|
+
expect(screen.getByRole('img')).toHaveClass('pf-m-light');
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
test('Renders with class name pf-m-dark when "dark" is passed as border prop', () => {
|
|
25
|
+
render(<Avatar alt="avatar" border="dark" />);
|
|
26
|
+
expect(screen.getByRole('img')).toHaveClass('pf-m-dark');
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test('Renders with class name pf-m-xl when "xl" is passed as size prop', () => {
|
|
30
|
+
render(<Avatar alt="avatar" size="xl" />);
|
|
31
|
+
expect(screen.getByRole('img')).toHaveClass('pf-m-xl');
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
test('Renders with class name pf-m-lg when "lg" is passed as size prop', () => {
|
|
35
|
+
render(<Avatar alt="avatar" size="lg" />);
|
|
36
|
+
expect(screen.getByRole('img')).toHaveClass('pf-m-lg');
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
test('Renders with class name pf-m-md when "md" is passed as size prop', () => {
|
|
40
|
+
render(<Avatar alt="avatar" size="md" />);
|
|
41
|
+
expect(screen.getByRole('img')).toHaveClass('pf-m-md');
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
test('Renders with class name pf-m-sm when "sm" is passed as size prop', () => {
|
|
45
|
+
render(<Avatar alt="avatar" size="sm" />);
|
|
46
|
+
expect(screen.getByRole('img')).toHaveClass('pf-m-sm');
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
test('Renders with custom class name when className prop is passed', () => {
|
|
50
|
+
render(<Avatar alt="avatar" className="test-class" />);
|
|
51
|
+
expect(screen.getByRole('img')).toHaveClass('test-class');
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
test('Renders with passed src prop', () => {
|
|
55
|
+
render(<Avatar alt="avatar" src="test.png" />);
|
|
56
|
+
const image = screen.getByRole('img') as HTMLImageElement;
|
|
57
|
+
expect(image.src).toMatch('test.png');
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
test('Renders with passed alt prop', () => {
|
|
61
|
+
render(<Avatar alt="avatar" />);
|
|
62
|
+
expect(screen.getByRole('img')).toHaveProperty('alt', 'avatar');
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
test('Renders with passed aria-label prop', () => {
|
|
66
|
+
render(<Avatar alt="avatar" aria-label="Avatar test" />);
|
|
67
|
+
expect(screen.getByRole('img')).toHaveAccessibleName('Avatar test');
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
test('Matches the snapshot', () => {
|
|
71
|
+
const { asFragment } = render(<Avatar alt="avatar" aria-label="Avatar test" src="test.png" className="test-class" />);
|
|
72
|
+
|
|
7
73
|
expect(asFragment()).toMatchSnapshot();
|
|
8
74
|
});
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`
|
|
3
|
+
exports[`Matches the snapshot 1`] = `
|
|
4
4
|
<DocumentFragment>
|
|
5
5
|
<img
|
|
6
6
|
alt="avatar"
|
|
7
|
-
|
|
7
|
+
aria-label="Avatar test"
|
|
8
|
+
class="pf-c-avatar test-class"
|
|
8
9
|
src="test.png"
|
|
9
10
|
/>
|
|
10
11
|
</DocumentFragment>
|
|
@@ -59,7 +59,7 @@ export const LabelGroupEditableAdd: React.FunctionComponent = () => {
|
|
|
59
59
|
{labels.map((label, index) => (
|
|
60
60
|
<Label
|
|
61
61
|
key={label.id}
|
|
62
|
-
id={
|
|
62
|
+
id={label.id}
|
|
63
63
|
color="blue"
|
|
64
64
|
onClose={() => onClose(label.id)}
|
|
65
65
|
onEditCancel={prevText => onEdit(prevText, index)}
|
|
@@ -122,7 +122,7 @@ export const LabelGroupEditableAddDropdown: React.FunctionComponent = () => {
|
|
|
122
122
|
{labels.map((label, index) => (
|
|
123
123
|
<Label
|
|
124
124
|
key={label.id}
|
|
125
|
-
id={
|
|
125
|
+
id={label.id}
|
|
126
126
|
color="blue"
|
|
127
127
|
onClose={() => onClose(label.id)}
|
|
128
128
|
onEditCancel={prevText => onEdit(prevText, index)}
|
|
@@ -20,7 +20,7 @@ import InfoCircleIcon from '@patternfly/react-icons/dist/esm/icons/info-circle-i
|
|
|
20
20
|
|
|
21
21
|
export const LabelGroupEditableAddModal: React.FunctionComponent = () => {
|
|
22
22
|
const [isModalOpen, setModalOpen] = React.useState<boolean>(false);
|
|
23
|
-
const [idIndex, setIdIndex] = React.useState<number>(
|
|
23
|
+
const [idIndex, setIdIndex] = React.useState<number>(7);
|
|
24
24
|
const [labelText, setLabelText] = React.useState<string>('');
|
|
25
25
|
const [color, setColor] = React.useState<string>();
|
|
26
26
|
const [icon, setIcon] = React.useState<any>();
|
|
@@ -40,8 +40,8 @@ export const LabelGroupEditableAddModal: React.FunctionComponent = () => {
|
|
|
40
40
|
const iconToggleRef = React.useRef<HTMLButtonElement>(null);
|
|
41
41
|
|
|
42
42
|
const [labels, setLabels] = React.useState<any>([
|
|
43
|
-
{ name: 'Label 1', id:
|
|
44
|
-
{ name: 'Label 2', id:
|
|
43
|
+
{ name: 'Label 1', id: 4 },
|
|
44
|
+
{ name: 'Label 2', id: 5 },
|
|
45
45
|
{
|
|
46
46
|
name: 'Label 3',
|
|
47
47
|
props: {
|
|
@@ -50,7 +50,7 @@ export const LabelGroupEditableAddModal: React.FunctionComponent = () => {
|
|
|
50
50
|
'aria-label': 'label editable text'
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
|
-
id:
|
|
53
|
+
id: 6
|
|
54
54
|
}
|
|
55
55
|
]);
|
|
56
56
|
|
|
@@ -239,7 +239,7 @@ export const LabelGroupEditableAddModal: React.FunctionComponent = () => {
|
|
|
239
239
|
{labels.map((label: { name: string; id: string; props: any }, index: number) => (
|
|
240
240
|
<Label
|
|
241
241
|
key={label.id}
|
|
242
|
-
id={
|
|
242
|
+
id={label.id}
|
|
243
243
|
color="blue"
|
|
244
244
|
onClose={() => onClose(label.id)}
|
|
245
245
|
onEditCancel={prevText => onEdit(prevText, index)}
|
|
@@ -54,7 +54,7 @@ export const PageCenteredSection: React.FunctionComponent = () => {
|
|
|
54
54
|
</Masthead>
|
|
55
55
|
);
|
|
56
56
|
|
|
57
|
-
const sidebar = <PageSidebar nav="Navigation" isNavOpen={isNavOpen} id="
|
|
57
|
+
const sidebar = <PageSidebar nav="Navigation" isNavOpen={isNavOpen} id="centered-section-sidebar" />;
|
|
58
58
|
|
|
59
59
|
return (
|
|
60
60
|
<Page header={header} sidebar={sidebar}>
|
|
@@ -26,7 +26,12 @@ export const TabButton: React.FunctionComponent<TabButtonProps> = ({
|
|
|
26
26
|
const Component = (props.href ? 'a' : 'button') as any;
|
|
27
27
|
|
|
28
28
|
return (
|
|
29
|
-
<Component
|
|
29
|
+
<Component
|
|
30
|
+
{...(!props.href && { type: 'button' })}
|
|
31
|
+
ref={parentInnerRef}
|
|
32
|
+
{...getOUIAProps(TabButton.displayName, ouiaId, ouiaSafe)}
|
|
33
|
+
{...props}
|
|
34
|
+
>
|
|
30
35
|
{children}
|
|
31
36
|
</Component>
|
|
32
37
|
);
|
|
@@ -463,6 +463,7 @@ export class Tabs extends React.Component<TabsProps, TabsState> {
|
|
|
463
463
|
)}
|
|
464
464
|
{!isOverflowHorizontal && (
|
|
465
465
|
<button
|
|
466
|
+
type="button"
|
|
466
467
|
className={css(styles.tabsScrollButton, isSecondary && buttonStyles.modifiers.secondary)}
|
|
467
468
|
aria-label={leftScrollAriaLabel}
|
|
468
469
|
onClick={this.scrollLeft}
|
|
@@ -478,6 +479,7 @@ export class Tabs extends React.Component<TabsProps, TabsState> {
|
|
|
478
479
|
</ul>
|
|
479
480
|
{!isOverflowHorizontal && (
|
|
480
481
|
<button
|
|
482
|
+
type="button"
|
|
481
483
|
className={css(styles.tabsScrollButton, isSecondary && buttonStyles.modifiers.secondary)}
|
|
482
484
|
aria-label={rightScrollAriaLabel}
|
|
483
485
|
onClick={this.scrollRight}
|