@simplybusiness/mobius 5.31.6 → 5.31.7

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.31.7
4
+
5
+ ### Patch Changes
6
+
7
+ - 8dca1c9: Fix: Close address lookup after selection
8
+
3
9
  ## 5.31.6
4
10
 
5
11
  ### Patch Changes
package/dist/cjs/index.js CHANGED
@@ -1532,7 +1532,7 @@ var ComboboxInner = (0, import_react25.forwardRef)(
1532
1532
  onBlur,
1533
1533
  onFocus,
1534
1534
  onChange,
1535
- onSearched,
1535
+ // onSearched, // unused prop, consider removing
1536
1536
  optionComponent,
1537
1537
  errorMessage,
1538
1538
  ...otherProps
@@ -1541,6 +1541,7 @@ var ComboboxInner = (0, import_react25.forwardRef)(
1541
1541
  const fallbackRef = (0, import_react25.useRef)(null);
1542
1542
  const [inputValue, setInputValue] = (0, import_react25.useState)(defaultValue || "");
1543
1543
  const [isOpen, setIsOpen] = (0, import_react25.useState)(false);
1544
+ const [isChanging, setIsChanging] = (0, import_react25.useState)(false);
1544
1545
  const { filteredOptions, updateFilteredOptions, isLoading, error: error3 } = useComboboxOptions({
1545
1546
  options,
1546
1547
  asyncOptions,
@@ -1581,6 +1582,7 @@ var ComboboxInner = (0, import_react25.forwardRef)(
1581
1582
  const handleInputChange = (e) => {
1582
1583
  const newValue = e.target.value;
1583
1584
  setInputValue(newValue);
1585
+ setIsChanging(true);
1584
1586
  clearHighlight();
1585
1587
  onChange?.(e);
1586
1588
  };
@@ -1593,6 +1595,7 @@ var ComboboxInner = (0, import_react25.forwardRef)(
1593
1595
  return;
1594
1596
  }
1595
1597
  skipNextDebounceRef.current = true;
1598
+ setIsChanging(false);
1596
1599
  setIsOpen(false);
1597
1600
  setInputValue(val);
1598
1601
  onSelected?.(option);
@@ -1679,10 +1682,10 @@ var ComboboxInner = (0, import_react25.forwardRef)(
1679
1682
  }
1680
1683
  }, [value]);
1681
1684
  (0, import_react25.useEffect)(() => {
1682
- if (asyncOptions) {
1685
+ if (asyncOptions && isChanging) {
1683
1686
  setIsOpen(!!filteredOptions && filteredOptions.length > 0);
1684
1687
  }
1685
- }, [filteredOptions, asyncOptions]);
1688
+ }, [filteredOptions, asyncOptions, isChanging]);
1686
1689
  const classes = (0, import_dedupe10.default)(
1687
1690
  "mobius mobius-combobox",
1688
1691
  {