@patternfly/react-core 4.257.1 → 4.258.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/react-core",
3
- "version": "4.257.1",
3
+ "version": "4.258.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",
@@ -70,5 +70,5 @@
70
70
  "react": "^16.8 || ^17 || ^18",
71
71
  "react-dom": "^16.8 || ^17 || ^18"
72
72
  },
73
- "gitHead": "9aafcbc3a7986f6fb5837f887cf1a25f01a11e8b"
73
+ "gitHead": "d16f3d69a570fd14b74f511300d693fdd1a231e0"
74
74
  }
@@ -260,8 +260,20 @@ export const Popover: React.FunctionComponent<PopoverProps> = ({
260
260
  closeBtnAriaLabel = 'Close',
261
261
  showClose = true,
262
262
  distance = 25,
263
- // For every initial starting position, there are 3 escape positions
264
- flipBehavior = ['top', 'right', 'bottom', 'left', 'top', 'right', 'bottom'],
263
+ flipBehavior = [
264
+ 'top',
265
+ 'bottom',
266
+ 'left',
267
+ 'right',
268
+ 'top-start',
269
+ 'top-end',
270
+ 'bottom-start',
271
+ 'bottom-end',
272
+ 'left-start',
273
+ 'left-end',
274
+ 'right-start',
275
+ 'right-end'
276
+ ],
265
277
  animationDuration = 300,
266
278
  id,
267
279
  withFocusTrap: propWithFocusTrap,
@@ -1,17 +1,45 @@
1
1
  import * as React from 'react';
2
2
  import * as ReactDOM from 'react-dom';
3
3
  import { usePopper } from './thirdparty/react-popper/usePopper';
4
- import { Placement, BasePlacement, Modifier } from './thirdparty/popper-core';
4
+ import { Placement, Modifier } from './thirdparty/popper-core';
5
5
  import { css } from '@patternfly/react-styles';
6
6
  import { FindRefWrapper } from './FindRefWrapper';
7
7
  import '@patternfly/react-styles/css/components/Popper/Popper.css';
8
8
 
9
- const hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
9
+ const hash = {
10
+ left: 'right',
11
+ right: 'left',
12
+ bottom: 'top',
13
+ top: 'bottom',
14
+ 'top-start': 'bottom-end',
15
+ 'top-end': 'bottom-start',
16
+ 'bottom-start': 'top-end',
17
+ 'bottom-end': 'top-start',
18
+ 'left-start': 'right-end',
19
+ 'left-end': 'right-start',
20
+ 'right-start': 'left-end',
21
+ 'right-end': 'left-start'
22
+ };
10
23
 
11
24
  const getOppositePlacement = (placement: Placement): any =>
12
25
  placement.replace(
13
- /left|right|bottom|top/g,
14
- (matched: string) => hash[matched as 'left' | 'right' | 'bottom' | 'top'] as BasePlacement
26
+ /left|right|bottom|top|top-start|top-end|bottom-start|bottom-end|right-start|right-end|left-start|left-end/g,
27
+ (matched: string) =>
28
+ hash[
29
+ matched as
30
+ | 'left'
31
+ | 'right'
32
+ | 'bottom'
33
+ | 'top'
34
+ | 'top-start'
35
+ | 'top-end'
36
+ | 'bottom-start'
37
+ | 'bottom-end'
38
+ | 'right-start'
39
+ | 'right-end'
40
+ | 'left-start'
41
+ | 'left-end'
42
+ ] as Placement
15
43
  );
16
44
 
17
45
  /** @deprecated Please use the menuAppendTo prop directly from within the PF component which uses it. */