@patternfly/react-core 4.235.2 → 4.235.5

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,16 +1,10 @@
1
1
  {
2
2
  "name": "@patternfly/react-core",
3
- "version": "4.235.2",
3
+ "version": "4.235.5",
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",
7
7
  "types": "dist/esm/index.d.ts",
8
- "exports": {
9
- ".": "./dist/esm/index.js",
10
- "./next": "./dist/esm/next/index.js",
11
- "./deprecated": "./dist/esm/deprecated/index.js",
12
- "./package.json": "./package.json"
13
- },
14
8
  "typesVersions": {
15
9
  "*": {
16
10
  "next": [
@@ -45,14 +39,14 @@
45
39
  },
46
40
  "homepage": "https://github.com/patternfly/patternfly-react#readme",
47
41
  "scripts": {
48
- "build:umd": "rollup -c && rollup -c --environment IS_PRODUCTION",
42
+ "build:umd": "rollup -c --environment IS_PRODUCTION",
49
43
  "clean": "rimraf dist",
50
44
  "generate": "node scripts/copyStyles.js"
51
45
  },
52
46
  "dependencies": {
53
- "@patternfly/react-icons": "^4.86.2",
54
- "@patternfly/react-styles": "^4.85.2",
55
- "@patternfly/react-tokens": "^4.87.2",
47
+ "@patternfly/react-icons": "^4.86.5",
48
+ "@patternfly/react-styles": "^4.85.5",
49
+ "@patternfly/react-tokens": "^4.87.5",
56
50
  "focus-trap": "6.9.2",
57
51
  "react-dropzone": "9.0.0",
58
52
  "tippy.js": "5.1.2",
@@ -76,5 +70,5 @@
76
70
  "react": "^16.8.0 || ^17.0.0",
77
71
  "react-dom": "^16.8.0 || ^17.0.0"
78
72
  },
79
- "gitHead": "481223940736dfb78100455556d8aa23738cec66"
73
+ "gitHead": "6ec6b7c439ec2475f03ddfdc9ad494396aecb6a6"
80
74
  }
@@ -81,7 +81,7 @@ export const DualListSelectorComposableDragDrop: React.FunctionComponent = () =>
81
81
  }
82
82
  };
83
83
 
84
- const onDrop = (source: DraggableItemPosition, dest?: DraggableItemPosition) => {
84
+ const onDrop = (source: DraggableItemPosition, dest: DraggableItemPosition | undefined) => {
85
85
  if (dest) {
86
86
  const newList = [...chosenOptions];
87
87
  const [removed] = newList.splice(source.index, 1);
@@ -10,7 +10,7 @@ import { TextInput } from '../TextInput';
10
10
 
11
11
  export interface NumberInputProps extends React.HTMLProps<HTMLDivElement> {
12
12
  /** Value of the number input */
13
- value?: number;
13
+ value?: number | null;
14
14
  /** Additional classes added to the number input */
15
15
  className?: string;
16
16
  /** Sets the width of the number input to a number of characters */
@@ -89,6 +89,7 @@ export const NumberInput: React.FunctionComponent<NumberInputProps> = ({
89
89
  plusBtnProps,
90
90
  ...props
91
91
  }: NumberInputProps) => {
92
+ value = value || 0;
92
93
  const numberInputUnit = <div className={css(styles.numberInputUnit)}>{unit}</div>;
93
94
  const keyDownHandler =
94
95
  inputProps && inputProps.onKeyDown ? inputProps.onKeyDown : defaultKeyDownHandler({ inputName, onMinus, onPlus });
@@ -169,4 +169,22 @@ describe('numberInput', () => {
169
169
 
170
170
  expect(input).toHaveDisplayValue('47.01');
171
171
  });
172
+
173
+ test('renders 0 if no value passed', () => {
174
+ render(<NumberInput />);
175
+ const input = screen.getByRole('spinbutton');
176
+ expect(input).toHaveDisplayValue('0');
177
+ });
178
+
179
+ test('renders 0 if undefined value passed', () => {
180
+ render(<NumberInput value={undefined} />);
181
+ const input = screen.getByRole('spinbutton');
182
+ expect(input).toHaveDisplayValue('0');
183
+ });
184
+
185
+ test('renders 0 if null value passed', () => {
186
+ render(<NumberInput value={null} />);
187
+ const input = screen.getByRole('spinbutton');
188
+ expect(input).toHaveDisplayValue('0');
189
+ });
172
190
  });
@@ -36,7 +36,7 @@ export const ComposableActionsMenu: React.FunctionComponent = () => {
36
36
  };
37
37
  }, [isOpen, menuRef]);
38
38
 
39
- const onSelect = (event?: React.MouseEvent, itemId?: string | number) => {
39
+ const onSelect = (event: React.MouseEvent | undefined, itemId: string | number | undefined) => {
40
40
  if (typeof itemId === 'string' || typeof itemId === 'undefined') {
41
41
  return;
42
42
  }
@@ -1,9 +1,10 @@
1
1
  import React from 'react';
2
2
  import { MenuToggle, Menu, MenuContent, MenuList, MenuItem, Popper } from '@patternfly/react-core';
3
3
 
4
- // eslint-disable-next-line no-console
5
- const onSelect = (event?: React.MouseEvent, itemId?: string | number) => console.log('selected', itemId);
6
-
4
+ /* eslint-disable no-console */
5
+ const onSelect = (event: React.MouseEvent | undefined, itemId: string | number | undefined) =>
6
+ console.log('selected', itemId);
7
+ /* eslint-enable no-console */
7
8
  interface FlyoutMenuProps {
8
9
  children?: React.ReactElement;
9
10
  depth: number;
@@ -50,7 +50,7 @@ export const ComposableSimpleCheckboxSelect: React.FunctionComponent = () => {
50
50
  setIsOpen(!isOpen);
51
51
  };
52
52
 
53
- const onSelect = (event?: React.MouseEvent, itemId?: string | number) => {
53
+ const onSelect = (event: React.MouseEvent | undefined, itemId: string | number | undefined) => {
54
54
  if (typeof itemId === 'string' || typeof itemId === 'undefined') {
55
55
  return;
56
56
  }
@@ -59,7 +59,7 @@ export const ComposableSimpleSelect: React.FunctionComponent = () => {
59
59
  </MenuToggle>
60
60
  );
61
61
 
62
- function onSelect(event?: React.MouseEvent, itemId?: string | number) {
62
+ function onSelect(event: React.MouseEvent | undefined, itemId: string | number | undefined) {
63
63
  if (typeof itemId === 'undefined') {
64
64
  return;
65
65
  }
@@ -55,7 +55,7 @@ export const ComposableTypeaheadSelect: React.FunctionComponent = () => {
55
55
 
56
56
  const focusOnInput = () => menuToggleRef.current?.querySelector('input')?.focus();
57
57
 
58
- const onMenuSelect = (event?: React.MouseEvent, itemId?: string | number) => {
58
+ const onMenuSelect = (event: React.MouseEvent | undefined, itemId: string | number | undefined) => {
59
59
  if (itemId) {
60
60
  setInputValue(itemId.toString());
61
61
  setIsSelected(true);
@@ -124,7 +124,7 @@ export const ComposableTypeaheadSelect: React.FunctionComponent = () => {
124
124
  };
125
125
 
126
126
  // Close the menu when a click occurs outside of the menu toggle content
127
- const onDocumentClick = (event?: MouseEvent) => {
127
+ const onDocumentClick = (event: MouseEvent | undefined) => {
128
128
  if (!menuToggleRef.current?.contains(event?.target as HTMLElement)) {
129
129
  setIsMenuOpen(false);
130
130
  }