@rufous/ui 0.2.91 → 0.2.92

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/main.cjs CHANGED
@@ -1925,6 +1925,15 @@ function defaultGetLabel(option) {
1925
1925
  return String(option.label);
1926
1926
  return String(option);
1927
1927
  }
1928
+ function defaultIsEqual(a, b) {
1929
+ if (a === b) return true;
1930
+ if (a !== null && b !== null && typeof a === "object" && typeof b === "object") {
1931
+ const aVal = a.value;
1932
+ const bVal = b.value;
1933
+ if (aVal !== void 0 && bVal !== void 0) return aVal === bVal;
1934
+ }
1935
+ return false;
1936
+ }
1928
1937
  function defaultFilter(options, inputValue, getLabel) {
1929
1938
  if (!inputValue) return options;
1930
1939
  const q = inputValue.toLowerCase();
@@ -2007,7 +2016,7 @@ function AutocompleteInner(props, _ref) {
2007
2016
  const activeInput = controlledInput !== void 0 ? controlledInput : inputStr;
2008
2017
  const selectedValues = multiple ? Array.isArray(value) ? value : [] : value != null ? [value] : [];
2009
2018
  const isEqual = (0, import_react18.useCallback)(
2010
- (a, b) => isOptionEqualToValue ? isOptionEqualToValue(a, b) : a === b,
2019
+ (a, b) => isOptionEqualToValue ? isOptionEqualToValue(a, b) : defaultIsEqual(a, b),
2011
2020
  [isOptionEqualToValue]
2012
2021
  );
2013
2022
  const isSelected = (0, import_react18.useCallback)(
package/dist/main.js CHANGED
@@ -1764,6 +1764,15 @@ function defaultGetLabel(option) {
1764
1764
  return String(option.label);
1765
1765
  return String(option);
1766
1766
  }
1767
+ function defaultIsEqual(a, b) {
1768
+ if (a === b) return true;
1769
+ if (a !== null && b !== null && typeof a === "object" && typeof b === "object") {
1770
+ const aVal = a.value;
1771
+ const bVal = b.value;
1772
+ if (aVal !== void 0 && bVal !== void 0) return aVal === bVal;
1773
+ }
1774
+ return false;
1775
+ }
1767
1776
  function defaultFilter(options, inputValue, getLabel) {
1768
1777
  if (!inputValue) return options;
1769
1778
  const q = inputValue.toLowerCase();
@@ -1846,7 +1855,7 @@ function AutocompleteInner(props, _ref) {
1846
1855
  const activeInput = controlledInput !== void 0 ? controlledInput : inputStr;
1847
1856
  const selectedValues = multiple ? Array.isArray(value) ? value : [] : value != null ? [value] : [];
1848
1857
  const isEqual = useCallback(
1849
- (a, b) => isOptionEqualToValue ? isOptionEqualToValue(a, b) : a === b,
1858
+ (a, b) => isOptionEqualToValue ? isOptionEqualToValue(a, b) : defaultIsEqual(a, b),
1850
1859
  [isOptionEqualToValue]
1851
1860
  );
1852
1861
  const isSelected = useCallback(
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rufous/ui",
3
3
  "private": false,
4
- "version": "0.2.91",
4
+ "version": "0.2.92",
5
5
  "type": "module",
6
6
  "description": "Experimental: A lightweight React UI component library (Beta)",
7
7
  "style": "./dist/main.css",