@patternfly/react-core 4.168.10 → 4.169.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 (75) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/dist/esm/components/AboutModal/AboutModal.d.ts +2 -0
  3. package/dist/esm/components/AboutModal/AboutModal.d.ts.map +1 -1
  4. package/dist/esm/components/AboutModal/AboutModal.js.map +1 -1
  5. package/dist/esm/components/AboutModal/AboutModalContainer.d.ts +2 -0
  6. package/dist/esm/components/AboutModal/AboutModalContainer.d.ts.map +1 -1
  7. package/dist/esm/components/AboutModal/AboutModalContainer.js +2 -2
  8. package/dist/esm/components/AboutModal/AboutModalContainer.js.map +1 -1
  9. package/dist/esm/components/Popover/Popover.d.ts +2 -0
  10. package/dist/esm/components/Popover/Popover.d.ts.map +1 -1
  11. package/dist/esm/components/Popover/Popover.js +5 -3
  12. package/dist/esm/components/Popover/Popover.js.map +1 -1
  13. package/dist/esm/components/Popover/PopoverContext.d.ts +7 -0
  14. package/dist/esm/components/Popover/PopoverContext.d.ts.map +1 -0
  15. package/dist/esm/components/Popover/PopoverContext.js +3 -0
  16. package/dist/esm/components/Popover/PopoverContext.js.map +1 -0
  17. package/dist/esm/components/Popover/PopoverHeader.d.ts.map +1 -1
  18. package/dist/esm/components/Popover/PopoverHeader.js +2 -1
  19. package/dist/esm/components/Popover/PopoverHeader.js.map +1 -1
  20. package/dist/esm/components/TextInput/TextInput.d.ts +1 -0
  21. package/dist/esm/components/TextInput/TextInput.d.ts.map +1 -1
  22. package/dist/esm/components/TextInput/TextInput.js +6 -7
  23. package/dist/esm/components/TextInput/TextInput.js.map +1 -1
  24. package/dist/esm/helpers/index.d.ts +1 -0
  25. package/dist/esm/helpers/index.d.ts.map +1 -1
  26. package/dist/esm/helpers/index.js +1 -0
  27. package/dist/esm/helpers/index.js.map +1 -1
  28. package/dist/esm/helpers/resizeObserver.d.ts +62 -0
  29. package/dist/esm/helpers/resizeObserver.d.ts.map +1 -0
  30. package/dist/esm/helpers/resizeObserver.js +89 -0
  31. package/dist/esm/helpers/resizeObserver.js.map +1 -0
  32. package/dist/js/components/AboutModal/AboutModal.d.ts +2 -0
  33. package/dist/js/components/AboutModal/AboutModal.d.ts.map +1 -1
  34. package/dist/js/components/AboutModal/AboutModal.js.map +1 -1
  35. package/dist/js/components/AboutModal/AboutModalContainer.d.ts +2 -0
  36. package/dist/js/components/AboutModal/AboutModalContainer.d.ts.map +1 -1
  37. package/dist/js/components/AboutModal/AboutModalContainer.js +2 -2
  38. package/dist/js/components/AboutModal/AboutModalContainer.js.map +1 -1
  39. package/dist/js/components/Popover/Popover.d.ts +2 -0
  40. package/dist/js/components/Popover/Popover.d.ts.map +1 -1
  41. package/dist/js/components/Popover/Popover.js +5 -3
  42. package/dist/js/components/Popover/Popover.js.map +1 -1
  43. package/dist/js/components/Popover/PopoverContext.d.ts +7 -0
  44. package/dist/js/components/Popover/PopoverContext.d.ts.map +1 -0
  45. package/dist/js/components/Popover/PopoverContext.js +7 -0
  46. package/dist/js/components/Popover/PopoverContext.js.map +1 -0
  47. package/dist/js/components/Popover/PopoverHeader.d.ts.map +1 -1
  48. package/dist/js/components/Popover/PopoverHeader.js +2 -1
  49. package/dist/js/components/Popover/PopoverHeader.js.map +1 -1
  50. package/dist/js/components/TextInput/TextInput.d.ts +1 -0
  51. package/dist/js/components/TextInput/TextInput.d.ts.map +1 -1
  52. package/dist/js/components/TextInput/TextInput.js +5 -6
  53. package/dist/js/components/TextInput/TextInput.js.map +1 -1
  54. package/dist/js/helpers/index.d.ts +1 -0
  55. package/dist/js/helpers/index.d.ts.map +1 -1
  56. package/dist/js/helpers/index.js +1 -0
  57. package/dist/js/helpers/index.js.map +1 -1
  58. package/dist/js/helpers/resizeObserver.d.ts +62 -0
  59. package/dist/js/helpers/resizeObserver.d.ts.map +1 -0
  60. package/dist/js/helpers/resizeObserver.js +93 -0
  61. package/dist/js/helpers/resizeObserver.js.map +1 -0
  62. package/dist/umd/react-core.js +102 -12
  63. package/dist/umd/react-core.min.js +3 -3
  64. package/package.json +5 -5
  65. package/src/components/AboutModal/AboutModal.tsx +2 -0
  66. package/src/components/AboutModal/AboutModalContainer.tsx +8 -1
  67. package/src/components/Popover/Popover.tsx +24 -18
  68. package/src/components/Popover/PopoverContext.tsx +7 -0
  69. package/src/components/Popover/PopoverHeader.tsx +8 -3
  70. package/src/components/Popover/__tests__/Generated/__snapshots__/Popover.test.tsx.snap +91 -83
  71. package/src/components/Popover/__tests__/Generated/__snapshots__/PopoverHeader.test.tsx.snap +3 -9
  72. package/src/components/Popover/__tests__/__snapshots__/Popover.test.tsx.snap +406 -374
  73. package/src/components/TextInput/TextInput.tsx +6 -7
  74. package/src/helpers/index.ts +1 -0
  75. package/src/helpers/resizeObserver.tsx +90 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/react-core",
3
- "version": "4.168.10",
3
+ "version": "4.169.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",
@@ -34,9 +34,9 @@
34
34
  "generate": "node scripts/copyStyles.js"
35
35
  },
36
36
  "dependencies": {
37
- "@patternfly/react-icons": "^4.19.10",
38
- "@patternfly/react-styles": "^4.18.10",
39
- "@patternfly/react-tokens": "^4.20.10",
37
+ "@patternfly/react-icons": "^4.20.2",
38
+ "@patternfly/react-styles": "^4.19.2",
39
+ "@patternfly/react-tokens": "^4.21.2",
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": "67e19e6066f3587428f52544ae00beb89827adc5"
63
+ "gitHead": "fef8a9f3a2a4a522fba27c683d298fd817b95f57"
64
64
  }
@@ -32,6 +32,8 @@ export interface AboutModalProps {
32
32
  appendTo?: HTMLElement | (() => HTMLElement);
33
33
  /** Set aria label to the close button */
34
34
  closeButtonAriaLabel?: string;
35
+ /** Flag to disable focus trap */
36
+ disableFocusTrap?: boolean;
35
37
  }
36
38
 
37
39
  interface ModalState {
@@ -36,6 +36,8 @@ export interface AboutModalContainerProps extends React.HTMLProps<HTMLDivElement
36
36
  aboutModalBoxContentId: string;
37
37
  /** Set close button aria label */
38
38
  closeButtonAriaLabel?: string;
39
+ /** Flag to disable focus trap */
40
+ disableFocusTrap?: boolean;
39
41
  }
40
42
 
41
43
  export const AboutModalContainer: React.FunctionComponent<AboutModalContainerProps> = ({
@@ -51,6 +53,7 @@ export const AboutModalContainer: React.FunctionComponent<AboutModalContainerPro
51
53
  closeButtonAriaLabel,
52
54
  aboutModalBoxHeaderId,
53
55
  aboutModalBoxContentId,
56
+ disableFocusTrap = false,
54
57
  ...props
55
58
  }: AboutModalContainerProps) => {
56
59
  if (!isOpen) {
@@ -58,7 +61,11 @@ export const AboutModalContainer: React.FunctionComponent<AboutModalContainerPro
58
61
  }
59
62
  return (
60
63
  <Backdrop>
61
- <FocusTrap focusTrapOptions={{ clickOutsideDeactivates: true }} className={css(styles.bullseye)}>
64
+ <FocusTrap
65
+ active={!disableFocusTrap}
66
+ focusTrapOptions={{ clickOutsideDeactivates: true }}
67
+ className={css(styles.bullseye)}
68
+ >
62
69
  <AboutModalBox
63
70
  className={className}
64
71
  aria-labelledby={aboutModalBoxHeaderId}
@@ -3,6 +3,7 @@ import * as React from 'react';
3
3
  import { KEY_CODES } from '../../helpers/constants';
4
4
  import styles from '@patternfly/react-styles/css/components/Popover/popover';
5
5
  import { css } from '@patternfly/react-styles';
6
+ import { PopoverContext } from './PopoverContext';
6
7
  import { PopoverContent } from './PopoverContent';
7
8
  import { PopoverBody } from './PopoverBody';
8
9
  import { PopoverHeader } from './PopoverHeader';
@@ -109,6 +110,8 @@ export interface PopoverProps {
109
110
  * i.e. headerContent={hide => <Button onClick={() => hide()}>Close</Button>}
110
111
  */
111
112
  headerContent?: React.ReactNode | ((hide: () => void) => React.ReactNode);
113
+ /** Sets the heading level to use for the popover header. Default is h6. */
114
+ headerComponent?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
112
115
  /** Hides the popover when a click occurs outside (only works if isVisible is not controlled by the user) */
113
116
  hideOnOutsideClick?: boolean;
114
117
  /**
@@ -206,6 +209,7 @@ export const Popover: React.FunctionComponent<PopoverProps> = ({
206
209
  'aria-label': ariaLabel = '',
207
210
  bodyContent,
208
211
  headerContent = null,
212
+ headerComponent = 'h6',
209
213
  footerContent = null,
210
214
  appendTo = () => document.body,
211
215
  hideOnOutsideClick = true,
@@ -435,24 +439,26 @@ export const Popover: React.FunctionComponent<PopoverProps> = ({
435
439
  );
436
440
 
437
441
  return (
438
- <Popper
439
- trigger={children}
440
- reference={reference}
441
- popper={content}
442
- popperMatchesTriggerWidth={false}
443
- appendTo={appendTo}
444
- isVisible={visible}
445
- positionModifiers={positionModifiers}
446
- distance={distance}
447
- placement={position}
448
- onTriggerClick={onTriggerClick}
449
- onTriggerEnter={onTriggerEnter}
450
- onDocumentClick={onDocumentClick}
451
- onDocumentKeyDown={onDocumentKeyDown}
452
- enableFlip={enableFlip}
453
- zIndex={zIndex}
454
- flipBehavior={flipBehavior}
455
- />
442
+ <PopoverContext.Provider value={{ headerComponent }}>
443
+ <Popper
444
+ trigger={children}
445
+ reference={reference}
446
+ popper={content}
447
+ popperMatchesTriggerWidth={false}
448
+ appendTo={appendTo}
449
+ isVisible={visible}
450
+ positionModifiers={positionModifiers}
451
+ distance={distance}
452
+ placement={position}
453
+ onTriggerClick={onTriggerClick}
454
+ onTriggerEnter={onTriggerEnter}
455
+ onDocumentClick={onDocumentClick}
456
+ onDocumentKeyDown={onDocumentKeyDown}
457
+ enableFlip={enableFlip}
458
+ zIndex={zIndex}
459
+ flipBehavior={flipBehavior}
460
+ />
461
+ </PopoverContext.Provider>
456
462
  );
457
463
  };
458
464
  Popover.displayName = 'Popover';
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+
3
+ interface PopoverContextProps {
4
+ headerComponent?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
5
+ }
6
+
7
+ export const PopoverContext = React.createContext<Partial<PopoverContextProps>>({});
@@ -1,14 +1,19 @@
1
1
  import * as React from 'react';
2
2
  import { Title, TitleSizes } from '../Title';
3
+ import { PopoverContext } from './PopoverContext';
3
4
 
4
5
  export const PopoverHeader: React.FunctionComponent<PopoverHeaderProps> = ({
5
6
  children,
6
7
  id,
7
8
  ...props
8
9
  }: PopoverHeaderProps) => (
9
- <Title headingLevel="h6" size={TitleSizes.md} id={id} {...props}>
10
- {children}
11
- </Title>
10
+ <PopoverContext.Consumer>
11
+ {({ headerComponent }) => (
12
+ <Title headingLevel={headerComponent} size={TitleSizes.md} id={id} {...props}>
13
+ {children}
14
+ </Title>
15
+ )}
16
+ </PopoverContext.Consumer>
12
17
  );
13
18
  PopoverHeader.displayName = 'PopoverHeader';
14
19
 
@@ -1,92 +1,100 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`Popover should match snapshot (auto-generated) 1`] = `
4
- <Popper
5
- appendTo={[Function]}
6
- distance={25}
7
- enableFlip={true}
8
- flipBehavior={
9
- Array [
10
- "top",
11
- "right",
12
- "bottom",
13
- "left",
14
- "top",
15
- "right",
16
- "bottom",
17
- ]
4
+ <ContextProvider
5
+ value={
6
+ Object {
7
+ "headerComponent": "h6",
8
+ }
18
9
  }
19
- isVisible={false}
20
- onDocumentClick={[Function]}
21
- onDocumentKeyDown={[Function]}
22
- onTriggerClick={[Function]}
23
- onTriggerEnter={[Function]}
24
- placement="top"
25
- popper={
26
- <FocusTrap
27
- active={false}
28
- aria-describedby="popover-test-body"
29
- aria-label="''"
30
- aria-modal="true"
31
- className="pf-c-popover ''"
32
- focusTrapOptions={
33
- Object {
34
- "clickOutsideDeactivates": true,
35
- "fallbackFocus": [Function],
36
- "returnFocusOnDeactivate": true,
10
+ >
11
+ <Popper
12
+ appendTo={[Function]}
13
+ distance={25}
14
+ enableFlip={true}
15
+ flipBehavior={
16
+ Array [
17
+ "top",
18
+ "right",
19
+ "bottom",
20
+ "left",
21
+ "top",
22
+ "right",
23
+ "bottom",
24
+ ]
25
+ }
26
+ isVisible={false}
27
+ onDocumentClick={[Function]}
28
+ onDocumentKeyDown={[Function]}
29
+ onTriggerClick={[Function]}
30
+ onTriggerEnter={[Function]}
31
+ placement="top"
32
+ popper={
33
+ <FocusTrap
34
+ active={false}
35
+ aria-describedby="popover-test-body"
36
+ aria-label="''"
37
+ aria-modal="true"
38
+ className="pf-c-popover ''"
39
+ focusTrapOptions={
40
+ Object {
41
+ "clickOutsideDeactivates": true,
42
+ "fallbackFocus": [Function],
43
+ "returnFocusOnDeactivate": true,
44
+ }
37
45
  }
38
- }
39
- onMouseDown={[Function]}
40
- paused={false}
41
- preventScrollOnDeactivate={true}
42
- role="dialog"
43
- style={
44
- Object {
45
- "maxWidth": "string",
46
- "minWidth": "string",
47
- "opacity": 0,
48
- "transition": "opacity 300ms cubic-bezier(.54, 1.5, .38, 1.11)",
46
+ onMouseDown={[Function]}
47
+ paused={false}
48
+ preventScrollOnDeactivate={true}
49
+ role="dialog"
50
+ style={
51
+ Object {
52
+ "maxWidth": "string",
53
+ "minWidth": "string",
54
+ "opacity": 0,
55
+ "transition": "opacity 300ms cubic-bezier(.54, 1.5, .38, 1.11)",
56
+ }
49
57
  }
58
+ >
59
+ <PopoverArrow />
60
+ <PopoverContent>
61
+ <PopoverCloseButton
62
+ aria-label="'Close'"
63
+ onClose={[Function]}
64
+ />
65
+ <PopoverBody
66
+ id="popover-test-body"
67
+ >
68
+ <div>
69
+ ReactNode
70
+ </div>
71
+ </PopoverBody>
72
+ </PopoverContent>
73
+ </FocusTrap>
74
+ }
75
+ popperMatchesTriggerWidth={false}
76
+ positionModifiers={
77
+ Object {
78
+ "bottom": "pf-m-bottom",
79
+ "bottom-end": "pf-m-bottom-right",
80
+ "bottom-start": "pf-m-bottom-left",
81
+ "left": "pf-m-left",
82
+ "left-end": "pf-m-left-bottom",
83
+ "left-start": "pf-m-left-top",
84
+ "right": "pf-m-right",
85
+ "right-end": "pf-m-right-bottom",
86
+ "right-start": "pf-m-right-top",
87
+ "top": "pf-m-top",
88
+ "top-end": "pf-m-top-right",
89
+ "top-start": "pf-m-top-left",
50
90
  }
51
- >
52
- <PopoverArrow />
53
- <PopoverContent>
54
- <PopoverCloseButton
55
- aria-label="'Close'"
56
- onClose={[Function]}
57
- />
58
- <PopoverBody
59
- id="popover-test-body"
60
- >
61
- <div>
62
- ReactNode
63
- </div>
64
- </PopoverBody>
65
- </PopoverContent>
66
- </FocusTrap>
67
- }
68
- popperMatchesTriggerWidth={false}
69
- positionModifiers={
70
- Object {
71
- "bottom": "pf-m-bottom",
72
- "bottom-end": "pf-m-bottom-right",
73
- "bottom-start": "pf-m-bottom-left",
74
- "left": "pf-m-left",
75
- "left-end": "pf-m-left-bottom",
76
- "left-start": "pf-m-left-top",
77
- "right": "pf-m-right",
78
- "right-end": "pf-m-right-bottom",
79
- "right-start": "pf-m-right-top",
80
- "top": "pf-m-top",
81
- "top-end": "pf-m-top-right",
82
- "top-start": "pf-m-top-left",
83
91
  }
84
- }
85
- trigger={
86
- <p>
87
- ReactElement
88
- </p>
89
- }
90
- zIndex={9999}
91
- />
92
+ trigger={
93
+ <p>
94
+ ReactElement
95
+ </p>
96
+ }
97
+ zIndex={9999}
98
+ />
99
+ </ContextProvider>
92
100
  `;
@@ -1,13 +1,7 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`PopoverHeader should match snapshot (auto-generated) 1`] = `
4
- <Title
5
- headingLevel="h6"
6
- id="string"
7
- size="md"
8
- >
9
- <div>
10
- ReactNode
11
- </div>
12
- </Title>
4
+ <ContextConsumer>
5
+ <Component />
6
+ </ContextConsumer>
13
7
  `;