@patternfly/react-core 4.265.1 → 4.266.0

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 (46) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/esm/components/ClipboardCopy/ClipboardCopy.d.ts +2 -0
  3. package/dist/esm/components/ClipboardCopy/ClipboardCopy.d.ts.map +1 -1
  4. package/dist/esm/components/ClipboardCopy/ClipboardCopy.js +4 -3
  5. package/dist/esm/components/ClipboardCopy/ClipboardCopy.js.map +1 -1
  6. package/dist/esm/components/ClipboardCopy/ClipboardCopyButton.d.ts +2 -0
  7. package/dist/esm/components/ClipboardCopy/ClipboardCopyButton.d.ts.map +1 -1
  8. package/dist/esm/components/ClipboardCopy/ClipboardCopyButton.js +2 -2
  9. package/dist/esm/components/ClipboardCopy/ClipboardCopyButton.js.map +1 -1
  10. package/dist/esm/components/SearchInput/AdvancedSearchMenu.d.ts.map +1 -1
  11. package/dist/esm/components/SearchInput/AdvancedSearchMenu.js +5 -4
  12. package/dist/esm/components/SearchInput/AdvancedSearchMenu.js.map +1 -1
  13. package/dist/esm/components/SearchInput/SearchInput.d.ts.map +1 -1
  14. package/dist/esm/components/SearchInput/SearchInput.js +23 -3
  15. package/dist/esm/components/SearchInput/SearchInput.js.map +1 -1
  16. package/dist/esm/components/Truncate/Truncate.d.ts +2 -0
  17. package/dist/esm/components/Truncate/Truncate.d.ts.map +1 -1
  18. package/dist/esm/components/Truncate/Truncate.js +2 -2
  19. package/dist/esm/components/Truncate/Truncate.js.map +1 -1
  20. package/dist/js/components/ClipboardCopy/ClipboardCopy.d.ts +2 -0
  21. package/dist/js/components/ClipboardCopy/ClipboardCopy.d.ts.map +1 -1
  22. package/dist/js/components/ClipboardCopy/ClipboardCopy.js +4 -3
  23. package/dist/js/components/ClipboardCopy/ClipboardCopy.js.map +1 -1
  24. package/dist/js/components/ClipboardCopy/ClipboardCopyButton.d.ts +2 -0
  25. package/dist/js/components/ClipboardCopy/ClipboardCopyButton.d.ts.map +1 -1
  26. package/dist/js/components/ClipboardCopy/ClipboardCopyButton.js +2 -2
  27. package/dist/js/components/ClipboardCopy/ClipboardCopyButton.js.map +1 -1
  28. package/dist/js/components/SearchInput/AdvancedSearchMenu.d.ts.map +1 -1
  29. package/dist/js/components/SearchInput/AdvancedSearchMenu.js +5 -4
  30. package/dist/js/components/SearchInput/AdvancedSearchMenu.js.map +1 -1
  31. package/dist/js/components/SearchInput/SearchInput.d.ts.map +1 -1
  32. package/dist/js/components/SearchInput/SearchInput.js +23 -3
  33. package/dist/js/components/SearchInput/SearchInput.js.map +1 -1
  34. package/dist/js/components/Truncate/Truncate.d.ts +2 -0
  35. package/dist/js/components/Truncate/Truncate.d.ts.map +1 -1
  36. package/dist/js/components/Truncate/Truncate.js +2 -2
  37. package/dist/js/components/Truncate/Truncate.js.map +1 -1
  38. package/dist/umd/react-core.min.css +108 -108
  39. package/dist/umd/react-core.min.js +2 -2
  40. package/package.json +2 -2
  41. package/src/components/ClipboardCopy/ClipboardCopy.tsx +6 -1
  42. package/src/components/ClipboardCopy/ClipboardCopyButton.tsx +4 -0
  43. package/src/components/SearchInput/AdvancedSearchMenu.tsx +7 -4
  44. package/src/components/SearchInput/SearchInput.tsx +26 -3
  45. package/src/components/SearchInput/examples/SearchInput.md +4 -0
  46. package/src/components/Truncate/Truncate.tsx +4 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/react-core",
3
- "version": "4.265.1",
3
+ "version": "4.266.0",
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": "48ab4d42a8037f77aa57bdfa3211745d4d873f34"
80
+ "gitHead": "c7ebbf2f2179a313370f6d386fec2c6c4fa5d9c2"
81
81
  }
@@ -65,6 +65,8 @@ export interface ClipboardCopyProps extends Omit<React.HTMLProps<HTMLDivElement>
65
65
  | 'left-end'
66
66
  | 'right-start'
67
67
  | 'right-end';
68
+ /** @beta Opt-in for updated popper that does not use findDOMNode. */
69
+ removeFindDomNode?: boolean;
68
70
  /** Maximum width of the tooltip (default 150px). */
69
71
  maxWidth?: string;
70
72
  /** Delay in ms before the tooltip disappears. */
@@ -125,7 +127,8 @@ export class ClipboardCopy extends React.Component<ClipboardCopyProps, Clipboard
125
127
  textAriaLabel: 'Copyable input',
126
128
  toggleAriaLabel: 'Show content',
127
129
  additionalActions: null,
128
- ouiaSafe: true
130
+ ouiaSafe: true,
131
+ removeFindDomNode: false
129
132
  };
130
133
 
131
134
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -177,6 +180,7 @@ export class ClipboardCopy extends React.Component<ClipboardCopyProps, Clipboard
177
180
  additionalActions,
178
181
  ouiaId,
179
182
  ouiaSafe,
183
+ removeFindDomNode,
180
184
  ...divProps
181
185
  } = this.props;
182
186
  const textIdPrefix = 'text-input-';
@@ -269,6 +273,7 @@ export class ClipboardCopy extends React.Component<ClipboardCopyProps, Clipboard
269
273
  this.setState({ copied: true });
270
274
  }}
271
275
  onTooltipHidden={() => this.setState({ copied: false })}
276
+ removeFindDomNode={removeFindDomNode}
272
277
  >
273
278
  {this.state.copied ? clickTip : hoverTip}
274
279
  </ClipboardCopyButton>
@@ -39,6 +39,8 @@ export interface ClipboardCopyButtonProps
39
39
  | 'left-end'
40
40
  | 'right-start'
41
41
  | 'right-end';
42
+ /** @beta Opt-in for updated popper that does not use findDOMNode. */
43
+ removeFindDomNode?: boolean;
42
44
  /** Aria-label for the copy button */
43
45
  'aria-label'?: string;
44
46
  /** Variant of the copy button */
@@ -59,6 +61,7 @@ export const ClipboardCopyButton: React.FunctionComponent<ClipboardCopyButtonPro
59
61
  children,
60
62
  variant = 'control',
61
63
  onTooltipHidden = () => {},
64
+ removeFindDomNode = false,
62
65
  ...props
63
66
  }: ClipboardCopyButtonProps) => (
64
67
  <Tooltip
@@ -71,6 +74,7 @@ export const ClipboardCopyButton: React.FunctionComponent<ClipboardCopyButtonPro
71
74
  aria="none"
72
75
  content={<div>{children}</div>}
73
76
  onTooltipHidden={onTooltipHidden}
77
+ removeFindDomNode={removeFindDomNode}
74
78
  >
75
79
  <Button
76
80
  type="button"
@@ -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
  ```
@@ -41,6 +41,8 @@ interface TruncateProps extends React.HTMLProps<HTMLSpanElement> {
41
41
  | 'left-end'
42
42
  | 'right-start'
43
43
  | 'right-end';
44
+ /** @beta Opt-in for updated popper that does not use findDOMNode. */
45
+ removeFindDomNode?: boolean;
44
46
  }
45
47
 
46
48
  const sliceContent = (str: string, slice: number) => [str.slice(0, str.length - slice), str.slice(-slice)];
@@ -51,9 +53,10 @@ export const Truncate: React.FunctionComponent<TruncateProps> = ({
51
53
  tooltipPosition = 'top',
52
54
  trailingNumChars = 7,
53
55
  content,
56
+ removeFindDomNode,
54
57
  ...props
55
58
  }: TruncateProps) => (
56
- <Tooltip position={tooltipPosition} content={content}>
59
+ <Tooltip position={tooltipPosition} content={content} removeFindDomNode={removeFindDomNode}>
57
60
  <span className={css(styles.truncate, className)} {...props}>
58
61
  {(position === TruncatePosition.end || position === TruncatePosition.start) && (
59
62
  <span className={truncateStyles[position]}>