authscape 1.0.142 → 1.0.144
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.js +19 -34
- package/package.json +1 -1
- package/src/components/GoogleMapsAutoComplete.js +19 -12
package/index.js
CHANGED
|
@@ -977,7 +977,7 @@ var AutoCompleteDialog = function AutoCompleteDialog(_ref) {
|
|
|
977
977
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_TextField["default"], {
|
|
978
978
|
ref: txtAddressField,
|
|
979
979
|
autoFocus: true,
|
|
980
|
-
|
|
980
|
+
name: "address",
|
|
981
981
|
label: placeholder,
|
|
982
982
|
variant: "outlined",
|
|
983
983
|
fullWidth: true,
|
|
@@ -988,29 +988,34 @@ var AutoCompleteDialog = function AutoCompleteDialog(_ref) {
|
|
|
988
988
|
sx: {
|
|
989
989
|
position: "absolute",
|
|
990
990
|
zIndex: 9999,
|
|
991
|
-
top: 125,
|
|
992
991
|
backgroundColor: "white",
|
|
993
992
|
border: "1px solid black"
|
|
994
993
|
}
|
|
995
994
|
}, renderSuggestions()));
|
|
996
995
|
};
|
|
997
996
|
var GooglePlacesModal = function GooglePlacesModal(_ref3) {
|
|
998
|
-
var
|
|
999
|
-
_ref3$
|
|
1000
|
-
|
|
1001
|
-
|
|
997
|
+
var onAddressSelected = _ref3.onAddressSelected,
|
|
998
|
+
_ref3$_address = _ref3._address,
|
|
999
|
+
_address = _ref3$_address === void 0 ? "" : _ref3$_address,
|
|
1000
|
+
_ref3$_city = _ref3._city,
|
|
1001
|
+
_city = _ref3$_city === void 0 ? "" : _ref3$_city,
|
|
1002
|
+
_ref3$_state = _ref3._state,
|
|
1003
|
+
_state = _ref3$_state === void 0 ? "" : _ref3$_state,
|
|
1004
|
+
_ref3$_postalCode = _ref3._postalCode,
|
|
1005
|
+
_postalCode = _ref3$_postalCode === void 0 ? "" : _ref3$_postalCode;
|
|
1006
|
+
var _useState = (0, _react.useState)(_address),
|
|
1002
1007
|
_useState2 = _slicedToArray(_useState, 2),
|
|
1003
1008
|
address = _useState2[0],
|
|
1004
1009
|
setAddress = _useState2[1];
|
|
1005
|
-
var _useState3 = (0, _react.useState)(
|
|
1010
|
+
var _useState3 = (0, _react.useState)(_city),
|
|
1006
1011
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
1007
1012
|
city = _useState4[0],
|
|
1008
1013
|
setCity = _useState4[1];
|
|
1009
|
-
var _useState5 = (0, _react.useState)(
|
|
1014
|
+
var _useState5 = (0, _react.useState)(_state),
|
|
1010
1015
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
1011
1016
|
state = _useState6[0],
|
|
1012
1017
|
setState = _useState6[1];
|
|
1013
|
-
var _useState7 = (0, _react.useState)(
|
|
1018
|
+
var _useState7 = (0, _react.useState)(_postalCode),
|
|
1014
1019
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
1015
1020
|
zip = _useState8[0],
|
|
1016
1021
|
setPostalcode = _useState8[1];
|
|
@@ -1032,6 +1037,7 @@ var GooglePlacesModal = function GooglePlacesModal(_ref3) {
|
|
|
1032
1037
|
setPostalcode(data.postalCode);
|
|
1033
1038
|
setLat(data.lat);
|
|
1034
1039
|
setLng(data["long"]);
|
|
1040
|
+
onAddressSelected(data.address, data.city, data.state, data.postalCode, data.lat, data["long"]);
|
|
1035
1041
|
},
|
|
1036
1042
|
onChange: function onChange(address) {
|
|
1037
1043
|
setAddress(address);
|
|
@@ -1048,6 +1054,7 @@ var GooglePlacesModal = function GooglePlacesModal(_ref3) {
|
|
|
1048
1054
|
}, /*#__PURE__*/_react["default"].createElement(_system.Box, null, /*#__PURE__*/_react["default"].createElement(_TextField["default"], {
|
|
1049
1055
|
id: "outlined-basic",
|
|
1050
1056
|
label: "City",
|
|
1057
|
+
name: "city",
|
|
1051
1058
|
variant: "outlined",
|
|
1052
1059
|
fullWidth: true,
|
|
1053
1060
|
value: city,
|
|
@@ -1060,6 +1067,7 @@ var GooglePlacesModal = function GooglePlacesModal(_ref3) {
|
|
|
1060
1067
|
}, /*#__PURE__*/_react["default"].createElement(_system.Box, null, /*#__PURE__*/_react["default"].createElement(_TextField["default"], {
|
|
1061
1068
|
id: "outlined-basic",
|
|
1062
1069
|
label: "State",
|
|
1070
|
+
name: "state",
|
|
1063
1071
|
variant: "outlined",
|
|
1064
1072
|
fullWidth: true,
|
|
1065
1073
|
value: state,
|
|
@@ -1073,37 +1081,14 @@ var GooglePlacesModal = function GooglePlacesModal(_ref3) {
|
|
|
1073
1081
|
}, /*#__PURE__*/_react["default"].createElement(_TextField["default"], {
|
|
1074
1082
|
id: "outlined-basic",
|
|
1075
1083
|
label: "Postal code",
|
|
1084
|
+
name: "postalCode",
|
|
1076
1085
|
variant: "outlined",
|
|
1077
1086
|
fullWidth: true,
|
|
1078
1087
|
value: zip,
|
|
1079
1088
|
onChange: function onChange(val) {
|
|
1080
1089
|
setPostalcode(val.currentTarget.value);
|
|
1081
1090
|
}
|
|
1082
|
-
}))
|
|
1083
|
-
sx: {
|
|
1084
|
-
marginTop: 1,
|
|
1085
|
-
textAlign: "right"
|
|
1086
|
-
}
|
|
1087
|
-
}, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
1088
|
-
variant: "contained",
|
|
1089
|
-
onClick: function onClick() {
|
|
1090
|
-
if (lat == null || lng == null) {
|
|
1091
|
-
var addressInfo = address + " " + city + " " + state + " " + zip;
|
|
1092
|
-
(0, _usePlacesAutocomplete.getGeocode)({
|
|
1093
|
-
address: addressInfo
|
|
1094
|
-
}).then(function (results) {
|
|
1095
|
-
var _getLatLng = (0, _usePlacesAutocomplete.getLatLng)(results[0]),
|
|
1096
|
-
lat = _getLatLng.lat,
|
|
1097
|
-
lng = _getLatLng.lng;
|
|
1098
|
-
setLat(lat);
|
|
1099
|
-
setLng(lng);
|
|
1100
|
-
});
|
|
1101
|
-
}
|
|
1102
|
-
onSave(address, city, state, zip, lat, lng);
|
|
1103
|
-
}
|
|
1104
|
-
}, createButtonText))), /*#__PURE__*/_react["default"].createElement(_script["default"], {
|
|
1105
|
-
src: "https://maps.googleapis.com/maps/api/js?key=" + process.env.googleMapsKey + "&libraries=places"
|
|
1106
|
-
}));
|
|
1091
|
+
}))));
|
|
1107
1092
|
};
|
|
1108
1093
|
exports.GooglePlacesModal = GooglePlacesModal;
|
|
1109
1094
|
"use strict";
|
package/package.json
CHANGED
|
@@ -322,10 +322,10 @@ const AutoCompleteDialog = ({placeholder, onSelected, defaultValue, onChange}) =
|
|
|
322
322
|
|
|
323
323
|
return (
|
|
324
324
|
<>
|
|
325
|
-
<TextField ref={txtAddressField} autoFocus={true}
|
|
325
|
+
<TextField ref={txtAddressField} autoFocus={true} name="address" label={placeholder} variant="outlined" fullWidth={true} value={value} onChange={handleInput} />
|
|
326
326
|
|
|
327
327
|
{status == "OK" &&
|
|
328
|
-
<MenuList ref={ref} sx={{position:"absolute", zIndex:9999,
|
|
328
|
+
<MenuList ref={ref} sx={{position:"absolute", zIndex:9999, backgroundColor:"white", border:"1px solid black"}}>
|
|
329
329
|
{renderSuggestions()}
|
|
330
330
|
</MenuList>
|
|
331
331
|
}
|
|
@@ -334,13 +334,17 @@ const AutoCompleteDialog = ({placeholder, onSelected, defaultValue, onChange}) =
|
|
|
334
334
|
};
|
|
335
335
|
|
|
336
336
|
export const GooglePlacesModal = ({
|
|
337
|
-
|
|
338
|
-
|
|
337
|
+
onAddressSelected,
|
|
338
|
+
_address = "",
|
|
339
|
+
_city = "",
|
|
340
|
+
_state = "",
|
|
341
|
+
_postalCode = ""
|
|
339
342
|
}) => {
|
|
340
|
-
const [address, setAddress] = useState(
|
|
341
|
-
const [city, setCity] = useState(
|
|
342
|
-
const [state, setState] = useState(
|
|
343
|
-
const [zip, setPostalcode] = useState(
|
|
343
|
+
const [address, setAddress] = useState(_address);
|
|
344
|
+
const [city, setCity] = useState(_city);
|
|
345
|
+
const [state, setState] = useState(_state);
|
|
346
|
+
const [zip, setPostalcode] = useState(_postalCode);
|
|
347
|
+
|
|
344
348
|
const [lat, setLat] = useState(null);
|
|
345
349
|
const [lng, setLng] = useState(null);
|
|
346
350
|
|
|
@@ -357,6 +361,8 @@ export const GooglePlacesModal = ({
|
|
|
357
361
|
setPostalcode(data.postalCode);
|
|
358
362
|
setLat(data.lat);
|
|
359
363
|
setLng(data.long);
|
|
364
|
+
|
|
365
|
+
onAddressSelected(data.address, data.city, data.state, data.postalCode, data.lat, data.long);
|
|
360
366
|
}}
|
|
361
367
|
onChange={(address) => {
|
|
362
368
|
setAddress(address);
|
|
@@ -369,6 +375,7 @@ export const GooglePlacesModal = ({
|
|
|
369
375
|
<TextField
|
|
370
376
|
id="outlined-basic"
|
|
371
377
|
label="City"
|
|
378
|
+
name="city"
|
|
372
379
|
variant="outlined"
|
|
373
380
|
fullWidth={true}
|
|
374
381
|
value={city}
|
|
@@ -384,6 +391,7 @@ export const GooglePlacesModal = ({
|
|
|
384
391
|
<TextField
|
|
385
392
|
id="outlined-basic"
|
|
386
393
|
label="State"
|
|
394
|
+
name="state"
|
|
387
395
|
variant="outlined"
|
|
388
396
|
fullWidth={true}
|
|
389
397
|
value={state}
|
|
@@ -399,6 +407,7 @@ export const GooglePlacesModal = ({
|
|
|
399
407
|
<TextField
|
|
400
408
|
id="outlined-basic"
|
|
401
409
|
label="Postal code"
|
|
410
|
+
name="postalCode"
|
|
402
411
|
variant="outlined"
|
|
403
412
|
fullWidth={true}
|
|
404
413
|
value={zip}
|
|
@@ -408,7 +417,7 @@ export const GooglePlacesModal = ({
|
|
|
408
417
|
/>
|
|
409
418
|
</Box>
|
|
410
419
|
|
|
411
|
-
<Box sx={{ marginTop: 1, textAlign: "right" }}>
|
|
420
|
+
{/* <Box sx={{ marginTop: 1, textAlign: "right" }}>
|
|
412
421
|
<Button
|
|
413
422
|
variant="contained"
|
|
414
423
|
onClick={() => {
|
|
@@ -426,10 +435,8 @@ export const GooglePlacesModal = ({
|
|
|
426
435
|
}}>
|
|
427
436
|
{createButtonText}
|
|
428
437
|
</Button>
|
|
429
|
-
</Box>
|
|
438
|
+
</Box> */}
|
|
430
439
|
</Box>
|
|
431
|
-
|
|
432
|
-
<Script src={"https://maps.googleapis.com/maps/api/js?key=" + process.env.googleMapsKey + "&libraries=places"}></Script>
|
|
433
440
|
</>
|
|
434
441
|
);
|
|
435
442
|
}
|