@adamjanicki/ui-extended 1.0.3 → 1.0.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.
@@ -75,7 +75,7 @@ var Autocomplete = function (props) {
75
75
  setOpen(true);
76
76
  };
77
77
  var handleKeys = function (_a) {
78
- var _b;
78
+ var _b, _c, _d;
79
79
  var code = _a.code;
80
80
  if (code === "Escape") {
81
81
  closeMenu();
@@ -84,13 +84,20 @@ var Autocomplete = function (props) {
84
84
  if (code === "Enter") {
85
85
  var current = onRef.current;
86
86
  if (modulo > 0 && current) {
87
- return current.click();
87
+ // Horrible heuristic to handle links
88
+ // It's terrible, but efficient
89
+ var child = current.firstChild;
90
+ if (child && child.nodeName === "A")
91
+ (_b = child.click) === null || _b === void 0 ? void 0 : _b.call(child);
92
+ current.click();
93
+ if (!focusOnSelect)
94
+ return (_c = inputRef.current) === null || _c === void 0 ? void 0 : _c.blur();
88
95
  }
89
96
  else if (onUnselectedEnter) {
90
97
  onUnselectedEnter();
91
98
  closeMenu();
92
99
  if (!focusOnSelect)
93
- return (_b = inputRef.current) === null || _b === void 0 ? void 0 : _b.blur();
100
+ return (_d = inputRef.current) === null || _d === void 0 ? void 0 : _d.blur();
94
101
  }
95
102
  }
96
103
  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.3",
3
+ "version": "1.0.5",
4
4
  "description": "More advanced UI components and hooks for React in TypeScript",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",