@hexure/ui 1.13.36 → 1.13.37

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/cjs/index.js CHANGED
@@ -1839,10 +1839,11 @@ const Loader$1 = styled.div `
1839
1839
  const Input$1 = (_a) => {
1840
1840
  var { format, suffix, height, invalid, loading, max, maxLength, min, onBlur, onChange, onFocus, onKeyDown,
1841
1841
  // eslint-disable-next-line @typescript-eslint/no-empty-function
1842
- onSuggestedSelect = () => { }, placeholder, readOnly, showCharCount, step, style, suggestedValues, showErrorTextColor = false, type = 'text', value = '', innerRef = null, tabIndex } = _a, accessibleProps = __rest(_a, ["format", "suffix", "height", "invalid", "loading", "max", "maxLength", "min", "onBlur", "onChange", "onFocus", "onKeyDown", "onSuggestedSelect", "placeholder", "readOnly", "showCharCount", "step", "style", "suggestedValues", "showErrorTextColor", "type", "value", "innerRef", "tabIndex"]);
1842
+ onSuggestedSelect = () => { }, placeholder, readOnly, showCharCount, step, style, suggestedValues, showErrorTextColor = false, type = 'text', value = '', innerRef = null, tabIndex, isAutoComplete = false } = _a, accessibleProps = __rest(_a, ["format", "suffix", "height", "invalid", "loading", "max", "maxLength", "min", "onBlur", "onChange", "onFocus", "onKeyDown", "onSuggestedSelect", "placeholder", "readOnly", "showCharCount", "step", "style", "suggestedValues", "showErrorTextColor", "type", "value", "innerRef", "tabIndex", "isAutoComplete"]);
1843
1843
  const [show_options, setShowOptions] = React.useState(false);
1844
1844
  const [internalValue, setInternalValue] = React.useState(value);
1845
1845
  const [internalSuggestedValues, setInternalSuggestedValues] = React.useState(suggestedValues || []);
1846
+ const [isFocused, setIsFocused] = React.useState(false);
1846
1847
  React.useEffect(() => {
1847
1848
  setInternalValue(value);
1848
1849
  setInternalSuggestedValues(suggestedValues || []);
@@ -1854,6 +1855,11 @@ const Input$1 = (_a) => {
1854
1855
  setInternalSuggestedValues(suggestedValues || []);
1855
1856
  }
1856
1857
  }, [value, suggestedValues]);
1858
+ React.useEffect(() => {
1859
+ if (isAutoComplete && isFocused) {
1860
+ setInternalSuggestedValues(suggestedValues || []);
1861
+ }
1862
+ }, [isFocused]);
1857
1863
  const formatCurrencyDecimal = (value) => {
1858
1864
  const parts = value.toString().split('.');
1859
1865
  const integerPart = parts[0];
@@ -1932,6 +1938,7 @@ const Input$1 = (_a) => {
1932
1938
  : e => {
1933
1939
  if (onBlur)
1934
1940
  onBlur(e);
1941
+ setIsFocused(false);
1935
1942
  setTimeout(() => {
1936
1943
  setShowOptions(false);
1937
1944
  }, 500);
@@ -1939,6 +1946,7 @@ const Input$1 = (_a) => {
1939
1946
  ? e => e.preventDefault()
1940
1947
  : e => {
1941
1948
  setShowOptions(true);
1949
+ setIsFocused(true);
1942
1950
  if (onFocus)
1943
1951
  onFocus(e);
1944
1952
  }, onKeyDown: readOnly ? e => e.preventDefault() : onKeyDown, placeholder: placeholder, readOnly: readOnly, ref: innerRef, step: step, tabIndex: readOnly ? -1 : tabIndex, type: type, value: format === 'currency_decimal' && internalValue ? `$${formatted_value}` : formatted_value }, accessibleProps, { id: `${id}-input` })),
@@ -1949,11 +1957,11 @@ const Input$1 = (_a) => {
1949
1957
  maxLength ? ` / ${maxLength}` : null)) : null,
1950
1958
  suffix && React.createElement(StyledSuffix, { id: `${id}-suffix` }, suffix),
1951
1959
  show_options && internalSuggestedValues.length ? (React.createElement(SuggestedValues, { id: `${id}-suggested-values` },
1952
- React.createElement(SuggestedSummary, { id: `${id}-suggested-summary` },
1960
+ isAutoComplete ? null : (React.createElement(SuggestedSummary, { id: `${id}-suggested-summary` },
1953
1961
  internalSuggestedValues.length,
1954
1962
  " Results Match \"",
1955
1963
  internalValue,
1956
- "\""),
1964
+ "\"")),
1957
1965
  internalSuggestedValues.map((suggestedValue, index) => (React.createElement(SuggestedValue, { id: `${id}-suggested-value-${index}`, key: index, onClick: () => {
1958
1966
  handleInputChange({ target: { value: suggestedValue } });
1959
1967
  onSuggestedSelect();