@patternfly/react-core 4.235.4 → 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/CHANGELOG.md +11 -0
- package/dist/esm/components/NumberInput/NumberInput.d.ts +1 -1
- package/dist/esm/components/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/esm/components/NumberInput/NumberInput.js +1 -0
- package/dist/esm/components/NumberInput/NumberInput.js.map +1 -1
- package/dist/js/components/NumberInput/NumberInput.d.ts +1 -1
- package/dist/js/components/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/js/components/NumberInput/NumberInput.js +1 -0
- package/dist/js/components/NumberInput/NumberInput.js.map +1 -1
- package/dist/umd/react-core.min.css +2160 -2160
- package/dist/umd/react-core.min.js +1 -1
- package/package.json +5 -5
- package/src/components/NumberInput/NumberInput.tsx +2 -1
- package/src/components/NumberInput/__tests__/NumberInput.test.tsx +18 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "4.235.
|
|
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",
|
|
@@ -44,9 +44,9 @@
|
|
|
44
44
|
"generate": "node scripts/copyStyles.js"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@patternfly/react-icons": "^4.86.
|
|
48
|
-
"@patternfly/react-styles": "^4.85.
|
|
49
|
-
"@patternfly/react-tokens": "^4.87.
|
|
47
|
+
"@patternfly/react-icons": "^4.86.5",
|
|
48
|
+
"@patternfly/react-styles": "^4.85.5",
|
|
49
|
+
"@patternfly/react-tokens": "^4.87.5",
|
|
50
50
|
"focus-trap": "6.9.2",
|
|
51
51
|
"react-dropzone": "9.0.0",
|
|
52
52
|
"tippy.js": "5.1.2",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"react": "^16.8.0 || ^17.0.0",
|
|
71
71
|
"react-dom": "^16.8.0 || ^17.0.0"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "6ec6b7c439ec2475f03ddfdc9ad494396aecb6a6"
|
|
74
74
|
}
|
|
@@ -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
|
});
|