@patternfly/react-core 4.199.2 → 4.199.5
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/umd/react-core.css +2 -2
- package/dist/umd/react-core.min.css +221 -221
- package/package.json +6 -6
- package/src/components/AboutModal/__tests__/AboutModal.test.tsx +41 -60
- package/src/components/Accordion/__tests__/Accordion.test.tsx +23 -17
- package/src/components/Alert/__tests__/Alert.test.tsx +195 -184
- package/src/components/Alert/__tests__/Generated/AlertActionCloseButton.test.tsx +19 -17
- package/src/components/Alert/__tests__/Generated/__snapshots__/AlertActionCloseButton.test.tsx.snap +26 -4
- package/src/components/Alert/__tests__/__snapshots__/Alert.test.tsx.snap +50 -700
- package/src/components/AlertGroup/__tests__/AlertGroup.test.tsx +68 -73
- package/src/components/AlertGroup/__tests__/__snapshots__/AlertGroup.test.tsx.snap +1 -893
- package/src/components/ApplicationLauncher/__tests__/Generated/ApplicationLauncherSeparator.test.tsx +13 -10
- package/src/components/ApplicationLauncher/__tests__/Generated/__snapshots__/ApplicationLauncherSeparator.test.tsx.snap +12 -1
- package/src/components/Button/__tests__/Button.test.tsx +116 -107
- package/src/components/Button/__tests__/__snapshots__/Button.test.tsx.snap +21 -21
- package/src/components/Card/__tests__/Card.test.tsx +119 -100
- package/src/components/Card/__tests__/CardBody.test.tsx +35 -28
- package/src/components/Card/__tests__/CardFooter.test.tsx +28 -24
- package/src/components/Card/__tests__/CardHeadMain.test.tsx +19 -14
- package/src/components/Card/__tests__/CardHeader.test.tsx +6 -22
- package/src/components/Card/__tests__/CardHeaderMain.test.tsx +19 -14
- package/src/components/Card/__tests__/CardTitle.test.tsx +25 -0
- package/src/components/Card/__tests__/__snapshots__/Card.test.tsx.snap +12 -28
- package/src/components/Card/__tests__/__snapshots__/CardBody.test.tsx.snap +2 -4
- package/src/components/Card/__tests__/__snapshots__/CardFooter.test.tsx.snap +1 -3
- package/src/components/Card/__tests__/__snapshots__/CardHeadMain.test.tsx.snap +1 -11
- package/src/components/Card/__tests__/__snapshots__/CardHeader.test.tsx.snap +1 -11
- package/src/components/Card/__tests__/__snapshots__/CardHeaderMain.test.tsx.snap +1 -11
- package/src/components/Card/__tests__/__snapshots__/CardTitle.test.tsx.snap +3 -0
- package/src/components/Checkbox/__tests__/Checkbox.test.tsx +66 -70
- package/src/components/Checkbox/__tests__/__snapshots__/Checkbox.test.tsx.snap +9 -204
- package/src/components/ClipboardCopy/examples/ClipboardCopy.md +11 -123
- package/src/components/ClipboardCopy/examples/ClipboardCopyBasic.tsx +8 -0
- package/src/components/ClipboardCopy/examples/ClipboardCopyExpanded.tsx +9 -0
- package/src/components/ClipboardCopy/examples/ClipboardCopyExpandedWithArray.tsx +14 -0
- package/src/components/ClipboardCopy/examples/ClipboardCopyInlineCompact.tsx +7 -0
- package/src/components/ClipboardCopy/examples/ClipboardCopyInlineCompactCode.tsx +8 -0
- package/src/components/ClipboardCopy/examples/ClipboardCopyInlineCompactInSentence.tsx +36 -0
- package/src/components/ClipboardCopy/examples/ClipboardCopyInlineCompactWithAdditionalAction.tsx +20 -0
- package/src/components/ClipboardCopy/examples/ClipboardCopyJSONObject.tsx +18 -0
- package/src/components/ClipboardCopy/examples/ClipboardCopyReadOnly.tsx +8 -0
- package/src/components/ClipboardCopy/examples/ClipboardCopyReadOnlyExpanded.tsx +9 -0
- package/src/components/ClipboardCopy/examples/ClipboardCopyReadOnlyExpandedByDefault.tsx +9 -0
|
@@ -1,86 +1,82 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
4
|
+
import userEvent from '@testing-library/user-event';
|
|
5
|
+
import '@testing-library/jest-dom';
|
|
6
|
+
|
|
4
7
|
import { Checkbox } from '../Checkbox';
|
|
5
8
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
describe('Checkbox', () => {
|
|
10
|
+
test('controlled', () => {
|
|
11
|
+
render(<Checkbox isChecked id="check" aria-label="check" />);
|
|
12
|
+
expect(screen.getByRole('checkbox').outerHTML).toMatchSnapshot();
|
|
13
|
+
});
|
|
10
14
|
|
|
11
|
-
test('controlled', () => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
});
|
|
15
|
+
test('controlled - 3rd state', () => {
|
|
16
|
+
render(<Checkbox isChecked={null} id="check" aria-label="check" />);
|
|
17
|
+
expect(screen.getByRole('checkbox').outerHTML).toMatchSnapshot();
|
|
18
|
+
});
|
|
15
19
|
|
|
16
|
-
test('
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
});
|
|
20
|
+
test('uncontrolled', () => {
|
|
21
|
+
render(<Checkbox id="check" aria-label="check" />);
|
|
22
|
+
expect(screen.getByRole('checkbox').outerHTML).toMatchSnapshot();
|
|
23
|
+
});
|
|
20
24
|
|
|
21
|
-
test('
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
});
|
|
25
|
+
test('isDisabled', () => {
|
|
26
|
+
render(<Checkbox id="check" isDisabled aria-label="check" />);
|
|
27
|
+
expect(screen.getByRole('checkbox').outerHTML).toMatchSnapshot();
|
|
28
|
+
});
|
|
25
29
|
|
|
26
|
-
test('
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
});
|
|
30
|
+
test('label is string', () => {
|
|
31
|
+
render(<Checkbox label="Label" id="check" isChecked aria-label="check" />);
|
|
32
|
+
expect(screen.getByRole('checkbox').outerHTML).toMatchSnapshot();
|
|
33
|
+
});
|
|
30
34
|
|
|
31
|
-
test('label is
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
test('label is function', () => {
|
|
36
|
+
const functionLabel = () => <h1>Header</h1>;
|
|
37
|
+
render(<Checkbox label={functionLabel()} id="check" isChecked aria-label="check" />);
|
|
38
|
+
expect(screen.getByRole('checkbox').outerHTML).toMatchSnapshot();
|
|
39
|
+
});
|
|
35
40
|
|
|
36
|
-
test('label is
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
});
|
|
41
|
+
test('label is node', () => {
|
|
42
|
+
render(<Checkbox label={<h1>Header</h1>} id="check" isChecked aria-label="check" />);
|
|
43
|
+
expect(screen.getByRole('checkbox').outerHTML).toMatchSnapshot();
|
|
44
|
+
});
|
|
41
45
|
|
|
42
|
-
test('
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
});
|
|
46
|
+
test('passing class', () => {
|
|
47
|
+
render(<Checkbox label="label" className="class-123" id="check" isChecked aria-label="check" />);
|
|
48
|
+
expect(screen.getByRole('checkbox').outerHTML).toMatchSnapshot();
|
|
49
|
+
});
|
|
46
50
|
|
|
47
|
-
test('passing
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
});
|
|
51
|
+
test('passing HTML attribute', () => {
|
|
52
|
+
render(<Checkbox label="label" aria-labelledby="labelId" id="check" isChecked aria-label="check" />);
|
|
53
|
+
expect(screen.getByRole('checkbox').outerHTML).toMatchSnapshot();
|
|
54
|
+
});
|
|
51
55
|
|
|
52
|
-
test('passing
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
});
|
|
56
|
+
test('passing description', () => {
|
|
57
|
+
render(<Checkbox id="check" label="checkbox" description="Text description..." />);
|
|
58
|
+
expect(screen.getByText('Text description...')).toBeInTheDocument();
|
|
59
|
+
});
|
|
56
60
|
|
|
57
|
-
test('passing
|
|
58
|
-
|
|
59
|
-
const descriptionEl = view.find('span[className="pf-c-check__description"]');
|
|
60
|
-
expect(descriptionEl.length).toBe(1);
|
|
61
|
-
expect(descriptionEl.text()).toBe('Text description...');
|
|
62
|
-
});
|
|
61
|
+
test('passing body', () => {
|
|
62
|
+
render(<Checkbox id="check" label="checkbox" body="This is where custom content goes." />);
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
const bodyEl = view.find('span[className="pf-c-check__body"]');
|
|
67
|
-
expect(bodyEl.length).toBe(1);
|
|
68
|
-
expect(bodyEl.text()).toBe('This is where custom content goes.');
|
|
69
|
-
});
|
|
64
|
+
expect(screen.getByText('This is where custom content goes.')).toBeInTheDocument();
|
|
65
|
+
});
|
|
70
66
|
|
|
71
|
-
test('checkbox
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
67
|
+
test('checkbox onChange handler called when component is clicked', () => {
|
|
68
|
+
const onChangeHandler = jest.fn();
|
|
69
|
+
render(<Checkbox id="check" onChange={onChangeHandler} aria-label="check" isChecked={false} />);
|
|
70
|
+
|
|
71
|
+
userEvent.click(screen.getByLabelText('check'));
|
|
72
|
+
expect(onChangeHandler).toBeCalled();
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
test('should throw console error when no id is given', () => {
|
|
76
|
+
const myMock = jest.fn();
|
|
77
|
+
global.console = { ...global.console, error: myMock };
|
|
80
78
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
render(<Checkbox {...props} />);
|
|
85
|
-
expect(myMock).toBeCalled();
|
|
79
|
+
render(<Checkbox id={undefined} />);
|
|
80
|
+
expect(myMock).toBeCalled();
|
|
81
|
+
});
|
|
86
82
|
});
|
|
@@ -1,214 +1,19 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`controlled - 3rd state 1`] = `
|
|
4
|
-
<div>
|
|
5
|
-
<div
|
|
6
|
-
class="pf-c-check pf-m-standalone"
|
|
7
|
-
>
|
|
8
|
-
<input
|
|
9
|
-
aria-invalid="false"
|
|
10
|
-
aria-label="check"
|
|
11
|
-
class="pf-c-check__input"
|
|
12
|
-
data-ouia-component-id="OUIA-Generated-Checkbox-2"
|
|
13
|
-
data-ouia-component-type="PF4/Checkbox"
|
|
14
|
-
data-ouia-safe="true"
|
|
15
|
-
id="check"
|
|
16
|
-
type="checkbox"
|
|
17
|
-
/>
|
|
18
|
-
</div>
|
|
19
|
-
</div>
|
|
20
|
-
`;
|
|
3
|
+
exports[`Checkbox controlled - 3rd state 1`] = `"<input id=\\"check\\" class=\\"pf-c-check__input\\" type=\\"checkbox\\" aria-invalid=\\"false\\" aria-label=\\"check\\" data-ouia-component-type=\\"PF4/Checkbox\\" data-ouia-safe=\\"true\\" data-ouia-component-id=\\"OUIA-Generated-Checkbox-2\\">"`;
|
|
21
4
|
|
|
22
|
-
exports[`controlled 1`] = `
|
|
23
|
-
<div>
|
|
24
|
-
<div
|
|
25
|
-
class="pf-c-check pf-m-standalone"
|
|
26
|
-
>
|
|
27
|
-
<input
|
|
28
|
-
aria-invalid="false"
|
|
29
|
-
aria-label="check"
|
|
30
|
-
checked=""
|
|
31
|
-
class="pf-c-check__input"
|
|
32
|
-
data-ouia-component-id="OUIA-Generated-Checkbox-1"
|
|
33
|
-
data-ouia-component-type="PF4/Checkbox"
|
|
34
|
-
data-ouia-safe="true"
|
|
35
|
-
id="check"
|
|
36
|
-
type="checkbox"
|
|
37
|
-
/>
|
|
38
|
-
</div>
|
|
39
|
-
</div>
|
|
40
|
-
`;
|
|
5
|
+
exports[`Checkbox controlled 1`] = `"<input id=\\"check\\" class=\\"pf-c-check__input\\" type=\\"checkbox\\" aria-invalid=\\"false\\" aria-label=\\"check\\" data-ouia-component-type=\\"PF4/Checkbox\\" data-ouia-safe=\\"true\\" data-ouia-component-id=\\"OUIA-Generated-Checkbox-1\\" checked=\\"\\">"`;
|
|
41
6
|
|
|
42
|
-
exports[`isDisabled 1`] = `
|
|
43
|
-
<div>
|
|
44
|
-
<div
|
|
45
|
-
class="pf-c-check pf-m-standalone"
|
|
46
|
-
>
|
|
47
|
-
<input
|
|
48
|
-
aria-invalid="false"
|
|
49
|
-
aria-label="check"
|
|
50
|
-
class="pf-c-check__input"
|
|
51
|
-
data-ouia-component-id="OUIA-Generated-Checkbox-4"
|
|
52
|
-
data-ouia-component-type="PF4/Checkbox"
|
|
53
|
-
data-ouia-safe="true"
|
|
54
|
-
disabled=""
|
|
55
|
-
id="check"
|
|
56
|
-
type="checkbox"
|
|
57
|
-
/>
|
|
58
|
-
</div>
|
|
59
|
-
</div>
|
|
60
|
-
`;
|
|
7
|
+
exports[`Checkbox isDisabled 1`] = `"<input id=\\"check\\" class=\\"pf-c-check__input\\" type=\\"checkbox\\" aria-invalid=\\"false\\" aria-label=\\"check\\" disabled=\\"\\" data-ouia-component-type=\\"PF4/Checkbox\\" data-ouia-safe=\\"true\\" data-ouia-component-id=\\"OUIA-Generated-Checkbox-4\\">"`;
|
|
61
8
|
|
|
62
|
-
exports[`label is function 1`] = `
|
|
63
|
-
<div>
|
|
64
|
-
<div
|
|
65
|
-
class="pf-c-check"
|
|
66
|
-
>
|
|
67
|
-
<input
|
|
68
|
-
aria-invalid="false"
|
|
69
|
-
aria-label="check"
|
|
70
|
-
checked=""
|
|
71
|
-
class="pf-c-check__input"
|
|
72
|
-
data-ouia-component-id="OUIA-Generated-Checkbox-6"
|
|
73
|
-
data-ouia-component-type="PF4/Checkbox"
|
|
74
|
-
data-ouia-safe="true"
|
|
75
|
-
id="check"
|
|
76
|
-
type="checkbox"
|
|
77
|
-
/>
|
|
78
|
-
<label
|
|
79
|
-
class="pf-c-check__label"
|
|
80
|
-
for="check"
|
|
81
|
-
>
|
|
82
|
-
<h1>
|
|
83
|
-
Header
|
|
84
|
-
</h1>
|
|
85
|
-
</label>
|
|
86
|
-
</div>
|
|
87
|
-
</div>
|
|
88
|
-
`;
|
|
9
|
+
exports[`Checkbox label is function 1`] = `"<input id=\\"check\\" class=\\"pf-c-check__input\\" type=\\"checkbox\\" aria-invalid=\\"false\\" aria-label=\\"check\\" data-ouia-component-type=\\"PF4/Checkbox\\" data-ouia-safe=\\"true\\" data-ouia-component-id=\\"OUIA-Generated-Checkbox-6\\" checked=\\"\\">"`;
|
|
89
10
|
|
|
90
|
-
exports[`label is node 1`] = `
|
|
91
|
-
<div>
|
|
92
|
-
<div
|
|
93
|
-
class="pf-c-check"
|
|
94
|
-
>
|
|
95
|
-
<input
|
|
96
|
-
aria-invalid="false"
|
|
97
|
-
aria-label="check"
|
|
98
|
-
checked=""
|
|
99
|
-
class="pf-c-check__input"
|
|
100
|
-
data-ouia-component-id="OUIA-Generated-Checkbox-7"
|
|
101
|
-
data-ouia-component-type="PF4/Checkbox"
|
|
102
|
-
data-ouia-safe="true"
|
|
103
|
-
id="check"
|
|
104
|
-
type="checkbox"
|
|
105
|
-
/>
|
|
106
|
-
<label
|
|
107
|
-
class="pf-c-check__label"
|
|
108
|
-
for="check"
|
|
109
|
-
>
|
|
110
|
-
<h1>
|
|
111
|
-
Header
|
|
112
|
-
</h1>
|
|
113
|
-
</label>
|
|
114
|
-
</div>
|
|
115
|
-
</div>
|
|
116
|
-
`;
|
|
11
|
+
exports[`Checkbox label is node 1`] = `"<input id=\\"check\\" class=\\"pf-c-check__input\\" type=\\"checkbox\\" aria-invalid=\\"false\\" aria-label=\\"check\\" data-ouia-component-type=\\"PF4/Checkbox\\" data-ouia-safe=\\"true\\" data-ouia-component-id=\\"OUIA-Generated-Checkbox-7\\" checked=\\"\\">"`;
|
|
117
12
|
|
|
118
|
-
exports[`label is string 1`] = `
|
|
119
|
-
<div>
|
|
120
|
-
<div
|
|
121
|
-
class="pf-c-check"
|
|
122
|
-
>
|
|
123
|
-
<input
|
|
124
|
-
aria-invalid="false"
|
|
125
|
-
aria-label="check"
|
|
126
|
-
checked=""
|
|
127
|
-
class="pf-c-check__input"
|
|
128
|
-
data-ouia-component-id="OUIA-Generated-Checkbox-5"
|
|
129
|
-
data-ouia-component-type="PF4/Checkbox"
|
|
130
|
-
data-ouia-safe="true"
|
|
131
|
-
id="check"
|
|
132
|
-
type="checkbox"
|
|
133
|
-
/>
|
|
134
|
-
<label
|
|
135
|
-
class="pf-c-check__label"
|
|
136
|
-
for="check"
|
|
137
|
-
>
|
|
138
|
-
Label
|
|
139
|
-
</label>
|
|
140
|
-
</div>
|
|
141
|
-
</div>
|
|
142
|
-
`;
|
|
13
|
+
exports[`Checkbox label is string 1`] = `"<input id=\\"check\\" class=\\"pf-c-check__input\\" type=\\"checkbox\\" aria-invalid=\\"false\\" aria-label=\\"check\\" data-ouia-component-type=\\"PF4/Checkbox\\" data-ouia-safe=\\"true\\" data-ouia-component-id=\\"OUIA-Generated-Checkbox-5\\" checked=\\"\\">"`;
|
|
143
14
|
|
|
144
|
-
exports[`passing HTML attribute 1`] = `
|
|
145
|
-
<div>
|
|
146
|
-
<div
|
|
147
|
-
class="pf-c-check"
|
|
148
|
-
>
|
|
149
|
-
<input
|
|
150
|
-
aria-invalid="false"
|
|
151
|
-
aria-label="check"
|
|
152
|
-
aria-labelledby="labelId"
|
|
153
|
-
checked=""
|
|
154
|
-
class="pf-c-check__input"
|
|
155
|
-
data-ouia-component-id="OUIA-Generated-Checkbox-9"
|
|
156
|
-
data-ouia-component-type="PF4/Checkbox"
|
|
157
|
-
data-ouia-safe="true"
|
|
158
|
-
id="check"
|
|
159
|
-
type="checkbox"
|
|
160
|
-
/>
|
|
161
|
-
<label
|
|
162
|
-
class="pf-c-check__label"
|
|
163
|
-
for="check"
|
|
164
|
-
>
|
|
165
|
-
label
|
|
166
|
-
</label>
|
|
167
|
-
</div>
|
|
168
|
-
</div>
|
|
169
|
-
`;
|
|
15
|
+
exports[`Checkbox passing HTML attribute 1`] = `"<input aria-labelledby=\\"labelId\\" id=\\"check\\" class=\\"pf-c-check__input\\" type=\\"checkbox\\" aria-invalid=\\"false\\" aria-label=\\"check\\" data-ouia-component-type=\\"PF4/Checkbox\\" data-ouia-safe=\\"true\\" data-ouia-component-id=\\"OUIA-Generated-Checkbox-9\\" checked=\\"\\">"`;
|
|
170
16
|
|
|
171
|
-
exports[`passing class 1`] = `
|
|
172
|
-
<div>
|
|
173
|
-
<div
|
|
174
|
-
class="pf-c-check class-123"
|
|
175
|
-
>
|
|
176
|
-
<input
|
|
177
|
-
aria-invalid="false"
|
|
178
|
-
aria-label="check"
|
|
179
|
-
checked=""
|
|
180
|
-
class="pf-c-check__input"
|
|
181
|
-
data-ouia-component-id="OUIA-Generated-Checkbox-8"
|
|
182
|
-
data-ouia-component-type="PF4/Checkbox"
|
|
183
|
-
data-ouia-safe="true"
|
|
184
|
-
id="check"
|
|
185
|
-
type="checkbox"
|
|
186
|
-
/>
|
|
187
|
-
<label
|
|
188
|
-
class="pf-c-check__label"
|
|
189
|
-
for="check"
|
|
190
|
-
>
|
|
191
|
-
label
|
|
192
|
-
</label>
|
|
193
|
-
</div>
|
|
194
|
-
</div>
|
|
195
|
-
`;
|
|
17
|
+
exports[`Checkbox passing class 1`] = `"<input id=\\"check\\" class=\\"pf-c-check__input\\" type=\\"checkbox\\" aria-invalid=\\"false\\" aria-label=\\"check\\" data-ouia-component-type=\\"PF4/Checkbox\\" data-ouia-safe=\\"true\\" data-ouia-component-id=\\"OUIA-Generated-Checkbox-8\\" checked=\\"\\">"`;
|
|
196
18
|
|
|
197
|
-
exports[`uncontrolled 1`] = `
|
|
198
|
-
<div>
|
|
199
|
-
<div
|
|
200
|
-
class="pf-c-check pf-m-standalone"
|
|
201
|
-
>
|
|
202
|
-
<input
|
|
203
|
-
aria-invalid="false"
|
|
204
|
-
aria-label="check"
|
|
205
|
-
class="pf-c-check__input"
|
|
206
|
-
data-ouia-component-id="OUIA-Generated-Checkbox-3"
|
|
207
|
-
data-ouia-component-type="PF4/Checkbox"
|
|
208
|
-
data-ouia-safe="true"
|
|
209
|
-
id="check"
|
|
210
|
-
type="checkbox"
|
|
211
|
-
/>
|
|
212
|
-
</div>
|
|
213
|
-
</div>
|
|
214
|
-
`;
|
|
19
|
+
exports[`Checkbox uncontrolled 1`] = `"<input id=\\"check\\" class=\\"pf-c-check__input\\" type=\\"checkbox\\" aria-invalid=\\"false\\" aria-label=\\"check\\" data-ouia-component-type=\\"PF4/Checkbox\\" data-ouia-safe=\\"true\\" data-ouia-component-id=\\"OUIA-Generated-Checkbox-3\\">"`;
|
|
@@ -11,167 +11,55 @@ import PlayIcon from '@patternfly/react-icons/dist/esm/icons/play-icon';
|
|
|
11
11
|
|
|
12
12
|
### Basic
|
|
13
13
|
|
|
14
|
-
```
|
|
15
|
-
import React from 'react';
|
|
16
|
-
import { ClipboardCopy } from '@patternfly/react-core';
|
|
17
|
-
|
|
18
|
-
<ClipboardCopy hoverTip="Copy" clickTip="Copied">This is editable</ClipboardCopy>;
|
|
14
|
+
```ts file="./ClipboardCopyBasic.tsx"
|
|
19
15
|
```
|
|
20
16
|
|
|
21
17
|
### Read Only
|
|
22
18
|
|
|
23
|
-
```
|
|
24
|
-
import React from 'react';
|
|
25
|
-
import { ClipboardCopy } from '@patternfly/react-core';
|
|
26
|
-
|
|
27
|
-
<ClipboardCopy isReadOnly hoverTip="Copy" clickTip="Copied">This is read-only</ClipboardCopy>;
|
|
19
|
+
```ts file="./ClipboardCopyReadOnly.tsx"
|
|
28
20
|
```
|
|
29
21
|
|
|
30
22
|
### Expanded
|
|
31
23
|
|
|
32
|
-
```
|
|
33
|
-
import React from 'react';
|
|
34
|
-
import { ClipboardCopy, ClipboardCopyVariant } from '@patternfly/react-core';
|
|
35
|
-
|
|
36
|
-
<ClipboardCopy hoverTip="Copy" clickTip="Copied" variant={ClipboardCopyVariant.expansion} >
|
|
37
|
-
Got a lot of text here, need to see all of it? Click that arrow on the left side and check out the resulting
|
|
38
|
-
expansion.
|
|
39
|
-
</ClipboardCopy>;
|
|
24
|
+
```ts file="./ClipboardCopyExpanded.tsx"
|
|
40
25
|
```
|
|
41
26
|
|
|
42
27
|
### Read only expanded
|
|
43
28
|
|
|
44
|
-
```
|
|
45
|
-
import React from 'react';
|
|
46
|
-
import { ClipboardCopy, ClipboardCopyVariant } from '@patternfly/react-core';
|
|
47
|
-
|
|
48
|
-
<ClipboardCopy isReadOnly hoverTip="Copy" clickTip="Copied" variant={ClipboardCopyVariant.expansion}>
|
|
49
|
-
Got a lot of text here, need to see all of it? Click that arrow on the left side and check out the resulting
|
|
50
|
-
expansion.
|
|
51
|
-
</ClipboardCopy>;
|
|
29
|
+
```ts file="./ClipboardCopyReadOnlyExpanded.tsx"
|
|
52
30
|
```
|
|
53
31
|
|
|
54
32
|
### Read only expanded by default
|
|
55
33
|
|
|
56
|
-
```
|
|
57
|
-
import React from 'react';
|
|
58
|
-
import { ClipboardCopy, ClipboardCopyVariant } from '@patternfly/react-core';
|
|
59
|
-
|
|
60
|
-
<ClipboardCopy isReadOnly isExpanded hoverTip="Copy" clickTip="Copied" variant={ClipboardCopyVariant.expansion}>
|
|
61
|
-
Got a lot of text here, need to see all of it? Click that arrow on the left side and check out the resulting
|
|
62
|
-
expansion.
|
|
63
|
-
</ClipboardCopy>;
|
|
34
|
+
```ts file="./ClipboardCopyReadOnlyExpandedByDefault.tsx"
|
|
64
35
|
```
|
|
65
36
|
|
|
66
37
|
### Expanded with array
|
|
67
38
|
|
|
68
|
-
```
|
|
69
|
-
import React from 'react';
|
|
70
|
-
import { ClipboardCopy, ClipboardCopyVariant } from '@patternfly/react-core';
|
|
71
|
-
|
|
72
|
-
ClipboardCopyArrayOfElements = () => {
|
|
73
|
-
let text = [
|
|
74
|
-
'Got a lot of text here,',
|
|
75
|
-
'need to see all of it?',
|
|
76
|
-
'Click that arrow on the left side and check out the resulting expansion.'
|
|
77
|
-
];
|
|
78
|
-
return <ClipboardCopy hoverTip="Copy" clickTip="Copied" variant={ClipboardCopyVariant.expansion}>{text.join(' ')}</ClipboardCopy>;
|
|
79
|
-
};
|
|
39
|
+
```ts file="./ClipboardCopyExpandedWithArray.tsx"
|
|
80
40
|
```
|
|
81
41
|
|
|
82
42
|
### JSON object (wrap code with pre)
|
|
83
43
|
|
|
84
|
-
```
|
|
85
|
-
import React from 'react';
|
|
86
|
-
import { ClipboardCopy, ClipboardCopyVariant } from '@patternfly/react-core';
|
|
87
|
-
|
|
88
|
-
<ClipboardCopy isCode hoverTip="Copy" clickTip="Copied" variant={ClipboardCopyVariant.expansion}>
|
|
89
|
-
{`{ "menu": {
|
|
90
|
-
"id": "file",
|
|
91
|
-
"value": "File",
|
|
92
|
-
"popup": {
|
|
93
|
-
"menuitem": [
|
|
94
|
-
{"value": "New", "onclick": "CreateNewDoc()"},
|
|
95
|
-
{"value": "Open", "onclick": "OpenDoc()"},
|
|
96
|
-
{"value": "Close", "onclick": "CloseDoc()"}
|
|
97
|
-
]
|
|
98
|
-
}
|
|
99
|
-
}} `}
|
|
100
|
-
</ClipboardCopy>;
|
|
44
|
+
```ts file="./ClipboardCopyJSONObject.tsx"
|
|
101
45
|
```
|
|
102
46
|
|
|
103
47
|
### Inline compact
|
|
104
48
|
|
|
105
|
-
```
|
|
106
|
-
import React from 'react';
|
|
107
|
-
import { ClipboardCopy } from '@patternfly/react-core';
|
|
108
|
-
|
|
109
|
-
<ClipboardCopy hoverTip="Copy" clickTip="Copied" variant="inline-compact">2.3.4-2-redhat</ClipboardCopy>;
|
|
49
|
+
```ts file="./ClipboardCopyInlineCompact.tsx"
|
|
110
50
|
```
|
|
111
51
|
|
|
112
52
|
### Inline compact code
|
|
113
53
|
|
|
114
|
-
```
|
|
115
|
-
import React from 'react';
|
|
116
|
-
import { ClipboardCopy } from '@patternfly/react-core';
|
|
117
|
-
|
|
118
|
-
<ClipboardCopy hoverTip="Copy" clickTip="Copied" variant="inline-compact" isCode>
|
|
119
|
-
2.3.4-2-redhat
|
|
120
|
-
</ClipboardCopy>;
|
|
54
|
+
```ts file="./ClipboardCopyInlineCompactCode.tsx"
|
|
121
55
|
```
|
|
122
56
|
|
|
123
57
|
### Inline compact with additional action
|
|
124
58
|
|
|
125
|
-
```
|
|
126
|
-
import React from 'react';
|
|
127
|
-
import { ClipboardCopy, ClipboardCopyAction, Button } from '@patternfly/react-core';
|
|
128
|
-
import PlayIcon from '@patternfly/react-icons/dist/esm/icons/play-icon';
|
|
129
|
-
|
|
130
|
-
<ClipboardCopy
|
|
131
|
-
hoverTip="Copy"
|
|
132
|
-
clickTip="Copied"
|
|
133
|
-
variant="inline-compact"
|
|
134
|
-
additionalActions={
|
|
135
|
-
<ClipboardCopyAction>
|
|
136
|
-
<Button variant="plain" aria-label="Run in web terminal">
|
|
137
|
-
<PlayIcon aria-hidden />
|
|
138
|
-
</Button>
|
|
139
|
-
</ClipboardCopyAction>
|
|
140
|
-
}
|
|
141
|
-
>
|
|
142
|
-
2.3.4-2-redhat
|
|
143
|
-
</ClipboardCopy>;
|
|
59
|
+
```ts file="./ClipboardCopyInlineCompactWithAdditionalAction.tsx"
|
|
144
60
|
```
|
|
145
61
|
|
|
146
62
|
### Inline compact in sentence
|
|
147
63
|
|
|
148
|
-
```
|
|
149
|
-
import React from 'react';
|
|
150
|
-
import { ClipboardCopy } from '@patternfly/react-core';
|
|
151
|
-
|
|
152
|
-
<React.Fragment>
|
|
153
|
-
<b>Basic</b>
|
|
154
|
-
<br />
|
|
155
|
-
Lorem ipsum {<ClipboardCopy hoverTip="Copy" clickTip="Copied" variant="inline-compact">2.3.4-2-redhat</ClipboardCopy>} dolor sit amet.
|
|
156
|
-
<br /> <br />
|
|
157
|
-
<b>Long copy string</b>
|
|
158
|
-
<br />
|
|
159
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit.{' '}
|
|
160
|
-
{
|
|
161
|
-
<ClipboardCopy hoverTip="Copy" clickTip="Copied" variant="inline-compact">
|
|
162
|
-
https://app.openshift.io/path/sub-path/sub-sub-path/?runtime=quarkus/12345678901234567890/abcdefghijklmnopqrstuvwxyz1234567890
|
|
163
|
-
</ClipboardCopy>
|
|
164
|
-
}{' '}
|
|
165
|
-
Mauris luctus, libero nec dapibus ultricies, urna purus pretium mauris, ullamcorper pharetra lacus nibh vitae enim.
|
|
166
|
-
<br /> <br />
|
|
167
|
-
<b>Long copy string in block</b>
|
|
168
|
-
<br />
|
|
169
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit.{' '}
|
|
170
|
-
{
|
|
171
|
-
<ClipboardCopy hoverTip="Copy" clickTip="Copied" variant="inline-compact" isBlock>
|
|
172
|
-
https://app.openshift.io/path/sub-path/sub-sub-path/?runtime=quarkus/12345678901234567890/abcdefghijklmnopqrstuvwxyz1234567890
|
|
173
|
-
</ClipboardCopy>
|
|
174
|
-
}{' '}
|
|
175
|
-
Mauris luctus, libero nec dapibus ultricies, urna purus pretium mauris, ullamcorper pharetra lacus nibh vitae enim.
|
|
176
|
-
</React.Fragment>;
|
|
64
|
+
```ts file="./ClipboardCopyInlineCompactInSentence.tsx"
|
|
177
65
|
```
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ClipboardCopy, ClipboardCopyVariant } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
export const ClipboardCopyExpanded: React.FunctionComponent = () => (
|
|
5
|
+
<ClipboardCopy hoverTip="Copy" clickTip="Copied" variant={ClipboardCopyVariant.expansion}>
|
|
6
|
+
Got a lot of text here, need to see all of it? Click that arrow on the left side and check out the resulting
|
|
7
|
+
expansion.
|
|
8
|
+
</ClipboardCopy>
|
|
9
|
+
);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ClipboardCopy, ClipboardCopyVariant } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
const text = [
|
|
5
|
+
'Got a lot of text here,',
|
|
6
|
+
'need to see all of it?',
|
|
7
|
+
'Click that arrow on the left side and check out the resulting expansion.'
|
|
8
|
+
];
|
|
9
|
+
|
|
10
|
+
export const ClipboardCopyExpandedWithArray: React.FunctionComponent = () => (
|
|
11
|
+
<ClipboardCopy hoverTip="Copy" clickTip="Copied" variant={ClipboardCopyVariant.expansion}>
|
|
12
|
+
{text.join(' ')}
|
|
13
|
+
</ClipboardCopy>
|
|
14
|
+
);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ClipboardCopy } from '@patternfly/react-core';
|
|
3
|
+
export const ClipboardCopyInlineCompact: React.FunctionComponent = () => (
|
|
4
|
+
<ClipboardCopy hoverTip="Copy" clickTip="Copied" variant="inline-compact">
|
|
5
|
+
2.3.4-2-redhat
|
|
6
|
+
</ClipboardCopy>
|
|
7
|
+
);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ClipboardCopy } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
export const ClipboardCopyInlineCompactCode: React.FunctionComponent = () => (
|
|
5
|
+
<ClipboardCopy hoverTip="Copy" clickTip="Copied" variant="inline-compact" isCode>
|
|
6
|
+
2.3.4-2-redhat
|
|
7
|
+
</ClipboardCopy>
|
|
8
|
+
);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ClipboardCopy } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
export const ClipboardCopyInlineCompactInSentence: React.FunctionComponent = () => (
|
|
5
|
+
<React.Fragment>
|
|
6
|
+
<b>Basic</b>
|
|
7
|
+
<br />
|
|
8
|
+
Lorem ipsum{' '}
|
|
9
|
+
{
|
|
10
|
+
<ClipboardCopy hoverTip="Copy" clickTip="Copied" variant="inline-compact">
|
|
11
|
+
2.3.4-2-redhat
|
|
12
|
+
</ClipboardCopy>
|
|
13
|
+
}
|
|
14
|
+
dolor sit amet.
|
|
15
|
+
<br /> <br />
|
|
16
|
+
<b>Long copy string</b>
|
|
17
|
+
<br />
|
|
18
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit.{' '}
|
|
19
|
+
{
|
|
20
|
+
<ClipboardCopy hoverTip="Copy" clickTip="Copied" variant="inline-compact">
|
|
21
|
+
https://app.openshift.io/path/sub-path/sub-sub-path/?runtime=quarkus/12345678901234567890/abcdefghijklmnopqrstuvwxyz1234567890
|
|
22
|
+
</ClipboardCopy>
|
|
23
|
+
}{' '}
|
|
24
|
+
Mauris luctus, libero nec dapibus ultricies, urna purus pretium mauris, ullamcorper pharetra lacus nibh vitae enim.
|
|
25
|
+
<br /> <br />
|
|
26
|
+
<b>Long copy string in block</b>
|
|
27
|
+
<br />
|
|
28
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit.{' '}
|
|
29
|
+
{
|
|
30
|
+
<ClipboardCopy hoverTip="Copy" clickTip="Copied" variant="inline-compact" isBlock>
|
|
31
|
+
https://app.openshift.io/path/sub-path/sub-sub-path/?runtime=quarkus/12345678901234567890/abcdefghijklmnopqrstuvwxyz1234567890
|
|
32
|
+
</ClipboardCopy>
|
|
33
|
+
}{' '}
|
|
34
|
+
Mauris luctus, libero nec dapibus ultricies, urna purus pretium mauris, ullamcorper pharetra lacus nibh vitae enim.
|
|
35
|
+
</React.Fragment>
|
|
36
|
+
);
|