@abgov/jsonforms-components 1.42.2 → 1.42.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.
Files changed (2) hide show
  1. package/index.esm.js +10 -6
  2. package/package.json +1 -1
package/index.esm.js CHANGED
@@ -8000,7 +8000,7 @@ const AddressLookUpControl = props => {
8000
8000
  };
8001
8001
  useEffect(() => {
8002
8002
  const fetchSuggestions = () => __awaiter(void 0, void 0, void 0, function* () {
8003
- if (searchTerm.length > 2) {
8003
+ if (searchTerm.length > 2 && searchTerm.charAt(searchTerm.length - 1) !== ' ') {
8004
8004
  setLoading(true);
8005
8005
  setOpen(true);
8006
8006
  yield fetchAddressSuggestions(formUrl, searchTerm, isAlbertaAddress).then(response => {
@@ -8033,8 +8033,8 @@ const AddressLookUpControl = props => {
8033
8033
  /* istanbul ignore next */
8034
8034
  const handleRequiredFieldBlur = name => {
8035
8035
  const err = Object.assign({}, errors);
8036
- if ((data === null || data === void 0 ? void 0 : data["city"]) === undefined || (data === null || data === void 0 ? void 0 : data["city"]) === "") {
8037
- err[name] = name === 'municipality' ? 'city is required' : "";
8036
+ if ((data === null || data === void 0 ? void 0 : data['city']) === undefined || (data === null || data === void 0 ? void 0 : data['city']) === '') {
8037
+ err[name] = name === 'municipality' ? 'city is required' : '';
8038
8038
  setErrors(err);
8039
8039
  }
8040
8040
  if (!(data === null || data === void 0 ? void 0 : data[name]) || data[name] === '' || (data === null || data === void 0 ? void 0 : data[name]) === undefined) {
@@ -8072,17 +8072,17 @@ const AddressLookUpControl = props => {
8072
8072
  } else if (key === 'ArrowUp') {
8073
8073
  setSelectedIndex(prevIndex => prevIndex > 0 ? prevIndex - 1 : suggestions.length - 1);
8074
8074
  handleDropdownChange(value);
8075
- } else if (key === 'Enter') {
8075
+ } else if (key === 'Enter' || key === ' ' && value.length > 2) {
8076
8076
  handleDropdownChange(value);
8077
8077
  setLoading(false);
8078
8078
  if (selectedIndex >= 0) {
8079
- (_a = document.getElementById("goaInput")) === null || _a === void 0 ? void 0 : _a.blur();
8079
+ (_a = document.getElementById('goaInput')) === null || _a === void 0 ? void 0 : _a.blur();
8080
8080
  const suggestion = suggestions[selectedIndex];
8081
8081
  if (suggestion) {
8082
8082
  setTimeout(() => {
8083
8083
  handleSuggestionClick(suggestion);
8084
8084
  setOpen(false);
8085
- }, 100);
8085
+ }, 1);
8086
8086
  }
8087
8087
  }
8088
8088
  }
@@ -8124,6 +8124,10 @@ const AddressLookUpControl = props => {
8124
8124
  tabIndex: 0,
8125
8125
  children: suggestions && autocompletion && open && suggestions.map((suggestion, index) => jsx(ListItem, {
8126
8126
  "data-index": index,
8127
+ onMouseDown: e => {
8128
+ e.preventDefault();
8129
+ e.stopPropagation();
8130
+ },
8127
8131
  onClick: () => {
8128
8132
  handleSuggestionClick(suggestion);
8129
8133
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "1.42.2",
3
+ "version": "1.42.3",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Government of Alberta - React renderers for JSON Forms based on the design system.",
6
6
  "repository": "https://github.com/GovAlta/adsp-monorepo",