@patternfly/react-core 4.255.0 → 4.255.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/esm/components/Alert/AlertIcon.js +1 -1
- package/dist/esm/components/Alert/AlertIcon.js.map +1 -1
- package/dist/js/components/Alert/AlertIcon.js +1 -1
- package/dist/js/components/Alert/AlertIcon.js.map +1 -1
- package/dist/umd/react-core.min.css +812 -812
- package/dist/umd/react-core.min.js +1 -1
- package/package.json +2 -2
- package/src/components/Alert/AlertIcon.tsx +2 -2
- package/src/components/Button/__tests__/Button.test.tsx +16 -7
- package/src/components/Button/__tests__/__snapshots__/Button.test.tsx.snap +36 -0
- package/src/components/Button/examples/ButtonProgress.tsx +15 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "4.255.
|
|
3
|
+
"version": "4.255.1",
|
|
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",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"react": "^16.8 || ^17 || ^18",
|
|
71
71
|
"react-dom": "^16.8 || ^17 || ^18"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "bb273c8429b6dc5794f70dc8ee4c0ea9a15c20f1"
|
|
74
74
|
}
|
|
@@ -26,9 +26,9 @@ export interface AlertIconProps extends React.HTMLProps<HTMLDivElement> {
|
|
|
26
26
|
|
|
27
27
|
export const AlertIcon = ({ variant, customIcon, className = '', ...props }: AlertIconProps) => {
|
|
28
28
|
const Icon = variantIcons[variant];
|
|
29
|
-
return (
|
|
29
|
+
return Icon ? (
|
|
30
30
|
<div {...props} className={css(styles.alertIcon, className)}>
|
|
31
31
|
{customIcon || <Icon />}
|
|
32
32
|
</div>
|
|
33
|
-
);
|
|
33
|
+
) : null;
|
|
34
34
|
};
|
|
@@ -103,6 +103,22 @@ describe('Button', () => {
|
|
|
103
103
|
expect(asFragment()).toMatchSnapshot();
|
|
104
104
|
});
|
|
105
105
|
|
|
106
|
+
test('isLoading inline link', () => {
|
|
107
|
+
const { asFragment } = render(
|
|
108
|
+
<Button variant="link" isInline isLoading aria-label="Loading" spinnerAriaValueText="Loading">
|
|
109
|
+
Loading Button
|
|
110
|
+
</Button>
|
|
111
|
+
);
|
|
112
|
+
expect(asFragment()).toMatchSnapshot();
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
test('isLoading icon only', () => {
|
|
116
|
+
const { asFragment } = render(
|
|
117
|
+
<Button variant="plain" isLoading aria-label="Upload" spinnerAriaValueText="Loading" icon={<div>ICON</div>} />
|
|
118
|
+
);
|
|
119
|
+
expect(asFragment()).toMatchSnapshot();
|
|
120
|
+
});
|
|
121
|
+
|
|
106
122
|
test('allows passing in a string as the component', () => {
|
|
107
123
|
const component = 'a';
|
|
108
124
|
render(<Button component={component}>anchor button</Button>);
|
|
@@ -130,11 +146,4 @@ describe('Button', () => {
|
|
|
130
146
|
render(<Button tabIndex={0}>TabIndex 0 Button</Button>);
|
|
131
147
|
expect(screen.getByRole('button')).toHaveAttribute('tabindex', '0');
|
|
132
148
|
});
|
|
133
|
-
|
|
134
|
-
test('isLoading icon only', () => {
|
|
135
|
-
const { asFragment } = render(
|
|
136
|
-
<Button variant="plain" isLoading aria-label="Upload" spinnerAriaValueText="Loading" icon={<div>ICON</div>} />
|
|
137
|
-
);
|
|
138
|
-
expect(asFragment()).toMatchSnapshot();
|
|
139
|
-
});
|
|
140
149
|
});
|
|
@@ -240,6 +240,42 @@ exports[`Button isLoading icon only 1`] = `
|
|
|
240
240
|
</DocumentFragment>
|
|
241
241
|
`;
|
|
242
242
|
|
|
243
|
+
exports[`Button isLoading inline link 1`] = `
|
|
244
|
+
<DocumentFragment>
|
|
245
|
+
<button
|
|
246
|
+
aria-disabled="false"
|
|
247
|
+
aria-label="Loading"
|
|
248
|
+
class="pf-c-button pf-m-link pf-m-inline pf-m-progress pf-m-in-progress"
|
|
249
|
+
data-ouia-component-id="OUIA-Generated-Button-link-5"
|
|
250
|
+
data-ouia-component-type="PF4/Button"
|
|
251
|
+
data-ouia-safe="true"
|
|
252
|
+
type="button"
|
|
253
|
+
>
|
|
254
|
+
<span
|
|
255
|
+
class="pf-c-button__progress"
|
|
256
|
+
>
|
|
257
|
+
<span
|
|
258
|
+
aria-label="Contents"
|
|
259
|
+
aria-valuetext="Loading"
|
|
260
|
+
class="pf-c-spinner pf-m-md"
|
|
261
|
+
role="progressbar"
|
|
262
|
+
>
|
|
263
|
+
<span
|
|
264
|
+
class="pf-c-spinner__clipper"
|
|
265
|
+
/>
|
|
266
|
+
<span
|
|
267
|
+
class="pf-c-spinner__lead-ball"
|
|
268
|
+
/>
|
|
269
|
+
<span
|
|
270
|
+
class="pf-c-spinner__tail-ball"
|
|
271
|
+
/>
|
|
272
|
+
</span>
|
|
273
|
+
</span>
|
|
274
|
+
Loading Button
|
|
275
|
+
</button>
|
|
276
|
+
</DocumentFragment>
|
|
277
|
+
`;
|
|
278
|
+
|
|
243
279
|
exports[`Button isSmall 1`] = `
|
|
244
280
|
<DocumentFragment>
|
|
245
281
|
<button
|
|
@@ -12,6 +12,7 @@ interface LoadingPropsType {
|
|
|
12
12
|
export const ButtonProgress: React.FunctionComponent = () => {
|
|
13
13
|
const [isPrimaryLoading, setIsPrimaryLoading] = React.useState<boolean>(true);
|
|
14
14
|
const [isSecondaryLoading, setIsSecondaryLoading] = React.useState<boolean>(true);
|
|
15
|
+
const [isInlineLoading, setIsInlineLoading] = React.useState<boolean>(true);
|
|
15
16
|
const [isUploading, setIsUploading] = React.useState<boolean>(false);
|
|
16
17
|
|
|
17
18
|
const primaryLoadingProps = {} as LoadingPropsType;
|
|
@@ -24,6 +25,11 @@ export const ButtonProgress: React.FunctionComponent = () => {
|
|
|
24
25
|
secondaryLoadingProps.spinnerAriaLabel = 'Content being loaded';
|
|
25
26
|
secondaryLoadingProps.isLoading = isSecondaryLoading;
|
|
26
27
|
|
|
28
|
+
const inlineLoadingProps = {} as LoadingPropsType;
|
|
29
|
+
inlineLoadingProps.spinnerAriaValueText = 'Loading';
|
|
30
|
+
inlineLoadingProps.spinnerAriaLabel = 'Content being loaded';
|
|
31
|
+
inlineLoadingProps.isLoading = isInlineLoading;
|
|
32
|
+
|
|
27
33
|
const uploadingProps = {} as LoadingPropsType;
|
|
28
34
|
uploadingProps.spinnerAriaValueText = 'Loading';
|
|
29
35
|
uploadingProps.spinnerAriaLabel = 'Uploading data';
|
|
@@ -37,18 +43,25 @@ export const ButtonProgress: React.FunctionComponent = () => {
|
|
|
37
43
|
onClick={() => setIsPrimaryLoading(!isPrimaryLoading)}
|
|
38
44
|
{...primaryLoadingProps}
|
|
39
45
|
>
|
|
40
|
-
{isPrimaryLoading ? '
|
|
46
|
+
{isPrimaryLoading ? 'Click to stop loading' : 'Click to start loading'}
|
|
41
47
|
</Button>{' '}
|
|
42
48
|
<Button variant="secondary" onClick={() => setIsSecondaryLoading(!isSecondaryLoading)} {...secondaryLoadingProps}>
|
|
43
49
|
{isSecondaryLoading ? 'Click to stop loading' : 'Click to start loading'}
|
|
44
50
|
</Button>{' '}
|
|
51
|
+
<br />
|
|
52
|
+
<br />
|
|
45
53
|
<Button
|
|
46
54
|
variant="plain"
|
|
47
55
|
{...(!isUploading && { 'aria-label': 'Upload' })}
|
|
48
56
|
onClick={() => setIsUploading(!isUploading)}
|
|
49
57
|
icon={<UploadIcon />}
|
|
50
58
|
{...uploadingProps}
|
|
51
|
-
/>
|
|
59
|
+
/>{' '}
|
|
60
|
+
<br />
|
|
61
|
+
<br />
|
|
62
|
+
<Button variant="link" isInline onClick={() => setIsInlineLoading(!isInlineLoading)} {...inlineLoadingProps}>
|
|
63
|
+
{isInlineLoading ? 'Pause loading logs' : 'Resume loading logs'}
|
|
64
|
+
</Button>{' '}
|
|
52
65
|
</React.Fragment>
|
|
53
66
|
);
|
|
54
67
|
};
|