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",
"version": "0.2.45",
"version": "0.2.46",
"description": "Javascript library to display typebots on your website",
"type": "module",
"main": "dist/index.js",

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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