sfc-utils 1.4.72 → 1.4.73

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.
@@ -67,7 +67,7 @@ const Geocoder = ({
67
67
  // POST as form url encoded data
68
68
  let formData = new FormData();
69
69
  formData.append("query", query);
70
- if(filterRegion != "United States"){
70
+ if (filterRegion != "United States") {
71
71
  formData.append("region", filterRegion);
72
72
  }
73
73
  // Remove any existing event listeners
@@ -109,6 +109,12 @@ const Geocoder = ({
109
109
  // Handle result
110
110
  if (output.data.length === 0) {
111
111
  // We could show something saying "No results" ... or we could not
112
+ if (output.fallback) {
113
+ // If we're using the fallback, we need to encourage the user to enter city
114
+ setLocData([
115
+ { name: "No results, make sure to include city name" },
116
+ ]);
117
+ }
112
118
  } else {
113
119
  // Create a keydown event listener
114
120
  setSingletonEventListener("keydown", function resultsKeyHandler(e) {
@@ -181,10 +187,13 @@ const Geocoder = ({
181
187
 
182
188
  // If the parent component passes in a string for inputValueOverride, use it
183
189
  useEffect(() => {
184
- if (typeof inputValueOverride === 'string' || inputValueOverride instanceof String) {
185
- setInputValue(inputValueOverride)
190
+ if (
191
+ typeof inputValueOverride === "string" ||
192
+ inputValueOverride instanceof String
193
+ ) {
194
+ setInputValue(inputValueOverride);
186
195
  }
187
- }, [inputValueOverride])
196
+ }, [inputValueOverride]);
188
197
 
189
198
  return (
190
199
  <div className={geocoderStyles.wrapper}>
@@ -212,6 +221,11 @@ const Geocoder = ({
212
221
  className={thisClass}
213
222
  key={i}
214
223
  onClick={() => {
224
+ if (
225
+ locData[i].name.toLowerCase().indexOf("no results") > -1
226
+ ) {
227
+ return false;
228
+ }
215
229
  setInputValue(locData[i].name);
216
230
  // Call function if it exists
217
231
  if (resultFunc) {
@@ -227,11 +241,13 @@ const Geocoder = ({
227
241
  }}
228
242
  >
229
243
  <div className={geocoderStyles.name}>{loc.name}</div>
230
- <div className={geocoderStyles.details}>
231
- {loc.locality}
232
- {loc.locality && loc.region && ", "}
233
- {loc.region}
234
- </div>
244
+ {(loc.locality || loc.region) && (
245
+ <div className={geocoderStyles.details}>
246
+ {loc.locality}
247
+ {loc.locality && loc.region && ", "}
248
+ {loc.region}
249
+ </div>
250
+ )}
235
251
  </button>
236
252
  </li>
237
253
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sfc-utils",
3
- "version": "1.4.72",
3
+ "version": "1.4.73",
4
4
  "author": "ewagstaff <evanjwagstaff@gmail.com>",
5
5
  "dependencies": {
6
6
  "archieml": "^0.4.2",