@patternfly/react-core 4.165.0 → 4.168.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 +145 -0
- package/README.md +1 -1
- package/dist/esm/components/Dropdown/DropdownToggle.d.ts +1 -1
- package/dist/esm/components/Dropdown/DropdownToggle.d.ts.map +1 -1
- package/dist/esm/components/Dropdown/KebabToggle.d.ts +1 -1
- package/dist/esm/components/Dropdown/KebabToggle.d.ts.map +1 -1
- package/dist/esm/components/DualListSelector/DualListSelector.d.ts +1 -0
- package/dist/esm/components/DualListSelector/DualListSelector.d.ts.map +1 -1
- package/dist/esm/components/DualListSelector/DualListSelector.js +23 -10
- package/dist/esm/components/DualListSelector/DualListSelector.js.map +1 -1
- package/dist/esm/components/Select/SelectOption.d.ts +1 -1
- package/dist/esm/components/Select/SelectOption.d.ts.map +1 -1
- package/dist/esm/components/Tabs/TabContentBody.d.ts +11 -0
- package/dist/esm/components/Tabs/TabContentBody.d.ts.map +1 -0
- package/dist/esm/components/Tabs/TabContentBody.js +10 -0
- package/dist/esm/components/Tabs/TabContentBody.js.map +1 -0
- package/dist/esm/components/Tabs/index.d.ts +1 -0
- package/dist/esm/components/Tabs/index.d.ts.map +1 -1
- package/dist/esm/components/Tabs/index.js +1 -0
- package/dist/esm/components/Tabs/index.js.map +1 -1
- package/dist/esm/components/TextInputGroup/TextInputGroup.d.ts +9 -0
- package/dist/esm/components/TextInputGroup/TextInputGroup.d.ts.map +1 -0
- package/dist/esm/components/TextInputGroup/TextInputGroup.js +10 -0
- package/dist/esm/components/TextInputGroup/TextInputGroup.js.map +1 -0
- package/dist/esm/components/TextInputGroup/TextInputGroupMain.d.ts +15 -0
- package/dist/esm/components/TextInputGroup/TextInputGroupMain.d.ts.map +1 -0
- package/dist/esm/components/TextInputGroup/TextInputGroupMain.js +15 -0
- package/dist/esm/components/TextInputGroup/TextInputGroupMain.js.map +1 -0
- package/dist/esm/components/TextInputGroup/TextInputGroupUtilities.d.ts +9 -0
- package/dist/esm/components/TextInputGroup/TextInputGroupUtilities.d.ts.map +1 -0
- package/dist/esm/components/TextInputGroup/TextInputGroupUtilities.js +10 -0
- package/dist/esm/components/TextInputGroup/TextInputGroupUtilities.js.map +1 -0
- package/dist/esm/components/TextInputGroup/index.d.ts +4 -0
- package/dist/esm/components/TextInputGroup/index.d.ts.map +1 -0
- package/dist/esm/components/TextInputGroup/index.js +4 -0
- package/dist/esm/components/TextInputGroup/index.js.map +1 -0
- package/dist/esm/components/Toolbar/Toolbar.d.ts +2 -0
- package/dist/esm/components/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/esm/components/Toolbar/Toolbar.js +2 -2
- package/dist/esm/components/Toolbar/Toolbar.js.map +1 -1
- package/dist/esm/components/index.d.ts +1 -0
- package/dist/esm/components/index.d.ts.map +1 -1
- package/dist/esm/components/index.js +1 -0
- package/dist/esm/components/index.js.map +1 -1
- package/dist/js/components/Dropdown/DropdownToggle.d.ts +1 -1
- package/dist/js/components/Dropdown/DropdownToggle.d.ts.map +1 -1
- package/dist/js/components/Dropdown/KebabToggle.d.ts +1 -1
- package/dist/js/components/Dropdown/KebabToggle.d.ts.map +1 -1
- package/dist/js/components/DualListSelector/DualListSelector.d.ts +1 -0
- package/dist/js/components/DualListSelector/DualListSelector.d.ts.map +1 -1
- package/dist/js/components/DualListSelector/DualListSelector.js +23 -10
- package/dist/js/components/DualListSelector/DualListSelector.js.map +1 -1
- package/dist/js/components/Select/SelectOption.d.ts +1 -1
- package/dist/js/components/Select/SelectOption.d.ts.map +1 -1
- package/dist/js/components/Tabs/TabContentBody.d.ts +11 -0
- package/dist/js/components/Tabs/TabContentBody.d.ts.map +1 -0
- package/dist/js/components/Tabs/TabContentBody.js +14 -0
- package/dist/js/components/Tabs/TabContentBody.js.map +1 -0
- package/dist/js/components/Tabs/index.d.ts +1 -0
- package/dist/js/components/Tabs/index.d.ts.map +1 -1
- package/dist/js/components/Tabs/index.js +1 -0
- package/dist/js/components/Tabs/index.js.map +1 -1
- package/dist/js/components/TextInputGroup/TextInputGroup.d.ts +9 -0
- package/dist/js/components/TextInputGroup/TextInputGroup.d.ts.map +1 -0
- package/dist/js/components/TextInputGroup/TextInputGroup.js +14 -0
- package/dist/js/components/TextInputGroup/TextInputGroup.js.map +1 -0
- package/dist/js/components/TextInputGroup/TextInputGroupMain.d.ts +15 -0
- package/dist/js/components/TextInputGroup/TextInputGroupMain.d.ts.map +1 -0
- package/dist/js/components/TextInputGroup/TextInputGroupMain.js +19 -0
- package/dist/js/components/TextInputGroup/TextInputGroupMain.js.map +1 -0
- package/dist/js/components/TextInputGroup/TextInputGroupUtilities.d.ts +9 -0
- package/dist/js/components/TextInputGroup/TextInputGroupUtilities.d.ts.map +1 -0
- package/dist/js/components/TextInputGroup/TextInputGroupUtilities.js +14 -0
- package/dist/js/components/TextInputGroup/TextInputGroupUtilities.js.map +1 -0
- package/dist/js/components/TextInputGroup/index.d.ts +4 -0
- package/dist/js/components/TextInputGroup/index.d.ts.map +1 -0
- package/dist/js/components/TextInputGroup/index.js +7 -0
- package/dist/js/components/TextInputGroup/index.js.map +1 -0
- package/dist/js/components/Toolbar/Toolbar.d.ts +2 -0
- package/dist/js/components/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/js/components/Toolbar/Toolbar.js +2 -2
- package/dist/js/components/Toolbar/Toolbar.js.map +1 -1
- package/dist/js/components/index.d.ts +1 -0
- package/dist/js/components/index.d.ts.map +1 -1
- package/dist/js/components/index.js +1 -0
- package/dist/js/components/index.js.map +1 -1
- package/dist/styles/assets/pficon/pficon.woff +0 -0
- package/dist/styles/assets/pficon/pficon.woff2 +0 -0
- package/dist/umd/react-core.css +360 -17
- package/dist/umd/react-core.js +959 -884
- package/dist/umd/react-core.min.css +360 -17
- package/dist/umd/react-core.min.js +3 -3
- package/package.json +6 -6
- package/src/components/Dropdown/DropdownToggle.tsx +1 -1
- package/src/components/Dropdown/KebabToggle.tsx +1 -1
- package/src/components/DualListSelector/DualListSelector.tsx +25 -23
- package/src/components/Modal/__tests__/ModalBox.test.tsx +11 -21
- package/src/components/Modal/__tests__/ModalBoxDescription.test.tsx +12 -0
- package/src/components/Modal/__tests__/ModalBoxTitle.test.tsx +59 -0
- package/src/components/Modal/__tests__/ModalContent.test.tsx +15 -10
- package/src/components/Modal/__tests__/__snapshots__/ModalBox.test.tsx.snap +12 -30
- package/src/components/Modal/__tests__/__snapshots__/ModalBoxDescription.test.tsx.snap +10 -0
- package/src/components/Modal/__tests__/__snapshots__/ModalBoxTitle.test.tsx.snap +158 -0
- package/src/components/Modal/__tests__/__snapshots__/ModalContent.test.tsx.snap +53 -22
- package/src/components/Select/SelectOption.tsx +1 -1
- package/src/components/Tabs/TabContentBody.tsx +24 -0
- package/src/components/Tabs/__tests__/Tabs.test.tsx +4 -3
- package/src/components/Tabs/__tests__/__snapshots__/Tabs.test.tsx.snap +10 -2
- package/src/components/Tabs/examples/Tabs.md +40 -0
- package/src/components/Tabs/index.ts +1 -0
- package/src/components/TextInputGroup/TextInputGroup.tsx +22 -0
- package/src/components/TextInputGroup/TextInputGroupMain.tsx +43 -0
- package/src/components/TextInputGroup/TextInputGroupUtilities.tsx +22 -0
- package/src/components/TextInputGroup/__tests__/TextInputGroup.test.tsx +77 -0
- package/src/components/TextInputGroup/__tests__/__snapshots__/TextInputGroup.test.tsx.snap +211 -0
- package/src/components/TextInputGroup/examples/TextInputGroup.md +138 -0
- package/src/components/TextInputGroup/index.ts +3 -0
- package/src/components/Toolbar/Toolbar.tsx +4 -0
- package/src/components/Wizard/examples/Wizard.md +17 -1
- package/src/components/index.ts +1 -0
- package/src/demos/ProgressDemo.md +82 -0
- package/src/demos/Tabs.md +439 -0
- package/src/demos/examples/DashboardWrapper.js +16 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.168.5",
|
|
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",
|
|
@@ -34,16 +34,16 @@
|
|
|
34
34
|
"generate": "node scripts/copyStyles.js"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@patternfly/react-icons": "^4.
|
|
38
|
-
"@patternfly/react-styles": "^4.
|
|
39
|
-
"@patternfly/react-tokens": "^4.
|
|
37
|
+
"@patternfly/react-icons": "^4.19.5",
|
|
38
|
+
"@patternfly/react-styles": "^4.18.5",
|
|
39
|
+
"@patternfly/react-tokens": "^4.20.5",
|
|
40
40
|
"focus-trap": "6.2.2",
|
|
41
41
|
"react-dropzone": "9.0.0",
|
|
42
42
|
"tippy.js": "5.1.2",
|
|
43
43
|
"tslib": "^2.0.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@patternfly/patternfly": "4.
|
|
46
|
+
"@patternfly/patternfly": "4.151.3",
|
|
47
47
|
"@rollup/plugin-commonjs": "^21.0.0",
|
|
48
48
|
"@rollup/plugin-node-resolve": "^13.0.0",
|
|
49
49
|
"@rollup/plugin-replace": "^3.0.0",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"react": "^16.8.0 || ^17.0.0",
|
|
61
61
|
"react-dom": "^16.8.0 || ^17.0.0"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "bfa2559a2e6b08c70f35d40f3917205696603548"
|
|
64
64
|
}
|
|
@@ -16,7 +16,7 @@ export interface DropdownToggleProps extends React.HTMLProps<HTMLButtonElement>,
|
|
|
16
16
|
/** Flag to indicate if menu is opened */
|
|
17
17
|
isOpen?: boolean;
|
|
18
18
|
/** Callback called when toggle is clicked */
|
|
19
|
-
onToggle?: (
|
|
19
|
+
onToggle?: (value: boolean, event: any) => void;
|
|
20
20
|
/** Element which wraps toggle */
|
|
21
21
|
parentRef?: HTMLElement;
|
|
22
22
|
/** The menu element */
|
|
@@ -15,7 +15,7 @@ export interface KebabToggleProps extends DropdownToggleProps {
|
|
|
15
15
|
/** Label Toggle button */
|
|
16
16
|
'aria-label'?: string;
|
|
17
17
|
/** Callback called when toggle is clicked */
|
|
18
|
-
onToggle?: (
|
|
18
|
+
onToggle?: (value: boolean, event: any) => void;
|
|
19
19
|
/** Element which wraps toggle */
|
|
20
20
|
parentRef?: any;
|
|
21
21
|
/** The menu element */
|
|
@@ -149,8 +149,27 @@ export class DualListSelector extends React.Component<DualListSelectorProps, Dua
|
|
|
149
149
|
isTree: false,
|
|
150
150
|
isDisabled: false
|
|
151
151
|
};
|
|
152
|
-
private originalAvailableCopy = this.props.availableOptions;
|
|
153
|
-
private originalChosenCopy = this.props.chosenOptions;
|
|
152
|
+
private originalAvailableCopy = JSON.parse(JSON.stringify(this.props.availableOptions));
|
|
153
|
+
private originalChosenCopy = JSON.parse(JSON.stringify(this.props.chosenOptions));
|
|
154
|
+
|
|
155
|
+
// If the DualListSelector uses trees, concat the two initial arrays and merge duplicate folder IDs
|
|
156
|
+
private mergedCopy = this.props.isTree
|
|
157
|
+
? Object.values(
|
|
158
|
+
(this.originalAvailableCopy as DualListSelectorTreeItemData[])
|
|
159
|
+
.concat(this.originalChosenCopy as DualListSelectorTreeItemData[])
|
|
160
|
+
.reduce((mapObj: any, item: DualListSelectorTreeItemData) => {
|
|
161
|
+
const key = item.id;
|
|
162
|
+
if (mapObj[key]) {
|
|
163
|
+
// If map already has an item ID, add the dupe ID's children to the existing map
|
|
164
|
+
mapObj[key].children.push(...item.children);
|
|
165
|
+
} else {
|
|
166
|
+
// Else clone the item data
|
|
167
|
+
mapObj[key] = { ...item };
|
|
168
|
+
}
|
|
169
|
+
return mapObj;
|
|
170
|
+
}, {})
|
|
171
|
+
)
|
|
172
|
+
: null;
|
|
154
173
|
|
|
155
174
|
constructor(props: DualListSelectorProps) {
|
|
156
175
|
super(props);
|
|
@@ -250,18 +269,13 @@ export class DualListSelector extends React.Component<DualListSelectorProps, Dua
|
|
|
250
269
|
const movedOptions =
|
|
251
270
|
prevState.availableTreeFilteredOptions ||
|
|
252
271
|
flattenTreeWithFolders(prevState.availableOptions as DualListSelectorTreeItemData[]);
|
|
253
|
-
|
|
254
272
|
const newAvailable = prevState.availableOptions
|
|
255
273
|
.map(opt => Object.assign({}, opt))
|
|
256
274
|
.filter(item => filterRestTreeItems(item as DualListSelectorTreeItemData, movedOptions));
|
|
257
275
|
|
|
258
276
|
const currChosen = flattenTree(prevState.chosenOptions as DualListSelectorTreeItemData[]);
|
|
259
277
|
const nextChosenOptions = currChosen.concat(movedOptions);
|
|
260
|
-
|
|
261
|
-
const allOptions = (this.originalAvailableCopy as DualListSelectorTreeItemData[]).concat(
|
|
262
|
-
this.originalChosenCopy as DualListSelectorTreeItemData[]
|
|
263
|
-
);
|
|
264
|
-
const newChosen = allOptions
|
|
278
|
+
const newChosen = this.mergedCopy
|
|
265
279
|
.map(opt => Object.assign({}, opt))
|
|
266
280
|
.filter(item => filterTreeItemsWithoutFolders(item as DualListSelectorTreeItemData, nextChosenOptions));
|
|
267
281
|
|
|
@@ -316,10 +330,7 @@ export class DualListSelector extends React.Component<DualListSelectorProps, Dua
|
|
|
316
330
|
// Get next chosen options from current + new nodes and remap from base
|
|
317
331
|
const currChosen = flattenTree(prevState.chosenOptions as DualListSelectorTreeItemData[]);
|
|
318
332
|
const nextChosenOptions = currChosen.concat(prevState.availableTreeOptionsChecked);
|
|
319
|
-
const
|
|
320
|
-
this.originalChosenCopy as DualListSelectorTreeItemData[]
|
|
321
|
-
);
|
|
322
|
-
const newChosen = allOptions
|
|
333
|
+
const newChosen = this.mergedCopy
|
|
323
334
|
.map(opt => Object.assign({}, opt))
|
|
324
335
|
.filter(item => filterTreeItemsWithoutFolders(item as DualListSelectorTreeItemData, nextChosenOptions));
|
|
325
336
|
|
|
@@ -372,11 +383,7 @@ export class DualListSelector extends React.Component<DualListSelectorProps, Dua
|
|
|
372
383
|
.filter(item => filterRestTreeItems(item as DualListSelectorTreeItemData, movedOptions));
|
|
373
384
|
const currAvailable = flattenTree(prevState.availableOptions as DualListSelectorTreeItemData[]);
|
|
374
385
|
const nextAvailableOptions = currAvailable.concat(movedOptions);
|
|
375
|
-
|
|
376
|
-
const allOptions = (this.originalAvailableCopy as DualListSelectorTreeItemData[]).concat(
|
|
377
|
-
this.originalChosenCopy as DualListSelectorTreeItemData[]
|
|
378
|
-
);
|
|
379
|
-
const newAvailable = allOptions
|
|
386
|
+
const newAvailable = this.mergedCopy
|
|
380
387
|
.map(opt => Object.assign({}, opt))
|
|
381
388
|
.filter(item => filterTreeItemsWithoutFolders(item as DualListSelectorTreeItemData, nextAvailableOptions));
|
|
382
389
|
|
|
@@ -427,11 +434,7 @@ export class DualListSelector extends React.Component<DualListSelectorProps, Dua
|
|
|
427
434
|
// Get next chosen options from current and remap from base
|
|
428
435
|
const currAvailable = flattenTree(prevState.availableOptions as DualListSelectorTreeItemData[]);
|
|
429
436
|
const nextAvailableOptions = currAvailable.concat(prevState.chosenTreeOptionsChecked);
|
|
430
|
-
|
|
431
|
-
const allOptions = (this.originalAvailableCopy as DualListSelectorTreeItemData[]).concat(
|
|
432
|
-
this.originalChosenCopy as DualListSelectorTreeItemData[]
|
|
433
|
-
);
|
|
434
|
-
const newAvailable = allOptions
|
|
437
|
+
const newAvailable = this.mergedCopy
|
|
435
438
|
.map(opt => Object.assign({}, opt))
|
|
436
439
|
.filter(item => filterTreeItemsWithoutFolders(item as DualListSelectorTreeItemData, nextAvailableOptions));
|
|
437
440
|
|
|
@@ -616,7 +619,6 @@ export class DualListSelector extends React.Component<DualListSelectorProps, Dua
|
|
|
616
619
|
chosenTreeOptionsChecked,
|
|
617
620
|
availableTreeOptionsChecked
|
|
618
621
|
} = this.state;
|
|
619
|
-
|
|
620
622
|
const availableOptionsStatusToDisplay =
|
|
621
623
|
availableOptionsStatus ||
|
|
622
624
|
(isTree
|
|
@@ -2,65 +2,55 @@ import * as React from 'react';
|
|
|
2
2
|
import { shallow } from 'enzyme';
|
|
3
3
|
|
|
4
4
|
import { ModalBox } from '../ModalBox';
|
|
5
|
-
import BullhornIcon from '@patternfly/react-icons/dist/esm/icons/bullhorn-icon';
|
|
6
5
|
|
|
7
6
|
test('ModalBox Test', () => {
|
|
8
7
|
const view = shallow(
|
|
9
|
-
<ModalBox
|
|
8
|
+
<ModalBox aria-describedby="Test Modal Box" id="boxId">
|
|
10
9
|
This is a ModalBox
|
|
11
10
|
</ModalBox>
|
|
12
11
|
);
|
|
13
12
|
expect(view).toMatchSnapshot();
|
|
14
13
|
});
|
|
15
14
|
|
|
16
|
-
test('ModalBox Test
|
|
15
|
+
test('ModalBox Test large', () => {
|
|
17
16
|
const view = shallow(
|
|
18
|
-
<ModalBox
|
|
17
|
+
<ModalBox aria-describedby="Test Modal Box" id="boxId" variant="large">
|
|
19
18
|
This is a ModalBox
|
|
20
19
|
</ModalBox>
|
|
21
20
|
);
|
|
22
21
|
expect(view).toMatchSnapshot();
|
|
23
22
|
});
|
|
24
23
|
|
|
25
|
-
test('ModalBox Test
|
|
24
|
+
test('ModalBox Test medium', () => {
|
|
26
25
|
const view = shallow(
|
|
27
|
-
<ModalBox
|
|
26
|
+
<ModalBox aria-describedby="Test Modal Box" id="boxId" variant="medium">
|
|
28
27
|
This is a ModalBox
|
|
29
28
|
</ModalBox>
|
|
30
29
|
);
|
|
31
30
|
expect(view).toMatchSnapshot();
|
|
32
31
|
});
|
|
33
32
|
|
|
34
|
-
test('ModalBox Test
|
|
33
|
+
test('ModalBox Test small', () => {
|
|
35
34
|
const view = shallow(
|
|
36
|
-
<ModalBox
|
|
35
|
+
<ModalBox aria-describedby="Test Modal Box" id="boxId" variant="small">
|
|
37
36
|
This is a ModalBox
|
|
38
37
|
</ModalBox>
|
|
39
38
|
);
|
|
40
39
|
expect(view).toMatchSnapshot();
|
|
41
40
|
});
|
|
42
41
|
|
|
43
|
-
test('ModalBox Test top aligned
|
|
44
|
-
const view = shallow(
|
|
45
|
-
<ModalBox title="Test Modal Box" id="boxId" position="top" positionOffset="50px">
|
|
46
|
-
This is a ModalBox
|
|
47
|
-
</ModalBox>
|
|
48
|
-
);
|
|
49
|
-
expect(view).toMatchSnapshot();
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
test('ModalBox Test alert variant', () => {
|
|
42
|
+
test('ModalBox Test top aligned', () => {
|
|
53
43
|
const view = shallow(
|
|
54
|
-
<ModalBox
|
|
44
|
+
<ModalBox aria-describedby="Test Modal Box" id="boxId" position="top">
|
|
55
45
|
This is a ModalBox
|
|
56
46
|
</ModalBox>
|
|
57
47
|
);
|
|
58
48
|
expect(view).toMatchSnapshot();
|
|
59
49
|
});
|
|
60
50
|
|
|
61
|
-
test('ModalBox Test
|
|
51
|
+
test('ModalBox Test top aligned distance', () => {
|
|
62
52
|
const view = shallow(
|
|
63
|
-
<ModalBox
|
|
53
|
+
<ModalBox aria-describedby="Test Modal Box" id="boxId" position="top" positionOffset="50px">
|
|
64
54
|
This is a ModalBox
|
|
65
55
|
</ModalBox>
|
|
66
56
|
);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { shallow } from 'enzyme';
|
|
3
|
+
import { ModalBoxDescription } from '../ModalBoxDescription';
|
|
4
|
+
|
|
5
|
+
test('ModalBoxDescription Test', () => {
|
|
6
|
+
const view = shallow(
|
|
7
|
+
<ModalBoxDescription>
|
|
8
|
+
This is a ModalBox Description
|
|
9
|
+
</ModalBoxDescription>
|
|
10
|
+
);
|
|
11
|
+
expect(view).toMatchSnapshot();
|
|
12
|
+
});
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { shallow } from 'enzyme';
|
|
3
|
+
|
|
4
|
+
import { ModalBoxTitle } from '../ModalBoxTitle';
|
|
5
|
+
import BullhornIcon from '@patternfly/react-icons/dist/esm/icons/bullhorn-icon';
|
|
6
|
+
|
|
7
|
+
test('ModalBoxTitle alert variant', () => {
|
|
8
|
+
const view = shallow(
|
|
9
|
+
<ModalBoxTitle title="Test Modal Box warning" id="boxId" titleIconVariant="warning">
|
|
10
|
+
content
|
|
11
|
+
</ModalBoxTitle>
|
|
12
|
+
);
|
|
13
|
+
expect(view).toMatchSnapshot();
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
test('ModalBoxTitle info variant', () => {
|
|
17
|
+
const view = shallow(
|
|
18
|
+
<ModalBoxTitle title="Test Modal Box info" id="boxId" titleIconVariant="info">
|
|
19
|
+
content
|
|
20
|
+
</ModalBoxTitle>
|
|
21
|
+
);
|
|
22
|
+
expect(view).toMatchSnapshot();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
test('ModalBoxTitle danger variant', () => {
|
|
26
|
+
const view = shallow(
|
|
27
|
+
<ModalBoxTitle title="Test Modal Box danger" id="boxId" titleIconVariant="danger">
|
|
28
|
+
content
|
|
29
|
+
</ModalBoxTitle>
|
|
30
|
+
);
|
|
31
|
+
expect(view).toMatchSnapshot();
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
test('ModalBoxTitle default variant', () => {
|
|
35
|
+
const view = shallow(
|
|
36
|
+
<ModalBoxTitle title="Test Modal Box warning" id="boxId" titleIconVariant="default">
|
|
37
|
+
content
|
|
38
|
+
</ModalBoxTitle>
|
|
39
|
+
);
|
|
40
|
+
expect(view).toMatchSnapshot();
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
test('ModalBoxTitle success variant', () => {
|
|
44
|
+
const view = shallow(
|
|
45
|
+
<ModalBoxTitle title="Test Modal Box success" id="boxId" titleIconVariant="success">
|
|
46
|
+
content
|
|
47
|
+
</ModalBoxTitle>
|
|
48
|
+
);
|
|
49
|
+
expect(view).toMatchSnapshot();
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
test('ModalBoxTitle custom icon variant', () => {
|
|
53
|
+
const view = shallow(
|
|
54
|
+
<ModalBoxTitle title="Test Modal Box custom" id="boxId" titleIconVariant={BullhornIcon}>
|
|
55
|
+
content
|
|
56
|
+
</ModalBoxTitle>
|
|
57
|
+
);
|
|
58
|
+
expect(view).toMatchSnapshot();
|
|
59
|
+
});
|
|
@@ -3,9 +3,14 @@ import { shallow } from 'enzyme';
|
|
|
3
3
|
|
|
4
4
|
import { ModalContent } from '../ModalContent';
|
|
5
5
|
|
|
6
|
+
const modalContentProps = {
|
|
7
|
+
boxId: "boxId",
|
|
8
|
+
labelId: "labelId",
|
|
9
|
+
descriptorId: "descriptorId"
|
|
10
|
+
}
|
|
6
11
|
test('Modal Content Test only body', () => {
|
|
7
12
|
const view = shallow(
|
|
8
|
-
<ModalContent title="Test Modal Content title"
|
|
13
|
+
<ModalContent title="Test Modal Content title" isOpen {...modalContentProps}>
|
|
9
14
|
This is a ModalBox header
|
|
10
15
|
</ModalContent>
|
|
11
16
|
);
|
|
@@ -14,7 +19,7 @@ test('Modal Content Test only body', () => {
|
|
|
14
19
|
|
|
15
20
|
test('Modal Content Test isOpen', () => {
|
|
16
21
|
const view = shallow(
|
|
17
|
-
<ModalContent title="Test Modal Content title"
|
|
22
|
+
<ModalContent title="Test Modal Content title" isOpen {...modalContentProps}>
|
|
18
23
|
This is a ModalBox header
|
|
19
24
|
</ModalContent>
|
|
20
25
|
);
|
|
@@ -23,7 +28,7 @@ test('Modal Content Test isOpen', () => {
|
|
|
23
28
|
|
|
24
29
|
test('Modal Content Test description', () => {
|
|
25
30
|
const view = shallow(
|
|
26
|
-
<ModalContent title="Test Modal Content title"
|
|
31
|
+
<ModalContent title="Test Modal Content title" isOpen description="This is a test description." {...modalContentProps}>
|
|
27
32
|
This is a ModalBox header
|
|
28
33
|
</ModalContent>
|
|
29
34
|
);
|
|
@@ -32,7 +37,7 @@ test('Modal Content Test description', () => {
|
|
|
32
37
|
|
|
33
38
|
test('Modal Content Test with footer', () => {
|
|
34
39
|
const view = shallow(
|
|
35
|
-
<ModalContent title="Test Modal Content title"
|
|
40
|
+
<ModalContent title="Test Modal Content title" isOpen actions={['Testing']} {...modalContentProps}>
|
|
36
41
|
This is a ModalBox header
|
|
37
42
|
</ModalContent>
|
|
38
43
|
);
|
|
@@ -41,7 +46,7 @@ test('Modal Content Test with footer', () => {
|
|
|
41
46
|
|
|
42
47
|
test('Modal Content test without footer', () => {
|
|
43
48
|
const view = shallow(
|
|
44
|
-
<ModalContent title="Test Modal Content title"
|
|
49
|
+
<ModalContent title="Test Modal Content title" isOpen {...modalContentProps}>
|
|
45
50
|
This is a ModalBox header
|
|
46
51
|
</ModalContent>
|
|
47
52
|
);
|
|
@@ -53,10 +58,10 @@ test('Modal Content Test with onclose', () => {
|
|
|
53
58
|
<ModalContent
|
|
54
59
|
title="Test Modal Content title"
|
|
55
60
|
actions={['Testing footer']}
|
|
56
|
-
|
|
61
|
+
variant="large"
|
|
57
62
|
onClose={() => undefined}
|
|
58
|
-
id="id"
|
|
59
63
|
isOpen
|
|
64
|
+
{...modalContentProps}
|
|
60
65
|
>
|
|
61
66
|
This is a ModalBox header
|
|
62
67
|
</ModalContent>
|
|
@@ -72,10 +77,10 @@ test('Modal Test with custom header', () => {
|
|
|
72
77
|
header={header}
|
|
73
78
|
title="test-custom-header-modal"
|
|
74
79
|
actions={['Testing footer']}
|
|
75
|
-
|
|
80
|
+
variant="large"
|
|
76
81
|
onClose={() => undefined}
|
|
77
|
-
id="id"
|
|
78
82
|
isOpen
|
|
83
|
+
{...modalContentProps}
|
|
79
84
|
>
|
|
80
85
|
This is a ModalBox header
|
|
81
86
|
</ModalContent>
|
|
@@ -87,7 +92,7 @@ test('Modal Test with custom footer', () => {
|
|
|
87
92
|
const footer = <span id="test-custom-footer">TEST</span>;
|
|
88
93
|
|
|
89
94
|
const view = shallow(
|
|
90
|
-
<ModalContent footer={footer} title="Test Modal Custom Footer"
|
|
95
|
+
<ModalContent footer={footer} title="Test Modal Custom Footer" variant="large" onClose={() => undefined} isOpen {...modalContentProps}>
|
|
91
96
|
This is a ModalBox header
|
|
92
97
|
</ModalContent>
|
|
93
98
|
);
|
|
@@ -2,73 +2,55 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`ModalBox Test 1`] = `
|
|
4
4
|
<div
|
|
5
|
+
aria-describedby="Test Modal Box"
|
|
5
6
|
aria-label={null}
|
|
6
7
|
aria-labelledby={null}
|
|
7
8
|
aria-modal="true"
|
|
8
9
|
className="pf-c-modal-box"
|
|
9
10
|
id="boxId"
|
|
10
11
|
role="dialog"
|
|
11
|
-
title="Test Modal Box"
|
|
12
12
|
>
|
|
13
13
|
This is a ModalBox
|
|
14
14
|
</div>
|
|
15
15
|
`;
|
|
16
16
|
|
|
17
|
-
exports[`ModalBox Test
|
|
17
|
+
exports[`ModalBox Test large 1`] = `
|
|
18
18
|
<div
|
|
19
|
+
aria-describedby="Test Modal Box"
|
|
19
20
|
aria-label={null}
|
|
20
21
|
aria-labelledby={null}
|
|
21
22
|
aria-modal="true"
|
|
22
|
-
className="pf-c-modal-box"
|
|
23
|
+
className="pf-c-modal-box pf-m-lg"
|
|
23
24
|
id="boxId"
|
|
24
25
|
role="dialog"
|
|
25
|
-
title="Test Modal Box"
|
|
26
|
-
titleIconVariant="warning"
|
|
27
26
|
>
|
|
28
27
|
This is a ModalBox
|
|
29
28
|
</div>
|
|
30
29
|
`;
|
|
31
30
|
|
|
32
|
-
exports[`ModalBox Test
|
|
31
|
+
exports[`ModalBox Test medium 1`] = `
|
|
33
32
|
<div
|
|
33
|
+
aria-describedby="Test Modal Box"
|
|
34
34
|
aria-label={null}
|
|
35
35
|
aria-labelledby={null}
|
|
36
36
|
aria-modal="true"
|
|
37
|
-
className="pf-c-modal-box"
|
|
37
|
+
className="pf-c-modal-box pf-m-md"
|
|
38
38
|
id="boxId"
|
|
39
39
|
role="dialog"
|
|
40
|
-
title="Test Modal Box"
|
|
41
|
-
titleIconVariant={[Function]}
|
|
42
40
|
>
|
|
43
41
|
This is a ModalBox
|
|
44
42
|
</div>
|
|
45
43
|
`;
|
|
46
44
|
|
|
47
|
-
exports[`ModalBox Test
|
|
45
|
+
exports[`ModalBox Test small 1`] = `
|
|
48
46
|
<div
|
|
47
|
+
aria-describedby="Test Modal Box"
|
|
49
48
|
aria-label={null}
|
|
50
49
|
aria-labelledby={null}
|
|
51
50
|
aria-modal="true"
|
|
52
|
-
className="pf-c-modal-box"
|
|
53
|
-
id="boxId"
|
|
54
|
-
isLarge={true}
|
|
55
|
-
role="dialog"
|
|
56
|
-
title="Test Modal Box"
|
|
57
|
-
>
|
|
58
|
-
This is a ModalBox
|
|
59
|
-
</div>
|
|
60
|
-
`;
|
|
61
|
-
|
|
62
|
-
exports[`ModalBox Test isSmall 1`] = `
|
|
63
|
-
<div
|
|
64
|
-
aria-label={null}
|
|
65
|
-
aria-labelledby={null}
|
|
66
|
-
aria-modal="true"
|
|
67
|
-
className="pf-c-modal-box"
|
|
51
|
+
className="pf-c-modal-box pf-m-sm"
|
|
68
52
|
id="boxId"
|
|
69
|
-
isSmall={true}
|
|
70
53
|
role="dialog"
|
|
71
|
-
title="Test Modal Box"
|
|
72
54
|
>
|
|
73
55
|
This is a ModalBox
|
|
74
56
|
</div>
|
|
@@ -76,13 +58,13 @@ exports[`ModalBox Test isSmall 1`] = `
|
|
|
76
58
|
|
|
77
59
|
exports[`ModalBox Test top aligned 1`] = `
|
|
78
60
|
<div
|
|
61
|
+
aria-describedby="Test Modal Box"
|
|
79
62
|
aria-label={null}
|
|
80
63
|
aria-labelledby={null}
|
|
81
64
|
aria-modal="true"
|
|
82
65
|
className="pf-c-modal-box pf-m-align-top"
|
|
83
66
|
id="boxId"
|
|
84
67
|
role="dialog"
|
|
85
|
-
title="Test Modal Box"
|
|
86
68
|
>
|
|
87
69
|
This is a ModalBox
|
|
88
70
|
</div>
|
|
@@ -90,6 +72,7 @@ exports[`ModalBox Test top aligned 1`] = `
|
|
|
90
72
|
|
|
91
73
|
exports[`ModalBox Test top aligned distance 1`] = `
|
|
92
74
|
<div
|
|
75
|
+
aria-describedby="Test Modal Box"
|
|
93
76
|
aria-label={null}
|
|
94
77
|
aria-labelledby={null}
|
|
95
78
|
aria-modal="true"
|
|
@@ -101,7 +84,6 @@ exports[`ModalBox Test top aligned distance 1`] = `
|
|
|
101
84
|
"--pf-c-modal-box--m-align-top--spacer": "50px",
|
|
102
85
|
}
|
|
103
86
|
}
|
|
104
|
-
title="Test Modal Box"
|
|
105
87
|
>
|
|
106
88
|
This is a ModalBox
|
|
107
89
|
</div>
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`ModalBoxTitle alert variant 1`] = `
|
|
4
|
+
<h1
|
|
5
|
+
className="pf-c-modal-box__title pf-m-icon"
|
|
6
|
+
id="boxId"
|
|
7
|
+
>
|
|
8
|
+
<span
|
|
9
|
+
className="pf-c-modal-box__title-icon"
|
|
10
|
+
>
|
|
11
|
+
<ExclamationTriangleIcon
|
|
12
|
+
color="currentColor"
|
|
13
|
+
noVerticalAlign={false}
|
|
14
|
+
size="sm"
|
|
15
|
+
/>
|
|
16
|
+
</span>
|
|
17
|
+
<span
|
|
18
|
+
className="pf-u-screen-reader"
|
|
19
|
+
>
|
|
20
|
+
Warning alert:
|
|
21
|
+
</span>
|
|
22
|
+
<span
|
|
23
|
+
className="pf-c-modal-box__title-text"
|
|
24
|
+
>
|
|
25
|
+
Test Modal Box warning
|
|
26
|
+
</span>
|
|
27
|
+
</h1>
|
|
28
|
+
`;
|
|
29
|
+
|
|
30
|
+
exports[`ModalBoxTitle custom icon variant 1`] = `
|
|
31
|
+
<h1
|
|
32
|
+
className="pf-c-modal-box__title pf-m-icon"
|
|
33
|
+
id="boxId"
|
|
34
|
+
>
|
|
35
|
+
<span
|
|
36
|
+
className="pf-c-modal-box__title-icon"
|
|
37
|
+
>
|
|
38
|
+
<BullhornIcon
|
|
39
|
+
color="currentColor"
|
|
40
|
+
noVerticalAlign={false}
|
|
41
|
+
size="sm"
|
|
42
|
+
/>
|
|
43
|
+
</span>
|
|
44
|
+
<span
|
|
45
|
+
className="pf-c-modal-box__title-text"
|
|
46
|
+
>
|
|
47
|
+
Test Modal Box custom
|
|
48
|
+
</span>
|
|
49
|
+
</h1>
|
|
50
|
+
`;
|
|
51
|
+
|
|
52
|
+
exports[`ModalBoxTitle danger variant 1`] = `
|
|
53
|
+
<h1
|
|
54
|
+
className="pf-c-modal-box__title pf-m-icon"
|
|
55
|
+
id="boxId"
|
|
56
|
+
>
|
|
57
|
+
<span
|
|
58
|
+
className="pf-c-modal-box__title-icon"
|
|
59
|
+
>
|
|
60
|
+
<ExclamationCircleIcon
|
|
61
|
+
color="currentColor"
|
|
62
|
+
noVerticalAlign={false}
|
|
63
|
+
size="sm"
|
|
64
|
+
/>
|
|
65
|
+
</span>
|
|
66
|
+
<span
|
|
67
|
+
className="pf-u-screen-reader"
|
|
68
|
+
>
|
|
69
|
+
Danger alert:
|
|
70
|
+
</span>
|
|
71
|
+
<span
|
|
72
|
+
className="pf-c-modal-box__title-text"
|
|
73
|
+
>
|
|
74
|
+
Test Modal Box danger
|
|
75
|
+
</span>
|
|
76
|
+
</h1>
|
|
77
|
+
`;
|
|
78
|
+
|
|
79
|
+
exports[`ModalBoxTitle default variant 1`] = `
|
|
80
|
+
<h1
|
|
81
|
+
className="pf-c-modal-box__title pf-m-icon"
|
|
82
|
+
id="boxId"
|
|
83
|
+
>
|
|
84
|
+
<span
|
|
85
|
+
className="pf-c-modal-box__title-icon"
|
|
86
|
+
>
|
|
87
|
+
<BellIcon
|
|
88
|
+
color="currentColor"
|
|
89
|
+
noVerticalAlign={false}
|
|
90
|
+
size="sm"
|
|
91
|
+
/>
|
|
92
|
+
</span>
|
|
93
|
+
<span
|
|
94
|
+
className="pf-u-screen-reader"
|
|
95
|
+
>
|
|
96
|
+
Default alert:
|
|
97
|
+
</span>
|
|
98
|
+
<span
|
|
99
|
+
className="pf-c-modal-box__title-text"
|
|
100
|
+
>
|
|
101
|
+
Test Modal Box warning
|
|
102
|
+
</span>
|
|
103
|
+
</h1>
|
|
104
|
+
`;
|
|
105
|
+
|
|
106
|
+
exports[`ModalBoxTitle info variant 1`] = `
|
|
107
|
+
<h1
|
|
108
|
+
className="pf-c-modal-box__title pf-m-icon"
|
|
109
|
+
id="boxId"
|
|
110
|
+
>
|
|
111
|
+
<span
|
|
112
|
+
className="pf-c-modal-box__title-icon"
|
|
113
|
+
>
|
|
114
|
+
<InfoCircleIcon
|
|
115
|
+
color="currentColor"
|
|
116
|
+
noVerticalAlign={false}
|
|
117
|
+
size="sm"
|
|
118
|
+
/>
|
|
119
|
+
</span>
|
|
120
|
+
<span
|
|
121
|
+
className="pf-u-screen-reader"
|
|
122
|
+
>
|
|
123
|
+
Info alert:
|
|
124
|
+
</span>
|
|
125
|
+
<span
|
|
126
|
+
className="pf-c-modal-box__title-text"
|
|
127
|
+
>
|
|
128
|
+
Test Modal Box info
|
|
129
|
+
</span>
|
|
130
|
+
</h1>
|
|
131
|
+
`;
|
|
132
|
+
|
|
133
|
+
exports[`ModalBoxTitle success variant 1`] = `
|
|
134
|
+
<h1
|
|
135
|
+
className="pf-c-modal-box__title pf-m-icon"
|
|
136
|
+
id="boxId"
|
|
137
|
+
>
|
|
138
|
+
<span
|
|
139
|
+
className="pf-c-modal-box__title-icon"
|
|
140
|
+
>
|
|
141
|
+
<CheckCircleIcon
|
|
142
|
+
color="currentColor"
|
|
143
|
+
noVerticalAlign={false}
|
|
144
|
+
size="sm"
|
|
145
|
+
/>
|
|
146
|
+
</span>
|
|
147
|
+
<span
|
|
148
|
+
className="pf-u-screen-reader"
|
|
149
|
+
>
|
|
150
|
+
Success alert:
|
|
151
|
+
</span>
|
|
152
|
+
<span
|
|
153
|
+
className="pf-c-modal-box__title-text"
|
|
154
|
+
>
|
|
155
|
+
Test Modal Box success
|
|
156
|
+
</span>
|
|
157
|
+
</h1>
|
|
158
|
+
`;
|