Skip to content

Commit

Permalink
chore: changeset
Browse files Browse the repository at this point in the history
  • Loading branch information
eikeland committed Jan 21, 2025
1 parent 7821d44 commit debdbcc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
13 changes: 13 additions & 0 deletions .changeset/yellow-carrots-play.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
'@equinor/fusion-wc-searchable-dropdown': patch
'@equinor/fusion-wc-storybook': patch
---

### @equinor/fusion-wc-searchable-dropdown

Fix: support for setting selectedId in initalItems
Fix: better handling of multiple selections

### @equinor/fusion-wc-storybook

Fix: can use selectedId in stories and eslint
17 changes: 1 addition & 16 deletions packages/searchable-dropdown/src/provider/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export class SearchableDropdownController implements ReactiveController {
return child;
});
} else {
if (selectedId === item.id) {''
if (selectedId === item.id) {
item.isSelected = true;
if (isMultiple) {
this._selectedItems.push(item);
Expand Down Expand Up @@ -237,21 +237,6 @@ export class SearchableDropdownController implements ReactiveController {
this._selectedItems = [selectedItem];
}
}

// if (this.#host.multiple) {
// if (this._selectedItems.find((si) => si.id === selectedItem?.id)) {
// /* Already selected so clear it from selections */
// selectedItem.isSelected = false;
// this._selectedItems = this._selectedItems.filter((i) => i.id !== selectedItem?.id);
// } else {
// /* Adds new item to selections */
// selectedItem.isSelected = true;
// this._selectedItems.push(selectedItem);
// }
// } else {
// /* Adds new item to selections */
// this._selectedItems = [selectedItem];
// }
} else {
/* Clear selected states if any */
this._selectedItems = [];
Expand Down

0 comments on commit debdbcc

Please sign in to comment.