From 15364b00125e96b842580acef3f67c0f6cde8082 Mon Sep 17 00:00:00 2001 From: Alex Barnsley <8069294+alexbarnsley@users.noreply.github.com> Date: Tue, 31 Jan 2023 12:57:42 +0000 Subject: [PATCH] feat: input debounce property --- resources/views/inputs/checkbox.blade.php | 5 +++++ .../views/inputs/includes/input-field.blade.php | 7 +++++++ resources/views/inputs/input-with-icon.blade.php | 1 + .../views/inputs/input-with-prefix.blade.php | 1 + .../views/inputs/input-with-suffix.blade.php | 1 + resources/views/inputs/input.blade.php | 15 ++++++++------- 6 files changed, 23 insertions(+), 7 deletions(-) diff --git a/resources/views/inputs/checkbox.blade.php b/resources/views/inputs/checkbox.blade.php index 405f96c93..73c417339 100644 --- a/resources/views/inputs/checkbox.blade.php +++ b/resources/views/inputs/checkbox.blade.php @@ -12,6 +12,7 @@ 'alpine' => false, 'right' => false, 'deferred' => false, + 'debounce' => null, ]) @php @@ -42,6 +43,10 @@ class="focus-visible:ring-2 form-checkbox input-checkbox focus-visible:ring-theme-primary-500" @if ($deferred) wire:model.defer="{{ $model ?? $name }}" + @elseif ($debounce === true) + wire:model.debounce="{{ $model ?? $name }}" + @elseif (is_string($debounce)) + wire:model.debounce.{{ $debounce }}="{{ $model ?? $name }}" @else wire:model="{{ $model ?? $name }}" @endif diff --git a/resources/views/inputs/includes/input-field.blade.php b/resources/views/inputs/includes/input-field.blade.php index 49f4d01d2..4b87f7f31 100644 --- a/resources/views/inputs/includes/input-field.blade.php +++ b/resources/views/inputs/includes/input-field.blade.php @@ -10,6 +10,7 @@ 'model' => null, 'attributes' => $attributes, 'deferred' => false, + 'debounce' => null, ]) @include('ark::inputs.includes.input-field', [ - 'name' => $name, - 'errors' => $errors, - 'id' => $id ?? $name, - 'inputClass' => $inputClass ?? '', - 'noModel' => $noModel ?? false, - 'model' => $model ?? $name, - 'deferred' => $deferred ?? false, + 'name' => $name, + 'errors' => $errors, + 'id' => $id ?? $name, + 'inputClass' => $inputClass ?? '', + 'noModel' => $noModel ?? false, + 'model' => $model ?? $name, + 'deferred' => $deferred ?? false, + 'debounce' => $debounce ?? null, ]) @error($name)