@patternfly/react-core 4.192.15 → 4.192.19

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 (41) hide show
  1. package/CHANGELOG.md +41 -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/NumberInput/NumberInput.d.ts.map +1 -1
  6. package/dist/esm/components/NumberInput/NumberInput.js +2 -1
  7. package/dist/esm/components/NumberInput/NumberInput.js.map +1 -1
  8. package/dist/esm/components/Select/Select.d.ts +1 -1
  9. package/dist/esm/components/Select/Select.d.ts.map +1 -1
  10. package/dist/esm/components/Select/Select.js +1 -2
  11. package/dist/esm/components/Select/Select.js.map +1 -1
  12. package/dist/esm/components/TimePicker/TimePicker.d.ts.map +1 -1
  13. package/dist/esm/components/TimePicker/TimePicker.js +3 -3
  14. package/dist/esm/components/TimePicker/TimePicker.js.map +1 -1
  15. package/dist/js/components/Button/Button.d.ts.map +1 -1
  16. package/dist/js/components/Button/Button.js +2 -1
  17. package/dist/js/components/Button/Button.js.map +1 -1
  18. package/dist/js/components/NumberInput/NumberInput.d.ts.map +1 -1
  19. package/dist/js/components/NumberInput/NumberInput.js +2 -1
  20. package/dist/js/components/NumberInput/NumberInput.js.map +1 -1
  21. package/dist/js/components/Select/Select.d.ts +1 -1
  22. package/dist/js/components/Select/Select.d.ts.map +1 -1
  23. package/dist/js/components/Select/Select.js +6 -7
  24. package/dist/js/components/Select/Select.js.map +1 -1
  25. package/dist/js/components/TimePicker/TimePicker.d.ts.map +1 -1
  26. package/dist/js/components/TimePicker/TimePicker.js +3 -3
  27. package/dist/js/components/TimePicker/TimePicker.js.map +1 -1
  28. package/dist/umd/react-core.css +69 -69
  29. package/dist/umd/react-core.js +7 -6
  30. package/dist/umd/react-core.min.js +3 -3
  31. package/package.json +5 -5
  32. package/src/components/Button/Button.tsx +2 -1
  33. package/src/components/Button/__tests__/Button.test.tsx +5 -0
  34. package/src/components/Button/__tests__/__snapshots__/Button.test.tsx.snap +67 -0
  35. package/src/components/Button/examples/Button.md +2 -0
  36. package/src/components/Button/examples/ButtonProgress.tsx +10 -1
  37. package/src/components/NumberInput/NumberInput.tsx +3 -2
  38. package/src/components/NumberInput/__tests__/__snapshots__/NumberInput.test.tsx.snap +1041 -1018
  39. package/src/components/Select/Select.tsx +2 -3
  40. package/src/components/TimePicker/TimePicker.tsx +3 -3
  41. 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.15",
3
+ "version": "4.192.19",
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.15",
38
- "@patternfly/react-styles": "^4.42.15",
39
- "@patternfly/react-tokens": "^4.44.15",
37
+ "@patternfly/react-icons": "^4.43.19",
38
+ "@patternfly/react-styles": "^4.42.19",
39
+ "@patternfly/react-tokens": "^4.44.19",
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": "43f728710c72197a3f6a093ec406de40cf12ce30"
63
+ "gitHead": "bc209995e347be2c3b41cd76790f890341b47b45"
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>
@@ -3,6 +3,7 @@ import styles from '@patternfly/react-styles/css/components/NumberInput/number-i
3
3
  import { css } from '@patternfly/react-styles';
4
4
  import MinusIcon from '@patternfly/react-icons/dist/esm/icons/minus-icon';
5
5
  import PlusIcon from '@patternfly/react-icons/dist/esm/icons/plus-icon';
6
+ import { InputGroup } from '../InputGroup';
6
7
  import { Button, ButtonProps } from '../Button';
7
8
  import { KEY_CODES } from '../../helpers';
8
9
 
@@ -94,7 +95,7 @@ export const NumberInput: React.FunctionComponent<NumberInputProps> = ({
94
95
  {...props}
95
96
  >
96
97
  {unit && unitPosition === 'before' && numberInputUnit}
97
- <div className={css(styles.inputGroup)}>
98
+ <InputGroup>
98
99
  <Button
99
100
  variant="control"
100
101
  aria-label={minusBtnAriaLabel}
@@ -129,7 +130,7 @@ export const NumberInput: React.FunctionComponent<NumberInputProps> = ({
129
130
  <PlusIcon aria-hidden="true" />
130
131
  </span>
131
132
  </Button>
132
- </div>
133
+ </InputGroup>
133
134
  {unit && unitPosition === 'after' && numberInputUnit}
134
135
  </div>
135
136
  );