@patternfly/react-core 4.202.8 → 4.202.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 (54) hide show
  1. package/CHANGELOG.md +30 -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 -2
  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 -2
  8. package/dist/esm/components/Drawer/DrawerContent.js.map +1 -1
  9. package/dist/esm/components/Drawer/DrawerPanelContent.d.ts +2 -2
  10. package/dist/esm/components/Drawer/DrawerPanelContent.d.ts.map +1 -1
  11. package/dist/esm/components/Drawer/DrawerPanelContent.js +65 -37
  12. package/dist/esm/components/Drawer/DrawerPanelContent.js.map +1 -1
  13. package/dist/esm/components/Select/Select.d.ts.map +1 -1
  14. package/dist/esm/components/Select/Select.js +21 -14
  15. package/dist/esm/components/Select/Select.js.map +1 -1
  16. package/dist/esm/components/Select/SelectMenu.d.ts.map +1 -1
  17. package/dist/esm/components/Select/SelectMenu.js +10 -1
  18. package/dist/esm/components/Select/SelectMenu.js.map +1 -1
  19. package/dist/esm/components/Select/SelectOption.js +1 -1
  20. package/dist/esm/components/Select/SelectOption.js.map +1 -1
  21. package/dist/js/components/Drawer/Drawer.d.ts +1 -0
  22. package/dist/js/components/Drawer/Drawer.d.ts.map +1 -1
  23. package/dist/js/components/Drawer/Drawer.js +3 -2
  24. package/dist/js/components/Drawer/Drawer.js.map +1 -1
  25. package/dist/js/components/Drawer/DrawerContent.d.ts.map +1 -1
  26. package/dist/js/components/Drawer/DrawerContent.js +3 -2
  27. package/dist/js/components/Drawer/DrawerContent.js.map +1 -1
  28. package/dist/js/components/Drawer/DrawerPanelContent.d.ts +2 -2
  29. package/dist/js/components/Drawer/DrawerPanelContent.d.ts.map +1 -1
  30. package/dist/js/components/Drawer/DrawerPanelContent.js +65 -37
  31. package/dist/js/components/Drawer/DrawerPanelContent.js.map +1 -1
  32. package/dist/js/components/Select/Select.d.ts.map +1 -1
  33. package/dist/js/components/Select/Select.js +21 -14
  34. package/dist/js/components/Select/Select.js.map +1 -1
  35. package/dist/js/components/Select/SelectMenu.d.ts.map +1 -1
  36. package/dist/js/components/Select/SelectMenu.js +10 -1
  37. package/dist/js/components/Select/SelectMenu.js.map +1 -1
  38. package/dist/js/components/Select/SelectOption.js +1 -1
  39. package/dist/js/components/Select/SelectOption.js.map +1 -1
  40. package/dist/umd/react-core.js +102 -57
  41. package/dist/umd/react-core.min.js +1 -1
  42. package/package.json +5 -5
  43. package/src/components/Card/examples/Card.md +1 -1
  44. package/src/components/Drawer/Drawer.tsx +4 -2
  45. package/src/components/Drawer/DrawerContent.tsx +19 -15
  46. package/src/components/Drawer/DrawerPanelContent.tsx +110 -75
  47. package/src/components/Drawer/__tests__/Generated/DrawerContent.test.tsx +2 -2
  48. package/src/components/Drawer/__tests__/Generated/__snapshots__/DrawerContent.test.tsx.snap +88 -9
  49. package/src/components/Drawer/__tests__/Generated/__snapshots__/DrawerPanelContent.test.tsx.snap +1 -0
  50. package/src/components/Drawer/__tests__/__snapshots__/Drawer.test.tsx.snap +15 -2
  51. package/src/components/Select/Select.tsx +23 -17
  52. package/src/components/Select/SelectMenu.tsx +9 -1
  53. package/src/components/Select/SelectOption.tsx +1 -1
  54. package/src/components/Select/__tests__/__snapshots__/Select.test.tsx.snap +4 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/react-core",
3
- "version": "4.202.8",
3
+ "version": "4.202.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.53.8",
38
- "@patternfly/react-styles": "^4.52.8",
39
- "@patternfly/react-tokens": "^4.54.8",
37
+ "@patternfly/react-icons": "^4.53.11",
38
+ "@patternfly/react-styles": "^4.52.11",
39
+ "@patternfly/react-tokens": "^4.54.11",
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": "42b0497c8176a89318f5237b08679b5462f284e9"
63
+ "gitHead": "37502dd4919001bb0202e637c4feb61b6ddb81c2"
64
64
  }
@@ -2,7 +2,7 @@
2
2
  id: Card
3
3
  section: components
4
4
  cssPrefix: pf-c-card
5
- propComponents: ['Card', 'CardHeader', 'CardHeaderMain', 'CardTitle', 'CardBody', 'CardFooter', 'CardExpandableContent']
5
+ propComponents: ['Card', 'CardActions', 'CardHeader', 'CardHeaderMain', 'CardTitle', 'CardBody', 'CardFooter', 'CardExpandableContent']
6
6
  ouia: true
7
7
  ---
8
8
 
@@ -30,6 +30,7 @@ export interface DrawerContextProps {
30
30
  onExpand?: () => void;
31
31
  position?: string;
32
32
  drawerRef?: React.RefObject<HTMLDivElement>;
33
+ isInline: boolean;
33
34
  }
34
35
 
35
36
  export const DrawerContext = React.createContext<Partial<DrawerContextProps>>({
@@ -37,7 +38,8 @@ export const DrawerContext = React.createContext<Partial<DrawerContextProps>>({
37
38
  isStatic: false,
38
39
  onExpand: () => {},
39
40
  position: 'right',
40
- drawerRef: null
41
+ drawerRef: null,
42
+ isInline: false
41
43
  });
42
44
 
43
45
  export const Drawer: React.FunctionComponent<DrawerProps> = ({
@@ -52,7 +54,7 @@ export const Drawer: React.FunctionComponent<DrawerProps> = ({
52
54
  }: DrawerProps) => {
53
55
  const drawerRef = React.useRef<HTMLDivElement>();
54
56
  return (
55
- <DrawerContext.Provider value={{ isExpanded, isStatic, onExpand, position, drawerRef }}>
57
+ <DrawerContext.Provider value={{ isExpanded, isStatic, onExpand, position, drawerRef, isInline }}>
56
58
  <div
57
59
  className={css(
58
60
  styles.drawer,
@@ -22,19 +22,23 @@ export const DrawerContent: React.SFC<DrawerContentProps> = ({
22
22
  panelContent,
23
23
  colorVariant = DrawerColorVariant.default,
24
24
  ...props
25
- }: DrawerContentProps) => (
26
- <DrawerMain>
27
- <div
28
- className={css(
29
- styles.drawerContent,
30
- colorVariant === DrawerColorVariant.light200 && styles.modifiers.light_200,
31
- className
32
- )}
33
- {...props}
34
- >
35
- {children}
36
- </div>
37
- {panelContent}
38
- </DrawerMain>
39
- );
25
+ }: DrawerContentProps) => {
26
+ const drawerContentRef = React.useRef<HTMLDivElement>();
27
+ return (
28
+ <DrawerMain>
29
+ <div
30
+ className={css(
31
+ styles.drawerContent,
32
+ colorVariant === DrawerColorVariant.light200 && styles.modifiers.light_200,
33
+ className
34
+ )}
35
+ ref={drawerContentRef}
36
+ {...props}
37
+ >
38
+ {children}
39
+ </div>
40
+ {React.cloneElement(panelContent as React.ReactElement, { drawerContentRef })}
41
+ </DrawerMain>
42
+ );
43
+ };
40
44
  DrawerContent.displayName = 'DrawerContent';
@@ -3,6 +3,7 @@ import styles from '@patternfly/react-styles/css/components/Drawer/drawer';
3
3
  import { css } from '@patternfly/react-styles';
4
4
  import { DrawerColorVariant, DrawerContext } from './Drawer';
5
5
  import { formatBreakpointMods } from '../../helpers/util';
6
+ import { GenerateId } from '../../helpers/GenerateId/GenerateId';
6
7
 
7
8
  export interface DrawerPanelContentProps extends React.HTMLProps<HTMLDivElement> {
8
9
  /** Additional classes added to the drawer. */
@@ -27,8 +28,6 @@ export interface DrawerPanelContentProps extends React.HTMLProps<HTMLDivElement>
27
28
  increment?: number;
28
29
  /** Aria label for the resizable drawer splitter. */
29
30
  resizeAriaLabel?: string;
30
- /** Aria described by label for the resizable drawer splitter. */
31
- resizeAriaDescribedBy?: string;
32
31
  /** Width for drawer panel at various breakpoints. Overriden by resizable drawer minSize and defaultSize. */
33
32
  widths?: {
34
33
  default?: 'width_25' | 'width_33' | 'width_50' | 'width_66' | 'width_75' | 'width_100';
@@ -38,6 +37,8 @@ export interface DrawerPanelContentProps extends React.HTMLProps<HTMLDivElement>
38
37
  };
39
38
  /** Color variant of the background of the drawer panel */
40
39
  colorVariant?: DrawerColorVariant | 'light-200' | 'default';
40
+ /** @hide Internal ref to drawer content */
41
+ drawerContentRef?: React.RefObject<HTMLDivElement>;
41
42
  }
42
43
  let isResizing: boolean = null;
43
44
  let newSize: number = 0;
@@ -54,13 +55,15 @@ export const DrawerPanelContent: React.FunctionComponent<DrawerPanelContentProps
54
55
  maxSize,
55
56
  increment = 5,
56
57
  resizeAriaLabel = 'Resize',
57
- resizeAriaDescribedBy = 'Press space to begin resizing, and use the arrow keys to grow or shrink the panel. Press enter or escape to finish resizing.',
58
58
  widths,
59
59
  colorVariant = DrawerColorVariant.default,
60
+ drawerContentRef,
60
61
  ...props
61
62
  }: DrawerPanelContentProps) => {
62
63
  const panel = React.useRef<HTMLDivElement>();
63
- const { position, isExpanded, isStatic, onExpand, drawerRef } = React.useContext(DrawerContext);
64
+ const splitterRef = React.useRef<HTMLDivElement>();
65
+ const [separatorValue, setSeparatorValue] = React.useState(0);
66
+ const { position, isExpanded, isStatic, onExpand, drawerRef, isInline } = React.useContext(DrawerContext);
64
67
  const hidden = isStatic ? false : !isExpanded;
65
68
  const [isExpandedInternal, setIsExpandedInternal] = React.useState(!hidden);
66
69
  let currWidth: number = 0;
@@ -76,6 +79,37 @@ export const DrawerPanelContent: React.FunctionComponent<DrawerPanelContentProps
76
79
  }
77
80
  }, [isStatic, isExpanded]);
78
81
 
82
+ const calcValueNow = () => {
83
+ let splitterPos;
84
+ let drawerSize;
85
+
86
+ if (isInline && position === 'right') {
87
+ splitterPos = panel.current.getBoundingClientRect().right - splitterRef.current.getBoundingClientRect().left;
88
+ drawerSize = drawerRef.current.getBoundingClientRect().right - drawerRef.current.getBoundingClientRect().left;
89
+ } else if (isInline && position === 'left') {
90
+ splitterPos = splitterRef.current.getBoundingClientRect().right - panel.current.getBoundingClientRect().left;
91
+ drawerSize = drawerRef.current.getBoundingClientRect().right - drawerRef.current.getBoundingClientRect().left;
92
+ } else if (position === 'right') {
93
+ splitterPos =
94
+ drawerContentRef.current.getBoundingClientRect().right - splitterRef.current.getBoundingClientRect().left;
95
+ drawerSize =
96
+ drawerContentRef.current.getBoundingClientRect().right - drawerContentRef.current.getBoundingClientRect().left;
97
+ } else if (position === 'left') {
98
+ splitterPos =
99
+ splitterRef.current.getBoundingClientRect().right - drawerContentRef.current.getBoundingClientRect().left;
100
+ drawerSize =
101
+ drawerContentRef.current.getBoundingClientRect().right - drawerContentRef.current.getBoundingClientRect().left;
102
+ } else if (position === 'bottom') {
103
+ splitterPos =
104
+ drawerContentRef.current.getBoundingClientRect().bottom - splitterRef.current.getBoundingClientRect().top;
105
+ drawerSize =
106
+ drawerContentRef.current.getBoundingClientRect().bottom - drawerContentRef.current.getBoundingClientRect().top;
107
+ }
108
+
109
+ const newSplitterPos = (splitterPos / drawerSize) * 100;
110
+ return Math.round((newSplitterPos + Number.EPSILON) * 100) / 100;
111
+ };
112
+
79
113
  const handleTouchStart = (e: React.TouchEvent) => {
80
114
  e.stopPropagation();
81
115
  document.addEventListener('touchmove', callbackTouchMove, { passive: false });
@@ -133,6 +167,7 @@ export const DrawerPanelContent: React.FunctionComponent<DrawerPanelContentProps
133
167
  }
134
168
  panel.current.style.setProperty('--pf-c-drawer__panel--md--FlexBasis', newSize + 'px');
135
169
  currWidth = newSize;
170
+ setSeparatorValue(calcValueNow());
136
171
  };
137
172
 
138
173
  const handleMouseup = () => {
@@ -166,7 +201,6 @@ export const DrawerPanelContent: React.FunctionComponent<DrawerPanelContentProps
166
201
  const handleKeys = (e: React.KeyboardEvent) => {
167
202
  const key = e.key;
168
203
  if (
169
- key !== ' ' &&
170
204
  key !== 'Escape' &&
171
205
  key !== 'Enter' &&
172
206
  key !== 'ArrowUp' &&
@@ -181,35 +215,28 @@ export const DrawerPanelContent: React.FunctionComponent<DrawerPanelContentProps
181
215
  }
182
216
  e.preventDefault();
183
217
 
184
- if (key === ' ' || key === 'Escape' || key === 'Enter') {
185
- if (key === ' ') {
186
- isResizing = true;
187
- } else {
188
- isResizing = false;
189
- onResize && onResize(currWidth, id);
190
- }
191
- const panelRect = panel.current.getBoundingClientRect();
192
- newSize = position === 'bottom' ? panelRect.height : panelRect.width;
218
+ if (key === 'Escape' || key === 'Enter') {
219
+ onResize && onResize(currWidth, id);
193
220
  }
194
-
195
- if (isResizing) {
196
- let delta = 0;
197
- if (key === 'ArrowRight') {
198
- delta = position === 'left' ? increment : -increment;
199
- } else if (key === 'ArrowLeft') {
200
- delta = position === 'left' ? -increment : increment;
201
- } else if (key === 'ArrowUp') {
202
- delta = increment;
203
- } else if (key === 'ArrowDown') {
204
- delta = -increment;
205
- }
206
- newSize = newSize + delta;
207
- if (position === 'bottom') {
208
- panel.current.style.overflowAnchor = 'none';
209
- }
210
- panel.current.style.setProperty('--pf-c-drawer__panel--md--FlexBasis', newSize + 'px');
211
- currWidth = newSize;
221
+ const panelRect = panel.current.getBoundingClientRect();
222
+ newSize = position === 'bottom' ? panelRect.height : panelRect.width;
223
+ let delta = 0;
224
+ if (key === 'ArrowRight') {
225
+ delta = position === 'left' ? increment : -increment;
226
+ } else if (key === 'ArrowLeft') {
227
+ delta = position === 'left' ? -increment : increment;
228
+ } else if (key === 'ArrowUp') {
229
+ delta = increment;
230
+ } else if (key === 'ArrowDown') {
231
+ delta = -increment;
232
+ }
233
+ newSize = newSize + delta;
234
+ if (position === 'bottom') {
235
+ panel.current.style.overflowAnchor = 'none';
212
236
  }
237
+ panel.current.style.setProperty('--pf-c-drawer__panel--md--FlexBasis', newSize + 'px');
238
+ currWidth = newSize;
239
+ setSeparatorValue(calcValueNow());
213
240
  };
214
241
  const boundaryCssVars: any = {};
215
242
  if (defaultSize) {
@@ -222,53 +249,61 @@ export const DrawerPanelContent: React.FunctionComponent<DrawerPanelContentProps
222
249
  boundaryCssVars['--pf-c-drawer__panel--md--FlexBasis--max'] = maxSize;
223
250
  }
224
251
  return (
225
- <div
226
- id={id}
227
- className={css(
228
- styles.drawerPanel,
229
- isResizable && styles.modifiers.resizable,
230
- hasNoBorder && styles.modifiers.noBorder,
231
- formatBreakpointMods(widths, styles),
232
- colorVariant === DrawerColorVariant.light200 && styles.modifiers.light_200,
233
- className
234
- )}
235
- ref={panel}
236
- onTransitionEnd={ev => {
237
- if (!hidden && ev.nativeEvent.propertyName === 'transform') {
238
- onExpand();
239
- }
240
- setIsExpandedInternal(!hidden);
241
- }}
242
- hidden={hidden}
243
- {...((defaultSize || minSize || maxSize) && {
244
- style: boundaryCssVars as React.CSSProperties
245
- })}
246
- {...props}
247
- >
248
- {isExpandedInternal && (
249
- <React.Fragment>
250
- {isResizable && (
252
+ <GenerateId prefix="pf-drawer-panel-">
253
+ {panelId => (
254
+ <div
255
+ id={id || panelId}
256
+ className={css(
257
+ styles.drawerPanel,
258
+ isResizable && styles.modifiers.resizable,
259
+ hasNoBorder && styles.modifiers.noBorder,
260
+ formatBreakpointMods(widths, styles),
261
+ colorVariant === DrawerColorVariant.light200 && styles.modifiers.light_200,
262
+ className
263
+ )}
264
+ ref={panel}
265
+ onTransitionEnd={ev => {
266
+ if (!hidden && ev.nativeEvent.propertyName === 'transform') {
267
+ onExpand();
268
+ }
269
+ setIsExpandedInternal(!hidden);
270
+ }}
271
+ hidden={hidden}
272
+ {...((defaultSize || minSize || maxSize) && {
273
+ style: boundaryCssVars as React.CSSProperties
274
+ })}
275
+ {...props}
276
+ >
277
+ {isExpandedInternal && (
251
278
  <React.Fragment>
252
- <div
253
- className={css(styles.drawerSplitter, position !== 'bottom' && styles.modifiers.vertical)}
254
- role="separator"
255
- tabIndex={0}
256
- aria-orientation={position === 'bottom' ? 'horizontal' : 'vertical'}
257
- aria-label={resizeAriaLabel}
258
- aria-describedby={resizeAriaDescribedBy}
259
- onMouseDown={handleMousedown}
260
- onKeyDown={handleKeys}
261
- onTouchStart={handleTouchStart}
262
- >
263
- <div className={css(styles.drawerSplitterHandle)} aria-hidden></div>
264
- </div>
265
- <div className={css(styles.drawerPanelMain)}>{children}</div>
279
+ {isResizable && (
280
+ <React.Fragment>
281
+ <div
282
+ className={css(styles.drawerSplitter, position !== 'bottom' && styles.modifiers.vertical)}
283
+ role="separator"
284
+ tabIndex={0}
285
+ aria-orientation={position === 'bottom' ? 'horizontal' : 'vertical'}
286
+ aria-label={resizeAriaLabel}
287
+ aria-valuenow={separatorValue}
288
+ aria-valuemin={0}
289
+ aria-valuemax={100}
290
+ aria-controls={id || panelId}
291
+ onMouseDown={handleMousedown}
292
+ onKeyDown={handleKeys}
293
+ onTouchStart={handleTouchStart}
294
+ ref={splitterRef}
295
+ >
296
+ <div className={css(styles.drawerSplitterHandle)} aria-hidden></div>
297
+ </div>
298
+ <div className={css(styles.drawerPanelMain)}>{children}</div>
299
+ </React.Fragment>
300
+ )}
301
+ {!isResizable && children}
266
302
  </React.Fragment>
267
303
  )}
268
- {!isResizable && children}
269
- </React.Fragment>
304
+ </div>
270
305
  )}
271
- </div>
306
+ </GenerateId>
272
307
  );
273
308
  };
274
309
  DrawerPanelContent.displayName = 'DrawerPanelContent';
@@ -8,6 +8,6 @@ import { DrawerContent } from '../../DrawerContent';
8
8
  import {} from '../..';
9
9
 
10
10
  it('DrawerContent should match snapshot (auto-generated)', () => {
11
- const view = render(<DrawerContent className={"''"} children={<div>ReactNode</div>} />);
12
- expect(view.container).toMatchSnapshot();
11
+ const view = render(<DrawerContent className={"''"} children={<div>ReactNode</div>} panelContent={<div>test</div>} />);
12
+ expect(view).toMatchSnapshot();
13
13
  });
@@ -1,17 +1,96 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`DrawerContent should match snapshot (auto-generated) 1`] = `
4
- <div>
5
- <div
6
- class="pf-c-drawer__main"
7
- >
4
+ Object {
5
+ "asFragment": [Function],
6
+ "baseElement": <body>
7
+ <div>
8
+ <div
9
+ class="pf-c-drawer__main"
10
+ >
11
+ <div
12
+ class="pf-c-drawer__content ''"
13
+ >
14
+ <div>
15
+ ReactNode
16
+ </div>
17
+ </div>
18
+ <div
19
+ drawercontentref="[object Object]"
20
+ >
21
+ test
22
+ </div>
23
+ </div>
24
+ </div>
25
+ </body>,
26
+ "container": <div>
8
27
  <div
9
- class="pf-c-drawer__content ''"
28
+ class="pf-c-drawer__main"
10
29
  >
11
- <div>
12
- ReactNode
30
+ <div
31
+ class="pf-c-drawer__content ''"
32
+ >
33
+ <div>
34
+ ReactNode
35
+ </div>
36
+ </div>
37
+ <div
38
+ drawercontentref="[object Object]"
39
+ >
40
+ test
13
41
  </div>
14
42
  </div>
15
- </div>
16
- </div>
43
+ </div>,
44
+ "debug": [Function],
45
+ "findAllByAltText": [Function],
46
+ "findAllByDisplayValue": [Function],
47
+ "findAllByLabelText": [Function],
48
+ "findAllByPlaceholderText": [Function],
49
+ "findAllByRole": [Function],
50
+ "findAllByTestId": [Function],
51
+ "findAllByText": [Function],
52
+ "findAllByTitle": [Function],
53
+ "findByAltText": [Function],
54
+ "findByDisplayValue": [Function],
55
+ "findByLabelText": [Function],
56
+ "findByPlaceholderText": [Function],
57
+ "findByRole": [Function],
58
+ "findByTestId": [Function],
59
+ "findByText": [Function],
60
+ "findByTitle": [Function],
61
+ "getAllByAltText": [Function],
62
+ "getAllByDisplayValue": [Function],
63
+ "getAllByLabelText": [Function],
64
+ "getAllByPlaceholderText": [Function],
65
+ "getAllByRole": [Function],
66
+ "getAllByTestId": [Function],
67
+ "getAllByText": [Function],
68
+ "getAllByTitle": [Function],
69
+ "getByAltText": [Function],
70
+ "getByDisplayValue": [Function],
71
+ "getByLabelText": [Function],
72
+ "getByPlaceholderText": [Function],
73
+ "getByRole": [Function],
74
+ "getByTestId": [Function],
75
+ "getByText": [Function],
76
+ "getByTitle": [Function],
77
+ "queryAllByAltText": [Function],
78
+ "queryAllByDisplayValue": [Function],
79
+ "queryAllByLabelText": [Function],
80
+ "queryAllByPlaceholderText": [Function],
81
+ "queryAllByRole": [Function],
82
+ "queryAllByTestId": [Function],
83
+ "queryAllByText": [Function],
84
+ "queryAllByTitle": [Function],
85
+ "queryByAltText": [Function],
86
+ "queryByDisplayValue": [Function],
87
+ "queryByLabelText": [Function],
88
+ "queryByPlaceholderText": [Function],
89
+ "queryByRole": [Function],
90
+ "queryByTestId": [Function],
91
+ "queryByText": [Function],
92
+ "queryByTitle": [Function],
93
+ "rerender": [Function],
94
+ "unmount": [Function],
95
+ }
17
96
  `;
@@ -5,6 +5,7 @@ exports[`DrawerPanelContent should match snapshot (auto-generated) 1`] = `
5
5
  <div
6
6
  class="pf-c-drawer__panel ''"
7
7
  hidden=""
8
+ id="pf-drawer-panel-0"
8
9
  />
9
10
  </div>
10
11
  `;
@@ -19,6 +19,7 @@ exports[`Drawer expands from bottom 1`] = `
19
19
  </div>
20
20
  <div
21
21
  class="pf-c-drawer__panel"
22
+ id="pf-drawer-panel-5"
22
23
  >
23
24
  <div
24
25
  class="pf-c-drawer__body"
@@ -95,9 +96,12 @@ exports[`Drawer has resizable callback and id 1`] = `
95
96
  id="test-id"
96
97
  >
97
98
  <div
98
- aria-describedby="Press space to begin resizing, and use the arrow keys to grow or shrink the panel. Press enter or escape to finish resizing."
99
+ aria-controls="test-id"
99
100
  aria-label="Resize"
100
101
  aria-orientation="vertical"
102
+ aria-valuemax="100"
103
+ aria-valuemin="0"
104
+ aria-valuenow="0"
101
105
  class="pf-c-drawer__splitter pf-m-vertical"
102
106
  role="separator"
103
107
  tabindex="0"
@@ -183,12 +187,16 @@ exports[`Drawer has resizable css and color variants 1`] = `
183
187
  </div>
184
188
  <div
185
189
  class="pf-c-drawer__panel pf-m-resizable pf-m-light-200"
190
+ id="pf-drawer-panel-6"
186
191
  style="--pf-c-drawer__panel--md--FlexBasis: 300px; --pf-c-drawer__panel--md--FlexBasis--min: 200px; --pf-c-drawer__panel--md--FlexBasis--max: 400px;"
187
192
  >
188
193
  <div
189
- aria-describedby="Press space to begin resizing, and use the arrow keys to grow or shrink the panel. Press enter or escape to finish resizing."
194
+ aria-controls="pf-drawer-panel-6"
190
195
  aria-label="Resize"
191
196
  aria-orientation="vertical"
197
+ aria-valuemax="100"
198
+ aria-valuemin="0"
199
+ aria-valuenow="0"
192
200
  class="pf-c-drawer__splitter pf-m-vertical"
193
201
  role="separator"
194
202
  tabindex="0"
@@ -275,6 +283,7 @@ exports[`Drawer isExpanded = false and isInline = false and isStatic = false 1`]
275
283
  <div
276
284
  class="pf-c-drawer__panel"
277
285
  hidden=""
286
+ id="pf-drawer-panel-1"
278
287
  />
279
288
  </div>
280
289
  </div>
@@ -301,6 +310,7 @@ exports[`Drawer isExpanded = false and isInline = true and isStatic = false 1`]
301
310
  <div
302
311
  class="pf-c-drawer__panel"
303
312
  hidden=""
313
+ id="pf-drawer-panel-3"
304
314
  />
305
315
  </div>
306
316
  </div>
@@ -326,6 +336,7 @@ exports[`Drawer isExpanded = true and isInline = false and isStatic = false 1`]
326
336
  </div>
327
337
  <div
328
338
  class="pf-c-drawer__panel"
339
+ id="pf-drawer-panel-0"
329
340
  >
330
341
  <div
331
342
  class="pf-c-drawer__body"
@@ -399,6 +410,7 @@ exports[`Drawer isExpanded = true and isInline = false and isStatic = true 1`] =
399
410
  </div>
400
411
  <div
401
412
  class="pf-c-drawer__panel"
413
+ id="pf-drawer-panel-4"
402
414
  >
403
415
  <div
404
416
  class="pf-c-drawer__body"
@@ -472,6 +484,7 @@ exports[`Drawer isExpanded = true and isInline = true and isStatic = false 1`] =
472
484
  </div>
473
485
  <div
474
486
  class="pf-c-drawer__panel"
487
+ id="pf-drawer-panel-2"
475
488
  >
476
489
  <div
477
490
  class="pf-c-drawer__body"
@@ -270,7 +270,9 @@ export class Select extends React.Component<SelectProps & OUIAProps, SelectState
270
270
  this.state.viewMoreNextIndex !== -1 &&
271
271
  this.refCollection.length > this.state.viewMoreNextIndex &&
272
272
  this.props.loadingVariant !== 'spinner' &&
273
- this.refCollection[this.state.viewMoreNextIndex][0]
273
+ this.refCollection[this.state.viewMoreNextIndex][0] &&
274
+ this.props.variant !== 'typeahead' && // do not hard focus newly added items for typeahead variants
275
+ this.props.variant !== 'typeaheadmulti'
274
276
  ) {
275
277
  this.refCollection[this.state.viewMoreNextIndex][0].focus();
276
278
  }
@@ -581,17 +583,16 @@ export class Select extends React.Component<SelectProps & OUIAProps, SelectState
581
583
  }
582
584
  });
583
585
  }
584
-
585
- return typeaheadChildren.map((child: React.ReactNode) => {
586
+ return typeaheadChildren.map((child: React.ReactNode, index) => {
586
587
  const childElement = child as any;
587
588
  return childElement.type.displayName === 'Divider'
588
589
  ? child
589
590
  : React.cloneElement(child as React.ReactElement, {
590
- isFocused:
591
- typeaheadActiveChild &&
592
- (typeaheadActiveChild.innerText === (child as React.ReactElement).props.value.toString() ||
591
+ isFocused: typeaheadActiveChild
592
+ ? typeaheadActiveChild.innerText === (child as React.ReactElement).props.value.toString() ||
593
593
  (this.props.isCreatable &&
594
- typeaheadActiveChild.innerText === `{createText} "${(child as React.ReactElement).props.value}"`))
594
+ typeaheadActiveChild.innerText === `{createText} "${(child as React.ReactElement).props.value}"`)
595
+ : index === typeaheadCurrIndex // fallback for view more + typeahead use cases, when the new expanded list is loaded and refCollection hasn't be updated yet
595
596
  });
596
597
  });
597
598
  }
@@ -621,6 +622,9 @@ export class Select extends React.Component<SelectProps & OUIAProps, SelectState
621
622
  const hasDescriptionElm = Boolean(
622
623
  this.refCollection[nextIndex][0] && this.refCollection[nextIndex][0].classList.contains('pf-m-description')
623
624
  );
625
+ const isLoad = Boolean(
626
+ this.refCollection[nextIndex][0] && this.refCollection[nextIndex][0].classList.contains('pf-m-load')
627
+ );
624
628
  const optionTextElm = hasDescriptionElm
625
629
  ? (this.refCollection[nextIndex][0].firstElementChild as HTMLElement)
626
630
  : this.refCollection[nextIndex][0];
@@ -628,7 +632,8 @@ export class Select extends React.Component<SelectProps & OUIAProps, SelectState
628
632
  let typeaheadInputValue = '';
629
633
  if (isCreatable && optionTextElm.innerText.includes(createText)) {
630
634
  typeaheadInputValue = this.state.creatableValue;
631
- } else if (optionTextElm) {
635
+ } else if (optionTextElm && !isLoad) {
636
+ // !isLoad prevents the view more button text from appearing the typeahead input
632
637
  typeaheadInputValue = optionTextElm.innerText;
633
638
  }
634
639
  this.setState(prevState => ({
@@ -682,19 +687,20 @@ export class Select extends React.Component<SelectProps & OUIAProps, SelectState
682
687
  (typeaheadActiveChild || (this.refCollection[0] && this.refCollection[0][0]))
683
688
  ) {
684
689
  if (typeaheadActiveChild) {
685
- const hasDescriptionElm = typeaheadActiveChild.childElementCount > 1;
686
- const typeaheadActiveChildText = hasDescriptionElm
687
- ? (typeaheadActiveChild.firstChild as HTMLElement).innerText
688
- : typeaheadActiveChild.innerText;
689
- this.setState({
690
- typeaheadInputValue: typeaheadActiveChildText
691
- });
692
- } else {
690
+ if (!typeaheadActiveChild.classList.contains('pf-m-load')) {
691
+ const hasDescriptionElm = typeaheadActiveChild.childElementCount > 1;
692
+ const typeaheadActiveChildText = hasDescriptionElm
693
+ ? (typeaheadActiveChild.firstChild as HTMLElement).innerText
694
+ : typeaheadActiveChild.innerText;
695
+ this.setState({
696
+ typeaheadInputValue: typeaheadActiveChildText
697
+ });
698
+ }
699
+ } else if (this.refCollection[0] && this.refCollection[0][0]) {
693
700
  this.setState({
694
701
  typeaheadInputValue: this.refCollection[0][0].innerText
695
702
  });
696
703
  }
697
-
698
704
  if (typeaheadActiveChild) {
699
705
  typeaheadActiveChild.click();
700
706
  } else {