Skip to content

Commit

Permalink
[MenuField] Include selected option when dispatching change event…
Browse files Browse the repository at this point in the history
…. Add type to event
  • Loading branch information
techniq committed Jun 3, 2024
1 parent b57e07a commit eff59e1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/perfect-singers-fold.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'svelte-ux': patch
---

[MenuField] Include selected `option` when dispatching `change` event. Add type to event
4 changes: 2 additions & 2 deletions packages/svelte-ux/src/lib/components/MenuField.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@
}
};
const dispatch = createEventDispatcher();
$: dispatch('change', { value });
const dispatch = createEventDispatcher<{ change: { value: any; option: MenuOption } }>();
$: dispatch('change', { value, option: selected });
function setValue(val: any): void {
value = val;
Expand Down

0 comments on commit eff59e1

Please sign in to comment.