Skip to content

Commit 181e3e1

Browse files
committed
simplify input component
1 parent ac5fa58 commit 181e3e1

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

resources/views/components/input-otp.blade.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@
3434
this.$refs.code.dispatchEvent(new Event('input', { bubbles: true }));
3535
this.$refs.code.dispatchEvent(new Event('change', { bubbles: true }));
3636
},
37-
onComplete() {
38-
this.updateHiddenField();
39-
},
4037
handleNumberKey(index, key) {
4138
this.getInput(index).value = key;
4239
@@ -46,9 +43,6 @@
4643
4744
$nextTick(() => {
4845
this.updateHiddenField();
49-
if (index === this.totalDigits && this.isComplete()) {
50-
this.onComplete();
51-
}
5246
});
5347
},
5448
handleBackspace(index) {
@@ -90,7 +84,6 @@
9084
9185
if (numericOnly.length >= this.totalDigits) {
9286
this.updateHiddenField();
93-
this.onComplete();
9487
}
9588
},
9689
clearAll() {
@@ -118,7 +111,7 @@ class="relative">
118111
@keydown="handleKeyDown({{ $x }}, $event)"
119112
@focus="$el.select()"
120113
@input="$el.value = $el.value.replace(/[^0-9]/g, '').slice(0, 1)"
121-
class="flex h-10 w-10 items-center justify-center border border-zinc-300 bg-accent-foreground text-center text-sm font-medium text-accent-content transition-colors placeholder:text-zinc-500 focus:border-accent focus:border-2 focus:outline-none focus:relative focus:z-10 disabled:cursor-not-allowed disabled:opacity-50 dark:border-zinc-700 dark:focus:border-accent
114+
class="flex h-10 w-10 items-center justify-center border border-zinc-300 bg-accent-foreground text-center text-sm font-medium text-accent-content transition-colors focus:border-accent focus:border-2 focus:outline-none focus:relative focus:z-10 dark:border-zinc-700 dark:focus:border-accent
122115
@if($x == 1) rounded-l-md @endif
123116
@if($x == $digits) rounded-r-md @endif
124117
@if($x > 1) -ml-px @endif"
@@ -129,7 +122,6 @@ class="flex h-10 w-10 items-center justify-center border border-zinc-300 bg-acce
129122
<input
130123
{{ $attributes->except(['digits']) }}
131124
type="hidden"
132-
class="hidden"
133125
x-ref="code"
134126
name="{{ $name }}"
135127
minlength="{{ $digits }}"

0 commit comments

Comments
 (0)