2
0

🐛 (bot) Remove SendButton disable state

It did not turn enable on some browser when input is autofilled

Closes #878
This commit is contained in:
Baptiste Arnaud
2024-03-01 16:02:16 +01:00
parent 78d3e9b1f2
commit dd9b7eebb5
9 changed files with 14 additions and 37 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@typebot.io/js", "name": "@typebot.io/js",
"version": "0.2.45", "version": "0.2.46",
"description": "Javascript library to display typebots on your website", "description": "Javascript library to display typebots on your website",
"type": "module", "type": "module",
"main": "dist/index.js", "main": "dist/index.js",

View File

@ -94,10 +94,7 @@ export const DateForm = (props: Props) => {
)} )}
</div> </div>
<SendButton <SendButton class="my-2 ml-2">
isDisabled={inputValues().to === '' && inputValues().from === ''}
class="my-2 ml-2"
>
{props.options?.labels?.button ?? {props.options?.labels?.button ??
defaultDateInputOptions.labels.button} defaultDateInputOptions.labels.button}
</SendButton> </SendButton>

View File

@ -24,6 +24,7 @@ export const EmailInput = (props: Props) => {
const submit = () => { const submit = () => {
if (checkIfInputIsValid()) props.onSubmit({ value: inputValue() }) if (checkIfInputIsValid()) props.onSubmit({ value: inputValue() })
else inputRef?.focus()
} }
const submitWhenEnter = (e: KeyboardEvent) => { const submitWhenEnter = (e: KeyboardEvent) => {
@ -65,12 +66,7 @@ export const EmailInput = (props: Props) => {
type="email" type="email"
autocomplete="email" autocomplete="email"
/> />
<SendButton <SendButton type="button" class="my-2 ml-2" on:click={submit}>
type="button"
isDisabled={inputValue() === ''}
class="my-2 ml-2"
on:click={submit}
>
{props.block.options?.labels?.button ?? {props.block.options?.labels?.button ??
defaultEmailInputOptions.labels.button} defaultEmailInputOptions.labels.button}
</SendButton> </SendButton>

View File

@ -29,6 +29,7 @@ export const NumberInput = (props: NumberInputProps) => {
const submit = () => { const submit = () => {
if (checkIfInputIsValid()) if (checkIfInputIsValid())
props.onSubmit({ value: inputValue().toString() }) props.onSubmit({ value: inputValue().toString() })
else inputRef?.focus()
} }
const submitWhenEnter = (e: KeyboardEvent) => { const submitWhenEnter = (e: KeyboardEvent) => {
@ -79,12 +80,7 @@ export const NumberInput = (props: NumberInputProps) => {
max={props.block.options?.max} max={props.block.options?.max}
step={props.block.options?.step ?? 'any'} step={props.block.options?.step ?? 'any'}
/> />
<SendButton <SendButton type="button" class="my-2 ml-2" on:click={submit}>
type="button"
isDisabled={inputValue() === ''}
class="my-2 ml-2"
on:click={submit}
>
{props.block.options?.labels?.button ?? {props.block.options?.labels?.button ??
defaultNumberInputOptions.labels.button} defaultNumberInputOptions.labels.button}
</SendButton> </SendButton>

View File

@ -69,6 +69,7 @@ export const PhoneInput = (props: PhoneInputProps) => {
? inputValue() ? inputValue()
: `${selectedCountryDialCode ?? ''}${inputValue()}`, : `${selectedCountryDialCode ?? ''}${inputValue()}`,
}) })
else inputRef?.focus()
} }
const submitWhenEnter = (e: KeyboardEvent) => { const submitWhenEnter = (e: KeyboardEvent) => {
@ -155,12 +156,7 @@ export const PhoneInput = (props: PhoneInputProps) => {
/> />
</div> </div>
<SendButton <SendButton type="button" class="my-2 ml-2" on:click={submit}>
type="button"
isDisabled={inputValue() === ''}
class="my-2 ml-2"
on:click={submit}
>
{props.labels?.button ?? defaultPhoneInputOptions.labels.button} {props.labels?.button ?? defaultPhoneInputOptions.labels.button}
</SendButton> </SendButton>
</div> </div>

View File

@ -24,6 +24,7 @@ export const TextInput = (props: Props) => {
const submit = () => { const submit = () => {
if (checkIfInputIsValid()) props.onSubmit({ value: inputValue() }) if (checkIfInputIsValid()) props.onSubmit({ value: inputValue() })
else inputRef?.focus()
} }
const submitWhenEnter = (e: KeyboardEvent) => { const submitWhenEnter = (e: KeyboardEvent) => {
@ -82,12 +83,7 @@ export const TextInput = (props: Props) => {
} }
/> />
)} )}
<SendButton <SendButton type="button" class="my-2 ml-2" on:click={submit}>
type="button"
isDisabled={inputValue() === ''}
class="my-2 ml-2"
on:click={submit}
>
{props.block.options?.labels?.button ?? {props.block.options?.labels?.button ??
defaultTextInputOptions.labels.button} defaultTextInputOptions.labels.button}
</SendButton> </SendButton>

View File

@ -30,6 +30,7 @@ export const UrlInput = (props: Props) => {
const submit = () => { const submit = () => {
if (checkIfInputIsValid()) props.onSubmit({ value: inputValue() }) if (checkIfInputIsValid()) props.onSubmit({ value: inputValue() })
else inputRef?.focus()
} }
const submitWhenEnter = (e: KeyboardEvent) => { const submitWhenEnter = (e: KeyboardEvent) => {
@ -71,12 +72,7 @@ export const UrlInput = (props: Props) => {
type="url" type="url"
autocomplete="url" autocomplete="url"
/> />
<SendButton <SendButton type="button" class="my-2 ml-2" on:click={submit}>
type="button"
isDisabled={inputValue() === ''}
class="my-2 ml-2"
on:click={submit}
>
{props.block.options?.labels?.button ?? {props.block.options?.labels?.button ??
defaultUrlInputOptions.labels.button} defaultUrlInputOptions.labels.button}
</SendButton> </SendButton>

View File

@ -1,6 +1,6 @@
{ {
"name": "@typebot.io/nextjs", "name": "@typebot.io/nextjs",
"version": "0.2.45", "version": "0.2.46",
"description": "Convenient library to display typebots on your Next.js website", "description": "Convenient library to display typebots on your Next.js website",
"main": "dist/index.js", "main": "dist/index.js",
"types": "dist/index.d.ts", "types": "dist/index.d.ts",

View File

@ -1,6 +1,6 @@
{ {
"name": "@typebot.io/react", "name": "@typebot.io/react",
"version": "0.2.45", "version": "0.2.46",
"description": "Convenient library to display typebots on your React app", "description": "Convenient library to display typebots on your React app",
"main": "dist/index.js", "main": "dist/index.js",
"types": "dist/index.d.ts", "types": "dist/index.d.ts",