diff --git a/packages/react-core/src/components/NumberInput/NumberInput.tsx b/packages/react-core/src/components/NumberInput/NumberInput.tsx index eea81b7e180..d4d3ed43954 100644 --- a/packages/react-core/src/components/NumberInput/NumberInput.tsx +++ b/packages/react-core/src/components/NumberInput/NumberInput.tsx @@ -51,8 +51,6 @@ export interface NumberInputProps extends React.HTMLProps { minusBtnProps?: ButtonProps; /** Additional properties added to the plus button */ plusBtnProps?: ButtonProps; - /** Allow the user to clear out the input to an empty string (recommended) */ - allowEmptyInput?: boolean; } type DefaultKeyDownHandlerArgs = Pick; @@ -89,12 +87,8 @@ export const NumberInput: React.FunctionComponent = ({ inputProps, minusBtnProps, plusBtnProps, - allowEmptyInput = false, ...props }: NumberInputProps) => { - if (!allowEmptyInput) { - value = value || 0; - } const numberInputUnit =
{unit}
; const keyDownHandler = inputProps && inputProps.onKeyDown ? inputProps.onKeyDown : defaultKeyDownHandler({ inputName, onMinus, onPlus }); diff --git a/packages/react-core/src/components/NumberInput/__tests__/NumberInput.test.tsx b/packages/react-core/src/components/NumberInput/__tests__/NumberInput.test.tsx index c043d5b7cb3..81b38cbf6f1 100644 --- a/packages/react-core/src/components/NumberInput/__tests__/NumberInput.test.tsx +++ b/packages/react-core/src/components/NumberInput/__tests__/NumberInput.test.tsx @@ -210,12 +210,6 @@ describe('numberInput', () => { test('renders 0 if null value passed', () => { render(); const input = screen.getByRole('spinbutton'); - expect(input).toHaveDisplayValue('0'); - }); - - test('renders nothing if null value passed with allow empty', () => { - render(); - const input = screen.getByRole('spinbutton'); expect(input).toHaveDisplayValue(''); }); diff --git a/packages/react-core/src/components/NumberInput/examples/NumberInputCustomStep.tsx b/packages/react-core/src/components/NumberInput/examples/NumberInputCustomStep.tsx index 47b47c281f7..c63f02b754b 100644 --- a/packages/react-core/src/components/NumberInput/examples/NumberInputCustomStep.tsx +++ b/packages/react-core/src/components/NumberInput/examples/NumberInputCustomStep.tsx @@ -24,7 +24,6 @@ export const NumberInputCustomStep: React.FunctionComponent = () => { inputAriaLabel="number input" minusBtnAriaLabel="minus" plusBtnAriaLabel="plus" - allowEmptyInput /> ); }; diff --git a/packages/react-core/src/components/NumberInput/examples/NumberInputCustomStepAndThreshold.tsx b/packages/react-core/src/components/NumberInput/examples/NumberInputCustomStepAndThreshold.tsx index b4fe60a4c2a..f410c255616 100644 --- a/packages/react-core/src/components/NumberInput/examples/NumberInputCustomStepAndThreshold.tsx +++ b/packages/react-core/src/components/NumberInput/examples/NumberInputCustomStepAndThreshold.tsx @@ -46,7 +46,6 @@ export const NumberInputCustomStepAndThreshold: React.FunctionComponent = () => inputAriaLabel="number input" minusBtnAriaLabel="minus" plusBtnAriaLabel="plus" - allowEmptyInput /> ); }; diff --git a/packages/react-core/src/components/NumberInput/examples/NumberInputDefault.tsx b/packages/react-core/src/components/NumberInput/examples/NumberInputDefault.tsx index b229401c0db..4f86471db04 100644 --- a/packages/react-core/src/components/NumberInput/examples/NumberInputDefault.tsx +++ b/packages/react-core/src/components/NumberInput/examples/NumberInputDefault.tsx @@ -29,7 +29,6 @@ export const NumberInputDefault: React.FunctionComponent = () => { inputAriaLabel="number input" minusBtnAriaLabel="minus" plusBtnAriaLabel="plus" - allowEmptyInput /> ); }; diff --git a/packages/react-core/src/components/NumberInput/examples/NumberInputDisabled.tsx b/packages/react-core/src/components/NumberInput/examples/NumberInputDisabled.tsx index 30de6258745..5f182ac00df 100644 --- a/packages/react-core/src/components/NumberInput/examples/NumberInputDisabled.tsx +++ b/packages/react-core/src/components/NumberInput/examples/NumberInputDisabled.tsx @@ -35,7 +35,6 @@ export const NumberInputDisabled: React.FunctionComponent = () => { plusBtnAriaLabel="plus" unit="%" isDisabled - allowEmptyInput /> ); }; diff --git a/packages/react-core/src/components/NumberInput/examples/NumberInputUnit.tsx b/packages/react-core/src/components/NumberInput/examples/NumberInputUnit.tsx index 30ec3d7a139..5cab6f02cc5 100644 --- a/packages/react-core/src/components/NumberInput/examples/NumberInputUnit.tsx +++ b/packages/react-core/src/components/NumberInput/examples/NumberInputUnit.tsx @@ -37,7 +37,6 @@ export const NumberInputUnit: React.FunctionComponent = () => { minusBtnAriaLabel="minus 1" plusBtnAriaLabel="plus 1" unit="%" - allowEmptyInput />

@@ -52,7 +51,6 @@ export const NumberInputUnit: React.FunctionComponent = () => { plusBtnAriaLabel="plus 0.01" unit="$" unitPosition="before" - allowEmptyInput /> ); diff --git a/packages/react-core/src/components/NumberInput/examples/NumberInputUnitThreshold.tsx b/packages/react-core/src/components/NumberInput/examples/NumberInputUnitThreshold.tsx index 80c4670673c..98cf3c66ed9 100644 --- a/packages/react-core/src/components/NumberInput/examples/NumberInputUnitThreshold.tsx +++ b/packages/react-core/src/components/NumberInput/examples/NumberInputUnitThreshold.tsx @@ -59,7 +59,6 @@ export const NumberInputUnitThreshold: React.FunctionComponent = () => { minusBtnAriaLabel="minus" plusBtnAriaLabel="plus" unit="%" - allowEmptyInput /> ); diff --git a/packages/react-core/src/components/NumberInput/examples/NumberInputVaryingSizes.tsx b/packages/react-core/src/components/NumberInput/examples/NumberInputVaryingSizes.tsx index cb8ac42dbab..d6430cf9dbe 100644 --- a/packages/react-core/src/components/NumberInput/examples/NumberInputVaryingSizes.tsx +++ b/packages/react-core/src/components/NumberInput/examples/NumberInputVaryingSizes.tsx @@ -35,7 +35,6 @@ export const NumberInputVaryingSizes: React.FunctionComponent = () => { minusBtnAriaLabel="input 2 minus" plusBtnAriaLabel="input 2 plus" widthChars={1} - allowEmptyInput />

@@ -49,7 +48,6 @@ export const NumberInputVaryingSizes: React.FunctionComponent = () => { minusBtnAriaLabel="input 2 minus" plusBtnAriaLabel="input 2 plus" widthChars={10} - allowEmptyInput />

@@ -63,7 +61,6 @@ export const NumberInputVaryingSizes: React.FunctionComponent = () => { minusBtnAriaLabel="input 3 minus" plusBtnAriaLabel="input 3 plus" widthChars={5} - allowEmptyInput />

@@ -77,7 +74,6 @@ export const NumberInputVaryingSizes: React.FunctionComponent = () => { minusBtnAriaLabel="input 4 minus" plusBtnAriaLabel="input 4 plus" widthChars={5} - allowEmptyInput /> ); diff --git a/packages/react-core/src/components/NumberInput/examples/NumberInputWithStatus.tsx b/packages/react-core/src/components/NumberInput/examples/NumberInputWithStatus.tsx index 5e1b762cf39..ef776062074 100644 --- a/packages/react-core/src/components/NumberInput/examples/NumberInputWithStatus.tsx +++ b/packages/react-core/src/components/NumberInput/examples/NumberInputWithStatus.tsx @@ -53,7 +53,6 @@ export const NumberInputWithStatus: React.FunctionComponent = () => { inputAriaLabel="number input" minusBtnAriaLabel="minus" plusBtnAriaLabel="plus" - allowEmptyInput /> ); diff --git a/packages/react-core/src/demos/examples/AlertGroup/AlertGroupToastWithNotificationDrawer.tsx b/packages/react-core/src/demos/examples/AlertGroup/AlertGroupToastWithNotificationDrawer.tsx index 884cff92a50..242268e4dcd 100644 --- a/packages/react-core/src/demos/examples/AlertGroup/AlertGroupToastWithNotificationDrawer.tsx +++ b/packages/react-core/src/demos/examples/AlertGroup/AlertGroupToastWithNotificationDrawer.tsx @@ -349,7 +349,6 @@ export const AlertGroupToastWithNotificationDrawer: React.FunctionComponent = () minusBtnAriaLabel="minus" plusBtnAriaLabel="plus" style={{ margin: '12px 0' }} - allowEmptyInput /> diff --git a/packages/react-integration/demo-app-ts/src/components/demos/NumberInputDemo/NumberInputDemo.tsx b/packages/react-integration/demo-app-ts/src/components/demos/NumberInputDemo/NumberInputDemo.tsx index 9c3a401bb00..2811603b4ec 100644 --- a/packages/react-integration/demo-app-ts/src/components/demos/NumberInputDemo/NumberInputDemo.tsx +++ b/packages/react-integration/demo-app-ts/src/components/demos/NumberInputDemo/NumberInputDemo.tsx @@ -87,7 +87,6 @@ export class NumberInputDemo extends Component { plusBtnProps={{ id: 'plus-button' }} unit="%" widthChars={5} - allowEmptyInput />

@@ -109,7 +108,6 @@ export class NumberInputDemo extends Component { unit="$" unitPosition="before" isDisabled - allowEmptyInput />

@@ -131,7 +129,6 @@ export class NumberInputDemo extends Component { plusBtnProps={{ id: 'plus-button3' }} unit="$" unitPosition="before" - allowEmptyInput /> );