@majoo-ui/react 1.62.4 → 1.62.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.
- package/index.esm.js +6 -1
- package/package.json +1 -1
package/index.esm.js
CHANGED
|
@@ -53751,10 +53751,12 @@ function InputMapPicker(props) {
|
|
|
53751
53751
|
} = props;
|
|
53752
53752
|
const modalTrigger = React__default.useRef(null);
|
|
53753
53753
|
const [inputValue, setInputValue] = useState(placeholder);
|
|
53754
|
+
const initialInputValue = useRef(null);
|
|
53754
53755
|
const handleSearchLatLng = useCallback(latLng => __awaiter(this, void 0, void 0, function* () {
|
|
53755
53756
|
try {
|
|
53756
53757
|
const res = yield fetch(`https://nominatim.openstreetmap.org/reverse?format=jsonv2&lat=${Number(latLng.lat)}&lon=${Number(latLng.lng)}&accept-language=id`);
|
|
53757
53758
|
const location = yield res.json();
|
|
53759
|
+
initialInputValue.current = location.display_name;
|
|
53758
53760
|
setInputValue(location.display_name);
|
|
53759
53761
|
} catch (error) {
|
|
53760
53762
|
throw new Error('Failed to search address');
|
|
@@ -53839,7 +53841,10 @@ function InputMapPicker(props) {
|
|
|
53839
53841
|
width: isDesktop ? 565 : '100%',
|
|
53840
53842
|
layer: "$modal",
|
|
53841
53843
|
onPointerDownOutside: e => e.preventDefault(),
|
|
53842
|
-
onCloseClick: () =>
|
|
53844
|
+
onCloseClick: () => {
|
|
53845
|
+
var _a;
|
|
53846
|
+
return setInputValue((_a = initialInputValue.current) !== null && _a !== void 0 ? _a : placeholder);
|
|
53847
|
+
},
|
|
53843
53848
|
children: [jsx(ModalDialogTrigger, {
|
|
53844
53849
|
asChild: true,
|
|
53845
53850
|
children: jsx("div", {
|