@patternfly/react-core 4.192.16 → 4.192.20

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 (33) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/dist/esm/components/Button/Button.d.ts.map +1 -1
  3. package/dist/esm/components/Button/Button.js +2 -1
  4. package/dist/esm/components/Button/Button.js.map +1 -1
  5. package/dist/esm/components/Select/Select.d.ts +1 -1
  6. package/dist/esm/components/Select/Select.d.ts.map +1 -1
  7. package/dist/esm/components/Select/Select.js +1 -2
  8. package/dist/esm/components/Select/Select.js.map +1 -1
  9. package/dist/esm/components/TimePicker/TimePicker.d.ts.map +1 -1
  10. package/dist/esm/components/TimePicker/TimePicker.js +3 -3
  11. package/dist/esm/components/TimePicker/TimePicker.js.map +1 -1
  12. package/dist/js/components/Button/Button.d.ts.map +1 -1
  13. package/dist/js/components/Button/Button.js +2 -1
  14. package/dist/js/components/Button/Button.js.map +1 -1
  15. package/dist/js/components/Select/Select.d.ts +1 -1
  16. package/dist/js/components/Select/Select.d.ts.map +1 -1
  17. package/dist/js/components/Select/Select.js +6 -7
  18. package/dist/js/components/Select/Select.js.map +1 -1
  19. package/dist/js/components/TimePicker/TimePicker.d.ts.map +1 -1
  20. package/dist/js/components/TimePicker/TimePicker.js +3 -3
  21. package/dist/js/components/TimePicker/TimePicker.js.map +1 -1
  22. package/dist/umd/react-core.css +12 -12
  23. package/dist/umd/react-core.js +6 -5
  24. package/dist/umd/react-core.min.js +3 -3
  25. package/package.json +5 -5
  26. package/src/components/Button/Button.tsx +2 -1
  27. package/src/components/Button/__tests__/Button.test.tsx +5 -0
  28. package/src/components/Button/__tests__/__snapshots__/Button.test.tsx.snap +67 -0
  29. package/src/components/Button/examples/Button.md +2 -0
  30. package/src/components/Button/examples/ButtonProgress.tsx +10 -1
  31. package/src/components/Select/Select.tsx +2 -3
  32. package/src/components/TimePicker/TimePicker.tsx +3 -3
  33. package/src/components/TimePicker/__tests__/TimePicker.test.tsx +9 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/react-core",
3
- "version": "4.192.16",
3
+ "version": "4.192.20",
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,9 +34,9 @@
34
34
  "generate": "node scripts/copyStyles.js"
35
35
  },
36
36
  "dependencies": {
37
- "@patternfly/react-icons": "^4.43.16",
38
- "@patternfly/react-styles": "^4.42.16",
39
- "@patternfly/react-tokens": "^4.44.16",
37
+ "@patternfly/react-icons": "^4.43.20",
38
+ "@patternfly/react-styles": "^4.42.20",
39
+ "@patternfly/react-tokens": "^4.44.20",
40
40
  "focus-trap": "6.2.2",
41
41
  "react-dropzone": "9.0.0",
42
42
  "tippy.js": "5.1.2",
@@ -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": "ab8881705440faa1a8f31a49214067790be5c228"
63
+ "gitHead": "48cfe47616a942dffa21d98bedafc976d11d26ed"
64
64
  }
@@ -131,7 +131,7 @@ const ButtonBase: React.FunctionComponent<ButtonProps> = ({
131
131
  isActive && styles.modifiers.active,
132
132
  isInline && variant === ButtonVariant.link && styles.modifiers.inline,
133
133
  isDanger && (variant === ButtonVariant.secondary || variant === ButtonVariant.link) && styles.modifiers.danger,
134
- isLoading !== null && styles.modifiers.progress,
134
+ isLoading !== null && children !== null && styles.modifiers.progress,
135
135
  isLoading && styles.modifiers.inProgress,
136
136
  isSmall && styles.modifiers.small,
137
137
  isLarge && styles.modifiers.displayLg,
@@ -149,6 +149,7 @@ const ButtonBase: React.FunctionComponent<ButtonProps> = ({
149
149
  <Spinner size={spinnerSize.md} aria-valuetext={spinnerAriaValueText} />
150
150
  </span>
151
151
  )}
152
+ {variant === ButtonVariant.plain && children === null && icon ? icon : null}
152
153
  {variant !== ButtonVariant.plain && icon && iconPosition === 'left' && (
153
154
  <span className={css(styles.buttonIcon, styles.modifiers.start)}>{icon}</span>
154
155
  )}
@@ -124,3 +124,8 @@ test('setting tab index through props', () => {
124
124
  const view = mount(<Button tabIndex={0}>TabIndex 0 Button</Button>);
125
125
  expect(view.find('button').props().tabIndex).toBe(0);
126
126
  });
127
+
128
+ test('isLoading icon only', () => {
129
+ const view = mount(<Button variant="plain" isLoading aria-label="Upload" isLoading spinnerAriaValueText="Loading" icon={<div>ICON</div>} />)
130
+ expect(view).toMatchSnapshot();
131
+ })
@@ -350,6 +350,73 @@ exports[`isLoading 1`] = `
350
350
  </Button>
351
351
  `;
352
352
 
353
+ exports[`isLoading icon only 1`] = `
354
+ <Button
355
+ aria-label="Upload"
356
+ icon={
357
+ <div>
358
+ ICON
359
+ </div>
360
+ }
361
+ isLoading={true}
362
+ spinnerAriaValueText="Loading"
363
+ variant="plain"
364
+ >
365
+ <ButtonBase
366
+ aria-label="Upload"
367
+ icon={
368
+ <div>
369
+ ICON
370
+ </div>
371
+ }
372
+ innerRef={null}
373
+ isLoading={true}
374
+ spinnerAriaValueText="Loading"
375
+ variant="plain"
376
+ >
377
+ <button
378
+ aria-disabled={false}
379
+ aria-label="Upload"
380
+ className="pf-c-button pf-m-plain pf-m-in-progress"
381
+ data-ouia-component-id="OUIA-Generated-Button-plain-2"
382
+ data-ouia-component-type="PF4/Button"
383
+ data-ouia-safe={true}
384
+ disabled={false}
385
+ role={null}
386
+ type="button"
387
+ >
388
+ <span
389
+ className="pf-c-button__progress"
390
+ >
391
+ <Spinner
392
+ aria-valuetext="Loading"
393
+ size="md"
394
+ >
395
+ <span
396
+ aria-valuetext="Loading"
397
+ className="pf-c-spinner pf-m-md"
398
+ role="progressbar"
399
+ >
400
+ <span
401
+ className="pf-c-spinner__clipper"
402
+ />
403
+ <span
404
+ className="pf-c-spinner__lead-ball"
405
+ />
406
+ <span
407
+ className="pf-c-spinner__tail-ball"
408
+ />
409
+ </span>
410
+ </Spinner>
411
+ </span>
412
+ <div>
413
+ ICON
414
+ </div>
415
+ </button>
416
+ </ButtonBase>
417
+ </Button>
418
+ `;
419
+
353
420
  exports[`isSmall 1`] = `
354
421
  <Button
355
422
  isSmall={true}
@@ -11,6 +11,7 @@ import PlusCircleIcon from '@patternfly/react-icons/dist/esm/icons/plus-circle-i
11
11
  import ExternalLinkSquareAltIcon from '@patternfly/react-icons/dist/esm/icons/external-link-square-alt-icon';
12
12
  import CopyIcon from '@patternfly/react-icons/dist/esm/icons/copy-icon';
13
13
  import ArrowRightIcon from '@patternfly/react-icons/dist/esm/icons/arrow-right-icon';
14
+ import UploadIcon from '@patternfly/react-icons/dist/esm/icons/upload-icon';
14
15
  import { Link } from '@reach/router';
15
16
 
16
17
  ## Examples
@@ -79,3 +80,4 @@ import { Link } from '@reach/router';
79
80
 
80
81
  ```ts file="./ButtonRouterLink.tsx"
81
82
  ```
83
+
@@ -1,9 +1,11 @@
1
1
  import React from 'react';
2
2
  import { Button } from '@patternfly/react-core';
3
+ import UploadIcon from '@patternfly/react-icons/dist/esm/icons/upload-icon';
3
4
 
4
5
  export const ButtonProgress: React.FunctionComponent = () => {
5
6
  const [isPrimaryLoading, setIsPrimaryLoading] = React.useState<boolean>(true);
6
7
  const [isSecondaryLoading, setIsSecondaryLoading] = React.useState<boolean>(true);
8
+ const [isUploading, setIsUploading] = React.useState(true);
7
9
 
8
10
  return (
9
11
  <React.Fragment>
@@ -24,7 +26,14 @@ export const ButtonProgress: React.FunctionComponent = () => {
24
26
  {...(isSecondaryLoading && { spinnerAriaValueText: 'Loading' })}
25
27
  >
26
28
  {isSecondaryLoading ? 'Click to stop loading' : 'Click to start loading'}
27
- </Button>
29
+ </Button>{' '}
30
+ <Button
31
+ spinnerAriaValueText={isUploading ? 'Loading' : undefined}
32
+ isLoading={isUploading}
33
+ variant="plain"
34
+ onClick={() => setIsUploading(!isUploading)}
35
+ icon={<UploadIcon />}
36
+ />
28
37
  <br />
29
38
  <br />
30
39
  </React.Fragment>
@@ -31,7 +31,6 @@ import {
31
31
  PickOptional,
32
32
  GenerateId
33
33
  } from '../../helpers';
34
- import { getUniqueId } from '../../helpers/util';
35
34
  import { Divider } from '../Divider';
36
35
  import { ToggleMenuBaseProps, Popper } from '../../helpers/Popper/Popper';
37
36
  import { createRenderableFavorites, extendItemsWithFavorite } from '../../helpers/favorites';
@@ -149,7 +148,7 @@ export interface SelectProps
149
148
  customBadgeText?: string | number;
150
149
  /** Prefix for the id of the input in the checkbox select variant*/
151
150
  inputIdPrefix?: string;
152
- /** Value for the typeahead and inline filtering input autocomplete attribute */
151
+ /** Value for the typeahead and inline filtering input autocomplete attribute. When targeting Chrome this property should be a random string. */
153
152
  inputAutoComplete?: string;
154
153
  /** Optional props to pass to the chip group in the typeaheadmulti variant */
155
154
  chipGroupProps?: Omit<ChipGroupProps, 'children' | 'ref'>;
@@ -224,7 +223,7 @@ export class Select extends React.Component<SelectProps & OUIAProps, SelectState
224
223
  inlineFilterPlaceholderText: null,
225
224
  customBadgeText: null,
226
225
  inputIdPrefix: '',
227
- inputAutoComplete: navigator.userAgent.match('Chrome') ? getUniqueId('pf-no-autocomplete') : 'off',
226
+ inputAutoComplete: 'off',
228
227
  menuAppendTo: 'inline',
229
228
  favorites: [] as string[],
230
229
  favoritesLabel: 'Favorites',
@@ -357,7 +357,8 @@ export class TimePicker extends React.Component<TimePickerProps, TimePickerState
357
357
 
358
358
  this.inputRef.current.focus();
359
359
  this.setState({
360
- isOpen: false
360
+ isOpen: false,
361
+ isInvalid: false
361
362
  });
362
363
  };
363
364
 
@@ -383,8 +384,7 @@ export class TimePicker extends React.Component<TimePickerProps, TimePickerState
383
384
  }
384
385
  this.scrollToSelection(newTime);
385
386
  this.setState({
386
- timeState: newTime,
387
- isInvalid: !this.isValid(newTime)
387
+ timeState: newTime
388
388
  });
389
389
  };
390
390
 
@@ -72,7 +72,7 @@ describe('test isInvalid', () => {
72
72
  expect(view.find('.pf-m-error')).toHaveLength(0);
73
73
  })
74
74
 
75
- test('should be invalid after onChange', () => {
75
+ test('should be invalid after onBlur', () => {
76
76
  const validateTime = (time: string) => {
77
77
  return false;
78
78
  }
@@ -87,6 +87,10 @@ describe('test isInvalid', () => {
87
87
  })
88
88
  view.update();
89
89
 
90
+ expect(view.find('.pf-m-error')).toHaveLength(0);
91
+
92
+ view.find('input').simulate('blur');
93
+
90
94
  expect(view.find('.pf-m-error')).toHaveLength(1);
91
95
  })
92
96
  })
@@ -125,6 +129,10 @@ describe('test includeSeconds', () => {
125
129
  act(() => view.find('input').prop('onChange')(event));
126
130
  view.update();
127
131
 
132
+ expect(view.find('.pf-m-error')).toHaveLength(0);
133
+
134
+ view.find('input').simulate('blur');
135
+
128
136
  expect(view.find('.pf-m-error')).toHaveLength(1);
129
137
  });
130
138
  });