From 06df87e442477b74bdb7af230665099518069d7f Mon Sep 17 00:00:00 2001 From: William Asaba Date: Mon, 11 May 2026 12:02:29 +0300 Subject: [PATCH 1/9] chore: Update configuration file structure Simplified configuration options and removed unused settings for cleaner setup. --- config/searchable-select.php | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/config/searchable-select.php b/config/searchable-select.php index c37b6b3..eff1aa1 100644 --- a/config/searchable-select.php +++ b/config/searchable-select.php @@ -12,17 +12,4 @@ */ 'theme' => env('SEARCHABLE_SELECT_THEME', 'tailwind'), - - /* - |-------------------------------------------------------------------------- - | Bootstrap Version - |-------------------------------------------------------------------------- - | - | Specify the Bootstrap version you're using. This helps optimize - | the CSS classes for your specific Bootstrap version. - | Supported values: "5" - | - */ - - 'bootstrap_version' => env('SEARCHABLE_SELECT_BOOTSTRAP_VERSION', '5'), ]; From f184ab40181cdaf5eb7bcc49cbaedf0728ecb2e0 Mon Sep 17 00:00:00 2001 From: William Asaba Date: Mon, 11 May 2026 12:02:40 +0300 Subject: [PATCH 2/9] feat: Add Bootstrap demo route Added route for Bootstrap theme demo page to showcase component functionality. --- demo/routes/web.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demo/routes/web.php b/demo/routes/web.php index d3df3d2..0016766 100644 --- a/demo/routes/web.php +++ b/demo/routes/web.php @@ -51,4 +51,4 @@ } return response()->json(array_values($countries)); -}); +})->middleware('throttle:60,1'); From 74660c23e4a3851099221ba0ab1fbec65295f632 Mon Sep 17 00:00:00 2001 From: William Asaba Date: Mon, 11 May 2026 12:02:54 +0300 Subject: [PATCH 3/9] fix: Refactor Bootstrap component with modular Alpine.js Improved component structure with better separation of concerns and enhanced maintainability. --- .../searchable-select-bootstrap.blade.php | 200 ++---------------- 1 file changed, 19 insertions(+), 181 deletions(-) diff --git a/resources/views/searchable-select-bootstrap.blade.php b/resources/views/searchable-select-bootstrap.blade.php index af98cd0..71a6318 100644 --- a/resources/views/searchable-select-bootstrap.blade.php +++ b/resources/views/searchable-select-bootstrap.blade.php @@ -50,196 +50,29 @@ if ($grouped) { foreach ($alpineOptions as $group) { foreach ($group['items'] as $item) { - $labelsMap[$item['value']] = $item['label']; + $labelsMap[(string) $item['value']] = $item['label']; } } } else { foreach ($alpineOptions as $item) { - $labelsMap[$item['value']] = $item['label']; + $labelsMap[(string) $item['value']] = $item['label']; } } + + $mappedSelectedValues = array_map(fn($v) => is_numeric($v) ? (int) $v : $v, $selectedValues); @endphp +@once - -@once -@push('scripts') - -@endpush @endonce -
@@ -342,6 +175,11 @@ class="dropdown-menu show position-absolute shadow border rounded overflow-hidde
+ {{-- Error message --}} + + @if ($grouped) - @@ -395,7 +233,7 @@ class="dropdown-item d-flex align-items-center justify-content-between py-2" - From 5ed4427914e3ea0fcf1f453122481fb88714e082 Mon Sep 17 00:00:00 2001 From: William Asaba Date: Mon, 11 May 2026 12:03:14 +0300 Subject: [PATCH 4/9] fix: Refactor main component with modular Alpine.js Improved component structure with shared script partial and enhanced maintainability. --- resources/views/searchable-select.blade.php | 197 ++------------------ 1 file changed, 16 insertions(+), 181 deletions(-) diff --git a/resources/views/searchable-select.blade.php b/resources/views/searchable-select.blade.php index 3a45d2e..537ec17 100644 --- a/resources/views/searchable-select.blade.php +++ b/resources/views/searchable-select.blade.php @@ -51,190 +51,19 @@ if ($grouped) { foreach ($alpineOptions as $group) { foreach ($group['items'] as $item) { - $labelsMap[$item['value']] = $item['label']; + $labelsMap[(string) $item['value']] = $item['label']; } } } else { foreach ($alpineOptions as $item) { - $labelsMap[$item['value']] = $item['label']; + $labelsMap[(string) $item['value']] = $item['label']; } } -@endphp - - - -@once -@push('scripts') - -@endpush -@endonce +@include('searchable-select::partials._searchable-select-script')
@@ -344,6 +173,12 @@ class="w-full px-3 py-2.5 border-b border-gray-300 dark:border-gray-600 bg-white
+ {{-- Error message --}} +
+ +
+ @if ($grouped) -
{{ $emptyMessage }}
@@ -398,7 +233,7 @@ class="w-4 h-4 text-blue-600 dark:text-blue-400 flex-shrink-0 ml-2" -
{{ $emptyMessage }}
From 7c0aee3d86a247bff07ec528f5dad0f3247ee011 Mon Sep 17 00:00:00 2001 From: William Asaba Date: Mon, 11 May 2026 12:03:31 +0300 Subject: [PATCH 5/9] refactor: Update service provider with component registration Enhanced service provider to properly register the SearchableSelect component class. --- src/SearchableSelectServiceProvider.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/SearchableSelectServiceProvider.php b/src/SearchableSelectServiceProvider.php index 54dcc0d..d7e14b2 100644 --- a/src/SearchableSelectServiceProvider.php +++ b/src/SearchableSelectServiceProvider.php @@ -26,6 +26,10 @@ public function boot(): void $this->publishes([ __DIR__.'/../config/searchable-select.php' => config_path('searchable-select.php'), ], 'searchable-select-config'); + + $this->publishes([ + __DIR__.'/../resources/views' => resource_path('views/vendor/searchable-select'), + ], 'searchable-select-views'); } } } From 9ee826cb66a284a486a5717d6855d35802d8bd60 Mon Sep 17 00:00:00 2001 From: William Asaba Date: Mon, 11 May 2026 12:03:46 +0300 Subject: [PATCH 6/9] feat: Add SearchableSelect component class Created proper component class for better type safety and component registration. --- src/View/Components/SearchableSelect.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/View/Components/SearchableSelect.php b/src/View/Components/SearchableSelect.php index 55bc9c9..dd9d32e 100644 --- a/src/View/Components/SearchableSelect.php +++ b/src/View/Components/SearchableSelect.php @@ -16,7 +16,7 @@ public function __construct(?string $theme = null) /** * Get the view / contents that represent the component. */ - public function render() + public function render(): \Illuminate\Contracts\View\View|\Closure|string { if ($this->currentTheme === 'bootstrap') { return view('searchable-select::searchable-select-bootstrap'); From 848122e709d81f625c7ddb98b3c8fff0af4bc3a9 Mon Sep 17 00:00:00 2001 From: William Asaba Date: Mon, 11 May 2026 12:04:07 +0300 Subject: [PATCH 7/9] test: Update architecture tests Modified test expectations to match new package structure and dependencies. --- tests/ArchTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ArchTest.php b/tests/ArchTest.php index 87fb64c..e6193b9 100644 --- a/tests/ArchTest.php +++ b/tests/ArchTest.php @@ -1,5 +1,5 @@ expect(['dd', 'dump', 'ray']) + ->expect(['dd', 'dump', 'ray', 'var_dump', 'print_r', 'var_export']) ->each->not->toBeUsed(); From 8b534341c19b35a77e6dbde480e895fc85e26bc4 Mon Sep 17 00:00:00 2001 From: William Asaba Date: Mon, 11 May 2026 12:04:47 +0300 Subject: [PATCH 8/9] feat: Add shared Alpine.js script partial Created reusable script partial for Alpine.js component logic to improve maintainability. --- .../_searchable-select-script.blade.php | 184 ++++++++++++++++++ 1 file changed, 184 insertions(+) create mode 100644 resources/views/partials/_searchable-select-script.blade.php diff --git a/resources/views/partials/_searchable-select-script.blade.php b/resources/views/partials/_searchable-select-script.blade.php new file mode 100644 index 0000000..0c1ae4b --- /dev/null +++ b/resources/views/partials/_searchable-select-script.blade.php @@ -0,0 +1,184 @@ +@once + +@endonce + +@once +@push('scripts') + +@endpush +@endonce From 5586f551d3cdd0367850b077cc6f21b11afae800 Mon Sep 17 00:00:00 2001 From: Williamug <15543507+Williamug@users.noreply.github.com> Date: Mon, 11 May 2026 09:05:48 +0000 Subject: [PATCH 9/9] Fix styling --- src/View/Components/SearchableSelect.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/View/Components/SearchableSelect.php b/src/View/Components/SearchableSelect.php index dd9d32e..74319a7 100644 --- a/src/View/Components/SearchableSelect.php +++ b/src/View/Components/SearchableSelect.php @@ -2,6 +2,7 @@ namespace Williamug\SearchableSelect\View\Components; +use Illuminate\Contracts\View\View; use Illuminate\View\Component; class SearchableSelect extends Component @@ -16,7 +17,7 @@ public function __construct(?string $theme = null) /** * Get the view / contents that represent the component. */ - public function render(): \Illuminate\Contracts\View\View|\Closure|string + public function render(): View|\Closure|string { if ($this->currentTheme === 'bootstrap') { return view('searchable-select::searchable-select-bootstrap');