@simplybusiness/mobius 5.31.5 → 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,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.31.7
4
+
5
+ ### Patch Changes
6
+
7
+ - 8dca1c9: Fix: Close address lookup after selection
8
+
9
+ ## 5.31.6
10
+
11
+ ### Patch Changes
12
+
13
+ - 0311105: Fix Combobox; in async mode, only show options list when there are options to display"
14
+
3
15
  ## 5.31.5
4
16
 
5
17
  ### 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,7 +1582,7 @@ var ComboboxInner = (0, import_react25.forwardRef)(
1581
1582
  const handleInputChange = (e) => {
1582
1583
  const newValue = e.target.value;
1583
1584
  setInputValue(newValue);
1584
- setIsOpen(true);
1585
+ setIsChanging(true);
1585
1586
  clearHighlight();
1586
1587
  onChange?.(e);
1587
1588
  };
@@ -1594,6 +1595,7 @@ var ComboboxInner = (0, import_react25.forwardRef)(
1594
1595
  return;
1595
1596
  }
1596
1597
  skipNextDebounceRef.current = true;
1598
+ setIsChanging(false);
1597
1599
  setIsOpen(false);
1598
1600
  setInputValue(val);
1599
1601
  onSelected?.(option);
@@ -1679,6 +1681,11 @@ var ComboboxInner = (0, import_react25.forwardRef)(
1679
1681
  setInputValue(value);
1680
1682
  }
1681
1683
  }, [value]);
1684
+ (0, import_react25.useEffect)(() => {
1685
+ if (asyncOptions && isChanging) {
1686
+ setIsOpen(!!filteredOptions && filteredOptions.length > 0);
1687
+ }
1688
+ }, [filteredOptions, asyncOptions, isChanging]);
1682
1689
  const classes = (0, import_dedupe10.default)(
1683
1690
  "mobius mobius-combobox",
1684
1691
  {