@patternfly/react-core 4.221.8 → 4.221.11

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 (50) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/esm/components/Drawer/Drawer.d.ts +1 -0
  3. package/dist/esm/components/Drawer/Drawer.d.ts.map +1 -1
  4. package/dist/esm/components/Drawer/Drawer.js +3 -1
  5. package/dist/esm/components/Drawer/Drawer.js.map +1 -1
  6. package/dist/esm/components/Drawer/DrawerContent.d.ts.map +1 -1
  7. package/dist/esm/components/Drawer/DrawerContent.js +3 -3
  8. package/dist/esm/components/Drawer/DrawerContent.js.map +1 -1
  9. package/dist/esm/components/Drawer/DrawerPanelContent.d.ts +0 -2
  10. package/dist/esm/components/Drawer/DrawerPanelContent.d.ts.map +1 -1
  11. package/dist/esm/components/Drawer/DrawerPanelContent.js +2 -2
  12. package/dist/esm/components/Drawer/DrawerPanelContent.js.map +1 -1
  13. package/dist/esm/components/Label/Label.d.ts +1 -1
  14. package/dist/esm/components/Label/Label.d.ts.map +1 -1
  15. package/dist/esm/components/Label/Label.js +1 -0
  16. package/dist/esm/components/Label/Label.js.map +1 -1
  17. package/dist/esm/components/Select/Select.d.ts.map +1 -1
  18. package/dist/esm/components/Select/Select.js +1 -0
  19. package/dist/esm/components/Select/Select.js.map +1 -1
  20. package/dist/js/components/Drawer/Drawer.d.ts +1 -0
  21. package/dist/js/components/Drawer/Drawer.d.ts.map +1 -1
  22. package/dist/js/components/Drawer/Drawer.js +3 -1
  23. package/dist/js/components/Drawer/Drawer.js.map +1 -1
  24. package/dist/js/components/Drawer/DrawerContent.d.ts.map +1 -1
  25. package/dist/js/components/Drawer/DrawerContent.js +2 -2
  26. package/dist/js/components/Drawer/DrawerContent.js.map +1 -1
  27. package/dist/js/components/Drawer/DrawerPanelContent.d.ts +0 -2
  28. package/dist/js/components/Drawer/DrawerPanelContent.d.ts.map +1 -1
  29. package/dist/js/components/Drawer/DrawerPanelContent.js +2 -2
  30. package/dist/js/components/Drawer/DrawerPanelContent.js.map +1 -1
  31. package/dist/js/components/Label/Label.d.ts +1 -1
  32. package/dist/js/components/Label/Label.d.ts.map +1 -1
  33. package/dist/js/components/Label/Label.js +1 -0
  34. package/dist/js/components/Label/Label.js.map +1 -1
  35. package/dist/js/components/Select/Select.d.ts.map +1 -1
  36. package/dist/js/components/Select/Select.js +1 -0
  37. package/dist/js/components/Select/Select.js.map +1 -1
  38. package/dist/umd/react-core.css +107 -107
  39. package/dist/umd/react-core.js +9 -5
  40. package/dist/umd/react-core.min.css +70 -70
  41. package/dist/umd/react-core.min.js +2 -2
  42. package/package.json +5 -5
  43. package/src/components/Drawer/Drawer.tsx +5 -1
  44. package/src/components/Drawer/DrawerContent.tsx +4 -3
  45. package/src/components/Drawer/DrawerPanelContent.tsx +3 -4
  46. package/src/components/Drawer/__tests__/Drawer.test.tsx +38 -1
  47. package/src/components/Drawer/__tests__/Generated/__snapshots__/DrawerContent.test.tsx.snap +1 -3
  48. package/src/components/Label/Label.tsx +2 -1
  49. package/src/components/Label/examples/Label.md +44 -0
  50. package/src/components/Select/Select.tsx +1 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/react-core",
3
- "version": "4.221.8",
3
+ "version": "4.221.11",
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.72.8",
38
- "@patternfly/react-styles": "^4.71.8",
39
- "@patternfly/react-tokens": "^4.73.8",
37
+ "@patternfly/react-icons": "^4.72.11",
38
+ "@patternfly/react-styles": "^4.71.11",
39
+ "@patternfly/react-tokens": "^4.73.11",
40
40
  "focus-trap": "6.9.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": "6f2f06b9e9c41575fabd48ca205fb17fbba8cde0"
63
+ "gitHead": "fd4459f338c4b07d600383d7204a240abd58d710"
64
64
  }
@@ -30,6 +30,7 @@ export interface DrawerContextProps {
30
30
  onExpand?: () => void;
31
31
  position?: string;
32
32
  drawerRef?: React.RefObject<HTMLDivElement>;
33
+ drawerContentRef?: React.RefObject<HTMLDivElement>;
33
34
  isInline: boolean;
34
35
  }
35
36
 
@@ -39,6 +40,7 @@ export const DrawerContext = React.createContext<Partial<DrawerContextProps>>({
39
40
  onExpand: () => {},
40
41
  position: 'right',
41
42
  drawerRef: null,
43
+ drawerContentRef: null,
42
44
  isInline: false
43
45
  });
44
46
 
@@ -53,8 +55,10 @@ export const Drawer: React.FunctionComponent<DrawerProps> = ({
53
55
  ...props
54
56
  }: DrawerProps) => {
55
57
  const drawerRef = React.useRef<HTMLDivElement>();
58
+ const drawerContentRef = React.useRef<HTMLDivElement>();
59
+
56
60
  return (
57
- <DrawerContext.Provider value={{ isExpanded, isStatic, onExpand, position, drawerRef, isInline }}>
61
+ <DrawerContext.Provider value={{ isExpanded, isStatic, onExpand, position, drawerRef, drawerContentRef, isInline }}>
58
62
  <div
59
63
  className={css(
60
64
  styles.drawer,
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
  import styles from '@patternfly/react-styles/css/components/Drawer/drawer';
3
3
  import { css } from '@patternfly/react-styles';
4
4
  import { DrawerMain } from './DrawerMain';
5
- import { DrawerColorVariant } from './Drawer';
5
+ import { DrawerColorVariant, DrawerContext } from './Drawer';
6
6
 
7
7
  export interface DrawerContentProps extends React.HTMLProps<HTMLDivElement> {
8
8
  /** Additional classes added to the Drawer. */
@@ -23,7 +23,8 @@ export const DrawerContent: React.FunctionComponent<DrawerContentProps> = ({
23
23
  colorVariant = DrawerColorVariant.default,
24
24
  ...props
25
25
  }: DrawerContentProps) => {
26
- const drawerContentRef = React.useRef<HTMLDivElement>();
26
+ const { drawerContentRef } = React.useContext(DrawerContext);
27
+
27
28
  return (
28
29
  <DrawerMain>
29
30
  <div
@@ -37,7 +38,7 @@ export const DrawerContent: React.FunctionComponent<DrawerContentProps> = ({
37
38
  >
38
39
  {children}
39
40
  </div>
40
- {panelContent && React.cloneElement(panelContent as React.ReactElement, { drawerContentRef })}
41
+ {panelContent}
41
42
  </DrawerMain>
42
43
  );
43
44
  };
@@ -37,8 +37,6 @@ export interface DrawerPanelContentProps extends React.HTMLProps<HTMLDivElement>
37
37
  };
38
38
  /** Color variant of the background of the drawer panel */
39
39
  colorVariant?: DrawerColorVariant | 'light-200' | 'default';
40
- /** @hide Internal ref to drawer content */
41
- drawerContentRef?: React.RefObject<HTMLDivElement>;
42
40
  }
43
41
  let isResizing: boolean = null;
44
42
  let newSize: number = 0;
@@ -57,13 +55,14 @@ export const DrawerPanelContent: React.FunctionComponent<DrawerPanelContentProps
57
55
  resizeAriaLabel = 'Resize',
58
56
  widths,
59
57
  colorVariant = DrawerColorVariant.default,
60
- drawerContentRef,
61
58
  ...props
62
59
  }: DrawerPanelContentProps) => {
63
60
  const panel = React.useRef<HTMLDivElement>();
64
61
  const splitterRef = React.useRef<HTMLDivElement>();
65
62
  const [separatorValue, setSeparatorValue] = React.useState(0);
66
- const { position, isExpanded, isStatic, onExpand, drawerRef, isInline } = React.useContext(DrawerContext);
63
+ const { position, isExpanded, isStatic, onExpand, drawerRef, drawerContentRef, isInline } = React.useContext(
64
+ DrawerContext
65
+ );
67
66
  const hidden = isStatic ? false : !isExpanded;
68
67
  const [isExpandedInternal, setIsExpandedInternal] = React.useState(!hidden);
69
68
  let currWidth: number = 0;
@@ -10,7 +10,8 @@ import {
10
10
  DrawerPanelContent
11
11
  } from '../';
12
12
  import React from 'react';
13
- import { render } from '@testing-library/react';
13
+ import { render, screen } from '@testing-library/react';
14
+ import userEvent from '@testing-library/user-event';
14
15
 
15
16
  Object.values([
16
17
  { isExpanded: true, isInline: false, isStatic: false },
@@ -124,3 +125,39 @@ test(`Drawer has resizable callback and id`, () => {
124
125
  );
125
126
  expect(asFragment()).toMatchSnapshot();
126
127
  });
128
+
129
+ test('Resizeable DrawerPanelContent can be wrapped in a context without causing an error', () => {
130
+ const TestContext = React.createContext({});
131
+
132
+ const consoleError = jest.spyOn(console, 'error').mockImplementation();
133
+
134
+ const panelContent = (
135
+ <TestContext.Provider value={{}}>
136
+ <DrawerPanelContent
137
+ isResizable
138
+ >
139
+ <DrawerHead>
140
+ <span>
141
+ drawer-panel
142
+ </span>
143
+ <DrawerActions>
144
+ <DrawerCloseButton />
145
+ </DrawerActions>
146
+ </DrawerHead>
147
+ </DrawerPanelContent>
148
+ </TestContext.Provider>
149
+ );
150
+
151
+ render(
152
+ <Drawer isExpanded={true} position="left">
153
+ <DrawerContent panelContent={panelContent}>
154
+ <DrawerContentBody>Drawer content text</DrawerContentBody>
155
+ </DrawerContent>
156
+ </Drawer>
157
+ );
158
+
159
+ userEvent.tab();
160
+ userEvent.keyboard('{arrowleft}');
161
+
162
+ expect(consoleError).not.toHaveBeenCalled();
163
+ })
@@ -12,9 +12,7 @@ exports[`DrawerContent should match snapshot (auto-generated) 1`] = `
12
12
  ReactNode
13
13
  </div>
14
14
  </div>
15
- <div
16
- drawercontentref="[object Object]"
17
- >
15
+ <div>
18
16
  test
19
17
  </div>
20
18
  </div>
@@ -14,7 +14,7 @@ export interface LabelProps extends React.HTMLProps<HTMLSpanElement> {
14
14
  /** Additional classes added to the label. */
15
15
  className?: string;
16
16
  /** Color of the label. */
17
- color?: 'blue' | 'cyan' | 'green' | 'orange' | 'purple' | 'red' | 'grey';
17
+ color?: 'blue' | 'cyan' | 'green' | 'orange' | 'purple' | 'red' | 'grey' | 'gold';
18
18
  /** Variant of the label. */
19
19
  variant?: 'outline' | 'filled';
20
20
  /** Flag indicating the label is compact. */
@@ -78,6 +78,7 @@ const colorStyles = {
78
78
  orange: styles.modifiers.orange,
79
79
  purple: styles.modifiers.purple,
80
80
  red: styles.modifiers.red,
81
+ gold: styles.modifiers.gold,
81
82
  grey: ''
82
83
  };
83
84
 
@@ -156,6 +156,27 @@ import InfoCircleIcon from '@patternfly/react-icons/dist/esm/icons/info-circle-i
156
156
  <Label color="cyan" icon={<InfoCircleIcon />} onClose={Function.prototype} isTruncated>
157
157
  Cyan label with icon that overflows
158
158
  </Label>
159
+ <br />
160
+ <br />
161
+ <Label color="gold">Gold</Label>{' '}
162
+ <Label color="gold" icon={<InfoCircleIcon />}>
163
+ Gold icon
164
+ </Label>{' '}
165
+ <Label color="gold" onClose={Function.prototype}>
166
+ Gold removable
167
+ </Label>{' '}
168
+ <Label color="gold" icon={<InfoCircleIcon />} onClose={Function.prototype}>
169
+ Gold icon removable
170
+ </Label>{' '}
171
+ <Label color="gold" href="#filled">
172
+ Gold link
173
+ </Label>{' '}
174
+ <Label color="gold" href="#filled" onClose={Function.prototype}>
175
+ Gold link removable
176
+ </Label>
177
+ <Label color="gold" icon={<InfoCircleIcon />} onClose={Function.prototype} isTruncated>
178
+ Gold label with icon that overflows
179
+ </Label>
159
180
  </React.Fragment>;
160
181
  ```
161
182
 
@@ -324,6 +345,29 @@ import InfoCircleIcon from '@patternfly/react-icons/dist/esm/icons/info-circle-i
324
345
  <Label variant="outline" color="cyan" icon={<InfoCircleIcon />} onClose={Function.prototype} isTruncated>
325
346
  Cyan label with icon that overflows
326
347
  </Label>
348
+ <br />
349
+ <br />
350
+ <Label variant="outline" color="gold">
351
+ Gold
352
+ </Label>{' '}
353
+ <Label variant="outline" color="gold" icon={<InfoCircleIcon />}>
354
+ Gold icon
355
+ </Label>{' '}
356
+ <Label variant="outline" color="gold" onClose={Function.prototype}>
357
+ Gold removable
358
+ </Label>{' '}
359
+ <Label variant="outline" color="gold" icon={<InfoCircleIcon />} onClose={Function.prototype}>
360
+ Gold icon removable
361
+ </Label>{' '}
362
+ <Label variant="outline" color="gold" href="#outline">
363
+ Gold link
364
+ </Label>{' '}
365
+ <Label variant="outline" color="gold" href="#outline" onClose={Function.prototype}>
366
+ Gold link removable
367
+ </Label>
368
+ <Label variant="outline" color="gold" icon={<InfoCircleIcon />} onClose={Function.prototype} isTruncated>
369
+ Gold label with icon that overflows
370
+ </Label>
327
371
  </React.Fragment>;
328
372
  ```
329
373
 
@@ -294,6 +294,7 @@ export class Select extends React.Component<SelectProps & OUIAProps, SelectState
294
294
  this.props.variant !== 'typeaheadmulti'
295
295
  ) {
296
296
  this.refCollection[this.state.viewMoreNextIndex][0].focus();
297
+ this.setState({ viewMoreNextIndex: -1 });
297
298
  }
298
299
 
299
300
  const hasUpdatedChildren =