@mackin.com/styleguide 9.2.2 → 9.2.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.
- package/index.js +11 -8
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1012,21 +1012,24 @@ const Autocomplete = (p) => {
|
|
|
1012
1012
|
listBorderRadius = theme.controls.borderRadius || '0.5rem';
|
|
1013
1013
|
}
|
|
1014
1014
|
const onPickValue = (v) => {
|
|
1015
|
-
|
|
1016
|
-
//
|
|
1015
|
+
var _a;
|
|
1016
|
+
// the TextInput will not respond to outer value changes if it has focus.
|
|
1017
|
+
// here we clear first and then onPickValue will re-focus after all updates.
|
|
1018
|
+
(_a = input.current) === null || _a === void 0 ? void 0 : _a.blur();
|
|
1017
1019
|
setTimeout(() => {
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
+
// blur is now complete
|
|
1021
|
+
p.onPick(v);
|
|
1022
|
+
// wait for the re-render. the value will not update if the control has focus
|
|
1023
|
+
setTimeout(() => {
|
|
1024
|
+
var _a;
|
|
1025
|
+
(_a = input.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
1026
|
+
}, 0);
|
|
1020
1027
|
}, 0);
|
|
1021
1028
|
};
|
|
1022
1029
|
return (React__namespace.createElement("div", { onClick: e => {
|
|
1023
1030
|
e.stopPropagation();
|
|
1024
1031
|
}, onKeyDown: e => {
|
|
1025
|
-
var _a;
|
|
1026
1032
|
if (e.key === 'Escape') {
|
|
1027
|
-
// the TextInput will not respond to outer value changes if it has focus.
|
|
1028
|
-
// here we clear first and then onPickValue will re-focus after all updates.
|
|
1029
|
-
(_a = input.current) === null || _a === void 0 ? void 0 : _a.blur();
|
|
1030
1033
|
onPickValue(undefined);
|
|
1031
1034
|
}
|
|
1032
1035
|
}, ref: element, className: css.cx(css.css({
|