@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.
Files changed (37) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/dist/esm/components/FormSelect/FormSelectOption.d.ts +1 -0
  3. package/dist/esm/components/FormSelect/FormSelectOption.d.ts.map +1 -1
  4. package/dist/esm/components/TreeView/TreeView.d.ts +2 -0
  5. package/dist/esm/components/TreeView/TreeView.d.ts.map +1 -1
  6. package/dist/esm/components/TreeView/TreeView.js +2 -2
  7. package/dist/esm/components/TreeView/TreeView.js.map +1 -1
  8. package/dist/esm/components/TreeView/TreeViewListItem.d.ts +3 -1
  9. package/dist/esm/components/TreeView/TreeViewListItem.d.ts.map +1 -1
  10. package/dist/esm/components/TreeView/TreeViewListItem.js +39 -2
  11. package/dist/esm/components/TreeView/TreeViewListItem.js.map +1 -1
  12. package/dist/esm/components/Wizard/WizardToggle.js +3 -3
  13. package/dist/esm/components/Wizard/WizardToggle.js.map +1 -1
  14. package/dist/js/components/FormSelect/FormSelectOption.d.ts +1 -0
  15. package/dist/js/components/FormSelect/FormSelectOption.d.ts.map +1 -1
  16. package/dist/js/components/TreeView/TreeView.d.ts +2 -0
  17. package/dist/js/components/TreeView/TreeView.d.ts.map +1 -1
  18. package/dist/js/components/TreeView/TreeView.js +2 -2
  19. package/dist/js/components/TreeView/TreeView.js.map +1 -1
  20. package/dist/js/components/TreeView/TreeViewListItem.d.ts +3 -1
  21. package/dist/js/components/TreeView/TreeViewListItem.d.ts.map +1 -1
  22. package/dist/js/components/TreeView/TreeViewListItem.js +39 -3
  23. package/dist/js/components/TreeView/TreeViewListItem.js.map +1 -1
  24. package/dist/js/components/Wizard/WizardToggle.js +3 -3
  25. package/dist/js/components/Wizard/WizardToggle.js.map +1 -1
  26. package/dist/umd/react-core.css +8658 -8658
  27. package/dist/umd/react-core.js +44 -7
  28. package/dist/umd/react-core.min.css +14346 -14345
  29. package/dist/umd/react-core.min.js +1 -1
  30. package/package.json +6 -6
  31. package/src/components/FormSelect/FormSelectOption.tsx +1 -1
  32. package/src/components/Nav/examples/Nav.md +1 -1
  33. package/src/components/TreeView/TreeView.tsx +4 -0
  34. package/src/components/TreeView/TreeViewListItem.tsx +55 -3
  35. package/src/components/TreeView/examples/TreeView.md +286 -176
  36. package/src/components/Wizard/WizardToggle.tsx +5 -5
  37. package/src/components/Wizard/__tests__/Generated/__snapshots__/WizardToggle.test.tsx.snap +4 -4
@@ -212,16 +212,21 @@ class SearchTreeView extends React.Component {
212
212
 
213
213
  render() {
214
214
  const { activeItems, filteredItems, isFiltered } = this.state;
215
-
215
+
216
216
  const toolbar = (
217
- <Toolbar style={{padding: 0}}>
218
- <ToolbarContent style={{padding: 0}}>
219
- <ToolbarItem widths={{default: "100%"}}>
220
- <TreeViewSearch onSearch={this.onSearch} id='input-search' name='search-input' aria-label='Search input example' />
217
+ <Toolbar style={{ padding: 0 }}>
218
+ <ToolbarContent style={{ padding: 0 }}>
219
+ <ToolbarItem widths={{ default: '100%' }}>
220
+ <TreeViewSearch
221
+ onSearch={this.onSearch}
222
+ id="input-search"
223
+ name="search-input"
224
+ aria-label="Search input example"
225
+ />
221
226
  </ToolbarItem>
222
227
  </ToolbarContent>
223
- </Toolbar>
224
- );
228
+ </Toolbar>
229
+ );
225
230
 
226
231
  return (
227
232
  <TreeView
@@ -440,9 +445,7 @@ class CheckboxTreeView extends React.Component {
440
445
 
441
446
  render() {
442
447
  const mapped = this.options.map(item => this.mapTree(item));
443
- return (
444
- <TreeView data={mapped} onCheck={this.onCheck} hasChecks />
445
- );
448
+ return <TreeView data={mapped} onCheck={this.onCheck} hasChecks />;
446
449
  }
447
450
  }
448
451
  ```
@@ -700,7 +703,14 @@ class CustomBadgesTreeView extends React.Component {
700
703
  name: 'Sources',
701
704
  id: 'Sources',
702
705
  customBadgeContent: '1 source',
703
- children: [{ name: 'Application 4', id: 'App4', customBadgeContent: '1 child', children: [{ name: 'Settings', id: 'App4Settings' }] }]
706
+ children: [
707
+ {
708
+ name: 'Application 4',
709
+ id: 'App4',
710
+ customBadgeContent: '1 child',
711
+ children: [{ name: 'Settings', id: 'App4Settings' }]
712
+ }
713
+ ]
704
714
  },
705
715
  {
706
716
  name: 'Really really really long folder name that overflows the container it is in',
@@ -853,64 +863,64 @@ import { TreeView, TreeViewDataItem } from '@patternfly/react-core';
853
863
 
854
864
  const GuidesTreeView: React.FunctionComponent = () => {
855
865
  const options: TreeViewDataItem[] = [
856
- {
857
- name: 'Application launcher',
858
- id: 'AppLaunch',
859
- children: [
860
- {
861
- name: 'Application 1',
862
- id: 'App1',
863
- children: [
864
- { name: 'Settings', id: 'App1Settings' },
865
- { name: 'Current', id: 'App1Current' }
866
- ]
867
- },
868
- {
869
- name: 'Application 2',
870
- id: 'App2',
871
- children: [
872
- { name: 'Settings', id: 'App2Settings' },
873
- {
874
- name: 'Loader',
875
- id: 'App2Loader',
876
- children: [
877
- { name: 'Loading App 1', id: 'LoadApp1' },
878
- { name: 'Loading App 2', id: 'LoadApp2' },
879
- { name: 'Loading App 3', id: 'LoadApp3' }
880
- ]
881
- }
882
- ]
883
- }
884
- ],
885
- defaultExpanded: true
886
- },
887
- {
888
- name: 'Cost management',
889
- id: 'Cost',
890
- children: [
891
- {
892
- name: 'Application 3',
893
- id: 'App3',
894
- children: [
895
- { name: 'Settings', id: 'App3Settings' },
896
- { name: 'Current', id: 'App3Current' }
897
- ]
898
- }
899
- ]
900
- },
901
- {
902
- name: 'Sources',
903
- id: 'Sources',
904
- children: [{ name: 'Application 4', id: 'App4', children: [{ name: 'Settings', id: 'App4Settings' }] }]
905
- },
906
- {
907
- name: 'Really really really long folder name that overflows the container it is in',
908
- id: 'Long',
909
- children: [{ name: 'Application 5', id: 'App5' }]
910
- }
911
- ];
912
- return <TreeView data={options} hasGuides={true} />;
913
- }
866
+ {
867
+ name: 'Application launcher',
868
+ id: 'AppLaunch',
869
+ children: [
870
+ {
871
+ name: 'Application 1',
872
+ id: 'App1',
873
+ children: [
874
+ { name: 'Settings', id: 'App1Settings' },
875
+ { name: 'Current', id: 'App1Current' }
876
+ ]
877
+ },
878
+ {
879
+ name: 'Application 2',
880
+ id: 'App2',
881
+ children: [
882
+ { name: 'Settings', id: 'App2Settings' },
883
+ {
884
+ name: 'Loader',
885
+ id: 'App2Loader',
886
+ children: [
887
+ { name: 'Loading App 1', id: 'LoadApp1' },
888
+ { name: 'Loading App 2', id: 'LoadApp2' },
889
+ { name: 'Loading App 3', id: 'LoadApp3' }
890
+ ]
891
+ }
892
+ ]
893
+ }
894
+ ],
895
+ defaultExpanded: true
896
+ },
897
+ {
898
+ name: 'Cost management',
899
+ id: 'Cost',
900
+ children: [
901
+ {
902
+ name: 'Application 3',
903
+ id: 'App3',
904
+ children: [
905
+ { name: 'Settings', id: 'App3Settings' },
906
+ { name: 'Current', id: 'App3Current' }
907
+ ]
908
+ }
909
+ ]
910
+ },
911
+ {
912
+ name: 'Sources',
913
+ id: 'Sources',
914
+ children: [{ name: 'Application 4', id: 'App4', children: [{ name: 'Settings', id: 'App4Settings' }] }]
915
+ },
916
+ {
917
+ name: 'Really really really long folder name that overflows the container it is in',
918
+ id: 'Long',
919
+ children: [{ name: 'Application 5', id: 'App5' }]
920
+ }
921
+ ];
922
+ return <TreeView data={options} hasGuides={true} />;
923
+ };
914
924
  ```
915
925
 
916
926
  ### Compact
@@ -921,61 +931,67 @@ import { TreeView, TreeViewDataItem } from '@patternfly/react-core';
921
931
 
922
932
  const CompactTreeView: React.FunctionComponent = () => {
923
933
  const options: TreeViewDataItem[] = [
924
- {
925
- name: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value and may reject unrecognized values.',
926
- title: 'apiVersion',
927
- id: 'apiVersion'
928
- },
929
- {
930
- name: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated is CamelCase. More info:',
931
- title: 'kind',
932
- id: 'kind'
933
- },
934
- {
935
- name: 'Standard metadata object',
936
- title: 'metadata',
937
- id: 'metadata'
938
- },
939
- {
940
- name: 'Standard metadata object',
941
- title: 'spec',
942
- id: 'spec',
943
- children: [
944
- {
945
- name: 'Minimum number of seconds for which a newly created pod should be ready without any of its container crashing, for it to be considered available. Default to 0 (pod will be considered available as soon as it is ready).',
946
- title: 'minReadySeconds',
947
- id: 'minReadySeconds'
948
- },
949
- {
950
- name: 'Indicates that the deployment is paused',
951
- title: 'paused',
952
- id: 'paused'
953
- },
954
- {
955
- name: 'The maximum time in seconds for a deployment to make progress before it is considered to be failed. The deployment controller will continue to process failed deployments and a condition with a ProgressDeadlineExceeded reason will be surfaced in the deployment status. Note that the progress will not de estimated during the time a deployment is paused. Defaults to 600s.',
956
- title: 'progressDeadlineSeconds',
957
- id: 'progressDeadlineSeconds',
958
- children: [
959
- {
960
- name: 'The number of old ReplicaSets to retain to allow rollback. This is a pointer to distinguish between explicit zero and not specified. Defaults to 10.',
961
- title: 'revisionHistoryLimit',
962
- id: 'revisionHistoryLimit',
963
- children: [
964
- {
965
- name: 'Map of {key.value} pairs. A single {key.value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In" and the values array contains only "value". The requirements are ANDed.',
966
- title: 'matchLabels',
967
- id: 'matchLabels'
968
- }
969
- ]
970
- }
971
- ]
972
- }
973
- ]
974
- }
975
- ];
976
- return <TreeView data={options} variant='compact' />;
977
- }
978
- ```
934
+ {
935
+ name:
936
+ 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value and may reject unrecognized values.',
937
+ title: 'apiVersion',
938
+ id: 'apiVersion'
939
+ },
940
+ {
941
+ name:
942
+ 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated is CamelCase. More info:',
943
+ title: 'kind',
944
+ id: 'kind'
945
+ },
946
+ {
947
+ name: 'Standard metadata object',
948
+ title: 'metadata',
949
+ id: 'metadata'
950
+ },
951
+ {
952
+ name: 'Standard metadata object',
953
+ title: 'spec',
954
+ id: 'spec',
955
+ children: [
956
+ {
957
+ name:
958
+ 'Minimum number of seconds for which a newly created pod should be ready without any of its container crashing, for it to be considered available. Default to 0 (pod will be considered available as soon as it is ready).',
959
+ title: 'minReadySeconds',
960
+ id: 'minReadySeconds'
961
+ },
962
+ {
963
+ name: 'Indicates that the deployment is paused',
964
+ title: 'paused',
965
+ id: 'paused'
966
+ },
967
+ {
968
+ name:
969
+ 'The maximum time in seconds for a deployment to make progress before it is considered to be failed. The deployment controller will continue to process failed deployments and a condition with a ProgressDeadlineExceeded reason will be surfaced in the deployment status. Note that the progress will not de estimated during the time a deployment is paused. Defaults to 600s.',
970
+ title: 'progressDeadlineSeconds',
971
+ id: 'progressDeadlineSeconds',
972
+ children: [
973
+ {
974
+ name:
975
+ 'The number of old ReplicaSets to retain to allow rollback. This is a pointer to distinguish between explicit zero and not specified. Defaults to 10.',
976
+ title: 'revisionHistoryLimit',
977
+ id: 'revisionHistoryLimit',
978
+ children: [
979
+ {
980
+ name:
981
+ 'Map of {key.value} pairs. A single {key.value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In" and the values array contains only "value". The requirements are ANDed.',
982
+ title: 'matchLabels',
983
+ id: 'matchLabels'
984
+ }
985
+ ]
986
+ }
987
+ ]
988
+ }
989
+ ]
990
+ }
991
+ ];
992
+ return <TreeView data={options} variant="compact" />;
993
+ };
994
+ ```
979
995
 
980
996
  ### Compact, no background
981
997
 
@@ -985,58 +1001,152 @@ import { TreeView, TreeViewDataItem } from '@patternfly/react-core';
985
1001
 
986
1002
  const CompactNoBackgroundTreeView: React.FunctionComponent = () => {
987
1003
  const options: TreeViewDataItem[] = [
988
- {
989
- name: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value and may reject unrecognized values.',
990
- title: 'apiVersion',
991
- id: 'apiVersion'
992
- },
993
- {
994
- name: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated is CamelCase. More info:',
995
- title: 'kind',
996
- id: 'kind'
997
- },
998
- {
999
- name: 'Standard metadata object',
1000
- title: 'metadata',
1001
- id: 'metadata'
1002
- },
1003
- {
1004
- name: 'Standard metadata object',
1005
- title: 'spec',
1006
- id: 'spec',
1007
- children: [
1008
- {
1009
- name: 'Minimum number of seconds for which a newly created pod should be ready without any of its container crashing, for it to be considered available. Default to 0 (pod will be considered available as soon as it is ready).',
1010
- title: 'minReadySeconds',
1011
- id: 'minReadySeconds'
1012
- },
1013
- {
1014
- name: 'Indicates that the deployment is paused',
1015
- title: 'paused',
1016
- id: 'paused'
1017
- },
1018
- {
1019
- name: 'The maximum time in seconds for a deployment to make progress before it is considered to be failed. The deployment controller will continue to process failed deployments and a condition with a ProgressDeadlineExceeded reason will be surfaced in the deployment status. Note that the progress will not de estimated during the time a deployment is paused. Defaults to 600s.',
1020
- title: 'progressDeadlineSeconds',
1021
- id: 'progressDeadlineSeconds',
1022
- children: [
1023
- {
1024
- name: 'The number of old ReplicaSets to retain to allow rollback. This is a pointer to distinguish between explicit zero and not specified. Defaults to 10.',
1025
- title: 'revisionHistoryLimit',
1026
- id: 'revisionHistoryLimit',
1027
- children: [
1028
- {
1029
- name: 'Map of {key.value} pairs. A single {key.value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In" and the values array contains only "value". The requirements are ANDed.',
1030
- title: 'matchLabels',
1031
- id: 'matchLabels'
1032
- }
1033
- ]
1034
- }
1035
- ]
1004
+ {
1005
+ name:
1006
+ 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value and may reject unrecognized values.',
1007
+ title: 'apiVersion',
1008
+ id: 'apiVersion'
1009
+ },
1010
+ {
1011
+ name:
1012
+ 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated is CamelCase. More info:',
1013
+ title: 'kind',
1014
+ id: 'kind'
1015
+ },
1016
+ {
1017
+ name: 'Standard metadata object',
1018
+ title: 'metadata',
1019
+ id: 'metadata'
1020
+ },
1021
+ {
1022
+ name: 'Standard metadata object',
1023
+ title: 'spec',
1024
+ id: 'spec',
1025
+ children: [
1026
+ {
1027
+ name:
1028
+ 'Minimum number of seconds for which a newly created pod should be ready without any of its container crashing, for it to be considered available. Default to 0 (pod will be considered available as soon as it is ready).',
1029
+ title: 'minReadySeconds',
1030
+ id: 'minReadySeconds'
1031
+ },
1032
+ {
1033
+ name: 'Indicates that the deployment is paused',
1034
+ title: 'paused',
1035
+ id: 'paused'
1036
+ },
1037
+ {
1038
+ name:
1039
+ 'The maximum time in seconds for a deployment to make progress before it is considered to be failed. The deployment controller will continue to process failed deployments and a condition with a ProgressDeadlineExceeded reason will be surfaced in the deployment status. Note that the progress will not de estimated during the time a deployment is paused. Defaults to 600s.',
1040
+ title: 'progressDeadlineSeconds',
1041
+ id: 'progressDeadlineSeconds',
1042
+ children: [
1043
+ {
1044
+ name:
1045
+ 'The number of old ReplicaSets to retain to allow rollback. This is a pointer to distinguish between explicit zero and not specified. Defaults to 10.',
1046
+ title: 'revisionHistoryLimit',
1047
+ id: 'revisionHistoryLimit',
1048
+ children: [
1049
+ {
1050
+ name:
1051
+ 'Map of {key.value} pairs. A single {key.value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In" and the values array contains only "value". The requirements are ANDed.',
1052
+ title: 'matchLabels',
1053
+ id: 'matchLabels'
1054
+ }
1055
+ ]
1056
+ }
1057
+ ]
1058
+ }
1059
+ ]
1060
+ }
1061
+ ];
1062
+ return <TreeView data={options} variant="compactNoBackground" />;
1063
+ };
1064
+ ```
1065
+
1066
+ ### With memoization
1067
+
1068
+ Turning on memoization with the `useMemo` property helps prevent unnecessary re-renders for large data sets. With this flag active, `activeItems` must pass in an array of nodes along the selected item's path to update properly.
1069
+
1070
+ ```js
1071
+ import React from 'react';
1072
+ import { TreeView, Button } from '@patternfly/react-core';
1073
+
1074
+ class MemoTreeView extends React.Component {
1075
+ constructor(props) {
1076
+ super(props);
1077
+
1078
+ this.state = { activeItems: {}, allExpanded: false };
1079
+
1080
+ this.onSelect = (evt, treeViewItem) => {
1081
+ let filtered = [];
1082
+ this.options.forEach(item => this.filterItems(item, treeViewItem.id, filtered));
1083
+ this.setState({
1084
+ activeItems: filtered
1085
+ });
1086
+ };
1087
+
1088
+ this.onToggle = evt => {
1089
+ const { allExpanded } = this.state;
1090
+ this.setState({
1091
+ allExpanded: allExpanded !== undefined ? !allExpanded : true
1092
+ });
1093
+ };
1094
+
1095
+ this.filterItems = (item, input, list) => {
1096
+ if (item.children) {
1097
+ let childContained = false;
1098
+ item.children.forEach(child => {
1099
+ if (childContained) {
1100
+ this.filterItems(child, input, list);
1101
+ } else {
1102
+ childContained = this.filterItems(child, input, list);
1036
1103
  }
1037
- ]
1104
+ });
1105
+ if (childContained) {
1106
+ list.push(item);
1107
+ }
1038
1108
  }
1039
- ];
1040
- return <TreeView data={options} variant='compactNoBackground' />;
1109
+
1110
+ if (item.id === input) {
1111
+ list.push(item);
1112
+ return true;
1113
+ } else {
1114
+ return false;
1115
+ }
1116
+ };
1117
+
1118
+ this.options = [];
1119
+ for (let i = 1; i <= 20; i++) {
1120
+ const childNum = 5;
1121
+ let childOptions = [];
1122
+ for (let j = 1; j <= childNum; j++) {
1123
+ childOptions.push({ name: 'Child ' + j, id: `Option${i} - Child${j}` });
1124
+ }
1125
+ this.options.push({ name: 'Option ' + i, id: i, children: childOptions });
1126
+ }
1127
+ }
1128
+
1129
+ render() {
1130
+ const { activeItems, allExpanded } = this.state;
1131
+ const tree = (
1132
+ <TreeView
1133
+ data={this.options}
1134
+ activeItems={activeItems}
1135
+ onSelect={this.onSelect}
1136
+ allExpanded={allExpanded}
1137
+ useMemo
1138
+ />
1139
+ );
1140
+
1141
+ return (
1142
+ <React.Fragment>
1143
+ <Button variant="link" onClick={this.onToggle}>
1144
+ {allExpanded && 'Collapse all'}
1145
+ {!allExpanded && 'Expand all'}
1146
+ </Button>
1147
+ {tree}
1148
+ </React.Fragment>
1149
+ );
1150
+ }
1041
1151
  }
1042
- ```
1152
+ ```
@@ -72,13 +72,13 @@ export const WizardToggle: React.FunctionComponent<WizardToggleProps> = ({
72
72
  aria-label={ariaLabel}
73
73
  aria-expanded={isNavOpen}
74
74
  >
75
- <ol className={css(styles.wizardToggleList)}>
76
- <li className={css(styles.wizardToggleListItem)}>
75
+ <span className={css(styles.wizardToggleList)}>
76
+ <span className={css(styles.wizardToggleListItem)}>
77
77
  <span className={css(styles.wizardToggleNum)}>{activeStepIndex}</span> {activeStepName}
78
78
  {activeStepSubName && <AngleRightIcon className={css(styles.wizardToggleSeparator)} aria-hidden="true" />}
79
- </li>
80
- {activeStepSubName && <li className={css(styles.wizardToggleListItem)}>{activeStepSubName}</li>}
81
- </ol>
79
+ </span>
80
+ {activeStepSubName && <span className={css(styles.wizardToggleListItem)}>{activeStepSubName}</span>}
81
+ </span>
82
82
  <span className={css(styles.wizardToggleIcon)}>
83
83
  <CaretDownIcon aria-hidden="true" />
84
84
  </span>
@@ -8,18 +8,18 @@ exports[`WizardToggle should match snapshot (auto-generated) 1`] = `
8
8
  className="pf-c-wizard__toggle pf-m-expanded"
9
9
  onClick={[Function]}
10
10
  >
11
- <ol
11
+ <span
12
12
  className="pf-c-wizard__toggle-list"
13
13
  >
14
- <li
14
+ <span
15
15
  className="pf-c-wizard__toggle-list-item"
16
16
  >
17
17
  <span
18
18
  className="pf-c-wizard__toggle-num"
19
19
  />
20
20
 
21
- </li>
22
- </ol>
21
+ </span>
22
+ </span>
23
23
  <span
24
24
  className="pf-c-wizard__toggle-icon"
25
25
  >