diff --git a/packages/bbui/src/Form/Core/Autocomplete.svelte b/packages/bbui/src/Form/Core/Autocomplete.svelte
new file mode 100644
index 0000000000..ea36d82463
--- /dev/null
+++ b/packages/bbui/src/Form/Core/Autocomplete.svelte
@@ -0,0 +1,80 @@
+
+
+ option === value}
+ onSelectOption={selectOption}
+/>
diff --git a/packages/bbui/src/Form/Core/Picker.svelte b/packages/bbui/src/Form/Core/Picker.svelte
index 3de454668c..ce08a33c59 100644
--- a/packages/bbui/src/Form/Core/Picker.svelte
+++ b/packages/bbui/src/Form/Core/Picker.svelte
@@ -5,6 +5,7 @@
import { fly } from "svelte/transition"
import { createEventDispatcher } from "svelte"
import clickOutside from "../../Actions/click_outside"
+ import Search from "./Search.svelte"
export let id = null
export let disabled = false
@@ -13,6 +14,7 @@
export let fieldIcon = ""
export let isPlaceholder = false
export let placeholderOption = null
+ export let autocompletePlaceholder = ""
export let options = []
export let isOptionSelected = () => false
export let onSelectOption = () => {}
@@ -23,10 +25,17 @@
export let readonly = false
export let quiet = false
export let autoWidth = false
+ export let autocomplete = false
const dispatch = createEventDispatcher()
+ let searchTerm = null
$: sortedOptions = getSortedOptions(options, getOptionLabel)
+ $: filteredOptions = getFilteredOptions(
+ sortedOptions,
+ searchTerm,
+ getOptionLabel
+ )
const onClick = () => {
dispatch("click")
@@ -46,6 +55,16 @@
return labelA > labelB ? 1 : -1
})
}
+
+ const getFilteredOptions = (options, term, getLabel) => {
+ if (autocomplete && term) {
+ const lowerCaseTerm = term.toLowerCase()
+ return options.filter(option =>
+ getLabel(option).toLowerCase().includes(lowerCaseTerm)
+ )
+ }
+ return options
+ }