@patternfly/react-core 4.217.2 → 4.217.3

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 (38) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/esm/components/ContextSelector/ContextSelector.d.ts +5 -0
  3. package/dist/esm/components/ContextSelector/ContextSelector.d.ts.map +1 -1
  4. package/dist/esm/components/ContextSelector/ContextSelector.js +4 -3
  5. package/dist/esm/components/ContextSelector/ContextSelector.js.map +1 -1
  6. package/dist/esm/components/Dropdown/Dropdown.d.ts +5 -0
  7. package/dist/esm/components/Dropdown/Dropdown.d.ts.map +1 -1
  8. package/dist/esm/components/Dropdown/Dropdown.js +2 -2
  9. package/dist/esm/components/Dropdown/Dropdown.js.map +1 -1
  10. package/dist/esm/components/Dropdown/DropdownWithContext.d.ts.map +1 -1
  11. package/dist/esm/components/Dropdown/DropdownWithContext.js +7 -3
  12. package/dist/esm/components/Dropdown/DropdownWithContext.js.map +1 -1
  13. package/dist/esm/components/Select/Select.d.ts +5 -0
  14. package/dist/esm/components/Select/Select.d.ts.map +1 -1
  15. package/dist/esm/components/Select/Select.js +7 -3
  16. package/dist/esm/components/Select/Select.js.map +1 -1
  17. package/dist/js/components/ContextSelector/ContextSelector.d.ts +5 -0
  18. package/dist/js/components/ContextSelector/ContextSelector.d.ts.map +1 -1
  19. package/dist/js/components/ContextSelector/ContextSelector.js +4 -3
  20. package/dist/js/components/ContextSelector/ContextSelector.js.map +1 -1
  21. package/dist/js/components/Dropdown/Dropdown.d.ts +5 -0
  22. package/dist/js/components/Dropdown/Dropdown.d.ts.map +1 -1
  23. package/dist/js/components/Dropdown/Dropdown.js +2 -2
  24. package/dist/js/components/Dropdown/Dropdown.js.map +1 -1
  25. package/dist/js/components/Dropdown/DropdownWithContext.d.ts.map +1 -1
  26. package/dist/js/components/Dropdown/DropdownWithContext.js +7 -3
  27. package/dist/js/components/Dropdown/DropdownWithContext.js.map +1 -1
  28. package/dist/js/components/Select/Select.d.ts +5 -0
  29. package/dist/js/components/Select/Select.d.ts.map +1 -1
  30. package/dist/js/components/Select/Select.js +7 -3
  31. package/dist/js/components/Select/Select.js.map +1 -1
  32. package/dist/umd/react-core.js +20 -11
  33. package/dist/umd/react-core.min.js +1 -1
  34. package/package.json +5 -5
  35. package/src/components/ContextSelector/ContextSelector.tsx +14 -2
  36. package/src/components/Dropdown/Dropdown.tsx +7 -1
  37. package/src/components/Dropdown/DropdownWithContext.tsx +6 -1
  38. package/src/components/Select/Select.tsx +11 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/react-core",
3
- "version": "4.217.2",
3
+ "version": "4.217.3",
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.68.2",
38
- "@patternfly/react-styles": "^4.67.2",
39
- "@patternfly/react-tokens": "^4.69.2",
37
+ "@patternfly/react-icons": "^4.68.3",
38
+ "@patternfly/react-styles": "^4.67.3",
39
+ "@patternfly/react-tokens": "^4.69.3",
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": "9aeee7e7186d7d8e8d572108ec54bea7bbb2bc6b"
63
+ "gitHead": "cb169f61276aee6fc695408537310c10cfb5f1f0"
64
64
  }
@@ -61,6 +61,11 @@ export interface ContextSelectorProps extends Omit<ToggleMenuBaseProps, 'menuApp
61
61
  isText?: boolean;
62
62
  /** Flag to disable focus trap */
63
63
  disableFocusTrap?: boolean;
64
+ /** Flag for indicating that the context selector menu should automatically flip vertically when
65
+ * it reaches the boundary. This prop can only be used when the context selector component is not
66
+ * appended inline, e.g. `menuAppendTo="parent"`
67
+ */
68
+ isFlipEnabled?: boolean;
64
69
  }
65
70
 
66
71
  export class ContextSelector extends React.Component<ContextSelectorProps, { ouiaStateId: string }> {
@@ -83,7 +88,8 @@ export class ContextSelector extends React.Component<ContextSelectorProps, { oui
83
88
  disableFocusTrap: false,
84
89
  footer: null as React.ReactNode,
85
90
  isPlain: false,
86
- isText: false
91
+ isText: false,
92
+ isFlipEnabled: false
87
93
  };
88
94
  constructor(props: ContextSelectorProps) {
89
95
  super(props);
@@ -126,10 +132,16 @@ export class ContextSelector extends React.Component<ContextSelectorProps, { oui
126
132
  isText,
127
133
  footer,
128
134
  disableFocusTrap,
135
+ isFlipEnabled,
129
136
  ...props
130
137
  } = this.props;
131
138
  const menuContainer = (
132
- <div className={css(styles.contextSelectorMenu)}>
139
+ <div
140
+ className={css(styles.contextSelectorMenu)}
141
+ // This removes the `position: absolute`styling from the `.pf-c-context-selector__menu`
142
+ // allowing the menu to flip correctly
143
+ {...(isFlipEnabled && { style: { position: 'revert' } })}
144
+ >
133
145
  {isOpen && (
134
146
  <FocusTrap active={!disableFocusTrap} focusTrapOptions={{ clickOutsideDeactivates: true }}>
135
147
  <div className={css(styles.contextSelectorMenuSearch)}>
@@ -55,6 +55,11 @@ export interface DropdownProps
55
55
  autoFocus?: boolean;
56
56
  /** Props for extreme customization of dropdown */
57
57
  contextProps?: typeof DropdownContext;
58
+ /** Flag for indicating that the dropdown menu should automatically flip vertically when
59
+ * it reaches the boundary. This prop can only be used when the dropdown component is not
60
+ * appended inline, e.g. `menuAppendTo="parent"`
61
+ */
62
+ isFlipEnabled?: boolean;
58
63
  }
59
64
 
60
65
  export const Dropdown: React.FunctionComponent<DropdownProps> = ({
@@ -66,6 +71,7 @@ export const Dropdown: React.FunctionComponent<DropdownProps> = ({
66
71
  alignments,
67
72
  contextProps,
68
73
  menuAppendTo = 'inline',
74
+ isFlipEnabled = false,
69
75
  ...props
70
76
  }: DropdownProps) => (
71
77
  <DropdownContext.Provider
@@ -91,7 +97,7 @@ export const Dropdown: React.FunctionComponent<DropdownProps> = ({
91
97
  ...contextProps
92
98
  }}
93
99
  >
94
- <DropdownWithContext menuAppendTo={menuAppendTo} {...props} />
100
+ <DropdownWithContext menuAppendTo={menuAppendTo} isFlipEnabled={isFlipEnabled} {...props} />
95
101
  </DropdownContext.Provider>
96
102
  );
97
103
  Dropdown.displayName = 'Dropdown';
@@ -29,7 +29,8 @@ export class DropdownWithContext extends React.Component<DropdownProps & OUIAPro
29
29
  direction: DropdownDirection.down,
30
30
  onSelect: (): void => undefined,
31
31
  autoFocus: true,
32
- menuAppendTo: 'inline'
32
+ menuAppendTo: 'inline',
33
+ isFlipEnabled: false
33
34
  };
34
35
 
35
36
  constructor(props: DropdownProps & OUIAProps) {
@@ -75,6 +76,7 @@ export class DropdownWithContext extends React.Component<DropdownProps & OUIAPro
75
76
  toggle,
76
77
  autoFocus,
77
78
  menuAppendTo,
79
+ isFlipEnabled,
78
80
  ...props
79
81
  } = this.props;
80
82
  const id = toggle.props.id || `pf-dropdown-toggle-id-${DropdownWithContext.currentId++}`;
@@ -96,6 +98,9 @@ export class DropdownWithContext extends React.Component<DropdownProps & OUIAPro
96
98
  const BaseComponent = baseComponent as any;
97
99
  const menuContainer = (
98
100
  <DropdownMenu
101
+ // This removes the `position: absolute` styling from the `.pf-c-dropdown__menu`
102
+ // allowing the menu to flip correctly
103
+ {...(isFlipEnabled && { style: { position: 'revert', minWidth: 'min-content' } })}
99
104
  setMenuComponentRef={this.setMenuComponentRef}
100
105
  component={component}
101
106
  isOpen={isOpen}
@@ -173,6 +173,11 @@ export interface SelectProps
173
173
  * menuAppendTo={document.getElementById('target')}
174
174
  */
175
175
  menuAppendTo?: HTMLElement | (() => HTMLElement) | 'inline' | 'parent';
176
+ /** Flag for indicating that the select menu should automatically flip vertically when
177
+ * it reaches the boundary. This prop can only be used when the select component is not
178
+ * appended inline, e.g. `menuAppendTo="parent"`
179
+ */
180
+ isFlipEnabled?: boolean;
176
181
  }
177
182
 
178
183
  export interface SelectState {
@@ -245,7 +250,8 @@ export class Select extends React.Component<SelectProps & OUIAProps, SelectState
245
250
  isInputValuePersisted: false,
246
251
  isInputFilterPersisted: false,
247
252
  isCreateSelectOptionObject: false,
248
- shouldResetOnSelect: true
253
+ shouldResetOnSelect: true,
254
+ isFlipEnabled: false
249
255
  };
250
256
 
251
257
  state: SelectState = {
@@ -978,6 +984,7 @@ export class Select extends React.Component<SelectProps & OUIAProps, SelectState
978
984
  loadingVariant,
979
985
  isCreateSelectOptionObject,
980
986
  shouldResetOnSelect,
987
+ isFlipEnabled,
981
988
  ...props
982
989
  } = this.props;
983
990
  const {
@@ -1204,6 +1211,9 @@ export class Select extends React.Component<SelectProps & OUIAProps, SelectState
1204
1211
 
1205
1212
  const innerMenu = (
1206
1213
  <SelectMenu
1214
+ // This removes the `position: absolute` styling from the `.pf-c-select__menu`
1215
+ // allowing the menu to flip correctly
1216
+ {...(isFlipEnabled && { style: { position: 'revert' } })}
1207
1217
  {...props}
1208
1218
  isGrouped={isGrouped}
1209
1219
  selected={selections}