diff --git a/packages/bbui/src/FancyForm/FancySelect.svelte b/packages/bbui/src/FancyForm/FancySelect.svelte
index ee43ecc3ca..e015f51570 100644
--- a/packages/bbui/src/FancyForm/FancySelect.svelte
+++ b/packages/bbui/src/FancyForm/FancySelect.svelte
@@ -2,8 +2,9 @@
import { createEventDispatcher } from "svelte"
import FancyField from "./FancyField.svelte"
import Icon from "../Icon/Icon.svelte"
- import Popover from "../Popover/Popover.svelte"
import FancyFieldLabel from "./FancyFieldLabel.svelte"
+ import StatusLight from "../StatusLight/StatusLight.svelte"
+ import Picker from "../Form/Core/Picker.svelte"
export let label
export let value
@@ -11,18 +12,30 @@
export let error = null
export let validate = null
export let options = []
+ export let isOptionEnabled = () => true
export let getOptionLabel = option => extractProperty(option, "label")
export let getOptionValue = option => extractProperty(option, "value")
-
+ export let getOptionSubtitle = option => extractProperty(option, "subtitle")
+ export let getOptionColour = () => null
const dispatch = createEventDispatcher()
let open = false
- let popover
let wrapper
$: placeholder = !value
$: selectedLabel = getSelectedLabel(value)
+ $: fieldColour = getFieldAttribute(getOptionColour, value, options)
+ const getFieldAttribute = (getAttribute, value, options) => {
+ // Wait for options to load if there is a value but no options
+ if (!options?.length) {
+ return ""
+ }
+ const index = options.findIndex(
+ (option, idx) => getOptionValue(option, idx) === value
+ )
+ return index !== -1 ? getAttribute(options[index], index) : null
+ }
const extractProperty = (value, property) => {
if (value && typeof value === "object") {
return value[property]
@@ -64,46 +77,45 @@