Skip to content

Commit

Permalink
Expose onApply on MultiSelectMenu and MultiSelectField (#479)
Browse files Browse the repository at this point in the history
* Dispatch `apply` event when applying from MultiSelect

* Expose `onApply` on `MultiSelectMenu` and `MultiSelectField`

* Expose `onApply` on `MultiSelectMenu` and `MultiSelectField`
  • Loading branch information
brandonmcconnell authored Sep 10, 2024
1 parent 8a38507 commit e742a87
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/polite-rivers-roll.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'svelte-ux': patch
---

Dispatch `apply` event when applying from MultiSelect
4 changes: 4 additions & 0 deletions packages/svelte-ux/src/lib/components/MultiSelectField.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@
export let menuProps: Omit<MultiSelectMenuProps, 'options'> | undefined = undefined;
// Passthrough onApply event
export let onApply: MultiSelectMenuProps['onApply'] | undefined = undefined;
const logger = new Logger('MultiSelectField');
let open = false;
Expand Down Expand Up @@ -213,6 +216,7 @@
{placement}
{infiniteScroll}
{searchText}
{onApply}
classes={{ ...settingsClasses.multiSelectMenu, ...classes.multiSelectMenu }}
matchWidth
bind:open
Expand Down
4 changes: 4 additions & 0 deletions packages/svelte-ux/src/lib/components/MultiSelectMenu.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
const settingsClasses = getComponentClasses('MultiSelectMenu');
export let menuItemsEl: HTMLMenuElement | undefined = undefined;
// Passthrough onApply event
export let onApply: MultiSelectProps['onApply'] | undefined = undefined;
</script>

<Menu
Expand Down Expand Up @@ -67,6 +70,7 @@
{placeholder}
{infiniteScroll}
{searchText}
{onApply}
classes={{
search: 'p-2',
options: 'px-2',
Expand Down

0 comments on commit e742a87

Please sign in to comment.