@entur/dropdown 5.1.3 → 5.2.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -789,12 +789,14 @@ var useNormalizedItems = function useNormalizedItems(items) {
789
789
  label: item
790
790
  };
791
791
  }
792
- if (!('value' in item)) {
792
+ if ((item == null ? void 0 : item.value) === undefined) {
793
793
  return _extends({}, item, {
794
794
  value: item.label
795
795
  });
796
796
  }
797
- return item;
797
+ return _extends({}, item, {
798
+ value: item.value
799
+ });
798
800
  });
799
801
  }, [items]);
800
802
  };
@@ -991,7 +993,7 @@ var useMultiSelectOldContext = function useMultiSelectOldContext() {
991
993
  return context;
992
994
  };
993
995
  function stateReducer(state,
994
- //StateChangeOptions<NormalizedDropdownItemType>,
996
+ //StateChangeOptions<NormalizedDropdownItemDeprecatedType>,
995
997
  actionAndChanges) {
996
998
  var changes = actionAndChanges.changes,
997
999
  type = actionAndChanges.type;
@@ -1334,6 +1336,9 @@ var DropdownList = function DropdownList(_ref) {
1334
1336
  })
1335
1337
  }, getItemProps({
1336
1338
  key: (item == null ? void 0 : item.label) + (item == null ? void 0 : item.value),
1339
+ // @ts-expect-error Since getItemProps expects the same item type
1340
+ // here as items, it throws error when selectAllItem is a string.
1341
+ // This does, however, not cause any functional issues.
1337
1342
  item: item,
1338
1343
  index: index
1339
1344
  })), itemIsSelectAll ? selectAllListItemContent() : listItemContent(item));
@@ -2209,7 +2214,7 @@ var MultiSelect = function MultiSelect(_ref) {
2209
2214
  disabled: disabled,
2210
2215
  getSelectedItemProps: getSelectedItemProps,
2211
2216
  index: index,
2212
- key: selectedItem == null ? void 0 : selectedItem.value,
2217
+ key: (selectedItem == null ? void 0 : selectedItem.label) + (typeof (selectedItem == null ? void 0 : selectedItem.value) === 'string' ? selectedItem.value : ''),
2213
2218
  readOnly: readOnly,
2214
2219
  removeSelectedItem: function removeSelectedItem() {
2215
2220
  var _inputRef$current6;