@popsure/dirty-swan 0.28.0-beta.1 → 0.28.0-beta.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/dist/index.js
CHANGED
|
@@ -4078,26 +4078,21 @@ function useJsApiLoader(_a) {
|
|
|
4078
4078
|
}
|
|
4079
4079
|
|
|
4080
4080
|
var AutoCompleteAddress = function (_a) {
|
|
4081
|
-
var _b = _a.mapId, mapId = _b === void 0 ? 'map' : _b, apiKey = _a.apiKey,
|
|
4081
|
+
var _b = _a.mapId, mapId = _b === void 0 ? 'map' : _b, apiKey = _a.apiKey, address = _a.address, _c = _a.staticVersion, staticVersion = _c === void 0 ? !!process.env.STORYBOOK_STATIC : _c, onAddressChange = _a.onAddressChange, manualAddressEntryTexts = _a.manualAddressEntryTexts;
|
|
4082
4082
|
var _d = require$$0.useState(false), isLoading = _d[0], setIsLoading = _d[1];
|
|
4083
|
-
var _e = require$$0.useState(
|
|
4084
|
-
var _f = require$$0.useState(
|
|
4085
|
-
var _g = require$$0.useState(!!initialAddress), manualAddressEntry = _g[0], setManualAddressEntry = _g[1];
|
|
4083
|
+
var _e = require$$0.useState(undefined), geometry = _e[0], setGeometry = _e[1];
|
|
4084
|
+
var _f = require$$0.useState(!!address), manualAddressEntry = _f[0], setManualAddressEntry = _f[1];
|
|
4086
4085
|
// you can read more about it here:
|
|
4087
4086
|
// https://github.com/JustFly1984/react-google-maps-api/blob/develop/packages/react-google-maps-api/src/useJsApiLoader.md
|
|
4088
|
-
var
|
|
4087
|
+
var _g = useJsApiLoader({
|
|
4089
4088
|
googleMapsApiKey: apiKey,
|
|
4090
|
-
}), hasLoadedGoogleAPI =
|
|
4089
|
+
}), hasLoadedGoogleAPI = _g.isLoaded, loadGoogleAPIError = _g.loadError;
|
|
4091
4090
|
var isGeometryEnabled = !staticVersion;
|
|
4092
4091
|
var handleModeSwitch = function (event) {
|
|
4093
4092
|
setManualAddressEntry(event.currentTarget.dataset.value === 'true');
|
|
4094
4093
|
};
|
|
4095
|
-
var handleAddressChange = function (address) {
|
|
4096
|
-
setAddress(address);
|
|
4097
|
-
onAddressChange(address);
|
|
4098
|
-
};
|
|
4099
4094
|
var handleDynamicAddress = function (address) {
|
|
4100
|
-
|
|
4095
|
+
onAddressChange(address);
|
|
4101
4096
|
setManualAddressEntry(true);
|
|
4102
4097
|
};
|
|
4103
4098
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -4115,7 +4110,7 @@ var AutoCompleteAddress = function (_a) {
|
|
|
4115
4110
|
});
|
|
4116
4111
|
}, 1000), [lodash_debounce]);
|
|
4117
4112
|
var handleManualAddress = function (address) {
|
|
4118
|
-
|
|
4113
|
+
onAddressChange(address);
|
|
4119
4114
|
if (isGeometryEnabled) {
|
|
4120
4115
|
setIsLoading(true);
|
|
4121
4116
|
updateMapGeometry(address);
|
|
@@ -4126,8 +4121,8 @@ var AutoCompleteAddress = function (_a) {
|
|
|
4126
4121
|
loadGoogleAPIError && jsxRuntime.jsx("p", { children: "Google API is not responding." }, void 0),
|
|
4127
4122
|
hasLoadedGoogleAPI && (jsxRuntime.jsx("div", __assign({ className: "wmx8" }, { children: manualAddressEntry || loadGoogleAPIError ? (jsxRuntime.jsx(ManualAddressEntry, { address: address, onAddressChange: handleManualAddress }, void 0)) : (jsxRuntime.jsx(DynamicAddressEntry, { address: address, onAddressChange: handleDynamicAddress, isGeometryEnabled: isGeometryEnabled, onGeometryChange: setGeometry }, void 0)) }), void 0)),
|
|
4128
4123
|
manualAddressEntry ? (jsxRuntime.jsxs("div", __assign({ className: "p-p mt8" }, { children: [(manualAddressEntryTexts === null || manualAddressEntryTexts === void 0 ? void 0 : manualAddressEntryTexts.preText) || 'Or ',
|
|
4129
|
-
jsxRuntime.jsx("button", __assign({ className: "p-a bg-transparent fw-bold c-pointer", onClick: handleModeSwitch, "data-value": 'false' }, { children: (manualAddressEntryTexts === null || manualAddressEntryTexts === void 0 ? void 0 : manualAddressEntryTexts.cta) || 'Enter address dynamically' }), void 0)] }), void 0)) : (jsxRuntime.jsxs("div", __assign({ className: "p-p mt8" }, { children: [(manualAddressEntryTexts === null || manualAddressEntryTexts === void 0 ? void 0 : manualAddressEntryTexts.preText) || 'Or ',
|
|
4130
|
-
jsxRuntime.jsx("button", __assign({ className: "p-a bg-transparent fw-bold c-pointer", onClick: handleModeSwitch, "data-value": 'true' }, { children: (manualAddressEntryTexts === null || manualAddressEntryTexts === void 0 ? void 0 : manualAddressEntryTexts.cta) || 'Enter address manually' }), void 0)] }), void 0))] }, void 0));
|
|
4124
|
+
jsxRuntime.jsx("button", __assign({ className: "p-a bg-transparent fw-bold c-pointer", onClick: handleModeSwitch, "data-value": 'false', type: "button" }, { children: (manualAddressEntryTexts === null || manualAddressEntryTexts === void 0 ? void 0 : manualAddressEntryTexts.cta) || 'Enter address dynamically' }), void 0)] }), void 0)) : (jsxRuntime.jsxs("div", __assign({ className: "p-p mt8" }, { children: [(manualAddressEntryTexts === null || manualAddressEntryTexts === void 0 ? void 0 : manualAddressEntryTexts.preText) || 'Or ',
|
|
4125
|
+
jsxRuntime.jsx("button", __assign({ className: "p-a bg-transparent fw-bold c-pointer", onClick: handleModeSwitch, "data-value": 'true', type: "button" }, { children: (manualAddressEntryTexts === null || manualAddressEntryTexts === void 0 ? void 0 : manualAddressEntryTexts.cta) || 'Enter address manually' }), void 0)] }), void 0))] }, void 0));
|
|
4131
4126
|
};
|
|
4132
4127
|
|
|
4133
4128
|
var propTypes$1 = {exports: {}};
|