diff --git a/src/main/app/src/components/NumberInput/index.tsx b/src/main/app/src/components/NumberInput/index.tsx index b16d72501..c38acafe6 100644 --- a/src/main/app/src/components/NumberInput/index.tsx +++ b/src/main/app/src/components/NumberInput/index.tsx @@ -1,6 +1,6 @@ import React from 'react'; -import _fp from 'lodash/fp'; +import { identity, isNaN, isNil, isNumber, noop, toString } from 'lodash'; import { Input, InputProps } from '#/src/components/virkailija'; import { parseFloatComma } from '#/src/utils'; @@ -14,25 +14,25 @@ type NumberInputProps = { } & InputProps; const floatToCommaStr = (value?: number | null) => - _fp.isNil(value) ? '' : _fp.toString(value).replace('.', ','); + isNil(value) ? '' : toString(value).replace('.', ','); const NumberInput = ({ - onBlur = _fp.noop, - min = 0, + onBlur = noop, + min, max, fallbackValue = null, - parseValue = _fp.identity, + parseValue = identity, ...props }: NumberInputProps) => { const usedOnBlur = e => { const value: string = e?.target?.value; const floatValue = parseValue(value); - if (_fp.isNaN(floatValue) || _fp.isNil(floatValue)) { + if (isNaN(floatValue) || isNil(floatValue)) { e.target.value = fallbackValue; } else { - if (_fp.isNumber(max) && floatValue > max) { + if (isNumber(max) && floatValue > max) { e.target.value = max; - } else if (_fp.isNumber(min) && floatValue < min) { + } else if (isNumber(min) && floatValue < min) { e.target.value = min; } else { e.target.value = floatToCommaStr(floatValue); diff --git a/src/main/app/src/pages/toteutus/ToteutusForm/HakeutumisTaiIlmoittautumistapaSection/HakeutumisTaiIlmoittautumistapaSection.tsx b/src/main/app/src/pages/toteutus/ToteutusForm/HakeutumisTaiIlmoittautumistapaSection/HakeutumisTaiIlmoittautumistapaSection.tsx index f46ba7712..f19c07a14 100644 --- a/src/main/app/src/pages/toteutus/ToteutusForm/HakeutumisTaiIlmoittautumistapaSection/HakeutumisTaiIlmoittautumistapaSection.tsx +++ b/src/main/app/src/pages/toteutus/ToteutusForm/HakeutumisTaiIlmoittautumistapaSection/HakeutumisTaiIlmoittautumistapaSection.tsx @@ -118,7 +118,7 @@ export const HakeutumisTaiIlmoittautumistapaSection = ({