@asdp/ferryui 0.1.1 → 0.1.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.d.mts +206 -11
- package/dist/index.d.ts +206 -11
- package/dist/index.js +1972 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1970 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -2
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import { makeStyles, tokens, shorthands, Dialog, DialogSurface, DialogBody, DialogTitle, DialogContent, Body1, Button, Carousel, mergeClasses, CarouselViewport, CarouselSlider, CarouselNav, CarouselNavButton, CarouselCard, Subtitle2, Card, Tooltip, Badge, Caption1, Title2, Caption2, Divider, Title3, Caption1Strong } from '@fluentui/react-components';
|
|
1
|
+
import { makeStyles, tokens, shorthands, Popover, PopoverTrigger, Input, PopoverSurface, Dialog, DialogSurface, DialogBody, DialogTitle, DialogContent, Body1, Button, Carousel, mergeClasses, CarouselViewport, CarouselSlider, CarouselNav, CarouselNavButton, CarouselCard, Subtitle2, Card, Tooltip, Badge, Caption1, Title2, Caption2, Divider, Title3, Caption1Strong, Field, Label, Text, Body1Strong, typographyStyles, Checkbox, RadioGroup, Radio, Switch, Textarea } from '@fluentui/react-components';
|
|
2
2
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
3
|
-
import React2, { useState, useCallback } from 'react';
|
|
3
|
+
import React2, { forwardRef, useState, useCallback, useRef, useEffect } from 'react';
|
|
4
|
+
import { Icon } from '@iconify/react';
|
|
5
|
+
import { Controller } from 'react-hook-form';
|
|
6
|
+
import PhoneInput from 'react-phone-input-2';
|
|
7
|
+
import Select from 'react-select';
|
|
8
|
+
import { Calendar } from '@fluentui/react-calendar-compat';
|
|
4
9
|
|
|
5
|
-
// src/components/ModalIllustration/ModalIllustration.tsx
|
|
6
10
|
var useStyles = makeStyles({
|
|
7
11
|
dialogSurface: {
|
|
8
12
|
maxWidth: "600px",
|
|
@@ -1069,7 +1073,1969 @@ var CardServiceMenu = ({
|
|
|
1069
1073
|
] })
|
|
1070
1074
|
] }, item.id)) }) });
|
|
1071
1075
|
};
|
|
1076
|
+
var fontWeight = {
|
|
1077
|
+
"Medium": 500};
|
|
1078
|
+
var sharedColors = {
|
|
1079
|
+
"Shared_Cranberry_Primary": "#c50f1f"};
|
|
1080
|
+
var lightModeColors = {
|
|
1081
|
+
"Brand_Stroke_1_Rest": "#00B3BD"};
|
|
1082
|
+
var tokensV2_default = {
|
|
1083
|
+
lightModeColors};
|
|
1084
|
+
var DatePickerInput = forwardRef(
|
|
1085
|
+
({
|
|
1086
|
+
field,
|
|
1087
|
+
placeholder,
|
|
1088
|
+
disabled,
|
|
1089
|
+
appearance,
|
|
1090
|
+
size,
|
|
1091
|
+
contentBefore,
|
|
1092
|
+
onClick,
|
|
1093
|
+
style,
|
|
1094
|
+
max,
|
|
1095
|
+
...restProps
|
|
1096
|
+
}, ref) => {
|
|
1097
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
1098
|
+
const dateValue = field.value ? new Date(field.value) : void 0;
|
|
1099
|
+
const onSelectDate = (date) => {
|
|
1100
|
+
if (date) {
|
|
1101
|
+
const offset = date.getTimezoneOffset();
|
|
1102
|
+
const adjustedDate = new Date(date.getTime() - offset * 60 * 1e3);
|
|
1103
|
+
field.onChange(adjustedDate.toISOString().split("T")[0]);
|
|
1104
|
+
setIsOpen(false);
|
|
1105
|
+
}
|
|
1106
|
+
};
|
|
1107
|
+
const formatDate = (dateString) => {
|
|
1108
|
+
if (!dateString) return "";
|
|
1109
|
+
const date = new Date(dateString);
|
|
1110
|
+
return date.toLocaleDateString("id-ID", {
|
|
1111
|
+
day: "numeric",
|
|
1112
|
+
month: "long",
|
|
1113
|
+
year: "numeric"
|
|
1114
|
+
});
|
|
1115
|
+
};
|
|
1116
|
+
const handleInputClick = (e) => {
|
|
1117
|
+
e?.preventDefault();
|
|
1118
|
+
if (!disabled) {
|
|
1119
|
+
setIsOpen(!isOpen);
|
|
1120
|
+
}
|
|
1121
|
+
onClick?.(e);
|
|
1122
|
+
};
|
|
1123
|
+
return /* @__PURE__ */ jsxs(Popover, { open: isOpen, onOpenChange: (_, data) => setIsOpen(data.open), trapFocus: true, children: [
|
|
1124
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { disableButtonEnhancement: true, children: /* @__PURE__ */ jsx(
|
|
1125
|
+
Input,
|
|
1126
|
+
{
|
|
1127
|
+
...restProps,
|
|
1128
|
+
value: formatDate(field.value),
|
|
1129
|
+
readOnly: true,
|
|
1130
|
+
placeholder: placeholder || "Pilih tanggal",
|
|
1131
|
+
disabled,
|
|
1132
|
+
appearance,
|
|
1133
|
+
size,
|
|
1134
|
+
contentBefore,
|
|
1135
|
+
onClick: handleInputClick,
|
|
1136
|
+
style: {
|
|
1137
|
+
cursor: disabled ? "not-allowed" : "pointer",
|
|
1138
|
+
...style
|
|
1139
|
+
},
|
|
1140
|
+
contentAfter: /* @__PURE__ */ jsx(
|
|
1141
|
+
"div",
|
|
1142
|
+
{
|
|
1143
|
+
onClick: (e) => {
|
|
1144
|
+
e.stopPropagation();
|
|
1145
|
+
if (!disabled) {
|
|
1146
|
+
setIsOpen(!isOpen);
|
|
1147
|
+
}
|
|
1148
|
+
},
|
|
1149
|
+
style: {
|
|
1150
|
+
cursor: disabled ? "not-allowed" : "pointer",
|
|
1151
|
+
display: "flex",
|
|
1152
|
+
alignItems: "center"
|
|
1153
|
+
},
|
|
1154
|
+
children: /* @__PURE__ */ jsx(Icon, { icon: "fluent:calendar-24-regular" })
|
|
1155
|
+
}
|
|
1156
|
+
)
|
|
1157
|
+
}
|
|
1158
|
+
) }),
|
|
1159
|
+
/* @__PURE__ */ jsx(PopoverSurface, { tabIndex: -1, style: { maxWidth: "530px" }, children: /* @__PURE__ */ jsx(
|
|
1160
|
+
Calendar,
|
|
1161
|
+
{
|
|
1162
|
+
value: dateValue,
|
|
1163
|
+
onSelectDate,
|
|
1164
|
+
showGoToToday: true,
|
|
1165
|
+
highlightSelectedMonth: true,
|
|
1166
|
+
showMonthPickerAsOverlay: false,
|
|
1167
|
+
maxDate: max ? new Date(max) : void 0
|
|
1168
|
+
}
|
|
1169
|
+
) })
|
|
1170
|
+
] });
|
|
1171
|
+
}
|
|
1172
|
+
);
|
|
1173
|
+
DatePickerInput.displayName = "DatePickerInput";
|
|
1174
|
+
var DatePickerInput_default = DatePickerInput;
|
|
1175
|
+
var useStyles7 = makeStyles({
|
|
1176
|
+
field: {
|
|
1177
|
+
display: "flex",
|
|
1178
|
+
flexDirection: "column",
|
|
1179
|
+
gap: tokens.spacingVerticalXS,
|
|
1180
|
+
marginBottom: tokens.spacingVerticalM
|
|
1181
|
+
},
|
|
1182
|
+
errorText: {
|
|
1183
|
+
color: tokens.colorPaletteRedBackground1,
|
|
1184
|
+
fontSize: tokens.fontSizeBase200
|
|
1185
|
+
},
|
|
1186
|
+
helperText: {
|
|
1187
|
+
color: tokens.colorNeutralForeground2,
|
|
1188
|
+
fontSize: tokens.fontSizeBase200
|
|
1189
|
+
},
|
|
1190
|
+
disabledFilledLighter: {
|
|
1191
|
+
backgroundColor: tokens.colorNeutralBackground4,
|
|
1192
|
+
border: "none",
|
|
1193
|
+
"& input": {
|
|
1194
|
+
backgroundColor: tokens.colorNeutralBackground4,
|
|
1195
|
+
border: "none"
|
|
1196
|
+
}
|
|
1197
|
+
},
|
|
1198
|
+
fileInput: {
|
|
1199
|
+
padding: tokens.spacingVerticalS,
|
|
1200
|
+
border: `1px solid ${tokens.colorNeutralStroke1}`,
|
|
1201
|
+
borderRadius: tokens.borderRadiusMedium,
|
|
1202
|
+
backgroundColor: tokens.colorNeutralBackground1,
|
|
1203
|
+
fontSize: tokens.fontSizeBase300,
|
|
1204
|
+
"&:focus": {
|
|
1205
|
+
outline: `2px solid ${tokens.colorBrandStroke1}`
|
|
1206
|
+
}
|
|
1207
|
+
},
|
|
1208
|
+
reactSelect: {
|
|
1209
|
+
// Custom styles akan dihandle via styles prop react-select
|
|
1210
|
+
},
|
|
1211
|
+
reactSelectError: {
|
|
1212
|
+
// Custom styles akan dihandle via styles prop react-select
|
|
1213
|
+
},
|
|
1214
|
+
phoneContainer: {
|
|
1215
|
+
display: "flex",
|
|
1216
|
+
gap: tokens.spacingHorizontalS,
|
|
1217
|
+
alignItems: "flex-start",
|
|
1218
|
+
width: "100%"
|
|
1219
|
+
},
|
|
1220
|
+
phoneCountrySelect: {
|
|
1221
|
+
minWidth: "120px",
|
|
1222
|
+
maxWidth: "120px",
|
|
1223
|
+
flexShrink: 0
|
|
1224
|
+
},
|
|
1225
|
+
switchWrapper: {
|
|
1226
|
+
"& .fui-Switch": {
|
|
1227
|
+
minHeight: "20px"
|
|
1228
|
+
},
|
|
1229
|
+
"& .fui-Switch__indicator": {
|
|
1230
|
+
height: "20px",
|
|
1231
|
+
width: "40px",
|
|
1232
|
+
borderRadius: "10px"
|
|
1233
|
+
},
|
|
1234
|
+
"& .fui-Switch__thumb": {
|
|
1235
|
+
height: "14px",
|
|
1236
|
+
width: "14px",
|
|
1237
|
+
borderRadius: "50%"
|
|
1238
|
+
}
|
|
1239
|
+
},
|
|
1240
|
+
otpInput: {
|
|
1241
|
+
"& input": {
|
|
1242
|
+
textAlign: "center"
|
|
1243
|
+
}
|
|
1244
|
+
},
|
|
1245
|
+
inputWithAutocomplete: {
|
|
1246
|
+
"& input:-webkit-autofill": {
|
|
1247
|
+
"-webkit-box-shadow": "0 0 0 30px white inset !important",
|
|
1248
|
+
"-webkit-text-fill-color": `${tokens.colorNeutralForeground1} !important`
|
|
1249
|
+
},
|
|
1250
|
+
"& input:-webkit-autofill:hover": {
|
|
1251
|
+
"-webkit-box-shadow": "0 0 0 30px white inset !important"
|
|
1252
|
+
},
|
|
1253
|
+
"& input:-webkit-autofill:focus": {
|
|
1254
|
+
"-webkit-box-shadow": "0 0 0 30px white inset !important"
|
|
1255
|
+
},
|
|
1256
|
+
"& input:-webkit-autofill:active": {
|
|
1257
|
+
"-webkit-box-shadow": "0 0 0 30px white inset !important"
|
|
1258
|
+
}
|
|
1259
|
+
},
|
|
1260
|
+
phoneInputWrapper: {
|
|
1261
|
+
width: "100%",
|
|
1262
|
+
"& .react-tel-input": {
|
|
1263
|
+
width: "100%"
|
|
1264
|
+
},
|
|
1265
|
+
"& .react-tel-input .form-control": {
|
|
1266
|
+
width: "100%",
|
|
1267
|
+
border: `1px solid ${tokens.colorNeutralStroke1}`,
|
|
1268
|
+
borderRadius: tokens.borderRadiusMedium,
|
|
1269
|
+
padding: tokens.spacingVerticalS,
|
|
1270
|
+
paddingLeft: "48px",
|
|
1271
|
+
fontSize: tokens.fontSizeBase300,
|
|
1272
|
+
fontFamily: tokens.fontFamilyBase,
|
|
1273
|
+
backgroundColor: tokens.colorNeutralBackground1,
|
|
1274
|
+
color: tokens.colorNeutralForeground1,
|
|
1275
|
+
outline: "none",
|
|
1276
|
+
height: "auto",
|
|
1277
|
+
minHeight: "40px"
|
|
1278
|
+
},
|
|
1279
|
+
"& .react-tel-input .form-control::placeholder": {
|
|
1280
|
+
fontSize: tokens.fontSizeBase400
|
|
1281
|
+
},
|
|
1282
|
+
"& .react-tel-input .form-control:hover": {
|
|
1283
|
+
border: `1px solid ${tokens.colorNeutralStroke1Hover}`
|
|
1284
|
+
},
|
|
1285
|
+
"& .react-tel-input .form-control:focus": {
|
|
1286
|
+
borderBottom: `2px solid ${tokens.colorBrandStroke1}`
|
|
1287
|
+
// boxShadow: `0 0 0 1px ${tokens.colorBrandStroke1}`,
|
|
1288
|
+
},
|
|
1289
|
+
"& .react-tel-input .form-control:disabled": {
|
|
1290
|
+
backgroundColor: tokens.colorNeutralBackground4,
|
|
1291
|
+
color: tokens.colorNeutralForegroundDisabled,
|
|
1292
|
+
cursor: "not-allowed"
|
|
1293
|
+
},
|
|
1294
|
+
"& .react-tel-input .flag-dropdown": {
|
|
1295
|
+
border: "none",
|
|
1296
|
+
backgroundColor: "transparent",
|
|
1297
|
+
borderRadius: tokens.borderRadiusMedium
|
|
1298
|
+
},
|
|
1299
|
+
"& .react-tel-input .selected-flag": {
|
|
1300
|
+
padding: "0 0 0 8px",
|
|
1301
|
+
width: "40px",
|
|
1302
|
+
backgroundColor: "transparent"
|
|
1303
|
+
},
|
|
1304
|
+
"& .react-tel-input .selected-flag:hover": {
|
|
1305
|
+
backgroundColor: "transparent"
|
|
1306
|
+
},
|
|
1307
|
+
"& .react-tel-input .flag-dropdown.open .selected-flag": {
|
|
1308
|
+
backgroundColor: "transparent"
|
|
1309
|
+
}
|
|
1310
|
+
},
|
|
1311
|
+
phoneInputError: {
|
|
1312
|
+
"& .react-tel-input .form-control": {
|
|
1313
|
+
border: `2px solid ${tokens.colorPaletteRedBorder2}`
|
|
1314
|
+
},
|
|
1315
|
+
"& .react-tel-input .form-control:focus": {
|
|
1316
|
+
border: `2px solid ${tokens.colorPaletteRedBorder2}`,
|
|
1317
|
+
boxShadow: `0 0 0 1px ${tokens.colorPaletteRedBorder2}`
|
|
1318
|
+
}
|
|
1319
|
+
},
|
|
1320
|
+
classRadioGroup: {
|
|
1321
|
+
display: "flex",
|
|
1322
|
+
flexDirection: "row",
|
|
1323
|
+
gap: "12px"
|
|
1324
|
+
},
|
|
1325
|
+
classRadio: {
|
|
1326
|
+
"& .fui-Radio__indicator": {
|
|
1327
|
+
display: "none"
|
|
1328
|
+
},
|
|
1329
|
+
"& .fui-Radio__label": {
|
|
1330
|
+
padding: "10px 24px",
|
|
1331
|
+
border: `1px solid ${tokens.colorNeutralStroke1}`,
|
|
1332
|
+
borderRadius: tokens.borderRadiusCircular,
|
|
1333
|
+
cursor: "pointer",
|
|
1334
|
+
transition: "all 0.2s ease",
|
|
1335
|
+
fontSize: tokens.fontSizeBase300,
|
|
1336
|
+
color: tokens.colorNeutralForeground2
|
|
1337
|
+
},
|
|
1338
|
+
"&:hover .fui-Radio__label": {
|
|
1339
|
+
backgroundColor: tokens.colorNeutralBackground1Hover,
|
|
1340
|
+
border: `1px solid ${tokensV2_default.lightModeColors.Brand_Stroke_1_Rest}`
|
|
1341
|
+
},
|
|
1342
|
+
"& .fui-Radio__input:checked ~ .fui-Radio__label": {
|
|
1343
|
+
borderRadius: tokens.borderRadiusXLarge,
|
|
1344
|
+
border: `1px solid ${tokensV2_default.lightModeColors.Brand_Stroke_1_Rest}`,
|
|
1345
|
+
color: tokensV2_default.lightModeColors.Brand_Stroke_1_Rest,
|
|
1346
|
+
backgroundColor: "transparent"
|
|
1347
|
+
},
|
|
1348
|
+
// Fallback for aria-checked if needed
|
|
1349
|
+
'&[aria-checked="true"] .fui-Radio__label': {
|
|
1350
|
+
borderRadius: tokens.borderRadiusXLarge,
|
|
1351
|
+
border: `1px solid ${tokensV2_default.lightModeColors.Brand_Stroke_1_Rest}`,
|
|
1352
|
+
color: tokensV2_default.lightModeColors.Brand_Stroke_1_Rest,
|
|
1353
|
+
backgroundColor: "transparent"
|
|
1354
|
+
}
|
|
1355
|
+
}
|
|
1356
|
+
});
|
|
1357
|
+
var DEFAULT_COUNTRY_CODES = [
|
|
1358
|
+
{ code: "AF", name: "Afghanistan", dialCode: "+93", passportRegex: "^[A-Z][0-9]{7}$" },
|
|
1359
|
+
{ code: "AL", name: "Albania", dialCode: "+355", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1360
|
+
{ code: "DZ", name: "Algeria", dialCode: "+213", passportRegex: "^[0-9]{9}$" },
|
|
1361
|
+
{ code: "AS", name: "American Samoa", dialCode: "+1", passportRegex: "^[0-9]{9}$" },
|
|
1362
|
+
{ code: "AD", name: "Andorra", dialCode: "+376", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1363
|
+
{ code: "AO", name: "Angola", dialCode: "+244", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1364
|
+
{ code: "AI", name: "Anguilla", dialCode: "+1", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1365
|
+
{ code: "AQ", name: "Antarctica", dialCode: "+672", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1366
|
+
{ code: "AG", name: "Antigua and Barbuda", dialCode: "+1", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1367
|
+
{ code: "AR", name: "Argentina", dialCode: "+54", passportRegex: "^[A-Z]{3}[0-9]{6}$" },
|
|
1368
|
+
{ code: "AM", name: "Armenia", dialCode: "+374", passportRegex: "^[A-Z]{2}[0-9]{6}$" },
|
|
1369
|
+
{ code: "AW", name: "Aruba", dialCode: "+297", passportRegex: "^[A-Z]{2}[0-9]{6}$" },
|
|
1370
|
+
{ code: "AU", name: "Australia", dialCode: "+61", passportRegex: "^[A-Z][0-9]{7}$" },
|
|
1371
|
+
{ code: "AT", name: "Austria", dialCode: "+43", passportRegex: "^[A-Z0-9]{8}$" },
|
|
1372
|
+
{ code: "AZ", name: "Azerbaijan", dialCode: "+994", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1373
|
+
{ code: "BS", name: "Bahamas", dialCode: "+1", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1374
|
+
{ code: "BH", name: "Bahrain", dialCode: "+973", passportRegex: "^[A-Z][0-9]{7}$" },
|
|
1375
|
+
{ code: "BD", name: "Bangladesh", dialCode: "+880", passportRegex: "^[A-Z][0-9]{7}$" },
|
|
1376
|
+
{ code: "BB", name: "Barbados", dialCode: "+1", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1377
|
+
{ code: "BY", name: "Belarus", dialCode: "+375", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1378
|
+
{ code: "BE", name: "Belgium", dialCode: "+32", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1379
|
+
{ code: "BZ", name: "Belize", dialCode: "+501", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1380
|
+
{ code: "BJ", name: "Benin", dialCode: "+229", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1381
|
+
{ code: "BM", name: "Bermuda", dialCode: "+1", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1382
|
+
{ code: "BT", name: "Bhutan", dialCode: "+975", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1383
|
+
{ code: "BO", name: "Bolivia", dialCode: "+591", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1384
|
+
{
|
|
1385
|
+
code: "BA",
|
|
1386
|
+
name: "Bosnia and Herzegovina",
|
|
1387
|
+
dialCode: "+387",
|
|
1388
|
+
passportRegex: "^[A-Z]{2}[0-9]{6}$"
|
|
1389
|
+
},
|
|
1390
|
+
{ code: "BW", name: "Botswana", dialCode: "+267", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1391
|
+
{ code: "BR", name: "Brazil", dialCode: "+55", passportRegex: "^[A-Z]{2}[0-9]{6}$" },
|
|
1392
|
+
{ code: "BN", name: "Brunei", dialCode: "+673", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1393
|
+
{ code: "BG", name: "Bulgaria", dialCode: "+359", passportRegex: "^[0-9]{9}$" },
|
|
1394
|
+
{ code: "BF", name: "Burkina Faso", dialCode: "+226", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1395
|
+
{ code: "BI", name: "Burundi", dialCode: "+257", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1396
|
+
{ code: "KH", name: "Cambodia", dialCode: "+855", passportRegex: "^[A-Z][0-9]{7}$" },
|
|
1397
|
+
{ code: "CM", name: "Cameroon", dialCode: "+237", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1398
|
+
{ code: "CA", name: "Canada", dialCode: "+1", passportRegex: "^[A-Z]{2}[0-9]{6}$" },
|
|
1399
|
+
{ code: "CV", name: "Cape Verde", dialCode: "+238", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1400
|
+
{ code: "KY", name: "Cayman Islands", dialCode: "+1", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1401
|
+
{
|
|
1402
|
+
code: "CF",
|
|
1403
|
+
name: "Central African Republic",
|
|
1404
|
+
dialCode: "+236",
|
|
1405
|
+
passportRegex: "^[A-Z0-9]{6,10}$"
|
|
1406
|
+
},
|
|
1407
|
+
{ code: "TD", name: "Chad", dialCode: "+235", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1408
|
+
{ code: "CL", name: "Chile", dialCode: "+56", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1409
|
+
{ code: "CN", name: "China", dialCode: "+86", passportRegex: "^[0-9]{9}$" },
|
|
1410
|
+
{ code: "CO", name: "Colombia", dialCode: "+57", passportRegex: "^[A-Z]{3}[0-9]{6}$" },
|
|
1411
|
+
{ code: "KM", name: "Comoros", dialCode: "+269", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1412
|
+
{ code: "CG", name: "Congo", dialCode: "+242", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1413
|
+
{ code: "CR", name: "Costa Rica", dialCode: "+506", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1414
|
+
{ code: "HR", name: "Croatia", dialCode: "+385", passportRegex: "^[A-Z]{3}[0-9]{6}$" },
|
|
1415
|
+
{ code: "CU", name: "Cuba", dialCode: "+53", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1416
|
+
{ code: "CY", name: "Cyprus", dialCode: "+357", passportRegex: "^[A-Z]{2}[0-9]{6}$" },
|
|
1417
|
+
{ code: "CZ", name: "Czech Republic", dialCode: "+420", passportRegex: "^[0-9]{8}$" },
|
|
1418
|
+
{ code: "DK", name: "Denmark", dialCode: "+45", passportRegex: "^[A-Z0-9]{9}$" },
|
|
1419
|
+
{ code: "DJ", name: "Djibouti", dialCode: "+253", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1420
|
+
{ code: "DM", name: "Dominica", dialCode: "+1", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1421
|
+
{ code: "DO", name: "Dominican Republic", dialCode: "+1", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1422
|
+
{ code: "EC", name: "Ecuador", dialCode: "+593", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1423
|
+
{ code: "EG", name: "Egypt", dialCode: "+20", passportRegex: "^[A-Z][0-9]{7}$" },
|
|
1424
|
+
{ code: "SV", name: "El Salvador", dialCode: "+503", passportRegex: "^[A-Z]{1}[0-9]{7}$" },
|
|
1425
|
+
{ code: "GQ", name: "Equatorial Guinea", dialCode: "+240", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1426
|
+
{ code: "ER", name: "Eritrea", dialCode: "+291", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1427
|
+
{ code: "EE", name: "Estonia", dialCode: "+372", passportRegex: "^[A-Z0-9]{8}$" },
|
|
1428
|
+
{ code: "SZ", name: "Eswatini", dialCode: "+268", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1429
|
+
{ code: "ET", name: "Ethiopia", dialCode: "+251", passportRegex: "^[A-Z]{2}[0-9]{6}$" },
|
|
1430
|
+
{ code: "FJ", name: "Fiji", dialCode: "+679", passportRegex: "^[A-Z]{2}[0-9]{6}$" },
|
|
1431
|
+
{ code: "FI", name: "Finland", dialCode: "+358", passportRegex: "^[A-Z0-9]{9}$" },
|
|
1432
|
+
{ code: "FR", name: "France", dialCode: "+33", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1433
|
+
{ code: "GA", name: "Gabon", dialCode: "+241", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1434
|
+
{ code: "GM", name: "Gambia", dialCode: "+220", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1435
|
+
{ code: "GE", name: "Georgia", dialCode: "+995", passportRegex: "^[A-Z0-9]{8}$" },
|
|
1436
|
+
{ code: "DE", name: "Germany", dialCode: "+49", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1437
|
+
{ code: "GH", name: "Ghana", dialCode: "+233", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1438
|
+
{ code: "GR", name: "Greece", dialCode: "+30", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1439
|
+
{ code: "GD", name: "Grenada", dialCode: "+1", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1440
|
+
{ code: "GT", name: "Guatemala", dialCode: "+502", passportRegex: "^[A-Z]{3}[0-9]{6}$" },
|
|
1441
|
+
{ code: "GN", name: "Guinea", dialCode: "+224", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1442
|
+
{ code: "GW", name: "Guinea-Bissau", dialCode: "+245", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1443
|
+
{ code: "GY", name: "Guyana", dialCode: "+592", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1444
|
+
{ code: "HT", name: "Haiti", dialCode: "+509", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1445
|
+
{ code: "HN", name: "Honduras", dialCode: "+504", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1446
|
+
{ code: "HK", name: "Hong Kong", dialCode: "+852", passportRegex: "^[A-Z]{1}[0-9]{7}$" },
|
|
1447
|
+
{ code: "HU", name: "Hungary", dialCode: "+36", passportRegex: "^[A-Z]{2}[0-9]{6}$" },
|
|
1448
|
+
{ code: "IS", name: "Iceland", dialCode: "+354", passportRegex: "^[A-Z]{2}[0-9]{6}$" },
|
|
1449
|
+
{ code: "IN", name: "India", dialCode: "+91", passportRegex: "^[A-Z][0-9]{7}$" },
|
|
1450
|
+
{ code: "ID", name: "Indonesia", dialCode: "+62", passportRegex: "^[A-Z]{1}[0-9]{7}$" },
|
|
1451
|
+
{ code: "IR", name: "Iran", dialCode: "+98", passportRegex: "^[A-Z]{1}[0-9]{7}$" },
|
|
1452
|
+
{ code: "IQ", name: "Iraq", dialCode: "+964", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1453
|
+
{ code: "IE", name: "Ireland", dialCode: "+353", passportRegex: "^[A-Z0-9]{2}[0-9]{7}$" },
|
|
1454
|
+
{ code: "IL", name: "Israel", dialCode: "+972", passportRegex: "^[0-9]{8,9}$" },
|
|
1455
|
+
{ code: "IT", name: "Italy", dialCode: "+39", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1456
|
+
{ code: "JM", name: "Jamaica", dialCode: "+1", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1457
|
+
{ code: "JP", name: "Japan", dialCode: "+81", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1458
|
+
{ code: "JO", name: "Jordan", dialCode: "+962", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1459
|
+
{ code: "KZ", name: "Kazakhstan", dialCode: "+7", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1460
|
+
{ code: "KE", name: "Kenya", dialCode: "+254", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1461
|
+
{ code: "KI", name: "Kiribati", dialCode: "+686", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1462
|
+
{ code: "KP", name: "North Korea", dialCode: "+850", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1463
|
+
{ code: "KR", name: "South Korea", dialCode: "+82", passportRegex: "^[A-Z]{1}[0-9]{8}$" },
|
|
1464
|
+
{ code: "KW", name: "Kuwait", dialCode: "+965", passportRegex: "^[A-Z]{1}[0-9]{7}$" },
|
|
1465
|
+
{ code: "KG", name: "Kyrgyzstan", dialCode: "+996", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1466
|
+
{ code: "LA", name: "Laos", dialCode: "+856", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1467
|
+
{ code: "LV", name: "Latvia", dialCode: "+371", passportRegex: "^[A-Z0-9]{8}$" },
|
|
1468
|
+
{ code: "LB", name: "Lebanon", dialCode: "+961", passportRegex: "^[A-Z]{1}[0-9]{7}$" },
|
|
1469
|
+
{ code: "LS", name: "Lesotho", dialCode: "+266", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1470
|
+
{ code: "LR", name: "Liberia", dialCode: "+231", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1471
|
+
{ code: "LY", name: "Libya", dialCode: "+218", passportRegex: "^[A-Z]{1}[0-9]{7}$" },
|
|
1472
|
+
{ code: "LI", name: "Liechtenstein", dialCode: "+423", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1473
|
+
{ code: "LT", name: "Lithuania", dialCode: "+370", passportRegex: "^[A-Z0-9]{8}$" },
|
|
1474
|
+
{ code: "LU", name: "Luxembourg", dialCode: "+352", passportRegex: "^[A-Z0-9]{8}$" },
|
|
1475
|
+
{ code: "MO", name: "Macau", dialCode: "+853", passportRegex: "^[A-Z]{1}[0-9]{7}$" },
|
|
1476
|
+
{ code: "MG", name: "Madagascar", dialCode: "+261", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1477
|
+
{ code: "MW", name: "Malawi", dialCode: "+265", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1478
|
+
{ code: "MY", name: "Malaysia", dialCode: "+60", passportRegex: "^[A-Z]{1}[0-9]{8}$" },
|
|
1479
|
+
{ code: "MV", name: "Maldives", dialCode: "+960", passportRegex: "^[A-Z]{1}[0-9]{7}$" },
|
|
1480
|
+
{ code: "ML", name: "Mali", dialCode: "+223", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1481
|
+
{ code: "MT", name: "Malta", dialCode: "+356", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1482
|
+
{ code: "MH", name: "Marshall Islands", dialCode: "+692", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1483
|
+
{ code: "MQ", name: "Martinique", dialCode: "+596", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1484
|
+
{ code: "MR", name: "Mauritania", dialCode: "+222", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1485
|
+
{ code: "MU", name: "Mauritius", dialCode: "+230", passportRegex: "^[A-Z]{2}[0-9]{6}$" },
|
|
1486
|
+
{ code: "MX", name: "Mexico", dialCode: "+52", passportRegex: "^[A-Z]{1}[0-9]{8}$" },
|
|
1487
|
+
{ code: "FM", name: "Micronesia", dialCode: "+691", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1488
|
+
{ code: "MD", name: "Moldova", dialCode: "+373", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1489
|
+
{ code: "MC", name: "Monaco", dialCode: "+377", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1490
|
+
{ code: "MN", name: "Mongolia", dialCode: "+976", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1491
|
+
{ code: "ME", name: "Montenegro", dialCode: "+382", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1492
|
+
{ code: "MS", name: "Montserrat", dialCode: "+1", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1493
|
+
{ code: "MA", name: "Morocco", dialCode: "+212", passportRegex: "^[A-Z]{2}[0-9]{6}$" },
|
|
1494
|
+
{ code: "MZ", name: "Mozambique", dialCode: "+258", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1495
|
+
{ code: "MM", name: "Myanmar", dialCode: "+95", passportRegex: "^[A-Z]{1}[0-9]{6,7}$" },
|
|
1496
|
+
{ code: "NA", name: "Namibia", dialCode: "+264", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1497
|
+
{ code: "NR", name: "Nauru", dialCode: "+674", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1498
|
+
{ code: "NP", name: "Nepal", dialCode: "+977", passportRegex: "^[A-Z]{1}[0-9]{7}$" },
|
|
1499
|
+
{ code: "NL", name: "Netherlands", dialCode: "+31", passportRegex: "^[A-Z]{2}[0-9]{6}$" },
|
|
1500
|
+
{ code: "NC", name: "New Caledonia", dialCode: "+687", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1501
|
+
{ code: "NZ", name: "New Zealand", dialCode: "+64", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1502
|
+
{ code: "NI", name: "Nicaragua", dialCode: "+505", passportRegex: "^[A-Z]{3}[0-9]{6}$" },
|
|
1503
|
+
{ code: "NE", name: "Niger", dialCode: "+227", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1504
|
+
{ code: "NG", name: "Nigeria", dialCode: "+234", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1505
|
+
{ code: "NO", name: "Norway", dialCode: "+47", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1506
|
+
{ code: "OM", name: "Oman", dialCode: "+968", passportRegex: "^[A-Z]{1}[0-9]{7}$" },
|
|
1507
|
+
{ code: "PK", name: "Pakistan", dialCode: "+92", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1508
|
+
{ code: "PW", name: "Palau", dialCode: "+680", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1509
|
+
{ code: "PS", name: "Palestine", dialCode: "+970", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1510
|
+
{ code: "PA", name: "Panama", dialCode: "+507", passportRegex: "^[A-Z]{1}[0-9]{7}$" },
|
|
1511
|
+
{ code: "PG", name: "Papua New Guinea", dialCode: "+675", passportRegex: "^[A-Z]{2}[0-9]{6}$" },
|
|
1512
|
+
{ code: "PY", name: "Paraguay", dialCode: "+595", passportRegex: "^[A-Z]{2}[0-9]{6}$" },
|
|
1513
|
+
{ code: "PE", name: "Peru", dialCode: "+51", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1514
|
+
{ code: "PH", name: "Philippines", dialCode: "+63", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1515
|
+
{ code: "PL", name: "Poland", dialCode: "+48", passportRegex: "^[A-Z0-9]{2}[0-9]{7}$" },
|
|
1516
|
+
{ code: "PT", name: "Portugal", dialCode: "+351", passportRegex: "^[A-Z]{2}[0-9]{6}$" },
|
|
1517
|
+
{ code: "RO", name: "Romania", dialCode: "+40", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1518
|
+
{ code: "RU", name: "Russia", dialCode: "+7", passportRegex: "^[0-9]{9}$" },
|
|
1519
|
+
{ code: "RW", name: "Rwanda", dialCode: "+250", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1520
|
+
{
|
|
1521
|
+
code: "KN",
|
|
1522
|
+
name: "Saint Kitts and Nevis",
|
|
1523
|
+
dialCode: "+1",
|
|
1524
|
+
passportRegex: "^[A-Z]{2}[0-9]{7}$"
|
|
1525
|
+
},
|
|
1526
|
+
{ code: "LC", name: "Saint Lucia", dialCode: "+1", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1527
|
+
{
|
|
1528
|
+
code: "VC",
|
|
1529
|
+
name: "Saint Vincent and the Grenadines",
|
|
1530
|
+
dialCode: "+1",
|
|
1531
|
+
passportRegex: "^[A-Z]{2}[0-9]{7}$"
|
|
1532
|
+
},
|
|
1533
|
+
{ code: "WS", name: "Samoa", dialCode: "+685", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1534
|
+
{ code: "SM", name: "San Marino", dialCode: "+378", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1535
|
+
{
|
|
1536
|
+
code: "ST",
|
|
1537
|
+
name: "Sao Tome and Principe",
|
|
1538
|
+
dialCode: "+239",
|
|
1539
|
+
passportRegex: "^[A-Z0-9]{6,10}$"
|
|
1540
|
+
},
|
|
1541
|
+
{ code: "SA", name: "Saudi Arabia", dialCode: "+966", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1542
|
+
{ code: "SN", name: "Senegal", dialCode: "+221", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1543
|
+
{ code: "RS", name: "Serbia", dialCode: "+381", passportRegex: "^[A-Z0-9]{9}$" },
|
|
1544
|
+
{ code: "SC", name: "Seychelles", dialCode: "+248", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1545
|
+
{ code: "SL", name: "Sierra Leone", dialCode: "+232", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1546
|
+
{ code: "SG", name: "Singapore", dialCode: "+65", passportRegex: "^[A-Z]{1}[0-9]{7}$" },
|
|
1547
|
+
{ code: "SK", name: "Slovakia", dialCode: "+421", passportRegex: "^[0-9]{9}$" },
|
|
1548
|
+
{ code: "SI", name: "Slovenia", dialCode: "+386", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1549
|
+
{ code: "SB", name: "Solomon Islands", dialCode: "+677", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1550
|
+
{ code: "SO", name: "Somalia", dialCode: "+252", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1551
|
+
{ code: "ZA", name: "South Africa", dialCode: "+27", passportRegex: "^[A-Z]{2}[0-9]{6}$" },
|
|
1552
|
+
{ code: "ES", name: "Spain", dialCode: "+34", passportRegex: "^[A-Z]{3}[0-9]{6}$" },
|
|
1553
|
+
{ code: "LK", name: "Sri Lanka", dialCode: "+94", passportRegex: "^[A-Z]{1}[0-9]{7}$" },
|
|
1554
|
+
{ code: "SD", name: "Sudan", dialCode: "+249", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1555
|
+
{ code: "SR", name: "Suriname", dialCode: "+597", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1556
|
+
{ code: "SE", name: "Sweden", dialCode: "+46", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1557
|
+
{ code: "CH", name: "Switzerland", dialCode: "+41", passportRegex: "^[A-Z]{1}[0-9]{7}$" },
|
|
1558
|
+
{ code: "SY", name: "Syria", dialCode: "+963", passportRegex: "^[A-Z]{1}[0-9]{7}$" },
|
|
1559
|
+
{ code: "TW", name: "Taiwan", dialCode: "+886", passportRegex: "^[A-Z]{1}[0-9]{8}$" },
|
|
1560
|
+
{ code: "TJ", name: "Tajikistan", dialCode: "+992", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1561
|
+
{ code: "TZ", name: "Tanzania", dialCode: "+255", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1562
|
+
{ code: "TH", name: "Thailand", dialCode: "+66", passportRegex: "^[A-Z]{1}[0-9]{7}$" },
|
|
1563
|
+
{ code: "TL", name: "Timor-Leste", dialCode: "+670", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1564
|
+
{ code: "TG", name: "Togo", dialCode: "+228", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1565
|
+
{ code: "TO", name: "Tonga", dialCode: "+676", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1566
|
+
{ code: "TT", name: "Trinidad and Tobago", dialCode: "+1", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1567
|
+
{ code: "TN", name: "Tunisia", dialCode: "+216", passportRegex: "^[A-Z]{1}[0-9]{7}$" },
|
|
1568
|
+
{ code: "TR", name: "Turkey", dialCode: "+90", passportRegex: "^[A-Z]{1}[0-9]{7}$" },
|
|
1569
|
+
{ code: "TM", name: "Turkmenistan", dialCode: "+993", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1570
|
+
{
|
|
1571
|
+
code: "TC",
|
|
1572
|
+
name: "Turks and Caicos Islands",
|
|
1573
|
+
dialCode: "+1",
|
|
1574
|
+
passportRegex: "^[A-Z0-9]{6,10}$"
|
|
1575
|
+
},
|
|
1576
|
+
{ code: "TV", name: "Tuvalu", dialCode: "+688", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1577
|
+
{ code: "UG", name: "Uganda", dialCode: "+256", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1578
|
+
{ code: "UA", name: "Ukraine", dialCode: "+380", passportRegex: "^[A-Z]{2}[0-9]{6}$" },
|
|
1579
|
+
{
|
|
1580
|
+
code: "AE",
|
|
1581
|
+
name: "United Arab Emirates",
|
|
1582
|
+
dialCode: "+971",
|
|
1583
|
+
passportRegex: "^[A-Z]{1}[0-9]{7}$"
|
|
1584
|
+
},
|
|
1585
|
+
{ code: "GB", name: "United Kingdom", dialCode: "+44", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1586
|
+
{ code: "US", name: "United States", dialCode: "+1", passportRegex: "^[0-9]{9}$" },
|
|
1587
|
+
{ code: "UY", name: "Uruguay", dialCode: "+598", passportRegex: "^[A-Z]{3}[0-9]{6}$" },
|
|
1588
|
+
{ code: "UZ", name: "Uzbekistan", dialCode: "+998", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1589
|
+
{ code: "VU", name: "Vanuatu", dialCode: "+678", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1590
|
+
{ code: "VA", name: "Vatican City", dialCode: "+379", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1591
|
+
{ code: "VE", name: "Venezuela", dialCode: "+58", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
1592
|
+
{ code: "VN", name: "Vietnam", dialCode: "+84", passportRegex: "^[A-Z]{1}[0-9]{7}$" },
|
|
1593
|
+
{ code: "YE", name: "Yemen", dialCode: "+967", passportRegex: "^[A-Z]{1}[0-9]{7}$" },
|
|
1594
|
+
{ code: "ZM", name: "Zambia", dialCode: "+260", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
1595
|
+
{ code: "ZW", name: "Zimbabwe", dialCode: "+263", passportRegex: "^[A-Z0-9]{6,10}$" }
|
|
1596
|
+
];
|
|
1597
|
+
var detectIdentityType = (value) => {
|
|
1598
|
+
if (!value) return "id";
|
|
1599
|
+
const stringValue = String(value);
|
|
1600
|
+
if (stringValue.includes("@")) return "email";
|
|
1601
|
+
if (stringValue.startsWith("+")) return "phone";
|
|
1602
|
+
return "id";
|
|
1603
|
+
};
|
|
1604
|
+
var detectEmailOrPhoneStrict = (value) => {
|
|
1605
|
+
if (!value) return "none";
|
|
1606
|
+
if (value.includes("@")) return "email";
|
|
1607
|
+
if (value.startsWith("+")) return "phone";
|
|
1608
|
+
if (/^0\d/.test(value)) return "phone";
|
|
1609
|
+
if (/^62\d/.test(value)) return "phone";
|
|
1610
|
+
return "none";
|
|
1611
|
+
};
|
|
1612
|
+
function InputDynamic({
|
|
1613
|
+
name,
|
|
1614
|
+
control,
|
|
1615
|
+
label,
|
|
1616
|
+
type,
|
|
1617
|
+
placeholder,
|
|
1618
|
+
required = false,
|
|
1619
|
+
disabled = false,
|
|
1620
|
+
options = [],
|
|
1621
|
+
multiple = false,
|
|
1622
|
+
accept,
|
|
1623
|
+
rows = 3,
|
|
1624
|
+
min,
|
|
1625
|
+
max,
|
|
1626
|
+
step,
|
|
1627
|
+
isMultiSelect = false,
|
|
1628
|
+
selectScrollbarColor,
|
|
1629
|
+
contentBefore,
|
|
1630
|
+
appearance = "outline",
|
|
1631
|
+
validationRules,
|
|
1632
|
+
helperText,
|
|
1633
|
+
className,
|
|
1634
|
+
layout,
|
|
1635
|
+
size,
|
|
1636
|
+
onClick,
|
|
1637
|
+
style,
|
|
1638
|
+
countryCodes = DEFAULT_COUNTRY_CODES,
|
|
1639
|
+
defaultCountry = "ID",
|
|
1640
|
+
maxLength,
|
|
1641
|
+
autoAdvance = false,
|
|
1642
|
+
otpIndex,
|
|
1643
|
+
hasError = false,
|
|
1644
|
+
autoComplete,
|
|
1645
|
+
onInput,
|
|
1646
|
+
contentAfter,
|
|
1647
|
+
onChange
|
|
1648
|
+
}) {
|
|
1649
|
+
const styles = useStyles7();
|
|
1650
|
+
const [showPassword, setShowPassword] = useState(false);
|
|
1651
|
+
const [isPhoneMode, setIsPhoneMode] = useState(false);
|
|
1652
|
+
const [emailOrPhoneType, setEmailOrPhoneType] = useState("none");
|
|
1653
|
+
const [identityType, setIdentityType] = useState("id");
|
|
1654
|
+
const [lastPhoneValue, setLastPhoneValue] = useState("");
|
|
1655
|
+
const [lastEmailOrPhoneValue, setLastEmailOrPhoneValue] = useState("");
|
|
1656
|
+
const inputRef = useRef(null);
|
|
1657
|
+
const phoneInputRef = useRef(null);
|
|
1658
|
+
const emailOrPhoneInputRef = useRef(null);
|
|
1659
|
+
const shouldFocusRef = useRef(false);
|
|
1660
|
+
const isBackspaceNavigationRef = useRef(false);
|
|
1661
|
+
const getSelectStyles = (hasError2) => ({
|
|
1662
|
+
menuPortal: (base) => ({
|
|
1663
|
+
...base,
|
|
1664
|
+
zIndex: 9999999,
|
|
1665
|
+
borderRadius: tokens.borderRadiusMedium
|
|
1666
|
+
}),
|
|
1667
|
+
control: (provided, state) => ({
|
|
1668
|
+
...provided,
|
|
1669
|
+
borderColor: hasError2 ? tokens.colorPaletteRedBorder2 : state.isFocused ? tokens.colorBrandStroke1 : tokens.colorNeutralStroke1,
|
|
1670
|
+
borderRadius: tokens.borderRadiusMedium,
|
|
1671
|
+
minHeight: "40px",
|
|
1672
|
+
fontSize: tokens.fontSizeBase400,
|
|
1673
|
+
backgroundColor: tokens.colorNeutralBackground1,
|
|
1674
|
+
boxShadow: state.isFocused ? `0 0 0 2px ${hasError2 ? tokens.colorPaletteRedBorder2 : tokens.colorBrandStroke1}` : "none",
|
|
1675
|
+
"&:hover": {
|
|
1676
|
+
borderColor: hasError2 ? tokens.colorPaletteRedBorder2 : tokens.colorNeutralStroke1Hover
|
|
1677
|
+
}
|
|
1678
|
+
}),
|
|
1679
|
+
menu: (provided) => ({
|
|
1680
|
+
...provided,
|
|
1681
|
+
border: `1px solid ${tokens.colorNeutralStroke1}`,
|
|
1682
|
+
borderRadius: tokens.borderRadiusMedium,
|
|
1683
|
+
zIndex: 9999
|
|
1684
|
+
}),
|
|
1685
|
+
menuList: (provided) => ({
|
|
1686
|
+
...provided,
|
|
1687
|
+
padding: 0,
|
|
1688
|
+
// Opsional: bersihkan padding agar scrollbar mepet ke pinggir
|
|
1689
|
+
maxHeight: "300px",
|
|
1690
|
+
// Pastikan ada limit height agar scrollbar muncul
|
|
1691
|
+
/* Targetkan Webkit Scrollbar di menuList */
|
|
1692
|
+
"&::-webkit-scrollbar": {
|
|
1693
|
+
width: "8px",
|
|
1694
|
+
display: "block"
|
|
1695
|
+
// Pastikan tampil
|
|
1696
|
+
},
|
|
1697
|
+
"&::-webkit-scrollbar-track": {
|
|
1698
|
+
backgroundColor: tokens.colorNeutralBackground2,
|
|
1699
|
+
borderRadius: "4px"
|
|
1700
|
+
},
|
|
1701
|
+
"&::-webkit-scrollbar-thumb": {
|
|
1702
|
+
backgroundColor: selectScrollbarColor || tokens.colorNeutralStroke2,
|
|
1703
|
+
borderRadius: "4px"
|
|
1704
|
+
},
|
|
1705
|
+
"&::-webkit-scrollbar-thumb:hover": {
|
|
1706
|
+
backgroundColor: selectScrollbarColor || tokens.colorBrandBackground
|
|
1707
|
+
},
|
|
1708
|
+
"&::-webkit-scrollbar-thumb:active": {
|
|
1709
|
+
backgroundColor: selectScrollbarColor || tokens.colorBrandBackgroundPressed
|
|
1710
|
+
}
|
|
1711
|
+
}),
|
|
1712
|
+
option: (provided, state) => ({
|
|
1713
|
+
...provided,
|
|
1714
|
+
fontSize: tokens.fontSizeBase300,
|
|
1715
|
+
color: state.isSelected ? tokens.colorNeutralForegroundOnBrand : tokens.colorNeutralForeground1,
|
|
1716
|
+
backgroundColor: state.isSelected ? tokens.colorBrandBackground : state.isFocused ? tokens.colorNeutralBackground1Hover : "transparent"
|
|
1717
|
+
}),
|
|
1718
|
+
placeholder: (provided) => ({
|
|
1719
|
+
...provided,
|
|
1720
|
+
color: tokens.colorNeutralForeground3,
|
|
1721
|
+
fontSize: tokens.fontSizeBase400
|
|
1722
|
+
}),
|
|
1723
|
+
singleValue: (provided) => ({
|
|
1724
|
+
...provided,
|
|
1725
|
+
color: tokens.colorNeutralForeground1,
|
|
1726
|
+
fontSize: tokens.fontSizeBase400
|
|
1727
|
+
})
|
|
1728
|
+
});
|
|
1729
|
+
useEffect(() => {
|
|
1730
|
+
if (shouldFocusRef.current) {
|
|
1731
|
+
setTimeout(() => {
|
|
1732
|
+
if (identityType === "phone" && phoneInputRef.current) {
|
|
1733
|
+
const phoneInput = phoneInputRef.current.querySelector("input.form-control");
|
|
1734
|
+
if (phoneInput) {
|
|
1735
|
+
phoneInput.focus();
|
|
1736
|
+
const len = phoneInput.value.length;
|
|
1737
|
+
phoneInput.setSelectionRange(len, len);
|
|
1738
|
+
}
|
|
1739
|
+
} else if (inputRef.current) {
|
|
1740
|
+
inputRef.current.focus();
|
|
1741
|
+
const inputType = inputRef.current.type;
|
|
1742
|
+
if (inputType === "text" || inputType === "tel" || inputType === "url" || inputType === "search") {
|
|
1743
|
+
const len = inputRef.current.value.length;
|
|
1744
|
+
inputRef.current.setSelectionRange(len, len);
|
|
1745
|
+
}
|
|
1746
|
+
}
|
|
1747
|
+
shouldFocusRef.current = false;
|
|
1748
|
+
}, 50);
|
|
1749
|
+
}
|
|
1750
|
+
}, [identityType]);
|
|
1751
|
+
useEffect(() => {
|
|
1752
|
+
if (shouldFocusRef.current && type === "emailOrPhone") {
|
|
1753
|
+
setTimeout(() => {
|
|
1754
|
+
if (emailOrPhoneType === "phone" && emailOrPhoneInputRef.current) {
|
|
1755
|
+
const phoneInput = emailOrPhoneInputRef.current.querySelector("input.form-control");
|
|
1756
|
+
if (phoneInput) {
|
|
1757
|
+
phoneInput.focus();
|
|
1758
|
+
const len = phoneInput.value.length;
|
|
1759
|
+
phoneInput.setSelectionRange(len, len);
|
|
1760
|
+
}
|
|
1761
|
+
} else if (inputRef.current) {
|
|
1762
|
+
inputRef.current.focus();
|
|
1763
|
+
const inputType = inputRef.current.type;
|
|
1764
|
+
if (inputType === "text" || inputType === "tel" || inputType === "url" || inputType === "search") {
|
|
1765
|
+
const len = inputRef.current.value.length;
|
|
1766
|
+
inputRef.current.setSelectionRange(len, len);
|
|
1767
|
+
}
|
|
1768
|
+
}
|
|
1769
|
+
shouldFocusRef.current = false;
|
|
1770
|
+
}, 50);
|
|
1771
|
+
}
|
|
1772
|
+
}, [emailOrPhoneType, type]);
|
|
1773
|
+
const updateIdentityType = (value) => {
|
|
1774
|
+
const stringValue = typeof value === "string" ? value : value?.phoneNumber || "";
|
|
1775
|
+
const detectedType = detectIdentityType(stringValue);
|
|
1776
|
+
if (detectedType !== identityType) {
|
|
1777
|
+
setIdentityType(detectedType);
|
|
1778
|
+
}
|
|
1779
|
+
};
|
|
1780
|
+
const updateEmailOrPhoneType = (value) => {
|
|
1781
|
+
const stringValue = typeof value === "string" ? value : "";
|
|
1782
|
+
const detectedType = detectEmailOrPhoneStrict(stringValue);
|
|
1783
|
+
if (detectedType !== emailOrPhoneType) {
|
|
1784
|
+
setEmailOrPhoneType(detectedType);
|
|
1785
|
+
}
|
|
1786
|
+
};
|
|
1787
|
+
const renderInput = (field, error) => {
|
|
1788
|
+
const shouldTransparentBorder = disabled && appearance !== "outline" && appearance !== "underline";
|
|
1789
|
+
const inputStyle = shouldTransparentBorder ? { ...style, border: "transparent" } : style;
|
|
1790
|
+
const handleInputChange = (e) => {
|
|
1791
|
+
field.onChange(e);
|
|
1792
|
+
if (onChange) {
|
|
1793
|
+
onChange(e.target?.value ?? e);
|
|
1794
|
+
}
|
|
1795
|
+
};
|
|
1796
|
+
const commonProps = {
|
|
1797
|
+
...field,
|
|
1798
|
+
onChange: handleInputChange,
|
|
1799
|
+
value: field.value ?? "",
|
|
1800
|
+
placeholder,
|
|
1801
|
+
disabled,
|
|
1802
|
+
appearance: error ? "invalid" : appearance,
|
|
1803
|
+
size,
|
|
1804
|
+
contentBefore,
|
|
1805
|
+
onClick,
|
|
1806
|
+
style: inputStyle,
|
|
1807
|
+
maxLength,
|
|
1808
|
+
autoComplete: autoComplete || "off",
|
|
1809
|
+
contentAfter,
|
|
1810
|
+
max
|
|
1811
|
+
};
|
|
1812
|
+
const otpMatch = /^otp(\d+)$/.exec(String(name));
|
|
1813
|
+
const otpIndex2 = otpMatch ? parseInt(otpMatch[1], 10) : null;
|
|
1814
|
+
if (type === "emailOrPhone") {
|
|
1815
|
+
updateEmailOrPhoneType(field.value);
|
|
1816
|
+
const stringValue = typeof field.value === "string" ? field.value : "";
|
|
1817
|
+
let inputType = "text";
|
|
1818
|
+
let inputPlaceholder = placeholder || "Email atau Nomor HP";
|
|
1819
|
+
if (emailOrPhoneType === "email") {
|
|
1820
|
+
inputType = "email";
|
|
1821
|
+
inputPlaceholder = placeholder || "Email";
|
|
1822
|
+
} else if (emailOrPhoneType === "phone") {
|
|
1823
|
+
inputType = "tel";
|
|
1824
|
+
inputPlaceholder = placeholder || "Nomor HP";
|
|
1825
|
+
}
|
|
1826
|
+
const normalizePhoneNumber = (val) => {
|
|
1827
|
+
if (!val) return val;
|
|
1828
|
+
if (val.startsWith("08")) {
|
|
1829
|
+
return "+62" + val.substring(1);
|
|
1830
|
+
}
|
|
1831
|
+
if (val.startsWith("62") && !val.startsWith("+")) {
|
|
1832
|
+
return "+" + val;
|
|
1833
|
+
}
|
|
1834
|
+
return val;
|
|
1835
|
+
};
|
|
1836
|
+
const cleanPhoneValue = (val) => {
|
|
1837
|
+
if (!val) return val;
|
|
1838
|
+
const match = val.match(/^(\d{1,4})(0\d+)$/);
|
|
1839
|
+
if (match) {
|
|
1840
|
+
return match[1] + match[2].substring(1);
|
|
1841
|
+
}
|
|
1842
|
+
return val;
|
|
1843
|
+
};
|
|
1844
|
+
emailOrPhoneType === "phone" ? cleanPhoneValue(stringValue) : stringValue;
|
|
1845
|
+
return /* @__PURE__ */ jsx("div", { className: styles.phoneContainer, children: emailOrPhoneType === "phone" ? /* @__PURE__ */ jsx(
|
|
1846
|
+
"div",
|
|
1847
|
+
{
|
|
1848
|
+
ref: emailOrPhoneInputRef,
|
|
1849
|
+
className: `${styles.phoneInputWrapper} ${error ? styles.phoneInputError : ""}`,
|
|
1850
|
+
children: /* @__PURE__ */ jsx(
|
|
1851
|
+
PhoneInput,
|
|
1852
|
+
{
|
|
1853
|
+
country: defaultCountry.toLowerCase(),
|
|
1854
|
+
value: stringValue.startsWith("+") ? stringValue.substring(1) : stringValue,
|
|
1855
|
+
onChange: (value, data) => {
|
|
1856
|
+
if (!value) {
|
|
1857
|
+
shouldFocusRef.current = true;
|
|
1858
|
+
field.onChange("");
|
|
1859
|
+
updateEmailOrPhoneType("");
|
|
1860
|
+
setLastEmailOrPhoneValue("");
|
|
1861
|
+
return;
|
|
1862
|
+
}
|
|
1863
|
+
const countryDialCode = data?.dialCode || "";
|
|
1864
|
+
if (value === countryDialCode) {
|
|
1865
|
+
const dialCodeChanged = lastEmailOrPhoneValue && lastEmailOrPhoneValue !== countryDialCode && !lastEmailOrPhoneValue.startsWith(countryDialCode);
|
|
1866
|
+
const isInitial = !lastEmailOrPhoneValue;
|
|
1867
|
+
const wasFullNumber = lastEmailOrPhoneValue && lastEmailOrPhoneValue.length > 3;
|
|
1868
|
+
if (isInitial || dialCodeChanged || wasFullNumber) {
|
|
1869
|
+
const phoneValue2 = "+" + value;
|
|
1870
|
+
field.onChange(phoneValue2);
|
|
1871
|
+
updateEmailOrPhoneType(phoneValue2);
|
|
1872
|
+
setLastEmailOrPhoneValue(value);
|
|
1873
|
+
return;
|
|
1874
|
+
} else {
|
|
1875
|
+
shouldFocusRef.current = true;
|
|
1876
|
+
field.onChange("");
|
|
1877
|
+
updateEmailOrPhoneType("");
|
|
1878
|
+
setLastEmailOrPhoneValue("");
|
|
1879
|
+
return;
|
|
1880
|
+
}
|
|
1881
|
+
}
|
|
1882
|
+
const phoneValue = "+" + value;
|
|
1883
|
+
field.onChange(phoneValue);
|
|
1884
|
+
updateEmailOrPhoneType(phoneValue);
|
|
1885
|
+
setLastEmailOrPhoneValue(value);
|
|
1886
|
+
},
|
|
1887
|
+
placeholder: inputPlaceholder,
|
|
1888
|
+
disabled,
|
|
1889
|
+
enableSearch: true
|
|
1890
|
+
}
|
|
1891
|
+
)
|
|
1892
|
+
}
|
|
1893
|
+
) : /* @__PURE__ */ jsx(
|
|
1894
|
+
Input,
|
|
1895
|
+
{
|
|
1896
|
+
ref: inputRef,
|
|
1897
|
+
value: stringValue,
|
|
1898
|
+
maxLength,
|
|
1899
|
+
autoComplete: autoComplete || "off",
|
|
1900
|
+
onChange: (e) => {
|
|
1901
|
+
const newValue = e.target.value;
|
|
1902
|
+
const willSwitchType = emailOrPhoneType !== detectEmailOrPhoneStrict(newValue);
|
|
1903
|
+
if (willSwitchType) shouldFocusRef.current = true;
|
|
1904
|
+
let normalizedValue = newValue;
|
|
1905
|
+
const detectedType = detectEmailOrPhoneStrict(newValue);
|
|
1906
|
+
if (detectedType === "phone") {
|
|
1907
|
+
normalizedValue = normalizePhoneNumber(newValue);
|
|
1908
|
+
}
|
|
1909
|
+
field.onChange(normalizedValue);
|
|
1910
|
+
updateEmailOrPhoneType(normalizedValue);
|
|
1911
|
+
},
|
|
1912
|
+
placeholder: inputPlaceholder,
|
|
1913
|
+
disabled,
|
|
1914
|
+
appearance,
|
|
1915
|
+
size,
|
|
1916
|
+
type: inputType,
|
|
1917
|
+
style: { width: "100%" }
|
|
1918
|
+
}
|
|
1919
|
+
) });
|
|
1920
|
+
}
|
|
1921
|
+
if (type === "identity") {
|
|
1922
|
+
updateIdentityType(field.value);
|
|
1923
|
+
const stringValue = typeof field.value === "string" ? field.value : "";
|
|
1924
|
+
let inputType = "text";
|
|
1925
|
+
let inputPlaceholder = placeholder || "Email, KTP, SIM, Passport, atau Nomor Telepon";
|
|
1926
|
+
if (identityType === "email") {
|
|
1927
|
+
inputType = "email";
|
|
1928
|
+
inputPlaceholder = placeholder || "Email";
|
|
1929
|
+
} else if (identityType === "phone") {
|
|
1930
|
+
inputType = "tel";
|
|
1931
|
+
inputPlaceholder = placeholder || "Nomor telepon";
|
|
1932
|
+
} else if (identityType === "id") {
|
|
1933
|
+
inputType = "text";
|
|
1934
|
+
inputPlaceholder = placeholder || "KTP, SIM, atau Passport";
|
|
1935
|
+
}
|
|
1936
|
+
const cleanPhoneValue = (val) => {
|
|
1937
|
+
if (!val) return val;
|
|
1938
|
+
const stringVal = String(val);
|
|
1939
|
+
const match = stringVal.match(/^(\d{1,4})(0\d+)$/);
|
|
1940
|
+
if (match) {
|
|
1941
|
+
return match[1] + match[2].substring(1);
|
|
1942
|
+
}
|
|
1943
|
+
return stringVal;
|
|
1944
|
+
};
|
|
1945
|
+
identityType === "phone" ? cleanPhoneValue(stringValue) : stringValue;
|
|
1946
|
+
return /* @__PURE__ */ jsx("div", { className: styles.phoneContainer, children: identityType === "phone" ? /* @__PURE__ */ jsx(
|
|
1947
|
+
"div",
|
|
1948
|
+
{
|
|
1949
|
+
ref: phoneInputRef,
|
|
1950
|
+
className: `${styles.phoneInputWrapper} ${error ? styles.phoneInputError : ""}`,
|
|
1951
|
+
children: /* @__PURE__ */ jsx(
|
|
1952
|
+
PhoneInput,
|
|
1953
|
+
{
|
|
1954
|
+
country: defaultCountry.toLowerCase(),
|
|
1955
|
+
value: stringValue.startsWith("+") ? stringValue.substring(1) : stringValue,
|
|
1956
|
+
onChange: (value, data) => {
|
|
1957
|
+
if (!value) {
|
|
1958
|
+
shouldFocusRef.current = true;
|
|
1959
|
+
field.onChange("");
|
|
1960
|
+
updateIdentityType("");
|
|
1961
|
+
setLastPhoneValue("");
|
|
1962
|
+
return;
|
|
1963
|
+
}
|
|
1964
|
+
const countryDialCode = data?.dialCode || "";
|
|
1965
|
+
if (value === countryDialCode) {
|
|
1966
|
+
const dialCodeChanged = lastPhoneValue && lastPhoneValue !== countryDialCode && !lastPhoneValue.startsWith(countryDialCode);
|
|
1967
|
+
const isInitial = !lastPhoneValue;
|
|
1968
|
+
const wasFullNumber = lastPhoneValue && lastPhoneValue.length > 3;
|
|
1969
|
+
if (isInitial || dialCodeChanged || wasFullNumber) {
|
|
1970
|
+
const phoneValue2 = "+" + value;
|
|
1971
|
+
field.onChange(phoneValue2);
|
|
1972
|
+
updateIdentityType(phoneValue2);
|
|
1973
|
+
setLastPhoneValue(value);
|
|
1974
|
+
return;
|
|
1975
|
+
} else {
|
|
1976
|
+
shouldFocusRef.current = true;
|
|
1977
|
+
field.onChange("");
|
|
1978
|
+
updateIdentityType("");
|
|
1979
|
+
setLastPhoneValue("");
|
|
1980
|
+
return;
|
|
1981
|
+
}
|
|
1982
|
+
}
|
|
1983
|
+
const phoneValue = "+" + value;
|
|
1984
|
+
field.onChange(phoneValue);
|
|
1985
|
+
updateIdentityType(phoneValue);
|
|
1986
|
+
setLastPhoneValue(value);
|
|
1987
|
+
},
|
|
1988
|
+
placeholder: inputPlaceholder,
|
|
1989
|
+
disabled,
|
|
1990
|
+
enableSearch: true,
|
|
1991
|
+
disableSearchIcon: true
|
|
1992
|
+
}
|
|
1993
|
+
)
|
|
1994
|
+
}
|
|
1995
|
+
) : /* @__PURE__ */ jsx(
|
|
1996
|
+
Input,
|
|
1997
|
+
{
|
|
1998
|
+
ref: inputRef,
|
|
1999
|
+
value: stringValue,
|
|
2000
|
+
maxLength,
|
|
2001
|
+
autoComplete: autoComplete || "off",
|
|
2002
|
+
onChange: (e) => {
|
|
2003
|
+
const newValue = e.target.value;
|
|
2004
|
+
const willSwitchType = identityType !== detectIdentityType(newValue);
|
|
2005
|
+
if (willSwitchType) shouldFocusRef.current = true;
|
|
2006
|
+
field.onChange(newValue);
|
|
2007
|
+
updateIdentityType(newValue);
|
|
2008
|
+
},
|
|
2009
|
+
placeholder: inputPlaceholder,
|
|
2010
|
+
disabled,
|
|
2011
|
+
appearance,
|
|
2012
|
+
size,
|
|
2013
|
+
type: inputType,
|
|
2014
|
+
style: { width: "100%" }
|
|
2015
|
+
}
|
|
2016
|
+
) });
|
|
2017
|
+
}
|
|
2018
|
+
switch (type) {
|
|
2019
|
+
case "textarea":
|
|
2020
|
+
return /* @__PURE__ */ jsx(Textarea, { ...commonProps, rows, resize: "vertical" });
|
|
2021
|
+
case "select":
|
|
2022
|
+
return /* @__PURE__ */ jsx(
|
|
2023
|
+
Select,
|
|
2024
|
+
{
|
|
2025
|
+
...field,
|
|
2026
|
+
name: `${String(name)}_${Math.random().toString(36).substring(7)}`,
|
|
2027
|
+
isDisabled: disabled,
|
|
2028
|
+
placeholder,
|
|
2029
|
+
options,
|
|
2030
|
+
styles: getSelectStyles(!!error),
|
|
2031
|
+
className: styles.reactSelect,
|
|
2032
|
+
classNamePrefix: "react-select",
|
|
2033
|
+
isMulti: isMultiSelect,
|
|
2034
|
+
inputProps: {
|
|
2035
|
+
autoComplete: "new-password",
|
|
2036
|
+
autoCorrect: "off",
|
|
2037
|
+
autoCapitalize: "off",
|
|
2038
|
+
spellCheck: "false"
|
|
2039
|
+
},
|
|
2040
|
+
value: isMultiSelect ? options.filter((option) => field.value?.includes(option.value)) : options.find((option) => option.value === field.value) || null,
|
|
2041
|
+
onChange: (selectedOption) => {
|
|
2042
|
+
if (isMultiSelect) {
|
|
2043
|
+
const values = selectedOption ? selectedOption.map((opt) => opt.value) : [];
|
|
2044
|
+
field.onChange(values);
|
|
2045
|
+
} else {
|
|
2046
|
+
field.onChange(selectedOption ? selectedOption.value : "");
|
|
2047
|
+
}
|
|
2048
|
+
},
|
|
2049
|
+
getOptionLabel: (option) => option.label,
|
|
2050
|
+
getOptionValue: (option) => option.value,
|
|
2051
|
+
isOptionDisabled: (option) => option.disabled || false
|
|
2052
|
+
}
|
|
2053
|
+
);
|
|
2054
|
+
case "phone": {
|
|
2055
|
+
const cleanPhoneValue = (val) => {
|
|
2056
|
+
if (!val) return val;
|
|
2057
|
+
const stringVal = String(val);
|
|
2058
|
+
const match = stringVal.match(/^(\d{1,4})(0\d+)$/);
|
|
2059
|
+
if (match) {
|
|
2060
|
+
return match[1] + match[2].substring(1);
|
|
2061
|
+
}
|
|
2062
|
+
return stringVal;
|
|
2063
|
+
};
|
|
2064
|
+
const cleanedFieldValue = cleanPhoneValue(field.value || "");
|
|
2065
|
+
return /* @__PURE__ */ jsx("div", { className: `${styles.phoneInputWrapper} ${error ? styles.phoneInputError : ""}`, children: /* @__PURE__ */ jsx(
|
|
2066
|
+
PhoneInput,
|
|
2067
|
+
{
|
|
2068
|
+
country: defaultCountry.toLowerCase(),
|
|
2069
|
+
value: cleanedFieldValue,
|
|
2070
|
+
onChange: (value, data) => {
|
|
2071
|
+
const cleanedValue = cleanPhoneValue(value || "");
|
|
2072
|
+
field.onChange(cleanedValue);
|
|
2073
|
+
},
|
|
2074
|
+
placeholder: placeholder || "Nomor telepon",
|
|
2075
|
+
disabled,
|
|
2076
|
+
enableSearch: true,
|
|
2077
|
+
disableSearchIcon: true
|
|
2078
|
+
}
|
|
2079
|
+
) });
|
|
2080
|
+
}
|
|
2081
|
+
case "passport": {
|
|
2082
|
+
const passportValue = field.value || {
|
|
2083
|
+
countryCode: defaultCountry,
|
|
2084
|
+
phoneNumber: ""
|
|
2085
|
+
};
|
|
2086
|
+
const countryOptions = countryCodes.map((country) => ({
|
|
2087
|
+
value: country.code,
|
|
2088
|
+
label: country.name,
|
|
2089
|
+
code: country.code,
|
|
2090
|
+
passportRegex: country.passportRegex
|
|
2091
|
+
}));
|
|
2092
|
+
const formatOptionLabel = (option) => /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
|
|
2093
|
+
/* @__PURE__ */ jsx("span", { style: { fontSize: "18px" }, children: String.fromCodePoint(
|
|
2094
|
+
...option.code.split("").map((char) => 127397 + char.charCodeAt(0))
|
|
2095
|
+
) }),
|
|
2096
|
+
/* @__PURE__ */ jsx("span", { children: option.label })
|
|
2097
|
+
] });
|
|
2098
|
+
const selectedCountry = countryOptions.find((opt) => opt.value === passportValue.countryCode);
|
|
2099
|
+
const isCountrySelected = !!selectedCountry;
|
|
2100
|
+
return /* @__PURE__ */ jsxs("div", { className: styles.phoneContainer, children: [
|
|
2101
|
+
/* @__PURE__ */ jsx("div", { className: styles.phoneCountrySelect, children: /* @__PURE__ */ jsx(
|
|
2102
|
+
Select,
|
|
2103
|
+
{
|
|
2104
|
+
value: selectedCountry || null,
|
|
2105
|
+
onChange: (selectedOption) => {
|
|
2106
|
+
field.onChange({
|
|
2107
|
+
...passportValue,
|
|
2108
|
+
countryCode: selectedOption ? selectedOption.value : defaultCountry
|
|
2109
|
+
});
|
|
2110
|
+
},
|
|
2111
|
+
options: countryOptions,
|
|
2112
|
+
isDisabled: disabled,
|
|
2113
|
+
placeholder: "\xF0\u0178\x8F\xB3\xEF\xB8\x8F",
|
|
2114
|
+
styles: getSelectStyles(!!error),
|
|
2115
|
+
isSearchable: true,
|
|
2116
|
+
formatOptionLabel
|
|
2117
|
+
}
|
|
2118
|
+
) }),
|
|
2119
|
+
/* @__PURE__ */ jsx("div", { style: { flex: 1, minWidth: 0 }, children: /* @__PURE__ */ jsx(
|
|
2120
|
+
Input,
|
|
2121
|
+
{
|
|
2122
|
+
value: passportValue.phoneNumber,
|
|
2123
|
+
maxLength,
|
|
2124
|
+
autoComplete: autoComplete || "off",
|
|
2125
|
+
onChange: (e) => {
|
|
2126
|
+
field.onChange({
|
|
2127
|
+
...passportValue,
|
|
2128
|
+
phoneNumber: e.target.value
|
|
2129
|
+
});
|
|
2130
|
+
},
|
|
2131
|
+
placeholder: placeholder || "Nomor paspor",
|
|
2132
|
+
disabled: disabled || !isCountrySelected,
|
|
2133
|
+
appearance,
|
|
2134
|
+
size,
|
|
2135
|
+
type: "text",
|
|
2136
|
+
style: { width: "100%" }
|
|
2137
|
+
}
|
|
2138
|
+
) })
|
|
2139
|
+
] });
|
|
2140
|
+
}
|
|
2141
|
+
case "file":
|
|
2142
|
+
return /* @__PURE__ */ jsx(
|
|
2143
|
+
"input",
|
|
2144
|
+
{
|
|
2145
|
+
...field,
|
|
2146
|
+
type: "file",
|
|
2147
|
+
multiple,
|
|
2148
|
+
accept,
|
|
2149
|
+
disabled,
|
|
2150
|
+
className: styles.fileInput,
|
|
2151
|
+
value: void 0,
|
|
2152
|
+
onChange: (e) => {
|
|
2153
|
+
const files = e.target.files;
|
|
2154
|
+
field.onChange(multiple ? files : files?.[0]);
|
|
2155
|
+
}
|
|
2156
|
+
}
|
|
2157
|
+
);
|
|
2158
|
+
case "switch":
|
|
2159
|
+
return /* @__PURE__ */ jsx("div", { className: styles.switchWrapper, children: /* @__PURE__ */ jsx(
|
|
2160
|
+
Switch,
|
|
2161
|
+
{
|
|
2162
|
+
...field,
|
|
2163
|
+
checked: field.value || false,
|
|
2164
|
+
disabled,
|
|
2165
|
+
onChange: (_, data) => field.onChange(data.checked)
|
|
2166
|
+
}
|
|
2167
|
+
) });
|
|
2168
|
+
case "date":
|
|
2169
|
+
return /* @__PURE__ */ jsx(DatePickerInput_default, { ...commonProps, field });
|
|
2170
|
+
case "radio":
|
|
2171
|
+
return /* @__PURE__ */ jsx(RadioGroup, { ...field, disabled, layout: layout ?? "vertical", children: options.map((option) => /* @__PURE__ */ jsx(
|
|
2172
|
+
Radio,
|
|
2173
|
+
{
|
|
2174
|
+
value: option.value,
|
|
2175
|
+
label: option.label,
|
|
2176
|
+
disabled: option.disabled
|
|
2177
|
+
},
|
|
2178
|
+
option.value
|
|
2179
|
+
)) });
|
|
2180
|
+
case "radiobutton":
|
|
2181
|
+
return /* @__PURE__ */ jsx(
|
|
2182
|
+
RadioGroup,
|
|
2183
|
+
{
|
|
2184
|
+
...field,
|
|
2185
|
+
disabled,
|
|
2186
|
+
layout: layout ?? "horizontal",
|
|
2187
|
+
className: styles.classRadioGroup,
|
|
2188
|
+
children: options.map((option) => /* @__PURE__ */ jsx(
|
|
2189
|
+
Radio,
|
|
2190
|
+
{
|
|
2191
|
+
value: option.value,
|
|
2192
|
+
label: option.label,
|
|
2193
|
+
disabled: option.disabled,
|
|
2194
|
+
className: styles.classRadio
|
|
2195
|
+
},
|
|
2196
|
+
option.value
|
|
2197
|
+
))
|
|
2198
|
+
}
|
|
2199
|
+
);
|
|
2200
|
+
case "checkbox":
|
|
2201
|
+
return /* @__PURE__ */ jsx(
|
|
2202
|
+
Checkbox,
|
|
2203
|
+
{
|
|
2204
|
+
...field,
|
|
2205
|
+
checked: field.value || false,
|
|
2206
|
+
disabled,
|
|
2207
|
+
onChange: (_, data) => field.onChange(data.checked),
|
|
2208
|
+
label
|
|
2209
|
+
}
|
|
2210
|
+
);
|
|
2211
|
+
case "number":
|
|
2212
|
+
return /* @__PURE__ */ jsx(
|
|
2213
|
+
Input,
|
|
2214
|
+
{
|
|
2215
|
+
...commonProps,
|
|
2216
|
+
type: "number",
|
|
2217
|
+
min,
|
|
2218
|
+
max,
|
|
2219
|
+
step,
|
|
2220
|
+
className: styles.inputWithAutocomplete
|
|
2221
|
+
}
|
|
2222
|
+
);
|
|
2223
|
+
case "time":
|
|
2224
|
+
case "datetime-local":
|
|
2225
|
+
return /* @__PURE__ */ jsx(
|
|
2226
|
+
Input,
|
|
2227
|
+
{
|
|
2228
|
+
...commonProps,
|
|
2229
|
+
type,
|
|
2230
|
+
min,
|
|
2231
|
+
max,
|
|
2232
|
+
className: styles.inputWithAutocomplete
|
|
2233
|
+
}
|
|
2234
|
+
);
|
|
2235
|
+
case "password":
|
|
2236
|
+
return /* @__PURE__ */ jsx(
|
|
2237
|
+
Input,
|
|
2238
|
+
{
|
|
2239
|
+
...commonProps,
|
|
2240
|
+
type: showPassword ? "text" : "password",
|
|
2241
|
+
className: styles.inputWithAutocomplete,
|
|
2242
|
+
contentAfter: /* @__PURE__ */ jsx(
|
|
2243
|
+
Button,
|
|
2244
|
+
{
|
|
2245
|
+
appearance: "transparent",
|
|
2246
|
+
icon: showPassword ? /* @__PURE__ */ jsx(Icon, { icon: "fluent:eye-off-24-filled" }) : /* @__PURE__ */ jsx(Icon, { icon: "fluent:eye-24-filled" }),
|
|
2247
|
+
"aria-label": showPassword ? "Hide password" : "Show password",
|
|
2248
|
+
onClick: () => setShowPassword(!showPassword),
|
|
2249
|
+
tabIndex: -1,
|
|
2250
|
+
type: "button"
|
|
2251
|
+
}
|
|
2252
|
+
)
|
|
2253
|
+
}
|
|
2254
|
+
);
|
|
2255
|
+
case "otp": {
|
|
2256
|
+
const setRefs = (el) => {
|
|
2257
|
+
try {
|
|
2258
|
+
if (field.ref) {
|
|
2259
|
+
if (typeof field.ref === "function") field.ref(el);
|
|
2260
|
+
else field.ref.current = el;
|
|
2261
|
+
}
|
|
2262
|
+
} catch {
|
|
2263
|
+
}
|
|
2264
|
+
inputRef.current = el;
|
|
2265
|
+
};
|
|
2266
|
+
const handleChange = (e) => {
|
|
2267
|
+
const val = e?.target?.value ?? "";
|
|
2268
|
+
const numericValue = val.replace(/\D/g, "");
|
|
2269
|
+
if (inputRef.current) {
|
|
2270
|
+
inputRef.current.value = numericValue;
|
|
2271
|
+
}
|
|
2272
|
+
const numericEvent = {
|
|
2273
|
+
...e,
|
|
2274
|
+
target: {
|
|
2275
|
+
...e.target,
|
|
2276
|
+
value: numericValue
|
|
2277
|
+
}
|
|
2278
|
+
};
|
|
2279
|
+
field.onChange(numericEvent);
|
|
2280
|
+
if (autoAdvance && otpIndex2 && maxLength && numericValue.length >= maxLength) {
|
|
2281
|
+
const next = document.querySelector(
|
|
2282
|
+
`[data-otp-index="${otpIndex2 + 1}"]`
|
|
2283
|
+
);
|
|
2284
|
+
if (next) next.focus();
|
|
2285
|
+
}
|
|
2286
|
+
};
|
|
2287
|
+
const handleKeyPress = (e) => {
|
|
2288
|
+
const char = e.key;
|
|
2289
|
+
if (!/^\d$/.test(char) && char !== "Backspace" && char !== "Delete" && char !== "Tab" && char !== "ArrowLeft" && char !== "ArrowRight") {
|
|
2290
|
+
e.preventDefault();
|
|
2291
|
+
}
|
|
2292
|
+
};
|
|
2293
|
+
const handleKeyDown = (e) => {
|
|
2294
|
+
if (e.key === "Backspace") {
|
|
2295
|
+
const curVal = field.value || "";
|
|
2296
|
+
if (!curVal && otpIndex2 !== null && otpIndex2 !== void 0) {
|
|
2297
|
+
const prevIndex = otpIndex2 - 1;
|
|
2298
|
+
if (prevIndex >= 1) {
|
|
2299
|
+
isBackspaceNavigationRef.current = true;
|
|
2300
|
+
const prev = document.querySelector(
|
|
2301
|
+
`[data-otp-index="${prevIndex}"]`
|
|
2302
|
+
);
|
|
2303
|
+
if (prev) {
|
|
2304
|
+
prev.focus();
|
|
2305
|
+
}
|
|
2306
|
+
}
|
|
2307
|
+
}
|
|
2308
|
+
}
|
|
2309
|
+
};
|
|
2310
|
+
const handleClick = (e) => {
|
|
2311
|
+
if (otpIndex2) {
|
|
2312
|
+
let lastFilledIndex = 0;
|
|
2313
|
+
for (let i = 1; i <= 6; i++) {
|
|
2314
|
+
const input = document.querySelector(`[data-otp-index="${i}"]`);
|
|
2315
|
+
if (input && input.value) {
|
|
2316
|
+
lastFilledIndex = i;
|
|
2317
|
+
} else {
|
|
2318
|
+
break;
|
|
2319
|
+
}
|
|
2320
|
+
}
|
|
2321
|
+
const targetIndex = lastFilledIndex === 6 ? 6 : lastFilledIndex + 1;
|
|
2322
|
+
if (otpIndex2 < targetIndex) {
|
|
2323
|
+
e.preventDefault();
|
|
2324
|
+
const targetInput = document.querySelector(
|
|
2325
|
+
`[data-otp-index="${targetIndex}"]`
|
|
2326
|
+
);
|
|
2327
|
+
if (targetInput) {
|
|
2328
|
+
targetInput.focus();
|
|
2329
|
+
const length = targetInput.value?.length || 0;
|
|
2330
|
+
setTimeout(() => {
|
|
2331
|
+
targetInput.setSelectionRange(length, length);
|
|
2332
|
+
}, 0);
|
|
2333
|
+
}
|
|
2334
|
+
return;
|
|
2335
|
+
}
|
|
2336
|
+
}
|
|
2337
|
+
if (inputRef.current) {
|
|
2338
|
+
const length = inputRef.current.value?.length || 0;
|
|
2339
|
+
setTimeout(() => {
|
|
2340
|
+
inputRef.current?.setSelectionRange(length, length);
|
|
2341
|
+
}, 0);
|
|
2342
|
+
}
|
|
2343
|
+
};
|
|
2344
|
+
const handleMouseDown = (e) => {
|
|
2345
|
+
isBackspaceNavigationRef.current = false;
|
|
2346
|
+
if (field.value) {
|
|
2347
|
+
e.preventDefault();
|
|
2348
|
+
if (inputRef.current) {
|
|
2349
|
+
inputRef.current.focus();
|
|
2350
|
+
const length = inputRef.current.value.length;
|
|
2351
|
+
inputRef.current.setSelectionRange(length, length);
|
|
2352
|
+
}
|
|
2353
|
+
}
|
|
2354
|
+
};
|
|
2355
|
+
const handleSelect = (e) => {
|
|
2356
|
+
if (inputRef.current && field.value) {
|
|
2357
|
+
const length = inputRef.current.value.length;
|
|
2358
|
+
inputRef.current.setSelectionRange(length, length);
|
|
2359
|
+
}
|
|
2360
|
+
};
|
|
2361
|
+
const handleFocus = (e) => {
|
|
2362
|
+
};
|
|
2363
|
+
const inputAttrs = {};
|
|
2364
|
+
if (otpIndex2) inputAttrs["data-otp-index"] = otpIndex2;
|
|
2365
|
+
const otpStyles = {
|
|
2366
|
+
height: "57px",
|
|
2367
|
+
borderRadius: tokens.borderRadiusXLarge,
|
|
2368
|
+
textAlign: "center",
|
|
2369
|
+
...typographyStyles.title2,
|
|
2370
|
+
fontWeight: fontWeight.Medium,
|
|
2371
|
+
lineHeight: tokens.lineHeightHero800,
|
|
2372
|
+
borderColor: hasError ? sharedColors.Shared_Cranberry_Primary : void 0,
|
|
2373
|
+
...style
|
|
2374
|
+
// Allow override from props
|
|
2375
|
+
};
|
|
2376
|
+
return /* @__PURE__ */ jsx(
|
|
2377
|
+
Input,
|
|
2378
|
+
{
|
|
2379
|
+
...commonProps,
|
|
2380
|
+
type: "tel",
|
|
2381
|
+
onChange: handleChange,
|
|
2382
|
+
onKeyDown: handleKeyDown,
|
|
2383
|
+
onKeyPress: handleKeyPress,
|
|
2384
|
+
onClick: handleClick,
|
|
2385
|
+
onMouseDown: handleMouseDown,
|
|
2386
|
+
onSelect: handleSelect,
|
|
2387
|
+
onFocus: handleFocus,
|
|
2388
|
+
ref: setRefs,
|
|
2389
|
+
style: otpStyles,
|
|
2390
|
+
className: styles.otpInput,
|
|
2391
|
+
...inputAttrs
|
|
2392
|
+
}
|
|
2393
|
+
);
|
|
2394
|
+
}
|
|
2395
|
+
default:
|
|
2396
|
+
return /* @__PURE__ */ jsx(
|
|
2397
|
+
Input,
|
|
2398
|
+
{
|
|
2399
|
+
...commonProps,
|
|
2400
|
+
type,
|
|
2401
|
+
onInput,
|
|
2402
|
+
className: styles.inputWithAutocomplete
|
|
2403
|
+
}
|
|
2404
|
+
);
|
|
2405
|
+
}
|
|
2406
|
+
};
|
|
2407
|
+
const getValidationRules = () => {
|
|
2408
|
+
const rules = {};
|
|
2409
|
+
if (required) {
|
|
2410
|
+
rules.required = validationRules?.required || "Field ini wajib diisi";
|
|
2411
|
+
}
|
|
2412
|
+
if (validationRules?.minLength) {
|
|
2413
|
+
rules.minLength = validationRules.minLength;
|
|
2414
|
+
}
|
|
2415
|
+
if (validationRules?.maxLength) {
|
|
2416
|
+
rules.maxLength = validationRules.maxLength;
|
|
2417
|
+
}
|
|
2418
|
+
if (validationRules?.pattern) {
|
|
2419
|
+
rules.pattern = validationRules.pattern;
|
|
2420
|
+
}
|
|
2421
|
+
if (validationRules?.min) {
|
|
2422
|
+
rules.min = validationRules.min;
|
|
2423
|
+
}
|
|
2424
|
+
if (validationRules?.max) {
|
|
2425
|
+
rules.max = validationRules.max;
|
|
2426
|
+
}
|
|
2427
|
+
if (validationRules?.validate) {
|
|
2428
|
+
rules.validate = validationRules.validate;
|
|
2429
|
+
}
|
|
2430
|
+
if (type === "email") {
|
|
2431
|
+
rules.pattern = {
|
|
2432
|
+
value: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,
|
|
2433
|
+
message: "Email tidak valid"
|
|
2434
|
+
};
|
|
2435
|
+
}
|
|
2436
|
+
if (type === "emailOrPhone") {
|
|
2437
|
+
rules.validate = (value) => {
|
|
2438
|
+
if (required && !value) {
|
|
2439
|
+
return "Email atau nomor HP wajib diisi";
|
|
2440
|
+
}
|
|
2441
|
+
const stringValue = typeof value === "string" ? value : "";
|
|
2442
|
+
if (!stringValue) return true;
|
|
2443
|
+
const detectedType = detectEmailOrPhoneStrict(stringValue);
|
|
2444
|
+
if (detectedType === "email") {
|
|
2445
|
+
if (!/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i.test(stringValue)) {
|
|
2446
|
+
return "Format email tidak valid";
|
|
2447
|
+
}
|
|
2448
|
+
} else if (detectedType === "phone") {
|
|
2449
|
+
if (!stringValue.startsWith("+")) {
|
|
2450
|
+
return "Nomor HP harus dalam format internasional (contoh: +628123456789)";
|
|
2451
|
+
}
|
|
2452
|
+
const phoneDigits = stringValue.substring(1);
|
|
2453
|
+
if (!/^\d+$/.test(phoneDigits)) {
|
|
2454
|
+
return "Nomor HP hanya boleh berisi angka setelah +";
|
|
2455
|
+
}
|
|
2456
|
+
if (phoneDigits.length < 10) {
|
|
2457
|
+
return "Nomor HP minimal 10 digit";
|
|
2458
|
+
}
|
|
2459
|
+
} else {
|
|
2460
|
+
return "Masukkan email atau nomor HP yang valid";
|
|
2461
|
+
}
|
|
2462
|
+
return true;
|
|
2463
|
+
};
|
|
2464
|
+
}
|
|
2465
|
+
if (type === "identity") {
|
|
2466
|
+
rules.validate = (value) => {
|
|
2467
|
+
if (required && !value) {
|
|
2468
|
+
return "Field ini wajib diisi";
|
|
2469
|
+
}
|
|
2470
|
+
const stringValue = typeof value === "string" ? value : value?.phoneNumber || "";
|
|
2471
|
+
if (!stringValue) return true;
|
|
2472
|
+
const detectedType = detectIdentityType(stringValue);
|
|
2473
|
+
if (detectedType === "email") {
|
|
2474
|
+
if (!/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i.test(stringValue)) {
|
|
2475
|
+
return "Format email tidak valid";
|
|
2476
|
+
}
|
|
2477
|
+
} else if (detectedType === "phone") {
|
|
2478
|
+
if (!stringValue.startsWith("+")) {
|
|
2479
|
+
return "Nomor telepon harus diawali dengan +";
|
|
2480
|
+
}
|
|
2481
|
+
const phoneDigits = stringValue.substring(1);
|
|
2482
|
+
if (!/^\d+$/.test(phoneDigits)) {
|
|
2483
|
+
return "Nomor telepon hanya boleh berisi angka setelah +";
|
|
2484
|
+
}
|
|
2485
|
+
}
|
|
2486
|
+
return true;
|
|
2487
|
+
};
|
|
2488
|
+
}
|
|
2489
|
+
if (type === "phone") {
|
|
2490
|
+
rules.validate = (value) => {
|
|
2491
|
+
if (required && !value) {
|
|
2492
|
+
return "Nomor telepon wajib diisi";
|
|
2493
|
+
}
|
|
2494
|
+
return true;
|
|
2495
|
+
};
|
|
2496
|
+
}
|
|
2497
|
+
if (type === "passport") {
|
|
2498
|
+
rules.validate = (value) => {
|
|
2499
|
+
if (required && !value?.phoneNumber) {
|
|
2500
|
+
return "Nomor paspor wajib diisi";
|
|
2501
|
+
}
|
|
2502
|
+
if (value?.phoneNumber) {
|
|
2503
|
+
const selectedCountry = countryCodes.find((c) => c.code === value.countryCode);
|
|
2504
|
+
if (selectedCountry?.passportRegex) {
|
|
2505
|
+
const passportRegex = new RegExp(selectedCountry.passportRegex);
|
|
2506
|
+
if (!passportRegex.test(value.phoneNumber)) {
|
|
2507
|
+
return `Format paspor ${selectedCountry.name} tidak valid`;
|
|
2508
|
+
}
|
|
2509
|
+
}
|
|
2510
|
+
}
|
|
2511
|
+
return true;
|
|
2512
|
+
};
|
|
2513
|
+
}
|
|
2514
|
+
return rules;
|
|
2515
|
+
};
|
|
2516
|
+
return /* @__PURE__ */ jsx(
|
|
2517
|
+
Controller,
|
|
2518
|
+
{
|
|
2519
|
+
name,
|
|
2520
|
+
control,
|
|
2521
|
+
rules: getValidationRules(),
|
|
2522
|
+
render: ({ field, fieldState: { error } }) => /* @__PURE__ */ jsxs(
|
|
2523
|
+
Field,
|
|
2524
|
+
{
|
|
2525
|
+
className: `${styles.field} ${className || ""}`,
|
|
2526
|
+
validationMessage: error?.message,
|
|
2527
|
+
validationState: error ? "error" : "none",
|
|
2528
|
+
children: [
|
|
2529
|
+
label && type !== "checkbox" && /* @__PURE__ */ jsx(Label, { required, children: label }),
|
|
2530
|
+
renderInput(field, error?.message),
|
|
2531
|
+
helperText && !error && /* @__PURE__ */ jsx(Text, { size: 200, style: { textAlign: "left" }, className: styles.helperText, children: helperText })
|
|
2532
|
+
]
|
|
2533
|
+
}
|
|
2534
|
+
)
|
|
2535
|
+
}
|
|
2536
|
+
);
|
|
2537
|
+
}
|
|
2538
|
+
var InputDynamic_default = InputDynamic;
|
|
2539
|
+
|
|
2540
|
+
// src/components/InputDynamic/constants.ts
|
|
2541
|
+
var DEFAULT_COUNTRY_CODES2 = [
|
|
2542
|
+
{ code: "AF", name: "Afghanistan", dialCode: "+93", passportRegex: "^[A-Z][0-9]{7}$" },
|
|
2543
|
+
{ code: "AL", name: "Albania", dialCode: "+355", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2544
|
+
{ code: "DZ", name: "Algeria", dialCode: "+213", passportRegex: "^[0-9]{9}$" },
|
|
2545
|
+
{ code: "AS", name: "American Samoa", dialCode: "+1", passportRegex: "^[0-9]{9}$" },
|
|
2546
|
+
{ code: "AD", name: "Andorra", dialCode: "+376", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2547
|
+
{ code: "AO", name: "Angola", dialCode: "+244", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2548
|
+
{ code: "AI", name: "Anguilla", dialCode: "+1", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2549
|
+
{ code: "AQ", name: "Antarctica", dialCode: "+672", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2550
|
+
{ code: "AG", name: "Antigua and Barbuda", dialCode: "+1", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2551
|
+
{ code: "AR", name: "Argentina", dialCode: "+54", passportRegex: "^[A-Z]{3}[0-9]{6}$" },
|
|
2552
|
+
{ code: "AM", name: "Armenia", dialCode: "+374", passportRegex: "^[A-Z]{2}[0-9]{6}$" },
|
|
2553
|
+
{ code: "AW", name: "Aruba", dialCode: "+297", passportRegex: "^[A-Z]{2}[0-9]{6}$" },
|
|
2554
|
+
{ code: "AU", name: "Australia", dialCode: "+61", passportRegex: "^[A-Z][0-9]{7}$" },
|
|
2555
|
+
{ code: "AT", name: "Austria", dialCode: "+43", passportRegex: "^[A-Z0-9]{8}$" },
|
|
2556
|
+
{ code: "AZ", name: "Azerbaijan", dialCode: "+994", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2557
|
+
{ code: "BS", name: "Bahamas", dialCode: "+1", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2558
|
+
{ code: "BH", name: "Bahrain", dialCode: "+973", passportRegex: "^[A-Z][0-9]{7}$" },
|
|
2559
|
+
{ code: "BD", name: "Bangladesh", dialCode: "+880", passportRegex: "^[A-Z][0-9]{7}$" },
|
|
2560
|
+
{ code: "BB", name: "Barbados", dialCode: "+1", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2561
|
+
{ code: "BY", name: "Belarus", dialCode: "+375", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2562
|
+
{ code: "BE", name: "Belgium", dialCode: "+32", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2563
|
+
{ code: "BZ", name: "Belize", dialCode: "+501", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2564
|
+
{ code: "BJ", name: "Benin", dialCode: "+229", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2565
|
+
{ code: "BM", name: "Bermuda", dialCode: "+1", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2566
|
+
{ code: "BT", name: "Bhutan", dialCode: "+975", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2567
|
+
{ code: "BO", name: "Bolivia", dialCode: "+591", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2568
|
+
{
|
|
2569
|
+
code: "BA",
|
|
2570
|
+
name: "Bosnia and Herzegovina",
|
|
2571
|
+
dialCode: "+387",
|
|
2572
|
+
passportRegex: "^[A-Z]{2}[0-9]{6}$"
|
|
2573
|
+
},
|
|
2574
|
+
{ code: "BW", name: "Botswana", dialCode: "+267", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2575
|
+
{ code: "BR", name: "Brazil", dialCode: "+55", passportRegex: "^[A-Z]{2}[0-9]{6}$" },
|
|
2576
|
+
{ code: "BN", name: "Brunei", dialCode: "+673", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2577
|
+
{ code: "BG", name: "Bulgaria", dialCode: "+359", passportRegex: "^[0-9]{9}$" },
|
|
2578
|
+
{ code: "BF", name: "Burkina Faso", dialCode: "+226", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2579
|
+
{ code: "BI", name: "Burundi", dialCode: "+257", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2580
|
+
{ code: "KH", name: "Cambodia", dialCode: "+855", passportRegex: "^[A-Z][0-9]{7}$" },
|
|
2581
|
+
{ code: "CM", name: "Cameroon", dialCode: "+237", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2582
|
+
{ code: "CA", name: "Canada", dialCode: "+1", passportRegex: "^[A-Z]{2}[0-9]{6}$" },
|
|
2583
|
+
{ code: "CV", name: "Cape Verde", dialCode: "+238", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2584
|
+
{ code: "KY", name: "Cayman Islands", dialCode: "+1", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2585
|
+
{
|
|
2586
|
+
code: "CF",
|
|
2587
|
+
name: "Central African Republic",
|
|
2588
|
+
dialCode: "+236",
|
|
2589
|
+
passportRegex: "^[A-Z0-9]{6,10}$"
|
|
2590
|
+
},
|
|
2591
|
+
{ code: "TD", name: "Chad", dialCode: "+235", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2592
|
+
{ code: "CL", name: "Chile", dialCode: "+56", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2593
|
+
{ code: "CN", name: "China", dialCode: "+86", passportRegex: "^[0-9]{9}$" },
|
|
2594
|
+
{ code: "CO", name: "Colombia", dialCode: "+57", passportRegex: "^[A-Z]{3}[0-9]{6}$" },
|
|
2595
|
+
{ code: "KM", name: "Comoros", dialCode: "+269", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2596
|
+
{ code: "CG", name: "Congo", dialCode: "+242", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2597
|
+
{ code: "CR", name: "Costa Rica", dialCode: "+506", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2598
|
+
{ code: "HR", name: "Croatia", dialCode: "+385", passportRegex: "^[A-Z]{3}[0-9]{6}$" },
|
|
2599
|
+
{ code: "CU", name: "Cuba", dialCode: "+53", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2600
|
+
{ code: "CY", name: "Cyprus", dialCode: "+357", passportRegex: "^[A-Z]{2}[0-9]{6}$" },
|
|
2601
|
+
{ code: "CZ", name: "Czech Republic", dialCode: "+420", passportRegex: "^[0-9]{8}$" },
|
|
2602
|
+
{ code: "DK", name: "Denmark", dialCode: "+45", passportRegex: "^[A-Z0-9]{9}$" },
|
|
2603
|
+
{ code: "DJ", name: "Djibouti", dialCode: "+253", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2604
|
+
{ code: "DM", name: "Dominica", dialCode: "+1", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2605
|
+
{ code: "DO", name: "Dominican Republic", dialCode: "+1", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2606
|
+
{ code: "EC", name: "Ecuador", dialCode: "+593", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2607
|
+
{ code: "EG", name: "Egypt", dialCode: "+20", passportRegex: "^[A-Z][0-9]{7}$" },
|
|
2608
|
+
{ code: "SV", name: "El Salvador", dialCode: "+503", passportRegex: "^[A-Z]{1}[0-9]{7}$" },
|
|
2609
|
+
{ code: "GQ", name: "Equatorial Guinea", dialCode: "+240", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2610
|
+
{ code: "ER", name: "Eritrea", dialCode: "+291", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2611
|
+
{ code: "EE", name: "Estonia", dialCode: "+372", passportRegex: "^[A-Z0-9]{8}$" },
|
|
2612
|
+
{ code: "SZ", name: "Eswatini", dialCode: "+268", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2613
|
+
{ code: "ET", name: "Ethiopia", dialCode: "+251", passportRegex: "^[A-Z]{2}[0-9]{6}$" },
|
|
2614
|
+
{ code: "FJ", name: "Fiji", dialCode: "+679", passportRegex: "^[A-Z]{2}[0-9]{6}$" },
|
|
2615
|
+
{ code: "FI", name: "Finland", dialCode: "+358", passportRegex: "^[A-Z0-9]{9}$" },
|
|
2616
|
+
{ code: "FR", name: "France", dialCode: "+33", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2617
|
+
{ code: "GA", name: "Gabon", dialCode: "+241", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2618
|
+
{ code: "GM", name: "Gambia", dialCode: "+220", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2619
|
+
{ code: "GE", name: "Georgia", dialCode: "+995", passportRegex: "^[A-Z0-9]{8}$" },
|
|
2620
|
+
{ code: "DE", name: "Germany", dialCode: "+49", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2621
|
+
{ code: "GH", name: "Ghana", dialCode: "+233", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2622
|
+
{ code: "GR", name: "Greece", dialCode: "+30", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2623
|
+
{ code: "GD", name: "Grenada", dialCode: "+1", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2624
|
+
{ code: "GT", name: "Guatemala", dialCode: "+502", passportRegex: "^[A-Z]{3}[0-9]{6}$" },
|
|
2625
|
+
{ code: "GN", name: "Guinea", dialCode: "+224", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2626
|
+
{ code: "GW", name: "Guinea-Bissau", dialCode: "+245", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2627
|
+
{ code: "GY", name: "Guyana", dialCode: "+592", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2628
|
+
{ code: "HT", name: "Haiti", dialCode: "+509", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2629
|
+
{ code: "HN", name: "Honduras", dialCode: "+504", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2630
|
+
{ code: "HK", name: "Hong Kong", dialCode: "+852", passportRegex: "^[A-Z]{1}[0-9]{7}$" },
|
|
2631
|
+
{ code: "HU", name: "Hungary", dialCode: "+36", passportRegex: "^[A-Z]{2}[0-9]{6}$" },
|
|
2632
|
+
{ code: "IS", name: "Iceland", dialCode: "+354", passportRegex: "^[A-Z]{2}[0-9]{6}$" },
|
|
2633
|
+
{ code: "IN", name: "India", dialCode: "+91", passportRegex: "^[A-Z][0-9]{7}$" },
|
|
2634
|
+
{ code: "ID", name: "Indonesia", dialCode: "+62", passportRegex: "^[A-Z]{1}[0-9]{7}$" },
|
|
2635
|
+
{ code: "IR", name: "Iran", dialCode: "+98", passportRegex: "^[A-Z]{1}[0-9]{7}$" },
|
|
2636
|
+
{ code: "IQ", name: "Iraq", dialCode: "+964", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2637
|
+
{ code: "IE", name: "Ireland", dialCode: "+353", passportRegex: "^[A-Z0-9]{2}[0-9]{7}$" },
|
|
2638
|
+
{ code: "IL", name: "Israel", dialCode: "+972", passportRegex: "^[0-9]{8,9}$" },
|
|
2639
|
+
{ code: "IT", name: "Italy", dialCode: "+39", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2640
|
+
{ code: "JM", name: "Jamaica", dialCode: "+1", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2641
|
+
{ code: "JP", name: "Japan", dialCode: "+81", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2642
|
+
{ code: "JO", name: "Jordan", dialCode: "+962", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2643
|
+
{ code: "KZ", name: "Kazakhstan", dialCode: "+7", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2644
|
+
{ code: "KE", name: "Kenya", dialCode: "+254", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2645
|
+
{ code: "KI", name: "Kiribati", dialCode: "+686", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2646
|
+
{ code: "KP", name: "North Korea", dialCode: "+850", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2647
|
+
{ code: "KR", name: "South Korea", dialCode: "+82", passportRegex: "^[A-Z]{1}[0-9]{8}$" },
|
|
2648
|
+
{ code: "KW", name: "Kuwait", dialCode: "+965", passportRegex: "^[A-Z]{1}[0-9]{7}$" },
|
|
2649
|
+
{ code: "KG", name: "Kyrgyzstan", dialCode: "+996", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2650
|
+
{ code: "LA", name: "Laos", dialCode: "+856", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2651
|
+
{ code: "LV", name: "Latvia", dialCode: "+371", passportRegex: "^[A-Z0-9]{8}$" },
|
|
2652
|
+
{ code: "LB", name: "Lebanon", dialCode: "+961", passportRegex: "^[A-Z]{1}[0-9]{7}$" },
|
|
2653
|
+
{ code: "LS", name: "Lesotho", dialCode: "+266", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2654
|
+
{ code: "LR", name: "Liberia", dialCode: "+231", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2655
|
+
{ code: "LY", name: "Libya", dialCode: "+218", passportRegex: "^[A-Z]{1}[0-9]{7}$" },
|
|
2656
|
+
{ code: "LI", name: "Liechtenstein", dialCode: "+423", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2657
|
+
{ code: "LT", name: "Lithuania", dialCode: "+370", passportRegex: "^[A-Z0-9]{8}$" },
|
|
2658
|
+
{ code: "LU", name: "Luxembourg", dialCode: "+352", passportRegex: "^[A-Z0-9]{8}$" },
|
|
2659
|
+
{ code: "MO", name: "Macau", dialCode: "+853", passportRegex: "^[A-Z]{1}[0-9]{7}$" },
|
|
2660
|
+
{ code: "MG", name: "Madagascar", dialCode: "+261", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2661
|
+
{ code: "MW", name: "Malawi", dialCode: "+265", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2662
|
+
{ code: "MY", name: "Malaysia", dialCode: "+60", passportRegex: "^[A-Z]{1}[0-9]{8}$" },
|
|
2663
|
+
{ code: "MV", name: "Maldives", dialCode: "+960", passportRegex: "^[A-Z]{1}[0-9]{7}$" },
|
|
2664
|
+
{ code: "ML", name: "Mali", dialCode: "+223", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2665
|
+
{ code: "MT", name: "Malta", dialCode: "+356", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2666
|
+
{ code: "MH", name: "Marshall Islands", dialCode: "+692", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2667
|
+
{ code: "MQ", name: "Martinique", dialCode: "+596", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2668
|
+
{ code: "MR", name: "Mauritania", dialCode: "+222", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2669
|
+
{ code: "MU", name: "Mauritius", dialCode: "+230", passportRegex: "^[A-Z]{2}[0-9]{6}$" },
|
|
2670
|
+
{ code: "MX", name: "Mexico", dialCode: "+52", passportRegex: "^[A-Z]{1}[0-9]{8}$" },
|
|
2671
|
+
{ code: "FM", name: "Micronesia", dialCode: "+691", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2672
|
+
{ code: "MD", name: "Moldova", dialCode: "+373", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2673
|
+
{ code: "MC", name: "Monaco", dialCode: "+377", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2674
|
+
{ code: "MN", name: "Mongolia", dialCode: "+976", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2675
|
+
{ code: "ME", name: "Montenegro", dialCode: "+382", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2676
|
+
{ code: "MS", name: "Montserrat", dialCode: "+1", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2677
|
+
{ code: "MA", name: "Morocco", dialCode: "+212", passportRegex: "^[A-Z]{2}[0-9]{6}$" },
|
|
2678
|
+
{ code: "MZ", name: "Mozambique", dialCode: "+258", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2679
|
+
{ code: "MM", name: "Myanmar", dialCode: "+95", passportRegex: "^[A-Z]{1}[0-9]{6,7}$" },
|
|
2680
|
+
{ code: "NA", name: "Namibia", dialCode: "+264", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2681
|
+
{ code: "NR", name: "Nauru", dialCode: "+674", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2682
|
+
{ code: "NP", name: "Nepal", dialCode: "+977", passportRegex: "^[A-Z]{1}[0-9]{7}$" },
|
|
2683
|
+
{ code: "NL", name: "Netherlands", dialCode: "+31", passportRegex: "^[A-Z]{2}[0-9]{6}$" },
|
|
2684
|
+
{ code: "NC", name: "New Caledonia", dialCode: "+687", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2685
|
+
{ code: "NZ", name: "New Zealand", dialCode: "+64", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2686
|
+
{ code: "NI", name: "Nicaragua", dialCode: "+505", passportRegex: "^[A-Z]{3}[0-9]{6}$" },
|
|
2687
|
+
{ code: "NE", name: "Niger", dialCode: "+227", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2688
|
+
{ code: "NG", name: "Nigeria", dialCode: "+234", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2689
|
+
{ code: "NO", name: "Norway", dialCode: "+47", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2690
|
+
{ code: "OM", name: "Oman", dialCode: "+968", passportRegex: "^[A-Z]{1}[0-9]{7}$" },
|
|
2691
|
+
{ code: "PK", name: "Pakistan", dialCode: "+92", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2692
|
+
{ code: "PW", name: "Palau", dialCode: "+680", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2693
|
+
{ code: "PS", name: "Palestine", dialCode: "+970", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2694
|
+
{ code: "PA", name: "Panama", dialCode: "+507", passportRegex: "^[A-Z]{1}[0-9]{7}$" },
|
|
2695
|
+
{ code: "PG", name: "Papua New Guinea", dialCode: "+675", passportRegex: "^[A-Z]{2}[0-9]{6}$" },
|
|
2696
|
+
{ code: "PY", name: "Paraguay", dialCode: "+595", passportRegex: "^[A-Z]{2}[0-9]{6}$" },
|
|
2697
|
+
{ code: "PE", name: "Peru", dialCode: "+51", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2698
|
+
{ code: "PH", name: "Philippines", dialCode: "+63", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2699
|
+
{ code: "PL", name: "Poland", dialCode: "+48", passportRegex: "^[A-Z0-9]{2}[0-9]{7}$" },
|
|
2700
|
+
{ code: "PT", name: "Portugal", dialCode: "+351", passportRegex: "^[A-Z]{2}[0-9]{6}$" },
|
|
2701
|
+
{ code: "RO", name: "Romania", dialCode: "+40", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2702
|
+
{ code: "RU", name: "Russia", dialCode: "+7", passportRegex: "^[0-9]{9}$" },
|
|
2703
|
+
{ code: "RW", name: "Rwanda", dialCode: "+250", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2704
|
+
{
|
|
2705
|
+
code: "KN",
|
|
2706
|
+
name: "Saint Kitts and Nevis",
|
|
2707
|
+
dialCode: "+1",
|
|
2708
|
+
passportRegex: "^[A-Z]{2}[0-9]{7}$"
|
|
2709
|
+
},
|
|
2710
|
+
{ code: "LC", name: "Saint Lucia", dialCode: "+1", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2711
|
+
{
|
|
2712
|
+
code: "VC",
|
|
2713
|
+
name: "Saint Vincent and the Grenadines",
|
|
2714
|
+
dialCode: "+1",
|
|
2715
|
+
passportRegex: "^[A-Z]{2}[0-9]{7}$"
|
|
2716
|
+
},
|
|
2717
|
+
{ code: "WS", name: "Samoa", dialCode: "+685", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2718
|
+
{ code: "SM", name: "San Marino", dialCode: "+378", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2719
|
+
{
|
|
2720
|
+
code: "ST",
|
|
2721
|
+
name: "Sao Tome and Principe",
|
|
2722
|
+
dialCode: "+239",
|
|
2723
|
+
passportRegex: "^[A-Z0-9]{6,10}$"
|
|
2724
|
+
},
|
|
2725
|
+
{ code: "SA", name: "Saudi Arabia", dialCode: "+966", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2726
|
+
{ code: "SN", name: "Senegal", dialCode: "+221", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2727
|
+
{ code: "RS", name: "Serbia", dialCode: "+381", passportRegex: "^[A-Z0-9]{9}$" },
|
|
2728
|
+
{ code: "SC", name: "Seychelles", dialCode: "+248", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2729
|
+
{ code: "SL", name: "Sierra Leone", dialCode: "+232", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2730
|
+
{ code: "SG", name: "Singapore", dialCode: "+65", passportRegex: "^[A-Z]{1}[0-9]{7}$" },
|
|
2731
|
+
{ code: "SK", name: "Slovakia", dialCode: "+421", passportRegex: "^[0-9]{9}$" },
|
|
2732
|
+
{ code: "SI", name: "Slovenia", dialCode: "+386", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2733
|
+
{ code: "SB", name: "Solomon Islands", dialCode: "+677", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2734
|
+
{ code: "SO", name: "Somalia", dialCode: "+252", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2735
|
+
{ code: "ZA", name: "South Africa", dialCode: "+27", passportRegex: "^[A-Z]{2}[0-9]{6}$" },
|
|
2736
|
+
{ code: "ES", name: "Spain", dialCode: "+34", passportRegex: "^[A-Z]{3}[0-9]{6}$" },
|
|
2737
|
+
{ code: "LK", name: "Sri Lanka", dialCode: "+94", passportRegex: "^[A-Z]{1}[0-9]{7}$" },
|
|
2738
|
+
{ code: "SD", name: "Sudan", dialCode: "+249", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2739
|
+
{ code: "SR", name: "Suriname", dialCode: "+597", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2740
|
+
{ code: "SE", name: "Sweden", dialCode: "+46", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2741
|
+
{ code: "CH", name: "Switzerland", dialCode: "+41", passportRegex: "^[A-Z]{1}[0-9]{7}$" },
|
|
2742
|
+
{ code: "SY", name: "Syria", dialCode: "+963", passportRegex: "^[A-Z]{1}[0-9]{7}$" },
|
|
2743
|
+
{ code: "TW", name: "Taiwan", dialCode: "+886", passportRegex: "^[A-Z]{1}[0-9]{8}$" },
|
|
2744
|
+
{ code: "TJ", name: "Tajikistan", dialCode: "+992", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2745
|
+
{ code: "TZ", name: "Tanzania", dialCode: "+255", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2746
|
+
{ code: "TH", name: "Thailand", dialCode: "+66", passportRegex: "^[A-Z]{1}[0-9]{7}$" },
|
|
2747
|
+
{ code: "TL", name: "Timor-Leste", dialCode: "+670", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2748
|
+
{ code: "TG", name: "Togo", dialCode: "+228", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2749
|
+
{ code: "TO", name: "Tonga", dialCode: "+676", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2750
|
+
{ code: "TT", name: "Trinidad and Tobago", dialCode: "+1", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2751
|
+
{ code: "TN", name: "Tunisia", dialCode: "+216", passportRegex: "^[A-Z]{1}[0-9]{7}$" },
|
|
2752
|
+
{ code: "TR", name: "Turkey", dialCode: "+90", passportRegex: "^[A-Z]{1}[0-9]{7}$" },
|
|
2753
|
+
{ code: "TM", name: "Turkmenistan", dialCode: "+993", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2754
|
+
{
|
|
2755
|
+
code: "TC",
|
|
2756
|
+
name: "Turks and Caicos Islands",
|
|
2757
|
+
dialCode: "+1",
|
|
2758
|
+
passportRegex: "^[A-Z0-9]{6,10}$"
|
|
2759
|
+
},
|
|
2760
|
+
{ code: "TV", name: "Tuvalu", dialCode: "+688", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2761
|
+
{ code: "UG", name: "Uganda", dialCode: "+256", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2762
|
+
{ code: "UA", name: "Ukraine", dialCode: "+380", passportRegex: "^[A-Z]{2}[0-9]{6}$" },
|
|
2763
|
+
{
|
|
2764
|
+
code: "AE",
|
|
2765
|
+
name: "United Arab Emirates",
|
|
2766
|
+
dialCode: "+971",
|
|
2767
|
+
passportRegex: "^[A-Z]{1}[0-9]{7}$"
|
|
2768
|
+
},
|
|
2769
|
+
{ code: "GB", name: "United Kingdom", dialCode: "+44", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2770
|
+
{ code: "US", name: "United States", dialCode: "+1", passportRegex: "^[0-9]{9}$" },
|
|
2771
|
+
{ code: "UY", name: "Uruguay", dialCode: "+598", passportRegex: "^[A-Z]{3}[0-9]{6}$" },
|
|
2772
|
+
{ code: "UZ", name: "Uzbekistan", dialCode: "+998", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2773
|
+
{ code: "VU", name: "Vanuatu", dialCode: "+678", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2774
|
+
{ code: "VA", name: "Vatican City", dialCode: "+379", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2775
|
+
{ code: "VE", name: "Venezuela", dialCode: "+58", passportRegex: "^[A-Z]{2}[0-9]{7}$" },
|
|
2776
|
+
{ code: "VN", name: "Vietnam", dialCode: "+84", passportRegex: "^[A-Z]{1}[0-9]{7}$" },
|
|
2777
|
+
{ code: "YE", name: "Yemen", dialCode: "+967", passportRegex: "^[A-Z]{1}[0-9]{7}$" },
|
|
2778
|
+
{ code: "ZM", name: "Zambia", dialCode: "+260", passportRegex: "^[A-Z0-9]{6,10}$" },
|
|
2779
|
+
{ code: "ZW", name: "Zimbabwe", dialCode: "+263", passportRegex: "^[A-Z0-9]{6,10}$" }
|
|
2780
|
+
];
|
|
2781
|
+
var useStyles8 = makeStyles({
|
|
2782
|
+
dialogTitle: {
|
|
2783
|
+
display: "flex",
|
|
2784
|
+
justifyContent: "space-between",
|
|
2785
|
+
alignItems: "center",
|
|
2786
|
+
paddingRight: "8px"
|
|
2787
|
+
},
|
|
2788
|
+
dialogSurface: {
|
|
2789
|
+
maxWidth: "600px",
|
|
2790
|
+
width: "100%"
|
|
2791
|
+
},
|
|
2792
|
+
closeButton: {
|
|
2793
|
+
minWidth: "32px",
|
|
2794
|
+
minHeight: "32px"
|
|
2795
|
+
},
|
|
2796
|
+
content: {
|
|
2797
|
+
display: "flex",
|
|
2798
|
+
flexDirection: "column",
|
|
2799
|
+
gap: "0px",
|
|
2800
|
+
paddingTop: "10px",
|
|
2801
|
+
paddingLeft: "10px",
|
|
2802
|
+
paddingRight: "10px"
|
|
2803
|
+
},
|
|
2804
|
+
searchInput: {
|
|
2805
|
+
width: "100%",
|
|
2806
|
+
marginBottom: "16px"
|
|
2807
|
+
},
|
|
2808
|
+
resultList: {
|
|
2809
|
+
display: "flex",
|
|
2810
|
+
flexDirection: "column",
|
|
2811
|
+
gap: "0px",
|
|
2812
|
+
maxHeight: "400px",
|
|
2813
|
+
overflowY: "auto",
|
|
2814
|
+
paddingRight: "1rem"
|
|
2815
|
+
},
|
|
2816
|
+
resultItem: {
|
|
2817
|
+
padding: "16px 20px",
|
|
2818
|
+
borderBottom: `1px solid ${tokens.colorNeutralStroke2}`,
|
|
2819
|
+
cursor: "pointer",
|
|
2820
|
+
transition: "all 0.2s ease",
|
|
2821
|
+
backgroundColor: tokens.colorNeutralBackground1,
|
|
2822
|
+
position: "relative",
|
|
2823
|
+
":hover": {
|
|
2824
|
+
backgroundColor: tokens.colorNeutralBackground1Hover,
|
|
2825
|
+
borderBottom: `1px solid ${tokens.colorBrandBackground}`
|
|
2826
|
+
}
|
|
2827
|
+
},
|
|
2828
|
+
resultItemSelected: {
|
|
2829
|
+
backgroundColor: tokens.colorNeutralBackground1,
|
|
2830
|
+
borderLeft: `4px solid ${tokens.colorBrandBackground}`,
|
|
2831
|
+
paddingLeft: "16px"
|
|
2832
|
+
},
|
|
2833
|
+
harborName: {
|
|
2834
|
+
fontSize: tokens.fontSizeBase300,
|
|
2835
|
+
fontWeight: tokens.fontWeightRegular,
|
|
2836
|
+
color: tokens.colorNeutralForeground1,
|
|
2837
|
+
marginBottom: "2px"
|
|
2838
|
+
},
|
|
2839
|
+
harborLocation: {
|
|
2840
|
+
fontSize: tokens.fontSizeBase200,
|
|
2841
|
+
color: tokens.colorNeutralForeground3
|
|
2842
|
+
},
|
|
2843
|
+
buttonContainer: {
|
|
2844
|
+
display: "flex",
|
|
2845
|
+
gap: "1rem",
|
|
2846
|
+
marginBottom: "1rem",
|
|
2847
|
+
flexWrap: "wrap"
|
|
2848
|
+
},
|
|
2849
|
+
circularButton: {
|
|
2850
|
+
borderRadius: tokens.borderRadiusCircular
|
|
2851
|
+
},
|
|
2852
|
+
headerRow: {
|
|
2853
|
+
display: "flex",
|
|
2854
|
+
justifyContent: "space-between",
|
|
2855
|
+
marginTop: "1rem",
|
|
2856
|
+
marginBottom: "1rem"
|
|
2857
|
+
},
|
|
2858
|
+
dangerText: {
|
|
2859
|
+
color: tokens.colorStatusDangerForeground1
|
|
2860
|
+
},
|
|
2861
|
+
historyItem: {
|
|
2862
|
+
display: "flex",
|
|
2863
|
+
justifyContent: "space-between",
|
|
2864
|
+
marginTop: "1rem",
|
|
2865
|
+
marginBottom: "1rem"
|
|
2866
|
+
},
|
|
2867
|
+
iconMargin: {
|
|
2868
|
+
marginRight: "0.5rem"
|
|
2869
|
+
},
|
|
2870
|
+
cursorPointer: {
|
|
2871
|
+
cursor: "pointer"
|
|
2872
|
+
},
|
|
2873
|
+
sectionTitle: {
|
|
2874
|
+
marginTop: "1rem",
|
|
2875
|
+
marginBottom: "1rem"
|
|
2876
|
+
},
|
|
2877
|
+
harborList: {
|
|
2878
|
+
display: "flex",
|
|
2879
|
+
flexDirection: "column",
|
|
2880
|
+
gap: "1rem",
|
|
2881
|
+
marginBottom: "1rem"
|
|
2882
|
+
},
|
|
2883
|
+
harborItem: {
|
|
2884
|
+
display: "flex",
|
|
2885
|
+
justifyContent: "space-between"
|
|
2886
|
+
},
|
|
2887
|
+
emptyState: {
|
|
2888
|
+
textAlign: "center",
|
|
2889
|
+
padding: "32px",
|
|
2890
|
+
color: tokens.colorNeutralForeground3
|
|
2891
|
+
}
|
|
2892
|
+
});
|
|
2893
|
+
var ModalSearchHarbor = ({
|
|
2894
|
+
open,
|
|
2895
|
+
onClose,
|
|
2896
|
+
title = "Pilih Pelabuhan",
|
|
2897
|
+
modalType = "origin",
|
|
2898
|
+
harbors,
|
|
2899
|
+
favoriteHarbors,
|
|
2900
|
+
lastSearchedHarbors,
|
|
2901
|
+
isLoading = false,
|
|
2902
|
+
searchQuery,
|
|
2903
|
+
onSearchChange,
|
|
2904
|
+
onSelectHarbor,
|
|
2905
|
+
onToggleFavorite,
|
|
2906
|
+
onAddLastSearched,
|
|
2907
|
+
onRemoveLastSearched,
|
|
2908
|
+
onClearLastSearched
|
|
2909
|
+
}) => {
|
|
2910
|
+
const styles = useStyles8();
|
|
2911
|
+
const handleSelect = (harbor) => {
|
|
2912
|
+
onAddLastSearched(harbor);
|
|
2913
|
+
onSelectHarbor(harbor);
|
|
2914
|
+
onSearchChange("");
|
|
2915
|
+
};
|
|
2916
|
+
const handleClose = () => {
|
|
2917
|
+
onClose();
|
|
2918
|
+
onSearchChange("");
|
|
2919
|
+
};
|
|
2920
|
+
return /* @__PURE__ */ jsx(
|
|
2921
|
+
Dialog,
|
|
2922
|
+
{
|
|
2923
|
+
open,
|
|
2924
|
+
onOpenChange: (_, data) => {
|
|
2925
|
+
if (!data.open) {
|
|
2926
|
+
onClose();
|
|
2927
|
+
}
|
|
2928
|
+
},
|
|
2929
|
+
children: /* @__PURE__ */ jsx(DialogSurface, { className: styles.dialogSurface, children: /* @__PURE__ */ jsxs(DialogBody, { children: [
|
|
2930
|
+
/* @__PURE__ */ jsx(
|
|
2931
|
+
DialogTitle,
|
|
2932
|
+
{
|
|
2933
|
+
action: /* @__PURE__ */ jsx(
|
|
2934
|
+
Button,
|
|
2935
|
+
{
|
|
2936
|
+
appearance: "subtle",
|
|
2937
|
+
"aria-label": "close",
|
|
2938
|
+
icon: /* @__PURE__ */ jsx(Icon, { icon: "fluent:dismiss-24-regular" }),
|
|
2939
|
+
onClick: handleClose,
|
|
2940
|
+
className: styles.closeButton
|
|
2941
|
+
}
|
|
2942
|
+
),
|
|
2943
|
+
children: title
|
|
2944
|
+
}
|
|
2945
|
+
),
|
|
2946
|
+
/* @__PURE__ */ jsxs(DialogContent, { className: styles.content, children: [
|
|
2947
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
2948
|
+
Input,
|
|
2949
|
+
{
|
|
2950
|
+
className: styles.searchInput,
|
|
2951
|
+
value: searchQuery,
|
|
2952
|
+
onChange: (e) => onSearchChange(e.target.value),
|
|
2953
|
+
placeholder: "Cari Pelabuhan...",
|
|
2954
|
+
contentBefore: /* @__PURE__ */ jsx(Icon, { icon: "fluent:search-24-regular", color: tokens.colorNeutralForeground3 }),
|
|
2955
|
+
size: "large"
|
|
2956
|
+
}
|
|
2957
|
+
) }),
|
|
2958
|
+
favoriteHarbors.length > 0 && /* @__PURE__ */ jsx("div", { className: styles.buttonContainer, children: favoriteHarbors.map((harbor) => /* @__PURE__ */ jsx(
|
|
2959
|
+
Button,
|
|
2960
|
+
{
|
|
2961
|
+
onClick: () => handleSelect(harbor),
|
|
2962
|
+
size: "medium",
|
|
2963
|
+
appearance: "outline",
|
|
2964
|
+
iconPosition: "before",
|
|
2965
|
+
className: styles.circularButton,
|
|
2966
|
+
icon: /* @__PURE__ */ jsx(Icon, { icon: "fluent:ribbon-20-filled" }),
|
|
2967
|
+
children: /* @__PURE__ */ jsx(Body1, { children: harbor.name })
|
|
2968
|
+
},
|
|
2969
|
+
harbor.id
|
|
2970
|
+
)) }),
|
|
2971
|
+
/* @__PURE__ */ jsx(Divider, {}),
|
|
2972
|
+
/* @__PURE__ */ jsxs("div", { className: styles.resultList, children: [
|
|
2973
|
+
lastSearchedHarbors.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2974
|
+
/* @__PURE__ */ jsxs("div", { className: styles.headerRow, children: [
|
|
2975
|
+
/* @__PURE__ */ jsx(Body1Strong, { children: "Terakhir dicari" }),
|
|
2976
|
+
/* @__PURE__ */ jsx(
|
|
2977
|
+
Caption1,
|
|
2978
|
+
{
|
|
2979
|
+
className: `${styles.dangerText} ${styles.cursorPointer}`,
|
|
2980
|
+
onClick: onClearLastSearched,
|
|
2981
|
+
children: "Hapus Semua"
|
|
2982
|
+
}
|
|
2983
|
+
)
|
|
2984
|
+
] }),
|
|
2985
|
+
/* @__PURE__ */ jsx("div", { children: lastSearchedHarbors.map((harbor) => /* @__PURE__ */ jsxs("div", { className: styles.historyItem, children: [
|
|
2986
|
+
/* @__PURE__ */ jsxs(
|
|
2987
|
+
"div",
|
|
2988
|
+
{
|
|
2989
|
+
style: { cursor: "pointer" },
|
|
2990
|
+
onClick: () => handleSelect(harbor),
|
|
2991
|
+
children: [
|
|
2992
|
+
/* @__PURE__ */ jsx(Icon, { icon: "fluent:vehicle-ship-24-regular", className: styles.iconMargin }),
|
|
2993
|
+
harbor.name
|
|
2994
|
+
]
|
|
2995
|
+
}
|
|
2996
|
+
),
|
|
2997
|
+
/* @__PURE__ */ jsx(
|
|
2998
|
+
Icon,
|
|
2999
|
+
{
|
|
3000
|
+
onClick: () => onRemoveLastSearched(harbor.id),
|
|
3001
|
+
icon: "fluent:dismiss-24-regular",
|
|
3002
|
+
color: tokens.colorStatusDangerForeground1,
|
|
3003
|
+
className: styles.cursorPointer
|
|
3004
|
+
}
|
|
3005
|
+
)
|
|
3006
|
+
] }, harbor.id)) }),
|
|
3007
|
+
/* @__PURE__ */ jsx(Divider, {})
|
|
3008
|
+
] }),
|
|
3009
|
+
/* @__PURE__ */ jsx(Body1Strong, { className: styles.sectionTitle, children: "Semua Pelabuhan" }),
|
|
3010
|
+
/* @__PURE__ */ jsx("div", { className: styles.harborList, children: isLoading ? /* @__PURE__ */ jsx("div", { className: styles.emptyState, children: "Memuat data..." }) : harbors.length > 0 ? harbors.map((harbor, index) => /* @__PURE__ */ jsxs("div", { className: styles.harborItem, children: [
|
|
3011
|
+
/* @__PURE__ */ jsxs(
|
|
3012
|
+
"div",
|
|
3013
|
+
{
|
|
3014
|
+
className: styles.cursorPointer,
|
|
3015
|
+
onClick: () => handleSelect(harbor),
|
|
3016
|
+
children: [
|
|
3017
|
+
/* @__PURE__ */ jsx(Icon, { icon: "fluent:vehicle-ship-24-regular", className: styles.iconMargin }),
|
|
3018
|
+
harbor.name
|
|
3019
|
+
]
|
|
3020
|
+
}
|
|
3021
|
+
),
|
|
3022
|
+
/* @__PURE__ */ jsx(
|
|
3023
|
+
Icon,
|
|
3024
|
+
{
|
|
3025
|
+
icon: favoriteHarbors.find((fav) => fav.id === harbor.id) ? "fluent:star-24-filled" : "fluent:star-24-regular",
|
|
3026
|
+
color: tokens.colorBrandBackground,
|
|
3027
|
+
className: styles.cursorPointer,
|
|
3028
|
+
onClick: () => onToggleFavorite(harbor)
|
|
3029
|
+
}
|
|
3030
|
+
)
|
|
3031
|
+
] }, index)) : /* @__PURE__ */ jsx("div", { className: styles.emptyState, children: "Pelabuhan tidak ditemukan" }) })
|
|
3032
|
+
] })
|
|
3033
|
+
] })
|
|
3034
|
+
] }) })
|
|
3035
|
+
}
|
|
3036
|
+
);
|
|
3037
|
+
};
|
|
1072
3038
|
|
|
1073
|
-
export { BackgroundTicketCard_default as BackgroundTicketCard, BackgroundTicketCardVertical_default as BackgroundTicketCardVertical, CardBanner, CardPromo, CardServiceMenu, CardTicket, CarouselWithCustomNav, MODAL_PRESETS, ModalIllustration, getModalPreset };
|
|
3039
|
+
export { BackgroundTicketCard_default as BackgroundTicketCard, BackgroundTicketCardVertical_default as BackgroundTicketCardVertical, CardBanner, CardPromo, CardServiceMenu, CardTicket, CarouselWithCustomNav, DEFAULT_COUNTRY_CODES2 as DEFAULT_COUNTRY_CODES, InputDynamic_default as InputDynamic, MODAL_PRESETS, ModalIllustration, ModalSearchHarbor, getModalPreset };
|
|
1074
3040
|
//# sourceMappingURL=index.mjs.map
|
|
1075
3041
|
//# sourceMappingURL=index.mjs.map
|