@hexure/ui 1.13.35 → 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
@@ -1183,6 +1183,12 @@ onChange = () => { }, style, }) => {
1183
1183
  setSelectedYear(d.year().toString());
1184
1184
  setDDate(d);
1185
1185
  }
1186
+ else {
1187
+ setSelectedDay('');
1188
+ setSelectedMonth('');
1189
+ setSelectedYear('');
1190
+ setDDate(dayjs(date || undefined));
1191
+ }
1186
1192
  }, [date]);
1187
1193
  React.useEffect(() => {
1188
1194
  if (selectedDay && selectedMonth && selectedYear) {
@@ -1833,10 +1839,11 @@ const Loader$1 = styled.div `
1833
1839
  const Input$1 = (_a) => {
1834
1840
  var { format, suffix, height, invalid, loading, max, maxLength, min, onBlur, onChange, onFocus, onKeyDown,
1835
1841
  // eslint-disable-next-line @typescript-eslint/no-empty-function
1836
- 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"]);
1837
1843
  const [show_options, setShowOptions] = React.useState(false);
1838
1844
  const [internalValue, setInternalValue] = React.useState(value);
1839
1845
  const [internalSuggestedValues, setInternalSuggestedValues] = React.useState(suggestedValues || []);
1846
+ const [isFocused, setIsFocused] = React.useState(false);
1840
1847
  React.useEffect(() => {
1841
1848
  setInternalValue(value);
1842
1849
  setInternalSuggestedValues(suggestedValues || []);
@@ -1848,6 +1855,11 @@ const Input$1 = (_a) => {
1848
1855
  setInternalSuggestedValues(suggestedValues || []);
1849
1856
  }
1850
1857
  }, [value, suggestedValues]);
1858
+ React.useEffect(() => {
1859
+ if (isAutoComplete && isFocused) {
1860
+ setInternalSuggestedValues(suggestedValues || []);
1861
+ }
1862
+ }, [isFocused]);
1851
1863
  const formatCurrencyDecimal = (value) => {
1852
1864
  const parts = value.toString().split('.');
1853
1865
  const integerPart = parts[0];
@@ -1926,6 +1938,7 @@ const Input$1 = (_a) => {
1926
1938
  : e => {
1927
1939
  if (onBlur)
1928
1940
  onBlur(e);
1941
+ setIsFocused(false);
1929
1942
  setTimeout(() => {
1930
1943
  setShowOptions(false);
1931
1944
  }, 500);
@@ -1933,6 +1946,7 @@ const Input$1 = (_a) => {
1933
1946
  ? e => e.preventDefault()
1934
1947
  : e => {
1935
1948
  setShowOptions(true);
1949
+ setIsFocused(true);
1936
1950
  if (onFocus)
1937
1951
  onFocus(e);
1938
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` })),
@@ -1943,11 +1957,11 @@ const Input$1 = (_a) => {
1943
1957
  maxLength ? ` / ${maxLength}` : null)) : null,
1944
1958
  suffix && React.createElement(StyledSuffix, { id: `${id}-suffix` }, suffix),
1945
1959
  show_options && internalSuggestedValues.length ? (React.createElement(SuggestedValues, { id: `${id}-suggested-values` },
1946
- React.createElement(SuggestedSummary, { id: `${id}-suggested-summary` },
1960
+ isAutoComplete ? null : (React.createElement(SuggestedSummary, { id: `${id}-suggested-summary` },
1947
1961
  internalSuggestedValues.length,
1948
1962
  " Results Match \"",
1949
1963
  internalValue,
1950
- "\""),
1964
+ "\"")),
1951
1965
  internalSuggestedValues.map((suggestedValue, index) => (React.createElement(SuggestedValue, { id: `${id}-suggested-value-${index}`, key: index, onClick: () => {
1952
1966
  handleInputChange({ target: { value: suggestedValue } });
1953
1967
  onSuggestedSelect();