@props([ 'name', // Static lists come in as a PHP iterable; lists that change on the page // (departments, once a campus is picked) come in as an Alpine expression. 'options' => null, 'optionsExpr' => null, 'selected' => '', 'placeholder' => 'Pilih', 'searchPlaceholder' => 'Cari…', 'emptyText' => 'Tiada padanan ditemui', // Label for an explicit "no value" entry; omit to make the field unclearable. 'emptyOption' => null, 'disabledExpr' => 'false', ]) @php $optionsJs = $optionsExpr ?: Js::from( collect($options ?? [])->map(fn ($option) => [ 'value' => (string) ($option['value'] ?? $option['id'] ?? ''), 'label' => (string) ($option['label'] ?? $option['name'] ?? ''), ])->values() ); @endphp
class('relative') }} @keydown.escape.prevent.stop="close()" @click.outside="close()" > {{-- The submitted control. Validation stays server-side: a hidden input is barred from the browser's constraint validation either way. --}}
{{-- Kept out of the scroll area so the count stays visible while scrolling. --}}

daripada pilihan