@rolster/react-components 18.10.4 → 18.10.5

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
@@ -1284,13 +1284,13 @@ function useAutocompleteField({ suggestions, disabled, formControl, onSelect, on
1284
1284
  react.useEffect(() => filterSuggestions(pattern, true), [suggestions]);
1285
1285
  react.useEffect(() => filterSuggestions(pattern), [pattern]);
1286
1286
  react.useEffect(() => {
1287
- changeInternal ? setChangeInternal(false) : resetComponent();
1287
+ changeInternal ? setChangeInternal(false) : resetState();
1288
1288
  }, [formControl?.state]);
1289
- react.useEffect(() => setValue(requestCurrentElement()?.description || ''), [collection]);
1289
+ react.useEffect(() => resetState(), [collection]);
1290
1290
  function requestCurrentElement() {
1291
1291
  return formControl?.state && collection.find(formControl.state);
1292
1292
  }
1293
- function resetComponent() {
1293
+ function resetState() {
1294
1294
  const element = requestCurrentElement();
1295
1295
  setValue(element?.description || '');
1296
1296
  if (!element) {
@@ -1744,9 +1744,9 @@ function RlsDateField({ children, date, disabled, formControl, maxDate, minDate,
1744
1744
  }
1745
1745
  function onChange(value, ignoreControl = false) {
1746
1746
  if (!ignoreControl) {
1747
- formControl?.setState(undefined);
1747
+ formControl?.setState(value);
1748
1748
  }
1749
- setValue(undefined);
1749
+ setValue(value);
1750
1750
  if (onValue) {
1751
1751
  onValue(value);
1752
1752
  }
@@ -1891,13 +1891,13 @@ function useSelectField({ suggestions, formControl, onSelect, onValue }) {
1891
1891
  const { collection, inputRef, visible, setFocused, setValue, setVisible, navigationElement, navigationInput } = listControl;
1892
1892
  const [changeInternal, setChangeInternal] = react.useState(false);
1893
1893
  react.useEffect(() => {
1894
- changeInternal ? setChangeInternal(false) : resetComponent();
1894
+ changeInternal ? setChangeInternal(false) : resetState();
1895
1895
  }, [formControl?.state]);
1896
- react.useEffect(() => setValue(requestCurrentElement()?.description || ''), [collection]);
1896
+ react.useEffect(() => resetState(), [collection]);
1897
1897
  function requestCurrentElement() {
1898
1898
  return formControl?.state && collection.find(formControl.state);
1899
1899
  }
1900
- function resetComponent() {
1900
+ function resetState() {
1901
1901
  const element = requestCurrentElement();
1902
1902
  setValue(element?.description || '');
1903
1903
  if (!element) {