karsten-design-system 1.1.85 → 1.1.86

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.
package/dist/index.js CHANGED
@@ -730,8 +730,16 @@ function MultiSelect(props) {
730
730
  };
731
731
  const filteredOptions = (() => {
732
732
  const allOptions = ensureValuesInOptions(options, props.value);
733
+ // if (!isReadOnly) {
734
+ // return allOptions.filter((option) =>
735
+ // normalize(option.label).includes(normalize(searchText))
736
+ // )
737
+ // }
733
738
  if (!isReadOnly) {
734
- return allOptions.filter((option) => normalize(option.label).includes(normalize(searchText)));
739
+ const filtered = allOptions.filter((option) => normalize(option.label).includes(normalize(searchText)));
740
+ const selected = Array.isArray(props.value) ? props.value : [];
741
+ const selectedNotInFiltered = selected.filter((sel) => !filtered.find((opt) => opt.value === sel.value));
742
+ return [...selectedNotInFiltered, ...filtered];
735
743
  }
736
744
  if (hasOnInputChange) {
737
745
  return allOptions;