@patternfly/react-core 5.0.0-alpha.7 → 5.0.0-alpha.8
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 +10 -0
- package/components/Card/Card.d.ts +1 -1
- package/components/Card/Card.d.ts.map +1 -1
- package/components/Card/Card.js +1 -1
- package/components/Card/Card.js.map +1 -1
- package/components/ClipboardCopy/ClipboardCopy.d.ts +0 -2
- package/components/ClipboardCopy/ClipboardCopy.d.ts.map +1 -1
- package/components/ClipboardCopy/ClipboardCopy.js +1 -7
- package/components/ClipboardCopy/ClipboardCopy.js.map +1 -1
- package/dist/esm/components/Card/Card.d.ts +1 -1
- package/dist/esm/components/Card/Card.d.ts.map +1 -1
- package/dist/esm/components/Card/Card.js +1 -1
- package/dist/esm/components/Card/Card.js.map +1 -1
- package/dist/esm/components/ClipboardCopy/ClipboardCopy.d.ts +0 -2
- package/dist/esm/components/ClipboardCopy/ClipboardCopy.d.ts.map +1 -1
- package/dist/esm/components/ClipboardCopy/ClipboardCopy.js +1 -7
- package/dist/esm/components/ClipboardCopy/ClipboardCopy.js.map +1 -1
- package/dist/js/components/Card/Card.d.ts +1 -1
- package/dist/js/components/Card/Card.d.ts.map +1 -1
- package/dist/js/components/Card/Card.js +1 -1
- package/dist/js/components/Card/Card.js.map +1 -1
- package/dist/js/components/ClipboardCopy/ClipboardCopy.d.ts +0 -2
- package/dist/js/components/ClipboardCopy/ClipboardCopy.d.ts.map +1 -1
- package/dist/js/components/ClipboardCopy/ClipboardCopy.js +1 -7
- package/dist/js/components/ClipboardCopy/ClipboardCopy.js.map +1 -1
- package/dist/umd/react-core.min.js +1 -1
- package/package.json +2 -2
- package/src/components/Card/Card.tsx +2 -2
- package/src/components/Card/__tests__/Card.test.tsx +22 -22
- package/src/components/Card/__tests__/__snapshots__/Card.test.tsx.snap +2 -2
- package/src/components/ClipboardCopy/ClipboardCopy.tsx +0 -11
- package/src/components/ClipboardCopy/__tests__/Generated/ClipboardCopy.test.tsx +0 -1
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.8",
|
|
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": "1c5b0a362bcd0d6cf448b11f4af9ca641ca398d6"
|
|
74
74
|
}
|
|
@@ -10,7 +10,7 @@ export interface CardProps extends React.HTMLProps<HTMLElement>, OUIAProps {
|
|
|
10
10
|
id?: string;
|
|
11
11
|
/** Additional classes added to the Card */
|
|
12
12
|
className?: string;
|
|
13
|
-
/** Sets the base component to render. defaults to
|
|
13
|
+
/** Sets the base component to render. defaults to div */
|
|
14
14
|
component?: keyof JSX.IntrinsicElements;
|
|
15
15
|
/** Modifies the card to include compact styling. Should not be used with isLarge. */
|
|
16
16
|
isCompact?: boolean;
|
|
@@ -67,7 +67,7 @@ export const Card: React.FunctionComponent<CardProps> = ({
|
|
|
67
67
|
children = null,
|
|
68
68
|
id = '',
|
|
69
69
|
className = '',
|
|
70
|
-
component = '
|
|
70
|
+
component = 'div',
|
|
71
71
|
isCompact = false,
|
|
72
72
|
isSelectable = false,
|
|
73
73
|
isSelectableRaised = false,
|
|
@@ -12,8 +12,8 @@ describe('Card', () => {
|
|
|
12
12
|
});
|
|
13
13
|
|
|
14
14
|
test('className is added to the root element', () => {
|
|
15
|
-
render(<Card className="extra-class"
|
|
16
|
-
expect(screen.
|
|
15
|
+
render(<Card className="extra-class">card</Card>);
|
|
16
|
+
expect(screen.getByText('card')).toHaveClass('extra-class');
|
|
17
17
|
});
|
|
18
18
|
|
|
19
19
|
test('extra props are spread to the root element', () => {
|
|
@@ -43,70 +43,70 @@ describe('Card', () => {
|
|
|
43
43
|
});
|
|
44
44
|
|
|
45
45
|
test('card with isSelectable applied ', () => {
|
|
46
|
-
render(<Card isSelectable
|
|
46
|
+
render(<Card isSelectable>selectable card</Card>);
|
|
47
47
|
|
|
48
|
-
const card = screen.
|
|
48
|
+
const card = screen.getByText('selectable card');
|
|
49
49
|
expect(card).toHaveClass('pf-m-selectable');
|
|
50
50
|
expect(card).toHaveAttribute('tabindex', '0');
|
|
51
51
|
});
|
|
52
52
|
|
|
53
53
|
test('card with isSelectable and isSelected applied ', () => {
|
|
54
|
-
render(<Card isSelectable isSelected
|
|
54
|
+
render(<Card isSelectable isSelected>selected and selectable card</Card>);
|
|
55
55
|
|
|
56
|
-
const card = screen.
|
|
56
|
+
const card = screen.getByText('selected and selectable card');
|
|
57
57
|
expect(card).toHaveClass('pf-m-selectable');
|
|
58
58
|
expect(card).toHaveClass('pf-m-selected');
|
|
59
59
|
expect(card).toHaveAttribute('tabindex', '0');
|
|
60
60
|
});
|
|
61
61
|
|
|
62
62
|
test('card with only isSelected applied - not change', () => {
|
|
63
|
-
render(<Card isSelected
|
|
63
|
+
render(<Card isSelected>selected card</Card>);
|
|
64
64
|
|
|
65
|
-
const card = screen.
|
|
65
|
+
const card = screen.getByText('selected card');
|
|
66
66
|
expect(card).not.toHaveClass('pf-m-selected');
|
|
67
67
|
expect(card.getAttribute('tabindex')).toBeNull();
|
|
68
68
|
});
|
|
69
69
|
|
|
70
70
|
test('card with isDisabledRaised applied', () => {
|
|
71
|
-
render(<Card isDisabledRaised
|
|
72
|
-
expect(screen.
|
|
71
|
+
render(<Card isDisabledRaised>disabled raised card</Card>);
|
|
72
|
+
expect(screen.getByText('disabled raised card')).toHaveClass('pf-m-non-selectable-raised');
|
|
73
73
|
});
|
|
74
74
|
|
|
75
75
|
test('card with isSelectableRaised applied - not change', () => {
|
|
76
|
-
render(<Card isSelectableRaised
|
|
76
|
+
render(<Card isSelectableRaised>raised selectable card</Card>);
|
|
77
77
|
|
|
78
|
-
const card = screen.
|
|
78
|
+
const card = screen.getByText('raised selectable card');
|
|
79
79
|
expect(card).toHaveClass('pf-m-selectable-raised');
|
|
80
80
|
expect(card).toHaveAttribute('tabindex', '0');
|
|
81
81
|
});
|
|
82
82
|
|
|
83
83
|
test('card with isSelectableRaised and isSelected applied ', () => {
|
|
84
|
-
render(<Card isSelected isSelectableRaised
|
|
84
|
+
render(<Card isSelected isSelectableRaised>raised selected card</Card>);
|
|
85
85
|
|
|
86
|
-
const card = screen.
|
|
86
|
+
const card = screen.getByText('raised selected card');
|
|
87
87
|
expect(card).toHaveClass('pf-m-selectable-raised');
|
|
88
88
|
expect(card).toHaveClass('pf-m-selected-raised');
|
|
89
89
|
expect(card).toHaveAttribute('tabindex', '0');
|
|
90
90
|
});
|
|
91
91
|
|
|
92
92
|
test('card with isFlat applied', () => {
|
|
93
|
-
render(<Card isFlat
|
|
94
|
-
expect(screen.
|
|
93
|
+
render(<Card isFlat>flat card</Card>);
|
|
94
|
+
expect(screen.getByText('flat card')).toHaveClass('pf-m-flat');
|
|
95
95
|
});
|
|
96
96
|
|
|
97
97
|
test('card with isExpanded applied', () => {
|
|
98
|
-
render(<Card isExpanded
|
|
99
|
-
expect(screen.
|
|
98
|
+
render(<Card isExpanded>expanded card</Card>);
|
|
99
|
+
expect(screen.getByText('expanded card')).toHaveClass('pf-m-expanded');
|
|
100
100
|
});
|
|
101
101
|
|
|
102
102
|
test('card with isRounded applied', () => {
|
|
103
|
-
render(<Card isRounded
|
|
104
|
-
expect(screen.
|
|
103
|
+
render(<Card isRounded>rounded card</Card>);
|
|
104
|
+
expect(screen.getByText('rounded card')).toHaveClass('pf-m-rounded');
|
|
105
105
|
});
|
|
106
106
|
|
|
107
107
|
test('card with isLarge applied', () => {
|
|
108
|
-
render(<Card isLarge
|
|
109
|
-
expect(screen.
|
|
108
|
+
render(<Card isLarge>large card</Card>);
|
|
109
|
+
expect(screen.getByText('large card')).toHaveClass('pf-m-display-lg');
|
|
110
110
|
});
|
|
111
111
|
|
|
112
112
|
test('card warns when isLarge and isCompact', () => {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`Card card with isCompact applied 1`] = `
|
|
4
4
|
<DocumentFragment>
|
|
5
|
-
<
|
|
5
|
+
<div
|
|
6
6
|
class="pf-c-card pf-m-compact"
|
|
7
7
|
data-ouia-component-id="OUIA-Generated-Card-6"
|
|
8
8
|
data-ouia-component-type="PF4/Card"
|
|
@@ -14,7 +14,7 @@ exports[`Card card with isCompact applied 1`] = `
|
|
|
14
14
|
|
|
15
15
|
exports[`Card renders with PatternFly Core styles 1`] = `
|
|
16
16
|
<DocumentFragment>
|
|
17
|
-
<
|
|
17
|
+
<div
|
|
18
18
|
class="pf-c-card"
|
|
19
19
|
data-ouia-component-id="OUIA-Generated-Card-1"
|
|
20
20
|
data-ouia-component-type="PF4/Card"
|
|
@@ -69,8 +69,6 @@ export interface ClipboardCopyProps extends Omit<React.HTMLProps<HTMLDivElement>
|
|
|
69
69
|
exitDelay?: number;
|
|
70
70
|
/** Delay in ms before the tooltip appears. */
|
|
71
71
|
entryDelay?: number;
|
|
72
|
-
/** @deprecated Delay in ms before the tooltip message switch to hover tip. */
|
|
73
|
-
switchDelay?: number;
|
|
74
72
|
/** A function that is triggered on clicking the copy button. */
|
|
75
73
|
onCopy?: (event: React.ClipboardEvent<HTMLDivElement>, text?: React.ReactNode) => void;
|
|
76
74
|
/** A function that is triggered on changing the text. */
|
|
@@ -97,14 +95,6 @@ export class ClipboardCopy extends React.Component<ClipboardCopyProps, Clipboard
|
|
|
97
95
|
expanded: this.props.isExpanded,
|
|
98
96
|
copied: false
|
|
99
97
|
};
|
|
100
|
-
|
|
101
|
-
if (this.props.switchDelay !== undefined) {
|
|
102
|
-
// eslint-disable-next-line no-console
|
|
103
|
-
console.warn(
|
|
104
|
-
'ClipboardCopy: switchDelay prop has been deprecated. ' +
|
|
105
|
-
'The tooltip message will switch back to the hover tip as soon as the tooltip is hidden.'
|
|
106
|
-
);
|
|
107
|
-
}
|
|
108
98
|
}
|
|
109
99
|
|
|
110
100
|
static defaultProps: PickOptional<ClipboardCopyProps> = {
|
|
@@ -156,7 +146,6 @@ export class ClipboardCopy extends React.Component<ClipboardCopyProps, Clipboard
|
|
|
156
146
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
157
147
|
isExpanded,
|
|
158
148
|
onChange, // Don't pass to <div>
|
|
159
|
-
switchDelay,
|
|
160
149
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
161
150
|
isReadOnly,
|
|
162
151
|
isCode,
|
|
@@ -23,7 +23,6 @@ it('ClipboardCopy should match snapshot (auto-generated)', () => {
|
|
|
23
23
|
maxWidth={"'150px'"}
|
|
24
24
|
exitDelay={1600}
|
|
25
25
|
entryDelay={100}
|
|
26
|
-
switchDelay={2000}
|
|
27
26
|
onCopy={(event: React.ClipboardEvent<HTMLDivElement>, text?: React.ReactNode) => {
|
|
28
27
|
const clipboard = event.currentTarget.parentElement;
|
|
29
28
|
const el = document.createElement('input');
|