diff --git a/packages/bbui/src/Form/Multiselect.svelte b/packages/bbui/src/Form/Multiselect.svelte index f6c4c1f188..19a99ba816 100644 --- a/packages/bbui/src/Form/Multiselect.svelte +++ b/packages/bbui/src/Form/Multiselect.svelte @@ -4,7 +4,7 @@ import Field from "./Field.svelte" export let value = null - export let label = undefined + export let label = [] export let disabled = false export let labelPosition = "above" export let error = null diff --git a/packages/bbui/src/Form/internal/Multiselect.svelte b/packages/bbui/src/Form/internal/Multiselect.svelte index e1df4ae575..23475a1417 100644 --- a/packages/bbui/src/Form/internal/Multiselect.svelte +++ b/packages/bbui/src/Form/internal/Multiselect.svelte @@ -14,7 +14,9 @@ const dispatch = createEventDispatcher() $: fieldText = getFieldText(value) $: valueLookupMap = getValueLookupMap(value) - $: isOptionSelected = option => valueLookupMap[option] === true + $: isOptionSelected = option => { + return valueLookupMap[option] === true + } const getFieldText = value => { if (value?.length) { @@ -29,21 +31,20 @@ let map = {} if (value?.length) { value.forEach(option => { - const optionValue = getOptionValue(option) - if (optionValue) { - map[optionValue] = true + if (option) { + map[option] = true } }) } return map } - const toggleOption = option => { - if (valueLookupMap[option]) { - const filtered = value.filter(option => option !== id) + const toggleOption = optionValue => { + if (valueLookupMap[optionValue]) { + const filtered = value.filter(option => option !== optionValue) dispatch("change", filtered) } else { - dispatch("change", [...value, option]) + dispatch("change", [...value, optionValue]) } }