@economic/taco 2.63.2-combobox-search.0 → 2.63.2-combobox-search-no-sorting.0

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/taco.js CHANGED
@@ -18368,7 +18368,7 @@ const filterData = (data, value = "") => {
18368
18368
  if (value === "" || value === null) {
18369
18369
  return data;
18370
18370
  }
18371
- const filteredOptions = [];
18371
+ const filteredOptionValues = /* @__PURE__ */ new Set();
18372
18372
  const shouldFilterOption = (option) => {
18373
18373
  if (option.disabled) {
18374
18374
  return false;
@@ -18378,22 +18378,13 @@ const filterData = (data, value = "") => {
18378
18378
  data.forEach((option) => {
18379
18379
  if (shouldFilterOption(option)) {
18380
18380
  const parents = getOptionParents(data, option.path);
18381
- const index2 = option.text.toString().toLocaleLowerCase().indexOf(value.toString().toLocaleLowerCase());
18382
- filteredOptions.push({ value: option.value, score: index2 });
18381
+ filteredOptionValues.add(option.value);
18383
18382
  if (parents !== null) {
18384
- parents.forEach((option2) => filteredOptions.push({ value: option2 == null ? void 0 : option2.value }));
18383
+ parents.forEach((option2) => filteredOptionValues.add(option2 == null ? void 0 : option2.value));
18385
18384
  }
18386
18385
  }
18387
18386
  });
18388
- return data.filter(({ value: value2 }) => filteredOptions.find((x2) => x2.value === value2)).toSorted((a2, b2) => {
18389
- var _a, _b;
18390
- const scoreA = (_a = filteredOptions.find((x2) => x2.value === a2.value)) == null ? void 0 : _a.score;
18391
- const scoreB = (_b = filteredOptions.find((x2) => x2.value === b2.value)) == null ? void 0 : _b.score;
18392
- if (scoreA !== void 0 && scoreB !== void 0) {
18393
- return scoreA - scoreB;
18394
- }
18395
- return 0;
18396
- });
18387
+ return data.filter(({ value: value2 }) => filteredOptionValues.has(value2));
18397
18388
  };
18398
18389
  const debouncer = debounce$1((f2) => f2(), 200);
18399
18390
  const convertToInputValue = (value) => String(value ?? "");
@@ -18470,7 +18461,7 @@ const useCombobox = (props, ref) => {
18470
18461
  React.useEffect(() => {
18471
18462
  const isCurrentValue = value !== void 0 && value !== null && inputValue === String(value);
18472
18463
  if (inputValue && data.length && !isCurrentValue) {
18473
- setCurrentIndex(0);
18464
+ setCurrentIndex(getIndexFromValue(data, inputValue) || 0);
18474
18465
  if (!open) {
18475
18466
  setOpen(true);
18476
18467
  }