@asdp/ferryui 0.1.22-dev.9771 → 0.1.22-dev.9800

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.mjs CHANGED
@@ -1700,7 +1700,7 @@ var CardTicket = ({
1700
1700
  },
1701
1701
  children: [
1702
1702
  /* @__PURE__ */ jsx(Subtitle2, { children: mergedLabels.totalPriceLabel }),
1703
- /* @__PURE__ */ jsxs(
1703
+ /* @__PURE__ */ jsx(
1704
1704
  Title3,
1705
1705
  {
1706
1706
  style: {
@@ -1708,11 +1708,7 @@ var CardTicket = ({
1708
1708
  flex: "column",
1709
1709
  justifyContent: "end"
1710
1710
  },
1711
- children: [
1712
- mergedLabels.currencySymbol,
1713
- "\xA0",
1714
- departureItem?.billingDetail?.total?.formatted
1715
- ]
1711
+ children: departureItem?.billingDetail?.total?.formatted
1716
1712
  }
1717
1713
  )
1718
1714
  ]
@@ -5471,7 +5467,7 @@ var DEFAULT_LABELS8 = {
5471
5467
  departureDateLabel: "Tanggal Berangkat",
5472
5468
  returnDateLabel: "Tanggal Pulang",
5473
5469
  serviceClassLabel: "Kelas Layanan",
5474
- typeOfServiceLabel: "Jenis Layanan",
5470
+ typeOfServiceLabel: "Jenis Penumpang",
5475
5471
  passengerLabel: "Penumpang",
5476
5472
  roundTripLabel: "Pulang Pergi",
5477
5473
  searchButton: "Cari Tiket",
@@ -5480,7 +5476,7 @@ var DEFAULT_LABELS8 = {
5480
5476
  placeholderDepartureDate: "Pilih Tanggal Keberangkatan",
5481
5477
  placeholderReturnDate: "Pilih Tanggal Kepulangan",
5482
5478
  placeholderTypeClass: "Pilih Kelas Layanan",
5483
- placeholderTypeService: "Pilih Jenis Layanan",
5479
+ placeholderTypeService: "Pilih Jenis Penumpang",
5484
5480
  placeholderPassenger: "Pilih Jumlah Penumpang",
5485
5481
  errorOriginRequired: "Pelabuhan asal wajib diisi",
5486
5482
  errorDestinationRequired: "Pelabuhan tujuan wajib diisi",
@@ -5499,7 +5495,7 @@ var DEFAULT_LABELS8 = {
5499
5495
  departureDateLabel: "Departure Date",
5500
5496
  returnDateLabel: "Return Date",
5501
5497
  serviceClassLabel: "Service Class",
5502
- typeOfServiceLabel: "Service Type",
5498
+ typeOfServiceLabel: "Type Of Passenger",
5503
5499
  passengerLabel: "Passenger",
5504
5500
  roundTripLabel: "Round Trip",
5505
5501
  searchButton: "Search Ticket",
@@ -6176,7 +6172,7 @@ var DEFAULT_LABELS9 = {
6176
6172
  destinationHarbor: "Pelabuhan Tujuan",
6177
6173
  departureDate: "Tanggal Keberangkatan",
6178
6174
  serviceClass: "Kelas Layanan",
6179
- typeOfService: "Jenis Layanan",
6175
+ typeOfService: "Jenis Penumpang",
6180
6176
  totalPassengers: "Jumlah Penumpang",
6181
6177
  changeSearchButton: "Ganti Pencarian",
6182
6178
  swapAriaLabel: "Tukar asal dan tujuan"
@@ -6186,7 +6182,7 @@ var DEFAULT_LABELS9 = {
6186
6182
  destinationHarbor: "Destination Port",
6187
6183
  departureDate: "Departure Date",
6188
6184
  serviceClass: "Service Class",
6189
- typeOfService: "Service Type",
6185
+ typeOfService: "Type Of Passenger",
6190
6186
  totalPassengers: "Total Passengers",
6191
6187
  changeSearchButton: "Change Search",
6192
6188
  swapAriaLabel: "Swap origin and destination"
@@ -8302,20 +8298,20 @@ var ModalTotalPassengers = ({
8302
8298
  // src/components/ModalTypeOfService/ModalTypeOfService.constants.ts
8303
8299
  var DEFAULT_LABELS15 = {
8304
8300
  id: {
8305
- title: "Pilih Jenis Layanan",
8301
+ title: "Pilih Jenis Penumpang",
8306
8302
  cancelButton: "Batal",
8307
8303
  saveButton: "Simpan",
8308
8304
  vehiclesAlt: "kendaraan",
8309
8305
  closeAriaLabel: "Tutup",
8310
- emptyContent: "Jenis Layanan"
8306
+ emptyContent: "Jenis Penumpang"
8311
8307
  },
8312
8308
  en: {
8313
- title: "Select Service Type",
8309
+ title: "Select Type Of Passenger",
8314
8310
  cancelButton: "Cancel",
8315
8311
  saveButton: "Save",
8316
8312
  vehiclesAlt: "vehicles",
8317
8313
  closeAriaLabel: "Close",
8318
- emptyContent: "Service Type"
8314
+ emptyContent: "Type Of Passenger"
8319
8315
  }
8320
8316
  };
8321
8317
  var DEFAULT_VEHICLE_ICONS = {
@@ -8510,7 +8506,8 @@ var HoverableRadioItem = ({
8510
8506
  item,
8511
8507
  imageRenderer,
8512
8508
  styles,
8513
- isChild = false
8509
+ isChild = false,
8510
+ onClick
8514
8511
  }) => {
8515
8512
  const [isHovered, setIsHovered] = useState(false);
8516
8513
  return /* @__PURE__ */ jsxs(
@@ -8520,6 +8517,7 @@ var HoverableRadioItem = ({
8520
8517
  style: { padding: tokens.spacingHorizontalXS, cursor: "pointer" },
8521
8518
  onMouseEnter: () => setIsHovered(true),
8522
8519
  onMouseLeave: () => setIsHovered(false),
8520
+ onClick,
8523
8521
  children: [
8524
8522
  /* @__PURE__ */ jsx("div", { style: isChild ? void 0 : { marginLeft: 2 }, children: imageRenderer({
8525
8523
  src: item.image,
@@ -8740,7 +8738,8 @@ var ModalTypeOfService = ({
8740
8738
  item: childItem,
8741
8739
  imageRenderer,
8742
8740
  styles,
8743
- isChild: true
8741
+ isChild: true,
8742
+ onClick: () => setSelectedServiceId(childItem.id)
8744
8743
  },
8745
8744
  childIndex
8746
8745
  )) })
@@ -8755,7 +8754,8 @@ var ModalTypeOfService = ({
8755
8754
  item,
8756
8755
  imageRenderer,
8757
8756
  styles,
8758
- isChild: false
8757
+ isChild: false,
8758
+ onClick: () => setSelectedServiceId(item.id)
8759
8759
  },
8760
8760
  index
8761
8761
  );
@@ -8992,7 +8992,7 @@ var SortMenu = ({
8992
8992
  var DEFAULT_LABELS17 = {
8993
8993
  id: {
8994
8994
  title: "Filter dengan",
8995
- serviceTypeLabel: "Jenis Layanan",
8995
+ serviceTypeLabel: "Jenis Penumpang",
8996
8996
  departureTimeLabel: "Waktu pergi",
8997
8997
  arrivalTimeLabel: "Waktu tiba",
8998
8998
  priceLabel: "Harga",
@@ -10783,7 +10783,7 @@ var DEFAULT_LABELS23 = {
10783
10783
  cancelButton: "Batal",
10784
10784
  idTypeOtherLabel: "Tanggal lahir",
10785
10785
  idTypeOtherPlaceholder: "DD/MM/YYYY",
10786
- countryLabel: "Negara Penerbit Passport",
10786
+ countryLabel: "Negara Penerbit Paspor",
10787
10787
  countryPlaceholder: "Masukkan Negara",
10788
10788
  autofill: "Isi Data Otomatis",
10789
10789
  phoneNumberLabel: "Nomor Telepon",
@@ -10813,7 +10813,7 @@ var DEFAULT_LABELS23 = {
10813
10813
  minLengthName: "Nama minimal 3 karakter",
10814
10814
  requiredIdType: "Jenis ID harus dipilih",
10815
10815
  requiredIdNumber: "Nomor identitas harus diisi",
10816
- minLengthIdNumber: "Nomor identitas minimal 6 karakter",
10816
+ lengthIdNumber: "Nomor identitas minimal 6 karakter",
10817
10817
  requiredAge: "Usia harus diisi",
10818
10818
  minAge: "Usia minimal 1 tahun",
10819
10819
  maxAge: "Usia maksimal 150 tahun",
@@ -10823,7 +10823,9 @@ var DEFAULT_LABELS23 = {
10823
10823
  requiredCountry: "Negara harus diisi",
10824
10824
  requiredPhoneNumber: "Nomor telepon harus diisi",
10825
10825
  minLengthPhoneNumber: "Nomor telepon minimal 10 karakter",
10826
- invalidEmail: "Format email tidak valid"
10826
+ invalidEmail: "Format email tidak valid",
10827
+ invalidName: "Nama hanya boleh berisi huruf dan spasi",
10828
+ invalidIdNumber: "Format Nomor Identitas tidak valid"
10827
10829
  }
10828
10830
  },
10829
10831
  en: {
@@ -10879,7 +10881,7 @@ var DEFAULT_LABELS23 = {
10879
10881
  minLengthName: "Name must be at least 3 characters",
10880
10882
  requiredIdType: "ID type is required",
10881
10883
  requiredIdNumber: "Identity number is required",
10882
- minLengthIdNumber: "Identity number must be at least 6 characters",
10884
+ lengthIdNumber: "Identity number must be at least 6 characters",
10883
10885
  requiredAge: "Age is required",
10884
10886
  minAge: "Age must be at least 1 year",
10885
10887
  maxAge: "Age must be at most 150 years",
@@ -10889,7 +10891,9 @@ var DEFAULT_LABELS23 = {
10889
10891
  requiredCountry: "Country is required",
10890
10892
  requiredPhoneNumber: "Phone number is required",
10891
10893
  minLengthPhoneNumber: "Phone number must be at least 10 characters",
10892
- invalidEmail: "Invalid email format"
10894
+ invalidEmail: "Invalid email format",
10895
+ invalidName: "Name must only contain letters and spaces",
10896
+ invalidIdNumber: "Invalid Identity Number format"
10893
10897
  }
10894
10898
  }
10895
10899
  };
@@ -11086,7 +11090,7 @@ var ModalPassengerForm = ({
11086
11090
  titleOptions,
11087
11091
  countryOptions,
11088
11092
  cityOptions,
11089
- idTypeOptions,
11093
+ idTypes,
11090
11094
  ticketClassOptions,
11091
11095
  onScanComplete
11092
11096
  }) => {
@@ -11117,6 +11121,11 @@ var ModalPassengerForm = ({
11117
11121
  const watchIdentityTypeId = watch("identityTypeId");
11118
11122
  const watchPassportCountryId = watch("countryId");
11119
11123
  const watchBirthdate = watch("birthdate");
11124
+ const selectedIdentityType = idTypes.find(
11125
+ (type) => type.id.toString() === watchIdentityTypeId
11126
+ );
11127
+ const idRuleLengthMatch = selectedIdentityType?.rule?.match(/\{(\d+)(?:,\d+)?\}/);
11128
+ const dynamicMinLengthId = idRuleLengthMatch ? parseInt(idRuleLengthMatch[1], 10) : 6;
11120
11129
  useEffect(() => {
11121
11130
  const subscription = watch((value, { name, type }) => {
11122
11131
  console.log("Changed field:", name);
@@ -11346,22 +11355,22 @@ var ModalPassengerForm = ({
11346
11355
  children: /* @__PURE__ */ jsx(Subtitle1, { children: mergedLabels.selectIdTypeTitle })
11347
11356
  }
11348
11357
  ),
11349
- /* @__PURE__ */ jsx(DialogContent, { className: styles.content, children: /* @__PURE__ */ jsx("div", { className: styles.idTypeList, children: idTypeOptions.map((type) => /* @__PURE__ */ jsx(
11358
+ /* @__PURE__ */ jsx(DialogContent, { className: styles.content, children: /* @__PURE__ */ jsx("div", { className: styles.idTypeList, children: idTypes.map((type) => /* @__PURE__ */ jsx(
11350
11359
  "div",
11351
11360
  {
11352
11361
  className: styles.idTypeItem,
11353
- onClick: () => handleSelectIdType(Number(type.value)),
11362
+ onClick: () => handleSelectIdType(Number(type.id)),
11354
11363
  onKeyDown: (e) => {
11355
11364
  if (e.key === "Enter" || e.key === " ") {
11356
11365
  e.preventDefault();
11357
- handleSelectIdType(Number(type.value));
11366
+ handleSelectIdType(type.id);
11358
11367
  }
11359
11368
  },
11360
11369
  role: "button",
11361
11370
  tabIndex: 0,
11362
- children: /* @__PURE__ */ jsx("span", { className: styles.idTypeText, children: type.label })
11371
+ children: /* @__PURE__ */ jsx("span", { className: styles.idTypeText, children: type.name })
11363
11372
  },
11364
- type.value
11373
+ type.id
11365
11374
  )) }) })
11366
11375
  ] }) })
11367
11376
  }
@@ -11656,6 +11665,10 @@ var ModalPassengerForm = ({
11656
11665
  minLength: {
11657
11666
  value: 3,
11658
11667
  message: mergedErrors.minLengthName
11668
+ },
11669
+ pattern: {
11670
+ value: /^[a-zA-Z\s]+$/,
11671
+ message: mergedErrors.invalidName
11659
11672
  }
11660
11673
  }
11661
11674
  }
@@ -11705,7 +11718,10 @@ var ModalPassengerForm = ({
11705
11718
  type: "select",
11706
11719
  label: mergedLabels.idTypeLabel,
11707
11720
  placeholder: mergedLabels.idTypePlaceholder,
11708
- options: idTypeOptions,
11721
+ options: idTypes.map((t) => ({
11722
+ label: t.name,
11723
+ value: t.id.toString()
11724
+ })),
11709
11725
  size: "large",
11710
11726
  required: true,
11711
11727
  validationRules: {
@@ -11717,15 +11733,15 @@ var ModalPassengerForm = ({
11717
11733
  watchIdentityTypeId === IDENTITY_TYPE.PSP.toString() && /* @__PURE__ */ jsx(
11718
11734
  InputDynamic_default,
11719
11735
  {
11736
+ control,
11737
+ label: mergedLabels.countryLabel,
11720
11738
  menuPlacement: "top",
11721
11739
  name: "countryId",
11722
- control,
11723
11740
  options: countryOptions,
11724
- type: "select",
11725
- label: mergedLabels.countryLabel,
11726
11741
  placeholder: mergedLabels.countryPlaceholder,
11727
- size: "large",
11728
11742
  required: true,
11743
+ size: "large",
11744
+ type: "country",
11729
11745
  validationRules: {
11730
11746
  required: mergedErrors.requiredCountry
11731
11747
  }
@@ -11736,7 +11752,7 @@ var ModalPassengerForm = ({
11736
11752
  {
11737
11753
  name: "identityId",
11738
11754
  control,
11739
- type: watchIdentityTypeId === IDENTITY_TYPE.KTP.toString() ? "number" : "text",
11755
+ type: "text",
11740
11756
  label: mergedLabels.idNumberLabel,
11741
11757
  placeholder: mergedLabels.idNumberPlaceholder,
11742
11758
  size: "large",
@@ -11744,8 +11760,40 @@ var ModalPassengerForm = ({
11744
11760
  validationRules: {
11745
11761
  required: mergedErrors.requiredIdNumber,
11746
11762
  minLength: {
11747
- value: 6,
11748
- message: mergedErrors.minLengthIdNumber
11763
+ value: dynamicMinLengthId,
11764
+ message: mergedErrors.lengthIdNumber.replace(
11765
+ "6",
11766
+ dynamicMinLengthId.toString()
11767
+ )
11768
+ },
11769
+ ...selectedIdentityType?.rule ? {
11770
+ pattern: {
11771
+ value: new RegExp(
11772
+ selectedIdentityType.rule
11773
+ ),
11774
+ message: mergedErrors.invalidIdNumber
11775
+ }
11776
+ } : {}
11777
+ },
11778
+ onChange: (val) => {
11779
+ let cleaned = val;
11780
+ if (selectedIdentityType?.rule) {
11781
+ const match = selectedIdentityType.rule.match(/\[(.*?)\]/);
11782
+ if (match && match[1]) {
11783
+ const filterRegex = new RegExp(
11784
+ `[^${match[1]}]`,
11785
+ "g"
11786
+ );
11787
+ cleaned = val.replace(filterRegex, "");
11788
+ }
11789
+ } else {
11790
+ cleaned = val.replace(/[^a-zA-Z0-9]/g, "");
11791
+ }
11792
+ if (cleaned !== val) {
11793
+ setValue("identityId", cleaned, {
11794
+ shouldValidate: true,
11795
+ shouldDirty: true
11796
+ });
11749
11797
  }
11750
11798
  }
11751
11799
  }
@@ -12046,7 +12094,8 @@ var DEFAULT_LABELS25 = {
12046
12094
  vehicleNumberPlaceholder: "Contoh: B1234CD",
12047
12095
  hasLoadLabel: "Apakah kendaraan membawa muatan?",
12048
12096
  yesLabel: "Ya",
12049
- noLabel: "Tidak"
12097
+ noLabel: "Tidak",
12098
+ vehicleNumberFormatError: "Format Plat Nomor Tidak Valid"
12050
12099
  },
12051
12100
  en: {
12052
12101
  title: "Vehicle Details",
@@ -12054,7 +12103,8 @@ var DEFAULT_LABELS25 = {
12054
12103
  vehicleNumberPlaceholder: "Example: B1234CD",
12055
12104
  hasLoadLabel: "Does the vehicle carry a load?",
12056
12105
  yesLabel: "Yes",
12057
- noLabel: "No"
12106
+ noLabel: "No",
12107
+ vehicleNumberFormatError: "Invalid License Plate Format"
12058
12108
  }
12059
12109
  };
12060
12110
  var useStyles26 = makeStyles({
@@ -12137,7 +12187,28 @@ var CardVehicleDetail = ({
12137
12187
  name: vehicleNumberName,
12138
12188
  placeholder: mergedLabels.vehicleNumberPlaceholder,
12139
12189
  required: true,
12140
- type: "text"
12190
+ type: "text",
12191
+ onInput: (e) => {
12192
+ const target = e.currentTarget;
12193
+ const val = target.value;
12194
+ const formatted = val.toUpperCase().replace(/[^A-Z0-9]/g, "");
12195
+ if (val !== formatted) {
12196
+ const nativeInputValueSetter = Object.getOwnPropertyDescriptor(
12197
+ window.HTMLInputElement.prototype,
12198
+ "value"
12199
+ )?.set;
12200
+ if (nativeInputValueSetter) {
12201
+ nativeInputValueSetter.call(target, formatted);
12202
+ target.dispatchEvent(new Event("input", { bubbles: true }));
12203
+ }
12204
+ }
12205
+ },
12206
+ validationRules: {
12207
+ pattern: {
12208
+ value: /^[A-Z]{1,2}[0-9]{1,4}[A-Z]{1,4}$/,
12209
+ message: mergedLabels.vehicleNumberFormatError || "Format Plat Nomor Tidak Valid"
12210
+ }
12211
+ }
12141
12212
  }
12142
12213
  )
12143
12214
  ] }),