authscape 1.0.147 → 1.0.149
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 -64
- package/package.json +2 -1
- package/src/components/GoogleMapsAutoComplete.js +18 -76
package/index.js
CHANGED
|
@@ -729,7 +729,6 @@ var _ListItemIcon = _interopRequireDefault(require("@mui/material/ListItemIcon")
|
|
|
729
729
|
var _LocationOnRounded = _interopRequireDefault(require("@mui/icons-material/LocationOnRounded"));
|
|
730
730
|
var _ListItemText = _interopRequireDefault(require("@mui/material/ListItemText"));
|
|
731
731
|
var _reactCoolOnclickoutside = _interopRequireDefault(require("react-cool-onclickoutside"));
|
|
732
|
-
var _reactHookForm = require("react-hook-form");
|
|
733
732
|
var _Stack = _interopRequireDefault(require("@mui/material/Stack"));
|
|
734
733
|
var _usePlacesAutocomplete = _interopRequireWildcard(require("use-places-autocomplete"));
|
|
735
734
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
@@ -987,11 +986,11 @@ var AutoCompleteDialog = function AutoCompleteDialog(_ref) {
|
|
|
987
986
|
fullWidth: true,
|
|
988
987
|
value: value,
|
|
989
988
|
onChange: handleInput
|
|
990
|
-
}),
|
|
989
|
+
}), react_hook_form_errors != null && react_hook_form_errors.address && react_hook_form_errors.address.type === 'required' && /*#__PURE__*/_react["default"].createElement(Typography, {
|
|
991
990
|
sx: {
|
|
992
991
|
color: "red"
|
|
993
992
|
}
|
|
994
|
-
}, "Address is required.")), react_hook_form_Control != null && /*#__PURE__*/_react["default"].createElement(
|
|
993
|
+
}, "Address is required.")), react_hook_form_Control != null && /*#__PURE__*/_react["default"].createElement(Controller, {
|
|
995
994
|
control: react_hook_form_Control,
|
|
996
995
|
rules: {
|
|
997
996
|
required: true
|
|
@@ -1009,7 +1008,7 @@ var AutoCompleteDialog = function AutoCompleteDialog(_ref) {
|
|
|
1009
1008
|
fullWidth: true,
|
|
1010
1009
|
value: value,
|
|
1011
1010
|
onChange: handleInput
|
|
1012
|
-
})),
|
|
1011
|
+
})), react_hook_form_errors != null && react_hook_form_errors.address && react_hook_form_errors.address.type === 'required' && /*#__PURE__*/_react["default"].createElement(Typography, {
|
|
1013
1012
|
sx: {
|
|
1014
1013
|
color: "red"
|
|
1015
1014
|
}
|
|
@@ -1034,9 +1033,7 @@ var GooglePlacesModal = function GooglePlacesModal(_ref4) {
|
|
|
1034
1033
|
_ref4$_state = _ref4._state,
|
|
1035
1034
|
_state = _ref4$_state === void 0 ? "" : _ref4$_state,
|
|
1036
1035
|
_ref4$_postalCode = _ref4._postalCode,
|
|
1037
|
-
_postalCode = _ref4$_postalCode === void 0 ? "" : _ref4$_postalCode
|
|
1038
|
-
_ref4$react_hook_form = _ref4.react_hook_form_Control,
|
|
1039
|
-
react_hook_form_Control = _ref4$react_hook_form === void 0 ? null : _ref4$react_hook_form;
|
|
1036
|
+
_postalCode = _ref4$_postalCode === void 0 ? "" : _ref4$_postalCode;
|
|
1040
1037
|
var _useState = (0, _react.useState)(_address),
|
|
1041
1038
|
_useState2 = _slicedToArray(_useState, 2),
|
|
1042
1039
|
address = _useState2[0],
|
|
@@ -1063,7 +1060,6 @@ var GooglePlacesModal = function GooglePlacesModal(_ref4) {
|
|
|
1063
1060
|
setLng = _useState12[1];
|
|
1064
1061
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_system.Box, null, /*#__PURE__*/_react["default"].createElement(AutoCompleteDialog, {
|
|
1065
1062
|
placeholder: "Address",
|
|
1066
|
-
react_hook_form_Control: react_hook_form_Control,
|
|
1067
1063
|
defaultValue: address,
|
|
1068
1064
|
onSelected: function onSelected(data) {
|
|
1069
1065
|
setAddress(data.address);
|
|
@@ -1086,79 +1082,35 @@ var GooglePlacesModal = function GooglePlacesModal(_ref4) {
|
|
|
1086
1082
|
}, /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
|
|
1087
1083
|
item: true,
|
|
1088
1084
|
xs: 6
|
|
1089
|
-
}, /*#__PURE__*/_react["default"].createElement(_system.Box, null,
|
|
1085
|
+
}, /*#__PURE__*/_react["default"].createElement(_system.Box, null, /*#__PURE__*/_react["default"].createElement(_TextField["default"], {
|
|
1090
1086
|
id: "outlined-basic",
|
|
1091
1087
|
label: "City",
|
|
1092
1088
|
name: "city",
|
|
1093
1089
|
variant: "outlined",
|
|
1094
1090
|
fullWidth: true,
|
|
1095
1091
|
value: city,
|
|
1092
|
+
InputProps: {
|
|
1093
|
+
readOnly: true
|
|
1094
|
+
},
|
|
1096
1095
|
onChange: function onChange(val) {
|
|
1097
1096
|
setCity(val.currentTarget.value);
|
|
1098
1097
|
}
|
|
1099
|
-
}), react_hook_form_Control != null && /*#__PURE__*/_react["default"].createElement(_reactHookForm.Controller, {
|
|
1100
|
-
control: react_hook_form_Control,
|
|
1101
|
-
rules: {
|
|
1102
|
-
required: true
|
|
1103
|
-
},
|
|
1104
|
-
name: "city",
|
|
1105
|
-
render: function render(_ref5) {
|
|
1106
|
-
var field = _ref5.field;
|
|
1107
|
-
return /*#__PURE__*/_react["default"].createElement(_Stack["default"], null, /*#__PURE__*/_react["default"].createElement(_TextField["default"], _extends({
|
|
1108
|
-
id: "outlined-basic",
|
|
1109
|
-
label: "City",
|
|
1110
|
-
name: "city",
|
|
1111
|
-
variant: "outlined"
|
|
1112
|
-
}, field, {
|
|
1113
|
-
fullWidth: true,
|
|
1114
|
-
value: city,
|
|
1115
|
-
onChange: function onChange(val) {
|
|
1116
|
-
setCity(val.currentTarget.value);
|
|
1117
|
-
}
|
|
1118
|
-
})), errors.city && errors.city.type === 'required' && /*#__PURE__*/_react["default"].createElement(Typography, {
|
|
1119
|
-
sx: {
|
|
1120
|
-
color: "red"
|
|
1121
|
-
}
|
|
1122
|
-
}, "City is required."));
|
|
1123
|
-
}
|
|
1124
1098
|
}))), /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
|
|
1125
1099
|
item: true,
|
|
1126
1100
|
xs: 6
|
|
1127
|
-
}, /*#__PURE__*/_react["default"].createElement(_system.Box, null,
|
|
1101
|
+
}, /*#__PURE__*/_react["default"].createElement(_system.Box, null, /*#__PURE__*/_react["default"].createElement(_TextField["default"], {
|
|
1128
1102
|
id: "outlined-basic",
|
|
1129
1103
|
label: "State",
|
|
1130
1104
|
name: "state",
|
|
1131
1105
|
variant: "outlined",
|
|
1132
1106
|
fullWidth: true,
|
|
1107
|
+
InputProps: {
|
|
1108
|
+
readOnly: true
|
|
1109
|
+
},
|
|
1133
1110
|
value: state,
|
|
1134
1111
|
onChange: function onChange(val) {
|
|
1135
1112
|
setState(val.currentTarget.value);
|
|
1136
1113
|
}
|
|
1137
|
-
}), react_hook_form_Control != null && /*#__PURE__*/_react["default"].createElement(_reactHookForm.Controller, {
|
|
1138
|
-
control: react_hook_form_Control,
|
|
1139
|
-
rules: {
|
|
1140
|
-
required: true
|
|
1141
|
-
},
|
|
1142
|
-
name: "state",
|
|
1143
|
-
render: function render(_ref6) {
|
|
1144
|
-
var field = _ref6.field;
|
|
1145
|
-
return /*#__PURE__*/_react["default"].createElement(_Stack["default"], null, /*#__PURE__*/_react["default"].createElement(_TextField["default"], _extends({
|
|
1146
|
-
id: "outlined-basic",
|
|
1147
|
-
label: "State"
|
|
1148
|
-
}, field, {
|
|
1149
|
-
name: "state",
|
|
1150
|
-
variant: "outlined",
|
|
1151
|
-
fullWidth: true,
|
|
1152
|
-
value: state,
|
|
1153
|
-
onChange: function onChange(val) {
|
|
1154
|
-
setState(val.currentTarget.value);
|
|
1155
|
-
}
|
|
1156
|
-
})), errors.state && errors.state.type === 'required' && /*#__PURE__*/_react["default"].createElement(Typography, {
|
|
1157
|
-
sx: {
|
|
1158
|
-
color: "red"
|
|
1159
|
-
}
|
|
1160
|
-
}, "State is required."));
|
|
1161
|
-
}
|
|
1162
1114
|
})))), /*#__PURE__*/_react["default"].createElement(_system.Box, {
|
|
1163
1115
|
sx: {
|
|
1164
1116
|
marginTop: 2
|
|
@@ -1170,17 +1122,20 @@ var GooglePlacesModal = function GooglePlacesModal(_ref4) {
|
|
|
1170
1122
|
variant: "outlined",
|
|
1171
1123
|
fullWidth: true,
|
|
1172
1124
|
value: zip,
|
|
1125
|
+
InputProps: {
|
|
1126
|
+
readOnly: true
|
|
1127
|
+
},
|
|
1173
1128
|
onChange: function onChange(val) {
|
|
1174
1129
|
setPostalcode(val.currentTarget.value);
|
|
1175
1130
|
}
|
|
1176
|
-
}), react_hook_form_Control != null && /*#__PURE__*/_react["default"].createElement(
|
|
1131
|
+
}), react_hook_form_Control != null && /*#__PURE__*/_react["default"].createElement(Controller, {
|
|
1177
1132
|
control: react_hook_form_Control,
|
|
1178
1133
|
rules: {
|
|
1179
1134
|
required: true
|
|
1180
1135
|
},
|
|
1181
1136
|
name: "postalCode",
|
|
1182
|
-
render: function render(
|
|
1183
|
-
var field =
|
|
1137
|
+
render: function render(_ref5) {
|
|
1138
|
+
var field = _ref5.field;
|
|
1184
1139
|
return /*#__PURE__*/_react["default"].createElement(_Stack["default"], null, /*#__PURE__*/_react["default"].createElement(_TextField["default"], _extends({
|
|
1185
1140
|
id: "outlined-basic",
|
|
1186
1141
|
label: "Postal code"
|
|
@@ -1192,7 +1147,7 @@ var GooglePlacesModal = function GooglePlacesModal(_ref4) {
|
|
|
1192
1147
|
onChange: function onChange(val) {
|
|
1193
1148
|
setPostalcode(val.currentTarget.value);
|
|
1194
1149
|
}
|
|
1195
|
-
})),
|
|
1150
|
+
})), react_hook_form_errors != null && react_hook_form_errors.postalCode && react_hook_form_errors.postalCode.type === 'required' && /*#__PURE__*/_react["default"].createElement(Typography, {
|
|
1196
1151
|
sx: {
|
|
1197
1152
|
color: "red"
|
|
1198
1153
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "authscape",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.149",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"query-string": "^7.1.1",
|
|
41
41
|
"react-cool-onclickoutside": "^1.7.0",
|
|
42
42
|
"react-data-table-component": "^7.5.2",
|
|
43
|
+
"react-hook-form": "^7.44.2",
|
|
43
44
|
"use-places-autocomplete": "^4.0.0"
|
|
44
45
|
}
|
|
45
46
|
}
|
|
@@ -9,7 +9,6 @@ import ListItemIcon from '@mui/material/ListItemIcon';
|
|
|
9
9
|
import LocationOnRoundedIcon from '@mui/icons-material/LocationOnRounded';
|
|
10
10
|
import ListItemText from '@mui/material/ListItemText';
|
|
11
11
|
import useOnclickOutside from "react-cool-onclickoutside";
|
|
12
|
-
import { useForm, Controller, useFieldArray } from "react-hook-form";
|
|
13
12
|
import Stack from "@mui/material/Stack";
|
|
14
13
|
|
|
15
14
|
import usePlacesAutocomplete, {
|
|
@@ -328,8 +327,8 @@ const AutoCompleteDialog = ({placeholder, onSelected, defaultValue, react_hook_f
|
|
|
328
327
|
{react_hook_form_Control == null &&
|
|
329
328
|
<Stack>
|
|
330
329
|
<TextField ref={txtAddressField} name="address" autoComplete="new-password" label={placeholder} variant="outlined" fullWidth={true} value={value} onChange={handleInput} />
|
|
331
|
-
{
|
|
332
|
-
|
|
330
|
+
{react_hook_form_errors != null && react_hook_form_errors.address &&
|
|
331
|
+
react_hook_form_errors.address.type === 'required'
|
|
333
332
|
&& <Typography sx={{color: "red"}}>Address is required.</Typography>}
|
|
334
333
|
</Stack>
|
|
335
334
|
}
|
|
@@ -342,8 +341,8 @@ const AutoCompleteDialog = ({placeholder, onSelected, defaultValue, react_hook_f
|
|
|
342
341
|
render={({ field }) => (
|
|
343
342
|
<Stack>
|
|
344
343
|
<TextField ref={txtAddressField} name="address" {...field} autoComplete="new-password" label={placeholder} variant="outlined" fullWidth={true} value={value} onChange={handleInput} />
|
|
345
|
-
{
|
|
346
|
-
|
|
344
|
+
{react_hook_form_errors != null && react_hook_form_errors.address &&
|
|
345
|
+
react_hook_form_errors.address.type === 'required'
|
|
347
346
|
&& <Typography sx={{color: "red"}}>Address is required.</Typography>}
|
|
348
347
|
</Stack>
|
|
349
348
|
)}
|
|
@@ -370,8 +369,7 @@ export const GooglePlacesModal = ({
|
|
|
370
369
|
_address = "",
|
|
371
370
|
_city = "",
|
|
372
371
|
_state = "",
|
|
373
|
-
_postalCode = ""
|
|
374
|
-
react_hook_form_Control = null
|
|
372
|
+
_postalCode = ""
|
|
375
373
|
}) => {
|
|
376
374
|
const [address, setAddress] = useState(_address);
|
|
377
375
|
const [city, setCity] = useState(_city);
|
|
@@ -386,7 +384,6 @@ export const GooglePlacesModal = ({
|
|
|
386
384
|
<Box>
|
|
387
385
|
<AutoCompleteDialog
|
|
388
386
|
placeholder={"Address"}
|
|
389
|
-
react_hook_form_Control={react_hook_form_Control}
|
|
390
387
|
defaultValue={address}
|
|
391
388
|
onSelected={(data) => {
|
|
392
389
|
setAddress(data.address);
|
|
@@ -406,8 +403,7 @@ export const GooglePlacesModal = ({
|
|
|
406
403
|
<Grid container spacing={1} sx={{ marginTop: 1 }}>
|
|
407
404
|
<Grid item xs={6}>
|
|
408
405
|
<Box>
|
|
409
|
-
|
|
410
|
-
{react_hook_form_Control == null &&
|
|
406
|
+
|
|
411
407
|
<TextField
|
|
412
408
|
id="outlined-basic"
|
|
413
409
|
label="City"
|
|
@@ -415,40 +411,13 @@ export const GooglePlacesModal = ({
|
|
|
415
411
|
variant="outlined"
|
|
416
412
|
fullWidth={true}
|
|
417
413
|
value={city}
|
|
414
|
+
InputProps={{
|
|
415
|
+
readOnly: true,
|
|
416
|
+
}}
|
|
418
417
|
onChange={(val) => {
|
|
419
418
|
setCity(val.currentTarget.value);
|
|
420
419
|
}}
|
|
421
420
|
/>
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
{react_hook_form_Control != null &&
|
|
425
|
-
<Controller
|
|
426
|
-
control={react_hook_form_Control}
|
|
427
|
-
rules={{ required: true }}
|
|
428
|
-
name="city"
|
|
429
|
-
render={({ field }) => (
|
|
430
|
-
<Stack>
|
|
431
|
-
<TextField
|
|
432
|
-
id="outlined-basic"
|
|
433
|
-
label="City"
|
|
434
|
-
name="city"
|
|
435
|
-
variant="outlined"
|
|
436
|
-
{...field}
|
|
437
|
-
fullWidth={true}
|
|
438
|
-
value={city}
|
|
439
|
-
onChange={(val) => {
|
|
440
|
-
setCity(val.currentTarget.value);
|
|
441
|
-
}}
|
|
442
|
-
/>
|
|
443
|
-
|
|
444
|
-
{errors.city &&
|
|
445
|
-
errors.city.type === 'required'
|
|
446
|
-
&& <Typography sx={{color: "red"}}>City is required.</Typography>}
|
|
447
|
-
</Stack>
|
|
448
|
-
)}
|
|
449
|
-
/>
|
|
450
|
-
}
|
|
451
|
-
|
|
452
421
|
|
|
453
422
|
</Box>
|
|
454
423
|
</Grid>
|
|
@@ -456,51 +425,21 @@ export const GooglePlacesModal = ({
|
|
|
456
425
|
<Grid item xs={6}>
|
|
457
426
|
<Box>
|
|
458
427
|
|
|
459
|
-
{react_hook_form_Control == null &&
|
|
460
|
-
|
|
461
428
|
<TextField
|
|
462
429
|
id="outlined-basic"
|
|
463
430
|
label="State"
|
|
464
431
|
name="state"
|
|
465
432
|
variant="outlined"
|
|
466
433
|
fullWidth={true}
|
|
434
|
+
InputProps={{
|
|
435
|
+
readOnly: true,
|
|
436
|
+
}}
|
|
467
437
|
value={state}
|
|
468
438
|
onChange={(val) => {
|
|
469
439
|
setState(val.currentTarget.value);
|
|
470
440
|
}}
|
|
471
441
|
/>
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
{react_hook_form_Control != null &&
|
|
475
|
-
<Controller
|
|
476
|
-
control={react_hook_form_Control}
|
|
477
|
-
rules={{ required: true }}
|
|
478
|
-
name="state"
|
|
479
|
-
render={({ field }) => (
|
|
480
|
-
<Stack>
|
|
481
|
-
|
|
482
|
-
<TextField
|
|
483
|
-
id="outlined-basic"
|
|
484
|
-
label="State"
|
|
485
|
-
{...field}
|
|
486
|
-
name="state"
|
|
487
|
-
variant="outlined"
|
|
488
|
-
fullWidth={true}
|
|
489
|
-
value={state}
|
|
490
|
-
onChange={(val) => {
|
|
491
|
-
setState(val.currentTarget.value);
|
|
492
|
-
}}
|
|
493
|
-
/>
|
|
494
|
-
|
|
495
|
-
{errors.state &&
|
|
496
|
-
errors.state.type === 'required'
|
|
497
|
-
&& <Typography sx={{color: "red"}}>State is required.</Typography>}
|
|
498
|
-
</Stack>
|
|
499
|
-
)}
|
|
500
|
-
/>
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
|
|
442
|
+
|
|
504
443
|
|
|
505
444
|
|
|
506
445
|
</Box>
|
|
@@ -519,6 +458,9 @@ export const GooglePlacesModal = ({
|
|
|
519
458
|
variant="outlined"
|
|
520
459
|
fullWidth={true}
|
|
521
460
|
value={zip}
|
|
461
|
+
InputProps={{
|
|
462
|
+
readOnly: true,
|
|
463
|
+
}}
|
|
522
464
|
onChange={(val) => {
|
|
523
465
|
setPostalcode(val.currentTarget.value);
|
|
524
466
|
}}
|
|
@@ -546,8 +488,8 @@ export const GooglePlacesModal = ({
|
|
|
546
488
|
}}
|
|
547
489
|
/>
|
|
548
490
|
|
|
549
|
-
{
|
|
550
|
-
|
|
491
|
+
{react_hook_form_errors != null && react_hook_form_errors.postalCode &&
|
|
492
|
+
react_hook_form_errors.postalCode.type === 'required'
|
|
551
493
|
&& <Typography sx={{color: "red"}}>Postal Code is required.</Typography>}
|
|
552
494
|
</Stack>
|
|
553
495
|
)}
|