@patternfly/react-core 5.0.0-alpha.1 → 5.0.0-alpha.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 +4 -0
- package/dist/esm/components/Accordion/AccordionContent.js +2 -2
- package/dist/esm/components/Accordion/AccordionContent.js.map +1 -1
- package/dist/esm/components/Accordion/AccordionExpandableContentBody.d.ts +7 -0
- package/dist/esm/components/Accordion/AccordionExpandableContentBody.d.ts.map +1 -0
- package/dist/esm/components/Accordion/AccordionExpandableContentBody.js +6 -0
- package/dist/esm/components/Accordion/AccordionExpandableContentBody.js.map +1 -0
- package/dist/esm/components/Accordion/index.d.ts +1 -1
- package/dist/esm/components/Accordion/index.d.ts.map +1 -1
- package/dist/esm/components/Accordion/index.js +1 -1
- package/dist/esm/components/Accordion/index.js.map +1 -1
- package/dist/js/components/Accordion/AccordionContent.js +2 -2
- package/dist/js/components/Accordion/AccordionContent.js.map +1 -1
- package/dist/js/components/Accordion/AccordionExpandableContentBody.d.ts +7 -0
- package/dist/js/components/Accordion/AccordionExpandableContentBody.d.ts.map +1 -0
- package/dist/js/components/Accordion/AccordionExpandableContentBody.js +11 -0
- package/dist/js/components/Accordion/AccordionExpandableContentBody.js.map +1 -0
- package/dist/js/components/Accordion/index.d.ts +1 -1
- package/dist/js/components/Accordion/index.d.ts.map +1 -1
- package/dist/js/components/Accordion/index.js +1 -1
- package/dist/js/components/Accordion/index.js.map +1 -1
- package/dist/umd/react-core.min.js +1 -1
- package/package.json +2 -2
- package/src/components/Accordion/AccordionContent.tsx +2 -2
- package/src/components/Accordion/AccordionExpandableContentBody.tsx +13 -0
- package/src/components/Accordion/__tests__/AccordionContent.test.tsx +4 -4
- package/src/components/Accordion/__tests__/AccordionExpandedContentBody.test.tsx +5 -5
- package/src/components/Accordion/examples/Accordion.md +1 -1
- package/src/components/Accordion/examples/AccordionBordered.tsx +5 -5
- package/src/components/Accordion/index.ts +1 -1
- package/dist/esm/components/Accordion/AccordionExpandedContentBody.d.ts +0 -7
- package/dist/esm/components/Accordion/AccordionExpandedContentBody.d.ts.map +0 -1
- package/dist/esm/components/Accordion/AccordionExpandedContentBody.js +0 -6
- package/dist/esm/components/Accordion/AccordionExpandedContentBody.js.map +0 -1
- package/dist/js/components/Accordion/AccordionExpandedContentBody.d.ts +0 -7
- package/dist/js/components/Accordion/AccordionExpandedContentBody.d.ts.map +0 -1
- package/dist/js/components/Accordion/AccordionExpandedContentBody.js +0 -11
- package/dist/js/components/Accordion/AccordionExpandedContentBody.js.map +0 -1
- package/src/components/Accordion/AccordionExpandedContentBody.tsx +0 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.2",
|
|
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": "^16.8 || ^17 || ^18",
|
|
72
72
|
"react-dom": "^16.8 || ^17 || ^18"
|
|
73
73
|
},
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "5c5e79f8ab23e8c173df7524ad2f1f59a9ba4300"
|
|
75
75
|
}
|
|
@@ -2,7 +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/Accordion/accordion';
|
|
4
4
|
import { AccordionContext } from './AccordionContext';
|
|
5
|
-
import {
|
|
5
|
+
import { AccordionExpandableContentBody } from './AccordionExpandableContentBody';
|
|
6
6
|
|
|
7
7
|
export interface AccordionContentProps extends React.HTMLProps<HTMLDivElement> {
|
|
8
8
|
/** Content rendered inside the Accordion */
|
|
@@ -50,7 +50,7 @@ export const AccordionContent: React.FunctionComponent<AccordionContentProps> =
|
|
|
50
50
|
aria-label={ariaLabel}
|
|
51
51
|
{...props}
|
|
52
52
|
>
|
|
53
|
-
{isCustomContent ? children : <
|
|
53
|
+
{isCustomContent ? children : <AccordionExpandableContentBody>{children}</AccordionExpandableContentBody>}
|
|
54
54
|
</Container>
|
|
55
55
|
);
|
|
56
56
|
}}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { css } from '@patternfly/react-styles';
|
|
3
|
+
import styles from '@patternfly/react-styles/css/components/Accordion/accordion';
|
|
4
|
+
|
|
5
|
+
export interface AccordionExpandableContentBodyProps {
|
|
6
|
+
/** Content rendered inside the accordion content body */
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const AccordionExpandableContentBody: React.FunctionComponent<AccordionExpandableContentBodyProps> = ({
|
|
11
|
+
children = null
|
|
12
|
+
}: AccordionExpandableContentBodyProps) => <div className={css(styles.accordionExpandableContentBody)}>{children}</div>;
|
|
13
|
+
AccordionExpandableContentBody.displayName = 'AccordionExpandableContentBody';
|
|
@@ -5,8 +5,8 @@ import { render, screen } from '@testing-library/react';
|
|
|
5
5
|
import { AccordionContent } from '../AccordionContent';
|
|
6
6
|
import { AccordionContext } from '../AccordionContext';
|
|
7
7
|
|
|
8
|
-
jest.mock('../
|
|
9
|
-
|
|
8
|
+
jest.mock('../AccordionExpandableContentBody', () => ({
|
|
9
|
+
AccordionExpandableContentBody: ({ children }) => <div aria-label="Expanded content body mock">{children}</div>
|
|
10
10
|
}));
|
|
11
11
|
|
|
12
12
|
test('Renders without children', () => {
|
|
@@ -29,7 +29,7 @@ test('Renders children', () => {
|
|
|
29
29
|
expect(screen.getByText('Test')).toBeVisible();
|
|
30
30
|
});
|
|
31
31
|
|
|
32
|
-
test('Renders with children wrapped in
|
|
32
|
+
test('Renders with children wrapped in AccordionExpandableContentBody by default', () => {
|
|
33
33
|
render(
|
|
34
34
|
<AccordionContext.Provider value={{ ContentContainer: 'h3' }}>
|
|
35
35
|
<AccordionContent>Test</AccordionContent>
|
|
@@ -39,7 +39,7 @@ test('Renders with children wrapped in AccordionExpandedContentBody by default',
|
|
|
39
39
|
expect(screen.getByText('Test')).toHaveAccessibleName('Expanded content body mock');
|
|
40
40
|
});
|
|
41
41
|
|
|
42
|
-
test('Does not render children wrapped in
|
|
42
|
+
test('Does not render children wrapped in AccordionExpandableContentBody when isCustomContent=true', () => {
|
|
43
43
|
render(
|
|
44
44
|
<AccordionContext.Provider value={{ ContentContainer: 'h3' }}>
|
|
45
45
|
<AccordionContent isCustomContent>Test</AccordionContent>
|
|
@@ -2,10 +2,10 @@ import React from 'react';
|
|
|
2
2
|
|
|
3
3
|
import { render, screen } from '@testing-library/react';
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { AccordionExpandableContentBody } from '../AccordionExpandableContentBody';
|
|
6
6
|
|
|
7
7
|
test('Renders without children', () => {
|
|
8
|
-
const { asFragment } = render(<
|
|
8
|
+
const { asFragment } = render(<AccordionExpandableContentBody />);
|
|
9
9
|
|
|
10
10
|
/* a snapshot test is used here because this component isn't selectable via better screen queries without children
|
|
11
11
|
as it doesn't spread other props to its container
|
|
@@ -14,20 +14,20 @@ test('Renders without children', () => {
|
|
|
14
14
|
});
|
|
15
15
|
|
|
16
16
|
test('Renders children', () => {
|
|
17
|
-
render(<
|
|
17
|
+
render(<AccordionExpandableContentBody>Test</AccordionExpandableContentBody>);
|
|
18
18
|
|
|
19
19
|
expect(screen.getByText('Test')).toBeVisible();
|
|
20
20
|
});
|
|
21
21
|
|
|
22
22
|
test('Renders with class name pf-c-accordion__expandable-content-body', () => {
|
|
23
|
-
render(<
|
|
23
|
+
render(<AccordionExpandableContentBody>Test</AccordionExpandableContentBody>);
|
|
24
24
|
|
|
25
25
|
expect(screen.getByText('Test')).toHaveClass('pf-c-accordion__expandable-content-body');
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
test('Matches the snapshot', () => {
|
|
29
29
|
const { asFragment } = render(
|
|
30
|
-
<
|
|
30
|
+
<AccordionExpandableContentBody>Test</AccordionExpandableContentBody>
|
|
31
31
|
);
|
|
32
32
|
expect(asFragment()).toMatchSnapshot();
|
|
33
33
|
});
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
id: Accordion
|
|
3
3
|
section: components
|
|
4
4
|
cssPrefix: pf-c-accordion
|
|
5
|
-
propComponents: ['Accordion', 'AccordionItem', 'AccordionContent', 'AccordionToggle',
|
|
5
|
+
propComponents: ['Accordion', 'AccordionItem', 'AccordionContent', 'AccordionToggle', AccordionExpandableContentBody]
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
import ArrowRightIcon from '@patternfly/react-icons/dist/esm/icons/arrow-right-icon';
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
AccordionItem,
|
|
5
5
|
AccordionContent,
|
|
6
6
|
AccordionToggle,
|
|
7
|
-
|
|
7
|
+
AccordionExpandableContentBody,
|
|
8
8
|
Button,
|
|
9
9
|
Checkbox
|
|
10
10
|
} from '@patternfly/react-core';
|
|
@@ -88,7 +88,7 @@ export const AccordionBordered: React.FunctionComponent = () => {
|
|
|
88
88
|
Item four
|
|
89
89
|
</AccordionToggle>
|
|
90
90
|
<AccordionContent id="bordered-expand4" isHidden={expanded !== 'bordered-toggle4'} isCustomContent>
|
|
91
|
-
<
|
|
91
|
+
<AccordionExpandableContentBody>
|
|
92
92
|
Donec vel posuere orci. Phasellus quis tortor a ex hendrerit efficitur. Aliquam lacinia ligula pharetra,
|
|
93
93
|
sagittis ex ut, pellentesque diam. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices
|
|
94
94
|
posuere cubilia Curae; Vestibulum ultricies nulla nibh. Etiam vel dui fermentum ligula ullamcorper
|
|
@@ -96,12 +96,12 @@ export const AccordionBordered: React.FunctionComponent = () => {
|
|
|
96
96
|
parturient montes, nascetur ridiculus mus. Mauris et velit neque. Donec ultricies condimentum mauris,
|
|
97
97
|
pellentesque imperdiet libero convallis convallis. Aliquam erat volutpat. Donec rutrum semper tempus.
|
|
98
98
|
Proin dictum imperdiet nibh, quis dapibus nulla. Integer sed tincidunt lectus, sit amet auctor eros.
|
|
99
|
-
</
|
|
100
|
-
<
|
|
99
|
+
</AccordionExpandableContentBody>
|
|
100
|
+
<AccordionExpandableContentBody>
|
|
101
101
|
<Button variant="link" size="lg" isInline>
|
|
102
102
|
Call to action <ArrowRightIcon />
|
|
103
103
|
</Button>
|
|
104
|
-
</
|
|
104
|
+
</AccordionExpandableContentBody>
|
|
105
105
|
</AccordionContent>
|
|
106
106
|
</AccordionItem>
|
|
107
107
|
<AccordionItem>
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
export interface AccordionExpandedContentBodyProps {
|
|
3
|
-
/** Content rendered inside the accordion content body */
|
|
4
|
-
children?: React.ReactNode;
|
|
5
|
-
}
|
|
6
|
-
export declare const AccordionExpandedContentBody: React.FunctionComponent<AccordionExpandedContentBodyProps>;
|
|
7
|
-
//# sourceMappingURL=AccordionExpandedContentBody.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AccordionExpandedContentBody.d.ts","sourceRoot":"","sources":["../../../../src/components/Accordion/AccordionExpandedContentBody.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,MAAM,WAAW,iCAAiC;IAChD,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,eAAO,MAAM,4BAA4B,EAAE,KAAK,CAAC,iBAAiB,CAAC,iCAAiC,CAEiB,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { css } from '@patternfly/react-styles';
|
|
3
|
-
import styles from '@patternfly/react-styles/css/components/Accordion/accordion';
|
|
4
|
-
export const AccordionExpandedContentBody = ({ children = null }) => React.createElement("div", { className: css(styles.accordionExpandableContentBody) }, children);
|
|
5
|
-
AccordionExpandedContentBody.displayName = 'AccordionExpandedContentBody';
|
|
6
|
-
//# sourceMappingURL=AccordionExpandedContentBody.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AccordionExpandedContentBody.js","sourceRoot":"","sources":["../../../../src/components/Accordion/AccordionExpandedContentBody.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAC/C,OAAO,MAAM,MAAM,6DAA6D,CAAC;AAOjF,MAAM,CAAC,MAAM,4BAA4B,GAA+D,CAAC,EACvG,QAAQ,GAAG,IAAI,EACmB,EAAE,EAAE,CAAC,6BAAK,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,8BAA8B,CAAC,IAAG,QAAQ,CAAO,CAAC;AACtH,4BAA4B,CAAC,WAAW,GAAG,8BAA8B,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
export interface AccordionExpandedContentBodyProps {
|
|
3
|
-
/** Content rendered inside the accordion content body */
|
|
4
|
-
children?: React.ReactNode;
|
|
5
|
-
}
|
|
6
|
-
export declare const AccordionExpandedContentBody: React.FunctionComponent<AccordionExpandedContentBodyProps>;
|
|
7
|
-
//# sourceMappingURL=AccordionExpandedContentBody.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AccordionExpandedContentBody.d.ts","sourceRoot":"","sources":["../../../../src/components/Accordion/AccordionExpandedContentBody.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,MAAM,WAAW,iCAAiC;IAChD,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,eAAO,MAAM,4BAA4B,EAAE,KAAK,CAAC,iBAAiB,CAAC,iCAAiC,CAEiB,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AccordionExpandedContentBody = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const React = tslib_1.__importStar(require("react"));
|
|
6
|
-
const react_styles_1 = require("@patternfly/react-styles");
|
|
7
|
-
const accordion_1 = tslib_1.__importDefault(require("@patternfly/react-styles/css/components/Accordion/accordion"));
|
|
8
|
-
const AccordionExpandedContentBody = ({ children = null }) => React.createElement("div", { className: react_styles_1.css(accordion_1.default.accordionExpandableContentBody) }, children);
|
|
9
|
-
exports.AccordionExpandedContentBody = AccordionExpandedContentBody;
|
|
10
|
-
exports.AccordionExpandedContentBody.displayName = 'AccordionExpandedContentBody';
|
|
11
|
-
//# sourceMappingURL=AccordionExpandedContentBody.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AccordionExpandedContentBody.js","sourceRoot":"","sources":["../../../../src/components/Accordion/AccordionExpandedContentBody.tsx"],"names":[],"mappings":";;;;AAAA,qDAA+B;AAC/B,2DAA+C;AAC/C,oHAAiF;AAO1E,MAAM,4BAA4B,GAA+D,CAAC,EACvG,QAAQ,GAAG,IAAI,EACmB,EAAE,EAAE,CAAC,6BAAK,SAAS,EAAE,kBAAG,CAAC,mBAAM,CAAC,8BAA8B,CAAC,IAAG,QAAQ,CAAO,CAAC;AAFzG,QAAA,4BAA4B,gCAE6E;AACtH,oCAA4B,CAAC,WAAW,GAAG,8BAA8B,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { css } from '@patternfly/react-styles';
|
|
3
|
-
import styles from '@patternfly/react-styles/css/components/Accordion/accordion';
|
|
4
|
-
|
|
5
|
-
export interface AccordionExpandedContentBodyProps {
|
|
6
|
-
/** Content rendered inside the accordion content body */
|
|
7
|
-
children?: React.ReactNode;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export const AccordionExpandedContentBody: React.FunctionComponent<AccordionExpandedContentBodyProps> = ({
|
|
11
|
-
children = null
|
|
12
|
-
}: AccordionExpandedContentBodyProps) => <div className={css(styles.accordionExpandableContentBody)}>{children}</div>;
|
|
13
|
-
AccordionExpandedContentBody.displayName = 'AccordionExpandedContentBody';
|