@adamjanicki/ui-extended 1.0.2 → 1.0.3

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.
@@ -64,7 +64,7 @@ var Autocomplete = function (props) {
64
64
  onSelect(v);
65
65
  var current = inputRef.current;
66
66
  closeMenu();
67
- if (focusOnSelect)
67
+ if (!focusOnSelect)
68
68
  return current === null || current === void 0 ? void 0 : current.focus();
69
69
  };
70
70
  var closeMenu = function () {
@@ -75,6 +75,7 @@ var Autocomplete = function (props) {
75
75
  setOpen(true);
76
76
  };
77
77
  var handleKeys = function (_a) {
78
+ var _b;
78
79
  var code = _a.code;
79
80
  if (code === "Escape") {
80
81
  closeMenu();
@@ -85,8 +86,11 @@ var Autocomplete = function (props) {
85
86
  if (modulo > 0 && current) {
86
87
  return current.click();
87
88
  }
88
- else {
89
- onUnselectedEnter === null || onUnselectedEnter === void 0 ? void 0 : onUnselectedEnter();
89
+ else if (onUnselectedEnter) {
90
+ onUnselectedEnter();
91
+ closeMenu();
92
+ if (!focusOnSelect)
93
+ return (_b = inputRef.current) === null || _b === void 0 ? void 0 : _b.blur();
90
94
  }
91
95
  }
92
96
  if (modulo > 0 && code === "ArrowDown") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adamjanicki/ui-extended",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "More advanced UI components and hooks for React in TypeScript",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",