mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
feat(elements): add autoSubmit bool to InputDigits
By default, InputDigits will auto submit unless autoSubmit is set to false.
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
export let readonly = false;
|
||||
export let autofocus = false;
|
||||
export let fullWidth = false;
|
||||
export let autoSubmit = true;
|
||||
|
||||
let element: HTMLOListElement;
|
||||
|
||||
@@ -21,9 +22,12 @@
|
||||
placeholder: '',
|
||||
defaultValue: value.split(''),
|
||||
onValueChange: ({ next }) => {
|
||||
if (!autoSubmit) {
|
||||
return next;
|
||||
}
|
||||
value = next.join('');
|
||||
|
||||
if (value.length === 6 && !autoSubmitted) {
|
||||
if (value.length === length && !autoSubmitted) {
|
||||
autoSubmitted = true;
|
||||
const firstInputElement = element.querySelector('input');
|
||||
firstInputElement?.form.requestSubmit();
|
||||
|
||||
Reference in New Issue
Block a user