@patternfly/react-core 4.202.19 → 4.202.20
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 +2 -0
- package/dist/esm/components/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/esm/components/NumberInput/NumberInput.js +2 -2
- package/dist/esm/components/NumberInput/NumberInput.js.map +1 -1
- package/dist/js/components/NumberInput/NumberInput.d.ts +2 -0
- package/dist/js/components/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/js/components/NumberInput/NumberInput.js +2 -2
- package/dist/js/components/NumberInput/NumberInput.js.map +1 -1
- package/dist/umd/react-core.js +2 -2
- package/dist/umd/react-core.min.css +460 -460
- package/dist/umd/react-core.min.js +1 -1
- package/package.json +5 -5
- package/src/components/NumberInput/NumberInput.tsx +4 -0
- package/src/components/NumberInput/examples/NumberInput.md +8 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "4.202.
|
|
3
|
+
"version": "4.202.20",
|
|
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.
|
|
38
|
-
"@patternfly/react-styles": "^4.52.
|
|
39
|
-
"@patternfly/react-tokens": "^4.54.
|
|
37
|
+
"@patternfly/react-icons": "^4.53.20",
|
|
38
|
+
"@patternfly/react-styles": "^4.52.20",
|
|
39
|
+
"@patternfly/react-tokens": "^4.54.20",
|
|
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": "
|
|
63
|
+
"gitHead": "d42bba5cd0c58e77d18fa60638804f9c6b21de94"
|
|
64
64
|
}
|
|
@@ -20,6 +20,8 @@ export interface NumberInputProps extends React.HTMLProps<HTMLDivElement> {
|
|
|
20
20
|
onMinus?: (event: React.MouseEvent, name?: string) => void;
|
|
21
21
|
/** Callback for the text input changing */
|
|
22
22
|
onChange?: (event: React.FormEvent<HTMLInputElement>) => void;
|
|
23
|
+
/** Callback function when text input is blurred (focus leaves) */
|
|
24
|
+
onBlur?: (event?: any) => void;
|
|
23
25
|
/** Callback for the plus button */
|
|
24
26
|
onPlus?: (event: React.MouseEvent, name?: string) => void;
|
|
25
27
|
/** Adds the given unit to the number input */
|
|
@@ -66,6 +68,7 @@ export const NumberInput: React.FunctionComponent<NumberInputProps> = ({
|
|
|
66
68
|
isDisabled = false,
|
|
67
69
|
onMinus = () => {},
|
|
68
70
|
onChange,
|
|
71
|
+
onBlur,
|
|
69
72
|
onPlus = () => {},
|
|
70
73
|
unit,
|
|
71
74
|
unitPosition = 'after',
|
|
@@ -116,6 +119,7 @@ export const NumberInput: React.FunctionComponent<NumberInputProps> = ({
|
|
|
116
119
|
aria-label={inputAriaLabel}
|
|
117
120
|
{...(isDisabled && { disabled: isDisabled })}
|
|
118
121
|
{...(onChange && { onChange })}
|
|
122
|
+
{...(onBlur && { onBlur })}
|
|
119
123
|
{...(!onChange && { readOnly: true })}
|
|
120
124
|
{...inputProps}
|
|
121
125
|
onKeyDown={keyDownHandler}
|
|
@@ -447,6 +447,13 @@ class CustomStepNumberInput extends React.Component {
|
|
|
447
447
|
};
|
|
448
448
|
|
|
449
449
|
this.onChange = event => {
|
|
450
|
+
const newValue = isNaN(event.target.value) ? 0 : Number(event.target.value);
|
|
451
|
+
this.setState({
|
|
452
|
+
value: newValue
|
|
453
|
+
});
|
|
454
|
+
};
|
|
455
|
+
|
|
456
|
+
this.onBlur = event => {
|
|
450
457
|
const newValue = isNaN(event.target.value) ? 0 : Number(event.target.value);
|
|
451
458
|
this.setState({
|
|
452
459
|
value: newValue > this.maxValue ? this.maxValue : newValue < this.minValue ? this.minValue : newValue
|
|
@@ -463,6 +470,7 @@ class CustomStepNumberInput extends React.Component {
|
|
|
463
470
|
max={this.maxValue}
|
|
464
471
|
onMinus={this.stepper(-3)}
|
|
465
472
|
onChange={this.onChange}
|
|
473
|
+
onBlur={this.onBlur}
|
|
466
474
|
onPlus={this.stepper(3)}
|
|
467
475
|
inputName="input"
|
|
468
476
|
inputAriaLabel="number input"
|