@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.cjs CHANGED
@@ -18386,7 +18386,7 @@ const filterData = (data, value = "") => {
18386
18386
  if (value === "" || value === null) {
18387
18387
  return data;
18388
18388
  }
18389
- const filteredOptions = [];
18389
+ const filteredOptionValues = /* @__PURE__ */ new Set();
18390
18390
  const shouldFilterOption = (option) => {
18391
18391
  if (option.disabled) {
18392
18392
  return false;
@@ -18396,22 +18396,13 @@ const filterData = (data, value = "") => {
18396
18396
  data.forEach((option) => {
18397
18397
  if (shouldFilterOption(option)) {
18398
18398
  const parents = getOptionParents(data, option.path);
18399
- const index2 = option.text.toString().toLocaleLowerCase().indexOf(value.toString().toLocaleLowerCase());
18400
- filteredOptions.push({ value: option.value, score: index2 });
18399
+ filteredOptionValues.add(option.value);
18401
18400
  if (parents !== null) {
18402
- parents.forEach((option2) => filteredOptions.push({ value: option2 == null ? void 0 : option2.value }));
18401
+ parents.forEach((option2) => filteredOptionValues.add(option2 == null ? void 0 : option2.value));
18403
18402
  }
18404
18403
  }
18405
18404
  });
18406
- return data.filter(({ value: value2 }) => filteredOptions.find((x2) => x2.value === value2)).toSorted((a2, b2) => {
18407
- var _a, _b;
18408
- const scoreA = (_a = filteredOptions.find((x2) => x2.value === a2.value)) == null ? void 0 : _a.score;
18409
- const scoreB = (_b = filteredOptions.find((x2) => x2.value === b2.value)) == null ? void 0 : _b.score;
18410
- if (scoreA !== void 0 && scoreB !== void 0) {
18411
- return scoreA - scoreB;
18412
- }
18413
- return 0;
18414
- });
18405
+ return data.filter(({ value: value2 }) => filteredOptionValues.has(value2));
18415
18406
  };
18416
18407
  const debouncer = debounce$1((f2) => f2(), 200);
18417
18408
  const convertToInputValue = (value) => String(value ?? "");
@@ -18488,7 +18479,7 @@ const useCombobox = (props, ref) => {
18488
18479
  React__namespace.useEffect(() => {
18489
18480
  const isCurrentValue = value !== void 0 && value !== null && inputValue === String(value);
18490
18481
  if (inputValue && data.length && !isCurrentValue) {
18491
- setCurrentIndex(0);
18482
+ setCurrentIndex(getIndexFromValue(data, inputValue) || 0);
18492
18483
  if (!open) {
18493
18484
  setOpen(true);
18494
18485
  }