@popsure/dirty-swan 0.28.0-beta.3 → 0.28.0-beta.4

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
@@ -3366,20 +3366,20 @@ var Input = require$$0__default['default'].forwardRef(function (_a, ref) {
3366
3366
  error && (jsxRuntime.jsx("p", __assign({ className: "p-p--small tc-red-500 w100 " + styles$n.error }, { children: error }), void 0))] }), void 0));
3367
3367
  });
3368
3368
 
3369
- var GERMANY_ALPHA_CODE = 'DE'; // default country can be cumbersome for new country implementation
3369
+ var GERMANY_ALPHA_CODE = 'DE';
3370
3370
  var ManualAddressEntry = function (_a) {
3371
- var address = _a.address, onAddressChange = _a.onAddressChange;
3371
+ var address = _a.address, onAddressChange = _a.onAddressChange, placeholders = _a.placeholders;
3372
3372
  var handleInputChange = function (event) {
3373
3373
  var _a;
3374
3374
  onAddressChange(__assign(__assign(__assign({}, address), (_a = {}, _a[event.target.name] = event.target.value, _a)), ((address === null || address === void 0 ? void 0 : address.country)
3375
3375
  ? { country: address.country }
3376
3376
  : { country: GERMANY_ALPHA_CODE })));
3377
3377
  };
3378
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", __assign({ className: "d-flex c-gap16 " + styles$o['input-line'] }, { children: [jsxRuntime.jsx(Input, { className: "w100", "data-cy": "autocomplete", type: "text", placeholder: "Street", value: (address === null || address === void 0 ? void 0 : address.street) || '', name: "street", onChange: handleInputChange }, void 0),
3379
- jsxRuntime.jsx(Input, { className: "wmx2 " + styles$o['house-number-input'], "data-cy": "autocomplete-house-number", placeholder: "House Number", value: (address === null || address === void 0 ? void 0 : address.houseNumber) || '', name: "houseNumber", onChange: handleInputChange }, void 0)] }), void 0),
3380
- jsxRuntime.jsx(Input, { className: "mt16", "data-cy": "autocomplete-additional-info", placeholder: "Additional information (C/O, appartment\u2026)", value: (address === null || address === void 0 ? void 0 : address.additionalInformation) || '', name: "additionalInformation", onChange: handleInputChange }, void 0),
3381
- jsxRuntime.jsxs("div", __assign({ className: "d-flex c-gap16 mt16 " + styles$o['input-line'] }, { children: [jsxRuntime.jsx(Input, { className: "w100", "data-cy": "autocomplete-postcode", placeholder: "Postcode", value: (address === null || address === void 0 ? void 0 : address.postcode) || '', name: "postcode", onChange: handleInputChange }, void 0),
3382
- jsxRuntime.jsx(Input, { className: "w100", "data-cy": "autocomplete-city", placeholder: "City", value: (address === null || address === void 0 ? void 0 : address.city) || '', name: "city", onChange: handleInputChange }, void 0)] }), void 0)] }, void 0));
3378
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", __assign({ className: "d-flex c-gap16 " + styles$o['input-line'] }, { children: [jsxRuntime.jsx(Input, { className: "w100", "data-cy": "autocomplete", type: "text", placeholder: placeholders === null || placeholders === void 0 ? void 0 : placeholders.street, value: (address === null || address === void 0 ? void 0 : address.street) || '', name: "street", onChange: handleInputChange }, void 0),
3379
+ jsxRuntime.jsx(Input, { className: "wmx2 " + styles$o['house-number-input'], "data-cy": "autocomplete-house-number", placeholder: placeholders === null || placeholders === void 0 ? void 0 : placeholders.houseNumber, value: (address === null || address === void 0 ? void 0 : address.houseNumber) || '', name: "houseNumber", onChange: handleInputChange }, void 0)] }), void 0),
3380
+ jsxRuntime.jsx(Input, { className: "mt16", "data-cy": "autocomplete-additional-info", placeholder: placeholders === null || placeholders === void 0 ? void 0 : placeholders.additionalInformation, value: (address === null || address === void 0 ? void 0 : address.additionalInformation) || '', name: "additionalInformation", onChange: handleInputChange }, void 0),
3381
+ jsxRuntime.jsxs("div", __assign({ className: "d-flex c-gap16 mt16 " + styles$o['input-line'] }, { children: [jsxRuntime.jsx(Input, { className: "w100", "data-cy": "autocomplete-postcode", placeholder: placeholders === null || placeholders === void 0 ? void 0 : placeholders.postcode, value: (address === null || address === void 0 ? void 0 : address.postcode) || '', name: "postcode", onChange: handleInputChange }, void 0),
3382
+ jsxRuntime.jsx(Input, { className: "w100", "data-cy": "autocomplete-city", placeholder: placeholders === null || placeholders === void 0 ? void 0 : placeholders.city, value: (address === null || address === void 0 ? void 0 : address.city) || '', name: "city", onChange: handleInputChange }, void 0)] }), void 0)] }, void 0));
3383
3383
  };
3384
3384
 
3385
3385
  function _extends() {
@@ -3672,11 +3672,11 @@ var styles$m = {"suggestionList":"dynamic-module_suggestionList__2YcUi","appear-
3672
3672
  styleInject(css_248z$n);
3673
3673
 
3674
3674
  var DynamicAddressEntry = function (_a) {
3675
- var isGeometryEnabled = _a.isGeometryEnabled, initialAddress = _a.address, onAddressChange = _a.onAddressChange, onGeometryChange = _a.onGeometryChange;
3676
- var _b = usePlacesAutocomplete({
3675
+ var isGeometryEnabled = _a.isGeometryEnabled, initialAddress = _a.address, onAddressChange = _a.onAddressChange, onGeometryChange = _a.onGeometryChange, _b = _a.manualAddressEntryText, manualAddressEntryText = _b === void 0 ? "Search for address" : _b;
3676
+ var _c = usePlacesAutocomplete({
3677
3677
  debounce: 400,
3678
- defaultValue: initialAddress === null || initialAddress === void 0 ? void 0 : initialAddress.street,
3679
- }), ready = _b.ready, value = _b.value, _c = _b.suggestions, status = _c.status, data = _c.data, setValue = _b.setValue, clearSuggestions = _b.clearSuggestions;
3678
+ defaultValue: (initialAddress === null || initialAddress === void 0 ? void 0 : initialAddress.street) ? (initialAddress === null || initialAddress === void 0 ? void 0 : initialAddress.street) + " " + (initialAddress === null || initialAddress === void 0 ? void 0 : initialAddress.houseNumber) : '',
3679
+ }), ready = _c.ready, value = _c.value, _d = _c.suggestions, status = _d.status, data = _d.data, setValue = _c.setValue, clearSuggestions = _c.clearSuggestions;
3680
3680
  var handleInput = function (e) {
3681
3681
  setValue(e.target.value);
3682
3682
  };
@@ -3713,7 +3713,7 @@ var DynamicAddressEntry = function (_a) {
3713
3713
  return (jsxRuntime.jsxs("li", __assign({ onClick: handleSelect(suggestion), className: styles$m.suggestionItem }, { children: [jsxRuntime.jsx("span", __assign({ className: "fw-bold pr8" }, { children: main_text }), void 0), ' ', jsxRuntime.jsx("small", { children: secondary_text }, void 0)] }), place_id));
3714
3714
  });
3715
3715
  };
3716
- return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs("div", __assign({ style: { position: 'relative' } }, { children: [jsxRuntime.jsx(Input, { className: "w100", id: "autocomplete", "data-cy": "autocomplete", type: "text", placeholder: "Search for address", disabled: !ready, onChange: handleInput, value: value }, void 0),
3716
+ return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs("div", __assign({ style: { position: 'relative' } }, { children: [jsxRuntime.jsx(Input, { className: "w100", id: "autocomplete", "data-cy": "autocomplete", type: "text", placeholder: manualAddressEntryText, disabled: !ready, onChange: handleInput, value: value }, void 0),
3717
3717
  status === 'OK' && (jsxRuntime.jsx("ul", __assign({ className: styles$m.suggestionList }, { children: renderSuggestions() }), void 0))] }), void 0) }, void 0));
3718
3718
  };
3719
3719
 
@@ -4073,12 +4073,13 @@ function useJsApiLoader(_a) {
4073
4073
  setLoadError(error);
4074
4074
  });
4075
4075
  }
4076
+ // eslint-disable-next-line react-hooks/exhaustive-deps
4076
4077
  }, []);
4077
4078
  return { isLoaded: isLoaded, loadError: loadError };
4078
4079
  }
4079
4080
 
4080
4081
  var AutoCompleteAddress = function (_a) {
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
+ 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, placeholders = _a.placeholders;
4082
4083
  var _d = require$$0.useState(false), isLoading = _d[0], setIsLoading = _d[1];
4083
4084
  var _e = require$$0.useState(undefined), geometry = _e[0], setGeometry = _e[1];
4084
4085
  var _f = require$$0.useState(!!address), manualAddressEntry = _f[0], setManualAddressEntry = _f[1];
@@ -4119,7 +4120,7 @@ var AutoCompleteAddress = function (_a) {
4119
4120
  return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [isGeometryEnabled && address && (jsxRuntime.jsx(GoogleMapsWrapper, { mapId: mapId, hasLoadedGoogleAPI: hasLoadedGoogleAPI, geometry: geometry, isLoading: isLoading }, void 0) // this can be composable <AutocompleteAddress>{({geometry} ) => <GoogleMapsWrapper geometry={geometry}>}
4120
4121
  ),
4121
4122
  loadGoogleAPIError && jsxRuntime.jsx("p", { children: "Google API is not responding." }, void 0),
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)),
4123
+ hasLoadedGoogleAPI && (jsxRuntime.jsx("div", __assign({ className: "wmx8" }, { children: manualAddressEntry || loadGoogleAPIError ? (jsxRuntime.jsx(ManualAddressEntry, { address: address, onAddressChange: handleManualAddress, placeholders: placeholders }, void 0)) : (jsxRuntime.jsx(DynamicAddressEntry, { address: address, onAddressChange: handleDynamicAddress, isGeometryEnabled: isGeometryEnabled, onGeometryChange: setGeometry, manualAddressEntryText: placeholders === null || placeholders === void 0 ? void 0 : placeholders.manualAddressEntry }, void 0)) }), void 0)),
4123
4124
  manualAddressEntry ? (jsxRuntime.jsxs("div", __assign({ className: "p-p mt8" }, { children: [(manualAddressEntryTexts === null || manualAddressEntryTexts === void 0 ? void 0 : manualAddressEntryTexts.preText) || 'Or ',
4124
4125
  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
4126
  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));