@patternfly/react-core 4.265.0 → 4.265.2

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 (40) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/esm/components/SearchInput/AdvancedSearchMenu.d.ts.map +1 -1
  3. package/dist/esm/components/SearchInput/AdvancedSearchMenu.js +5 -4
  4. package/dist/esm/components/SearchInput/AdvancedSearchMenu.js.map +1 -1
  5. package/dist/esm/components/SearchInput/SearchInput.d.ts.map +1 -1
  6. package/dist/esm/components/SearchInput/SearchInput.js +23 -3
  7. package/dist/esm/components/SearchInput/SearchInput.js.map +1 -1
  8. package/dist/js/components/SearchInput/AdvancedSearchMenu.d.ts.map +1 -1
  9. package/dist/js/components/SearchInput/AdvancedSearchMenu.js +5 -4
  10. package/dist/js/components/SearchInput/AdvancedSearchMenu.js.map +1 -1
  11. package/dist/js/components/SearchInput/SearchInput.d.ts.map +1 -1
  12. package/dist/js/components/SearchInput/SearchInput.js +23 -3
  13. package/dist/js/components/SearchInput/SearchInput.js.map +1 -1
  14. package/dist/umd/react-core.min.js +1 -1
  15. package/package.json +2 -2
  16. package/src/components/SearchInput/AdvancedSearchMenu.tsx +7 -4
  17. package/src/components/SearchInput/SearchInput.tsx +26 -3
  18. package/src/components/SearchInput/examples/SearchInput.md +4 -0
  19. package/src/components/Tabs/examples/Tabs.md +21 -1557
  20. package/src/components/Tabs/examples/TabsBoxLight.tsx +63 -0
  21. package/src/components/Tabs/examples/TabsChildrenMounting.tsx +33 -0
  22. package/src/components/Tabs/examples/TabsContentWithBodyPadding.tsx +58 -0
  23. package/src/components/Tabs/examples/TabsDefault.tsx +62 -0
  24. package/src/components/Tabs/examples/TabsDefaultOverflow.tsx +74 -0
  25. package/src/components/Tabs/examples/TabsFilled.tsx +51 -0
  26. package/src/components/Tabs/examples/TabsFilledWithIcons.tsx +85 -0
  27. package/src/components/Tabs/examples/TabsIconAndText.tsx +108 -0
  28. package/src/components/Tabs/examples/TabsInset.tsx +65 -0
  29. package/src/components/Tabs/examples/TabsNav.tsx +40 -0
  30. package/src/components/Tabs/examples/TabsNavSecondary.tsx +76 -0
  31. package/src/components/Tabs/examples/TabsPageInsets.tsx +60 -0
  32. package/src/components/Tabs/examples/TabsSeparateContent.tsx +75 -0
  33. package/src/components/Tabs/examples/TabsSubtabs.tsx +115 -0
  34. package/src/components/Tabs/examples/TabsToggledSeparateContent.tsx +67 -0
  35. package/src/components/Tabs/examples/TabsTooltipReactRef.tsx +72 -0
  36. package/src/components/Tabs/examples/TabsUncontrolled.tsx +33 -0
  37. package/src/components/Tabs/examples/TabsUnmountingInvisibleChildren.tsx +33 -0
  38. package/src/components/Tabs/examples/TabsVertical.tsx +72 -0
  39. package/src/components/Tabs/examples/TabsVerticalExpandable.tsx +51 -0
  40. package/src/components/Tabs/examples/TabsVerticalExpandableUncontrolled.tsx +48 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/react-core",
3
- "version": "4.265.0",
3
+ "version": "4.265.2",
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",
@@ -77,5 +77,5 @@
77
77
  "react": "^16.8 || ^17 || ^18",
78
78
  "react-dom": "^16.8 || ^17 || ^18"
79
79
  },
80
- "gitHead": "47c6127c70191349261aec122b56e6ca61fa0c99"
80
+ "gitHead": "16dc61cc8c2e8ee43522c388c638290d34bbb20b"
81
81
  }
@@ -133,21 +133,24 @@ export const AdvancedSearchMenu: React.FunctionComponent<AdvancedSearchMenuProps
133
133
 
134
134
  const handleValueChange = (attribute: string, newValue: string, event: React.FormEvent<HTMLInputElement>) => {
135
135
  const newMap = getAttrValueMap();
136
+
136
137
  newMap[attribute] = newValue;
137
138
  let updatedValue = '';
138
139
  Object.entries(newMap).forEach(([k, v]) => {
139
140
  if (v.trim() !== '') {
141
+ /* Wrap the value in quotes if it contains spaces */
142
+ const quoteWrappedValue = v.includes(' ') ? `'${v.replace(/(^'|'$)/g, '')}'` : v;
143
+
140
144
  if (k !== 'haswords') {
141
- updatedValue = `${updatedValue} ${k}${advancedSearchDelimiter}${v}`;
145
+ updatedValue = `${updatedValue} ${k}${advancedSearchDelimiter}${quoteWrappedValue}`;
142
146
  } else {
143
- updatedValue = `${updatedValue} ${v}`;
147
+ updatedValue = `${updatedValue} ${quoteWrappedValue}`;
144
148
  }
145
149
  }
146
150
  });
147
- updatedValue = updatedValue.replace(/^\s+/g, '');
148
151
 
149
152
  if (onChange) {
150
- onChange(updatedValue, event);
153
+ onChange(updatedValue.replace(/^\s+/g, ''), event);
151
154
  }
152
155
  };
153
156
 
@@ -229,13 +229,36 @@ const SearchInputBase: React.FunctionComponent<SearchInputProps> = ({
229
229
  setIsSearchMenuOpen(false);
230
230
  };
231
231
 
232
+ const splitStringExceptInQuotes = (str: string) => {
233
+ let quoteType: string;
234
+
235
+ return str.match(/\\?.|^$/g).reduce(
236
+ (p: any, c: string) => {
237
+ if (c === "'" || c === '"') {
238
+ if (!quoteType) {
239
+ quoteType = c;
240
+ }
241
+ if (c === quoteType) {
242
+ p.quote = !p.quote;
243
+ }
244
+ } else if (!p.quote && c === ' ') {
245
+ p.a.push('');
246
+ } else {
247
+ p.a[p.a.length - 1] += c.replace(/\\(.)/, '$1');
248
+ }
249
+ return p;
250
+ },
251
+ { a: [''] }
252
+ ).a;
253
+ };
254
+
232
255
  const getAttrValueMap = () => {
233
256
  const attrValue: { [key: string]: string } = {};
234
- const pairs = searchValue.split(' ');
235
- pairs.map(pair => {
257
+ const pairs = splitStringExceptInQuotes(searchValue);
258
+ pairs.map((pair: string) => {
236
259
  const splitPair = pair.split(advancedSearchDelimiter);
237
260
  if (splitPair.length === 2) {
238
- attrValue[splitPair[0]] = splitPair[1];
261
+ attrValue[splitPair[0]] = splitPair[1].replace(/(^'|'$)/g, '');
239
262
  } else if (splitPair.length === 1) {
240
263
  attrValue.haswords = attrValue.hasOwnProperty('haswords')
241
264
  ? `${attrValue.haswords} ${splitPair[0]}`
@@ -48,5 +48,9 @@ the following example. The search input component can also be used as a composab
48
48
  or other elements to build a completely custom advanced search form. This feature is demonstrated
49
49
  in the search input's <a href="/components/search-input/react-demos">react demos</a>.
50
50
 
51
+ The values used in the attribute-value form fields may contain spaces. The values containing spaces
52
+ should be wrapped with quotes inside the summary search string in the input field. If the latter is
53
+ autogenerated from the individual fields the quotes will be autoplaced.
54
+
51
55
  ```ts file='./SearchInputAdvanced.tsx'
52
56
  ```