@patternfly/react-core 4.162.1 → 4.162.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 +38 -0
- package/dist/esm/components/FormSelect/FormSelectOption.d.ts +1 -0
- package/dist/esm/components/FormSelect/FormSelectOption.d.ts.map +1 -1
- package/dist/esm/components/TreeView/TreeView.d.ts +2 -0
- package/dist/esm/components/TreeView/TreeView.d.ts.map +1 -1
- package/dist/esm/components/TreeView/TreeView.js +2 -2
- package/dist/esm/components/TreeView/TreeView.js.map +1 -1
- package/dist/esm/components/TreeView/TreeViewListItem.d.ts +3 -1
- package/dist/esm/components/TreeView/TreeViewListItem.d.ts.map +1 -1
- package/dist/esm/components/TreeView/TreeViewListItem.js +39 -2
- package/dist/esm/components/TreeView/TreeViewListItem.js.map +1 -1
- package/dist/esm/components/Wizard/WizardToggle.js +3 -3
- package/dist/esm/components/Wizard/WizardToggle.js.map +1 -1
- package/dist/js/components/FormSelect/FormSelectOption.d.ts +1 -0
- package/dist/js/components/FormSelect/FormSelectOption.d.ts.map +1 -1
- package/dist/js/components/TreeView/TreeView.d.ts +2 -0
- package/dist/js/components/TreeView/TreeView.d.ts.map +1 -1
- package/dist/js/components/TreeView/TreeView.js +2 -2
- package/dist/js/components/TreeView/TreeView.js.map +1 -1
- package/dist/js/components/TreeView/TreeViewListItem.d.ts +3 -1
- package/dist/js/components/TreeView/TreeViewListItem.d.ts.map +1 -1
- package/dist/js/components/TreeView/TreeViewListItem.js +39 -3
- package/dist/js/components/TreeView/TreeViewListItem.js.map +1 -1
- package/dist/js/components/Wizard/WizardToggle.js +3 -3
- package/dist/js/components/Wizard/WizardToggle.js.map +1 -1
- package/dist/umd/react-core.css +8658 -8658
- package/dist/umd/react-core.js +44 -7
- package/dist/umd/react-core.min.css +14346 -14345
- package/dist/umd/react-core.min.js +1 -1
- package/package.json +6 -6
- package/src/components/FormSelect/FormSelectOption.tsx +1 -1
- package/src/components/Nav/examples/Nav.md +1 -1
- package/src/components/TreeView/TreeView.tsx +4 -0
- package/src/components/TreeView/TreeViewListItem.tsx +55 -3
- package/src/components/TreeView/examples/TreeView.md +286 -176
- package/src/components/Wizard/WizardToggle.tsx +5 -5
- package/src/components/Wizard/__tests__/Generated/__snapshots__/WizardToggle.test.tsx.snap +4 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "4.162.
|
|
3
|
+
"version": "4.162.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.12.
|
|
39
|
-
"@patternfly/react-tokens": "^4.14.
|
|
37
|
+
"@patternfly/react-icons": "^4.13.1",
|
|
38
|
+
"@patternfly/react-styles": "^4.12.5",
|
|
39
|
+
"@patternfly/react-tokens": "^4.14.1",
|
|
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.144.
|
|
46
|
+
"@patternfly/patternfly": "4.144.5",
|
|
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": "257056ac06e7928bc56f9942ba0407719fd03663"
|
|
64
64
|
}
|
|
@@ -9,7 +9,7 @@ export interface FormSelectOptionProps extends Omit<React.HTMLProps<HTMLOptionEl
|
|
|
9
9
|
label: string;
|
|
10
10
|
/** flag indicating if the option is disabled */
|
|
11
11
|
isDisabled?: boolean;
|
|
12
|
-
|
|
12
|
+
/** flag indicating if option will have placeholder styling applied when selected **/
|
|
13
13
|
isPlaceholder?: boolean;
|
|
14
14
|
}
|
|
15
15
|
|
|
@@ -508,7 +508,7 @@ class NavTertiaryList extends React.Component {
|
|
|
508
508
|
|
|
509
509
|
A flyout should be a `Menu` component. Press `space` or `right arrow` to open a flyout using the keyboard, use the arrow keys to navigate between flyout items, and press `escape` or `left arrow` to close a flyout.
|
|
510
510
|
|
|
511
|
-
```js
|
|
511
|
+
```js isBeta
|
|
512
512
|
import React from 'react';
|
|
513
513
|
import {
|
|
514
514
|
Nav,
|
|
@@ -69,6 +69,8 @@ export interface TreeViewProps {
|
|
|
69
69
|
className?: string;
|
|
70
70
|
/** Toolbar to display above the tree view */
|
|
71
71
|
toolbar?: React.ReactNode;
|
|
72
|
+
/** Flag indicating the TreeView should utilize memoization to help render large data sets. Setting this property requires that `activeItems` pass in an array containing every node in the selected item's path. */
|
|
73
|
+
useMemo?: boolean;
|
|
72
74
|
}
|
|
73
75
|
|
|
74
76
|
export const TreeView: React.FunctionComponent<TreeViewProps> = ({
|
|
@@ -89,6 +91,7 @@ export const TreeView: React.FunctionComponent<TreeViewProps> = ({
|
|
|
89
91
|
activeItems,
|
|
90
92
|
compareItems = (item, itemToCheck) => item.id === itemToCheck.id,
|
|
91
93
|
className,
|
|
94
|
+
useMemo,
|
|
92
95
|
...props
|
|
93
96
|
}: TreeViewProps) => {
|
|
94
97
|
const treeViewList = (
|
|
@@ -116,6 +119,7 @@ export const TreeView: React.FunctionComponent<TreeViewProps> = ({
|
|
|
116
119
|
action={item.action}
|
|
117
120
|
compareItems={compareItems}
|
|
118
121
|
isCompact={variant === 'compact' || variant === 'compactNoBackground'}
|
|
122
|
+
useMemo={useMemo}
|
|
119
123
|
{...(item.children && {
|
|
120
124
|
children: (
|
|
121
125
|
<TreeView
|
|
@@ -53,9 +53,11 @@ export interface TreeViewListItemProps {
|
|
|
53
53
|
action?: React.ReactNode;
|
|
54
54
|
/** Callback for item comparison function */
|
|
55
55
|
compareItems?: (item: TreeViewDataItem, itemToCheck: TreeViewDataItem) => boolean;
|
|
56
|
+
/** Flag indicating the TreeView should utilize memoization to help render large data sets. Setting this property requires that `activeItems` pass in an array containing every node in the selected item's path. */
|
|
57
|
+
useMemo?: boolean;
|
|
56
58
|
}
|
|
57
59
|
|
|
58
|
-
|
|
60
|
+
const TreeViewListItemBase: React.FunctionComponent<TreeViewListItemProps> = ({
|
|
59
61
|
name,
|
|
60
62
|
title,
|
|
61
63
|
id,
|
|
@@ -78,10 +80,11 @@ export const TreeViewListItem: React.FunctionComponent<TreeViewListItemProps> =
|
|
|
78
80
|
icon,
|
|
79
81
|
expandedIcon,
|
|
80
82
|
action,
|
|
81
|
-
compareItems
|
|
83
|
+
compareItems,
|
|
84
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
85
|
+
useMemo
|
|
82
86
|
}: TreeViewListItemProps) => {
|
|
83
87
|
const [internalIsExpanded, setIsExpanded] = useState(defaultExpanded);
|
|
84
|
-
|
|
85
88
|
useEffect(() => {
|
|
86
89
|
if (isExpanded !== undefined && isExpanded !== null) {
|
|
87
90
|
setIsExpanded(isExpanded);
|
|
@@ -207,4 +210,53 @@ export const TreeViewListItem: React.FunctionComponent<TreeViewListItemProps> =
|
|
|
207
210
|
</li>
|
|
208
211
|
);
|
|
209
212
|
};
|
|
213
|
+
|
|
214
|
+
export const TreeViewListItem = React.memo(TreeViewListItemBase, (prevProps, nextProps) => {
|
|
215
|
+
if (!nextProps.useMemo) {
|
|
216
|
+
return false;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
const prevIncludes =
|
|
220
|
+
prevProps.activeItems &&
|
|
221
|
+
prevProps.activeItems.length > 0 &&
|
|
222
|
+
prevProps.activeItems.some(
|
|
223
|
+
item => prevProps.compareItems && item && prevProps.compareItems(item, prevProps.itemData)
|
|
224
|
+
);
|
|
225
|
+
const nextIncludes =
|
|
226
|
+
nextProps.activeItems &&
|
|
227
|
+
nextProps.activeItems.length > 0 &&
|
|
228
|
+
nextProps.activeItems.some(
|
|
229
|
+
item => nextProps.compareItems && item && nextProps.compareItems(item, nextProps.itemData)
|
|
230
|
+
);
|
|
231
|
+
|
|
232
|
+
if (prevIncludes || nextIncludes) {
|
|
233
|
+
return false;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
if (
|
|
237
|
+
prevProps.name !== nextProps.name ||
|
|
238
|
+
prevProps.title !== nextProps.title ||
|
|
239
|
+
prevProps.id !== nextProps.id ||
|
|
240
|
+
prevProps.isExpanded !== nextProps.isExpanded ||
|
|
241
|
+
prevProps.defaultExpanded !== nextProps.defaultExpanded ||
|
|
242
|
+
prevProps.onSelect !== nextProps.onSelect ||
|
|
243
|
+
prevProps.onCheck !== nextProps.onCheck ||
|
|
244
|
+
prevProps.hasCheck !== nextProps.hasCheck ||
|
|
245
|
+
prevProps.checkProps !== nextProps.checkProps ||
|
|
246
|
+
prevProps.hasBadge !== nextProps.hasBadge ||
|
|
247
|
+
prevProps.customBadgeContent !== nextProps.customBadgeContent ||
|
|
248
|
+
prevProps.badgeProps !== nextProps.badgeProps ||
|
|
249
|
+
prevProps.isCompact !== nextProps.isCompact ||
|
|
250
|
+
prevProps.icon !== nextProps.icon ||
|
|
251
|
+
prevProps.expandedIcon !== nextProps.expandedIcon ||
|
|
252
|
+
prevProps.action !== nextProps.action ||
|
|
253
|
+
prevProps.parentItem !== nextProps.parentItem ||
|
|
254
|
+
prevProps.itemData !== nextProps.itemData
|
|
255
|
+
) {
|
|
256
|
+
return false;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
return true;
|
|
260
|
+
});
|
|
261
|
+
|
|
210
262
|
TreeViewListItem.displayName = 'TreeViewListItem';
|