🐛 (numberInput) Fix input clearing out on dot or comma press
This commit is contained in:
1
packages/bot-engine/blocks/inputs/number/parseNumber.ts
Normal file
1
packages/bot-engine/blocks/inputs/number/parseNumber.ts
Normal file
@@ -0,0 +1 @@
|
||||
export const parseNumber = (value: string) => Number(value).toString()
|
||||
@@ -1 +1,10 @@
|
||||
export const validateNumber = (inputValue: string) => !isNaN(Number(inputValue))
|
||||
import { isNotDefined } from '@typebot.io/lib'
|
||||
import { NumberInputBlock } from '@typebot.io/schemas'
|
||||
|
||||
export const validateNumber = (
|
||||
inputValue: string,
|
||||
options: NumberInputBlock['options']
|
||||
) =>
|
||||
inputValue !== '' &&
|
||||
(isNotDefined(options?.min) || Number(inputValue) >= Number(options.min)) &&
|
||||
(isNotDefined(options?.max) || Number(inputValue) <= Number(options.max))
|
||||
|
||||
Reference in New Issue
Block a user