-
{selectedImage.name}
+
+ {#if selectedUrl}
+ {selectedImage.name}
+ {:else}
+ {selectedImage.name}
+ {/if}
+
{#if selectedImage.size}
{#if selectedImage.size <= BYTES_IN_MB}
diff --git a/packages/bbui/src/Form/Core/Picker.svelte b/packages/bbui/src/Form/Core/Picker.svelte
index e2456271c7..3de454668c 100644
--- a/packages/bbui/src/Form/Core/Picker.svelte
+++ b/packages/bbui/src/Form/Core/Picker.svelte
@@ -23,7 +23,11 @@
export let readonly = false
export let quiet = false
export let autoWidth = false
+
const dispatch = createEventDispatcher()
+
+ $: sortedOptions = getSortedOptions(options, getOptionLabel)
+
const onClick = () => {
dispatch("click")
if (readonly) {
@@ -31,6 +35,17 @@
}
open = true
}
+
+ const getSortedOptions = (options, getLabel) => {
+ if (!options?.length || !Array.isArray(options)) {
+ return []
+ }
+ return options.sort((a, b) => {
+ const labelA = getLabel(a)
+ const labelB = getLabel(b)
+ return labelA > labelB ? 1 : -1
+ })
+ }