@wherabouts/react-ui 0.1.1 → 0.3.0
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/LICENSE +21 -0
- package/README.md +4 -4
- package/dist/index.cjs +4 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4 -7
- package/dist/index.js.map +1 -1
- package/dist/styles.css +29 -14
- package/package.json +21 -21
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useAutocomplete, useCombobox, useReverseGeocode } from '@wherabouts/react';
|
|
2
2
|
import { useMemo, useRef, useState, useEffect } from 'react';
|
|
3
3
|
import { createPortal } from 'react-dom';
|
|
4
|
+
import { countryName } from '@wherabouts/sdk';
|
|
4
5
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
5
6
|
|
|
6
7
|
// src/components/address-autocomplete.tsx
|
|
@@ -2520,11 +2521,6 @@ var twMerge = /* @__PURE__ */ createTailwindMerge(getDefaultConfig);
|
|
|
2520
2521
|
function cn(...inputs) {
|
|
2521
2522
|
return twMerge(clsx(inputs));
|
|
2522
2523
|
}
|
|
2523
|
-
|
|
2524
|
-
// src/utils/parse-address.ts
|
|
2525
|
-
var COUNTRY_NAMES = {
|
|
2526
|
-
AU: "Australia"
|
|
2527
|
-
};
|
|
2528
2524
|
function toAddressWithParsed(suggestion) {
|
|
2529
2525
|
return {
|
|
2530
2526
|
id: suggestion.id,
|
|
@@ -2535,7 +2531,7 @@ function toAddressWithParsed(suggestion) {
|
|
|
2535
2531
|
suburb: suggestion.locality,
|
|
2536
2532
|
state: suggestion.state,
|
|
2537
2533
|
postcode: suggestion.postcode,
|
|
2538
|
-
country:
|
|
2534
|
+
country: countryName(suggestion.country)
|
|
2539
2535
|
};
|
|
2540
2536
|
}
|
|
2541
2537
|
var DEFAULT_I18N = {
|
|
@@ -2986,13 +2982,14 @@ function useForwardGeocode(client, query) {
|
|
|
2986
2982
|
setError(null);
|
|
2987
2983
|
return;
|
|
2988
2984
|
}
|
|
2985
|
+
const activeQuery = query;
|
|
2989
2986
|
const controller = new AbortController();
|
|
2990
2987
|
async function fetch() {
|
|
2991
2988
|
setLoading(true);
|
|
2992
2989
|
setError(null);
|
|
2993
2990
|
try {
|
|
2994
2991
|
const response = await client.geocode.forward(
|
|
2995
|
-
{ q:
|
|
2992
|
+
{ q: activeQuery },
|
|
2996
2993
|
{ signal: controller.signal }
|
|
2997
2994
|
);
|
|
2998
2995
|
if (controller.signal.aborted) {
|