action select: add onchange callback

This commit is contained in:
Elijah Duffy
2025-07-07 17:34:38 -07:00
parent 645320d335
commit 45ca099570

View File

@@ -24,6 +24,7 @@
tabbable?: boolean;
options: ActionSelectOption[];
class?: ClassValue | null | undefined;
onchange?: (value: ActionSelectOption | undefined) => void;
}
let {
@@ -33,14 +34,18 @@
stateless = false,
tabbable = true,
options,
class: classValue
class: classValue,
onchange
}: Props = $props();
const select = new Select<ActionSelectOption>({
value: () => value,
onValueChange: (val) => {
val?.onchoose?.(val);
if (!stateless) value = val;
if (!stateless) {
value = val;
onchange?.(val);
}
}
});
</script>