@asdp/ferryui 0.1.22-dev.10166 → 0.1.22-dev.10168
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.css +4 -4
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +12 -1
- package/dist/index.d.ts +12 -1
- package/dist/index.js +105 -55
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +105 -55
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -4255,7 +4255,8 @@ var InputDynamic = ({
|
|
|
4255
4255
|
const [isMobile, setIsMobile] = useState(false);
|
|
4256
4256
|
const [isInsideDialog, setIsInsideDialog] = useState(false);
|
|
4257
4257
|
useEffect(() => {
|
|
4258
|
-
if (typeof document === "undefined" || typeof window === "undefined")
|
|
4258
|
+
if (typeof document === "undefined" || typeof window === "undefined")
|
|
4259
|
+
return;
|
|
4259
4260
|
const provider = document.querySelector(
|
|
4260
4261
|
".fui-FluentProvider"
|
|
4261
4262
|
);
|
|
@@ -4577,7 +4578,9 @@ var InputDynamic = ({
|
|
|
4577
4578
|
if (!DIGITS_ONLY_REGEX.test(e.key)) {
|
|
4578
4579
|
e.preventDefault();
|
|
4579
4580
|
const fieldStr = typeof field.value === "string" ? field.value : "";
|
|
4580
|
-
const fieldDigits = stripNonDigits(
|
|
4581
|
+
const fieldDigits = stripNonDigits(
|
|
4582
|
+
fieldStr.replace(/^\+/, "")
|
|
4583
|
+
);
|
|
4581
4584
|
const activeDialCode = getDialCode(onlyCountries?.[0] || defaultCountry) || "";
|
|
4582
4585
|
const userDigitsFromField = activeDialCode && fieldDigits.startsWith(activeDialCode) ? fieldDigits.slice(activeDialCode.length) : fieldDigits;
|
|
4583
4586
|
const hadTrunkPrefix = rawEmailOrPhoneInputRef.current.startsWith("08");
|
|
@@ -4608,7 +4611,10 @@ var InputDynamic = ({
|
|
|
4608
4611
|
return;
|
|
4609
4612
|
}
|
|
4610
4613
|
const countryDialCode = data?.dialCode || "";
|
|
4611
|
-
const cleanedValue = removeLeadingZeroAfterDialCode(
|
|
4614
|
+
const cleanedValue = removeLeadingZeroAfterDialCode(
|
|
4615
|
+
value,
|
|
4616
|
+
countryDialCode
|
|
4617
|
+
);
|
|
4612
4618
|
if (cleanedValue === countryDialCode) {
|
|
4613
4619
|
const dialCodeChanged = lastEmailOrPhoneValue && lastEmailOrPhoneValue !== countryDialCode && !lastEmailOrPhoneValue.startsWith(countryDialCode);
|
|
4614
4620
|
const isInitial = !lastEmailOrPhoneValue;
|
|
@@ -4647,7 +4653,9 @@ var InputDynamic = ({
|
|
|
4647
4653
|
const inputEl = e.currentTarget;
|
|
4648
4654
|
if (nativeInputValueSetter) {
|
|
4649
4655
|
nativeInputValueSetter.call(inputEl, digitsOnly);
|
|
4650
|
-
inputEl.dispatchEvent(
|
|
4656
|
+
inputEl.dispatchEvent(
|
|
4657
|
+
new Event("input", { bubbles: true })
|
|
4658
|
+
);
|
|
4651
4659
|
}
|
|
4652
4660
|
}
|
|
4653
4661
|
}
|
|
@@ -4673,7 +4681,10 @@ var InputDynamic = ({
|
|
|
4673
4681
|
rawEmailOrPhoneInputRef.current = newValue;
|
|
4674
4682
|
let normalizedValue = newValue;
|
|
4675
4683
|
if (detectedType === "phone") {
|
|
4676
|
-
normalizedValue = localToInternational(
|
|
4684
|
+
normalizedValue = localToInternational(
|
|
4685
|
+
newValue,
|
|
4686
|
+
defaultCountry
|
|
4687
|
+
);
|
|
4677
4688
|
}
|
|
4678
4689
|
field.onChange(normalizedValue);
|
|
4679
4690
|
updateEmailOrPhoneType(normalizedValue);
|
|
@@ -4739,7 +4750,10 @@ var InputDynamic = ({
|
|
|
4739
4750
|
return;
|
|
4740
4751
|
}
|
|
4741
4752
|
const countryDialCode = data?.dialCode || "";
|
|
4742
|
-
const cleanedValue = removeLeadingZeroAfterDialCode(
|
|
4753
|
+
const cleanedValue = removeLeadingZeroAfterDialCode(
|
|
4754
|
+
value,
|
|
4755
|
+
countryDialCode
|
|
4756
|
+
);
|
|
4743
4757
|
if (cleanedValue === countryDialCode) {
|
|
4744
4758
|
const dialCodeChanged = lastPhoneValue && lastPhoneValue !== countryDialCode && !lastPhoneValue.startsWith(countryDialCode);
|
|
4745
4759
|
const isInitial = !lastPhoneValue;
|
|
@@ -4777,7 +4791,9 @@ var InputDynamic = ({
|
|
|
4777
4791
|
const inputEl = e.currentTarget;
|
|
4778
4792
|
if (nativeInputValueSetter) {
|
|
4779
4793
|
nativeInputValueSetter.call(inputEl, digitsOnly);
|
|
4780
|
-
inputEl.dispatchEvent(
|
|
4794
|
+
inputEl.dispatchEvent(
|
|
4795
|
+
new Event("input", { bubbles: true })
|
|
4796
|
+
);
|
|
4781
4797
|
}
|
|
4782
4798
|
}
|
|
4783
4799
|
}
|
|
@@ -4804,7 +4820,10 @@ var InputDynamic = ({
|
|
|
4804
4820
|
if (willSwitchType) shouldFocusRef.current = true;
|
|
4805
4821
|
let normalizedValue = newValue;
|
|
4806
4822
|
if (detectedType === "phone") {
|
|
4807
|
-
normalizedValue = localToInternational(
|
|
4823
|
+
normalizedValue = localToInternational(
|
|
4824
|
+
newValue,
|
|
4825
|
+
defaultCountry
|
|
4826
|
+
);
|
|
4808
4827
|
}
|
|
4809
4828
|
field.onChange(normalizedValue);
|
|
4810
4829
|
updateIdentityType(normalizedValue);
|
|
@@ -4868,6 +4887,21 @@ var InputDynamic = ({
|
|
|
4868
4887
|
},
|
|
4869
4888
|
getOptionLabel: (option) => option.label,
|
|
4870
4889
|
getOptionValue: (option) => option.value,
|
|
4890
|
+
formatOptionLabel: (option) => /* @__PURE__ */ jsxs("div", { children: [
|
|
4891
|
+
/* @__PURE__ */ jsx("div", { children: option.label }),
|
|
4892
|
+
option.description && /* @__PURE__ */ jsx(
|
|
4893
|
+
"div",
|
|
4894
|
+
{
|
|
4895
|
+
style: {
|
|
4896
|
+
fontSize: "12px",
|
|
4897
|
+
color: "#6b7280",
|
|
4898
|
+
marginTop: "2px",
|
|
4899
|
+
lineHeight: "1.4"
|
|
4900
|
+
},
|
|
4901
|
+
children: option.description
|
|
4902
|
+
}
|
|
4903
|
+
)
|
|
4904
|
+
] }),
|
|
4871
4905
|
isOptionDisabled: (option) => option.disabled || false,
|
|
4872
4906
|
menuPlacement: menuPlacement || "auto",
|
|
4873
4907
|
menuShouldScrollIntoView: false,
|
|
@@ -4965,7 +4999,10 @@ var InputDynamic = ({
|
|
|
4965
4999
|
return;
|
|
4966
5000
|
}
|
|
4967
5001
|
const dialCode = data?.dialCode || "";
|
|
4968
|
-
let cleanedValue = removeLeadingZeroAfterDialCode(
|
|
5002
|
+
let cleanedValue = removeLeadingZeroAfterDialCode(
|
|
5003
|
+
value,
|
|
5004
|
+
dialCode
|
|
5005
|
+
);
|
|
4969
5006
|
if (cleanedValue.length > PHONE_MAX_DIGITS) {
|
|
4970
5007
|
cleanedValue = cleanedValue.substring(0, PHONE_MAX_DIGITS);
|
|
4971
5008
|
}
|
|
@@ -4985,7 +5022,9 @@ var InputDynamic = ({
|
|
|
4985
5022
|
const inputEl = e.currentTarget;
|
|
4986
5023
|
if (nativeInputValueSetter) {
|
|
4987
5024
|
nativeInputValueSetter.call(inputEl, digitsOnly);
|
|
4988
|
-
inputEl.dispatchEvent(
|
|
5025
|
+
inputEl.dispatchEvent(
|
|
5026
|
+
new Event("input", { bubbles: true })
|
|
5027
|
+
);
|
|
4989
5028
|
}
|
|
4990
5029
|
}
|
|
4991
5030
|
}
|
|
@@ -5467,7 +5506,7 @@ var DEFAULT_LABELS8 = {
|
|
|
5467
5506
|
id: {
|
|
5468
5507
|
fromLabel: "Dari",
|
|
5469
5508
|
toLabel: "Ke",
|
|
5470
|
-
departureDateLabel: "Tanggal
|
|
5509
|
+
departureDateLabel: "Tanggal Pergi",
|
|
5471
5510
|
returnDateLabel: "Tanggal Pulang",
|
|
5472
5511
|
serviceClassLabel: "Jenis Layanan",
|
|
5473
5512
|
typeOfServiceLabel: "Jenis Penumpang",
|
|
@@ -5476,14 +5515,14 @@ var DEFAULT_LABELS8 = {
|
|
|
5476
5515
|
searchButton: "Cari Tiket",
|
|
5477
5516
|
placeholderPort: "Pilih Pelabuhan Asal",
|
|
5478
5517
|
placeholderDestinationPort: "Pilih Pelabuhan Tujuan",
|
|
5479
|
-
placeholderDepartureDate: "Pilih Tanggal
|
|
5480
|
-
placeholderReturnDate: "Pilih Tanggal
|
|
5518
|
+
placeholderDepartureDate: "Pilih Tanggal Pergi",
|
|
5519
|
+
placeholderReturnDate: "Pilih Tanggal Pulang",
|
|
5481
5520
|
placeholderTypeClass: "Pilih Jenis Layanan",
|
|
5482
5521
|
placeholderTypeService: "Pilih Jenis Penumpang",
|
|
5483
5522
|
placeholderPassenger: "Pilih Jumlah Penumpang",
|
|
5484
5523
|
errorOriginRequired: "Pelabuhan asal wajib diisi",
|
|
5485
5524
|
errorDestinationRequired: "Pelabuhan tujuan wajib diisi",
|
|
5486
|
-
errorDepartureDateRequired: "Tanggal
|
|
5525
|
+
errorDepartureDateRequired: "Tanggal Pergi wajib diisi",
|
|
5487
5526
|
errorReturnDateRequired: "Tanggal Pulang wajib diisi",
|
|
5488
5527
|
switchAriaLabel: "Tukar asal dan tujuan",
|
|
5489
5528
|
ferryDescription: "Layanan Penyeberangan Ferry ASDP",
|
|
@@ -6173,7 +6212,8 @@ var DEFAULT_LABELS9 = {
|
|
|
6173
6212
|
id: {
|
|
6174
6213
|
originHarbor: "Pelabuhan Keberangkatan",
|
|
6175
6214
|
destinationHarbor: "Pelabuhan Tujuan",
|
|
6176
|
-
departureDate: "Tanggal
|
|
6215
|
+
departureDate: "Tanggal Pergi",
|
|
6216
|
+
returnDate: "Tanggal Pulang",
|
|
6177
6217
|
serviceClass: "Jenis Layanan",
|
|
6178
6218
|
typeOfService: "Jenis Penumpang",
|
|
6179
6219
|
totalPassengers: "Jumlah Penumpang",
|
|
@@ -6184,6 +6224,7 @@ var DEFAULT_LABELS9 = {
|
|
|
6184
6224
|
originHarbor: "Departure Port",
|
|
6185
6225
|
destinationHarbor: "Destination Port",
|
|
6186
6226
|
departureDate: "Departure Date",
|
|
6227
|
+
returnDate: "Return Date",
|
|
6187
6228
|
serviceClass: "Service Type",
|
|
6188
6229
|
typeOfService: "Type Of Passenger",
|
|
6189
6230
|
totalPassengers: "Total Passengers",
|
|
@@ -6261,10 +6302,12 @@ var useStyles10 = makeStyles({
|
|
|
6261
6302
|
}
|
|
6262
6303
|
});
|
|
6263
6304
|
var CardTicketSearchSummary = ({
|
|
6305
|
+
showReturnDate = false,
|
|
6264
6306
|
language = "id",
|
|
6265
6307
|
originHarbor,
|
|
6266
6308
|
destinationHarbor,
|
|
6267
6309
|
departureDate,
|
|
6310
|
+
returnDate,
|
|
6268
6311
|
serviceClass,
|
|
6269
6312
|
typeOfService,
|
|
6270
6313
|
totalPassengers,
|
|
@@ -6460,8 +6503,8 @@ var CardTicketSearchSummary = ({
|
|
|
6460
6503
|
children: /* @__PURE__ */ jsx(
|
|
6461
6504
|
RenderField,
|
|
6462
6505
|
{
|
|
6463
|
-
label: mergedLabels.departureDate,
|
|
6464
|
-
value: departureDate,
|
|
6506
|
+
label: showReturnDate ? mergedLabels.returnDate : mergedLabels.departureDate,
|
|
6507
|
+
value: showReturnDate ? returnDate : departureDate,
|
|
6465
6508
|
icon: "fluent:calendar-24-regular"
|
|
6466
6509
|
}
|
|
6467
6510
|
)
|
|
@@ -7332,6 +7375,10 @@ var ModalSelectDate = ({
|
|
|
7332
7375
|
}) => {
|
|
7333
7376
|
const styles = useStyles13();
|
|
7334
7377
|
const mergedLabels = { ...DEFAULT_LABELS12[language], ...labels };
|
|
7378
|
+
const isSameCalendarDay = (first, second) => {
|
|
7379
|
+
if (!first || !second) return false;
|
|
7380
|
+
return moment(first).isSame(second, "day");
|
|
7381
|
+
};
|
|
7335
7382
|
useEffect(() => {
|
|
7336
7383
|
moment.locale(language === "id" ? "id" : "en");
|
|
7337
7384
|
}, [language]);
|
|
@@ -7343,24 +7390,26 @@ var ModalSelectDate = ({
|
|
|
7343
7390
|
);
|
|
7344
7391
|
const [hoveredDate, setHoveredDate] = useState();
|
|
7345
7392
|
const [activeTab, setActiveTab] = useState(initialTab);
|
|
7346
|
-
const
|
|
7347
|
-
if (selectedEndDate)
|
|
7348
|
-
|
|
7349
|
-
|
|
7393
|
+
const previewRange = useMemo(() => {
|
|
7394
|
+
if (selectedEndDate) {
|
|
7395
|
+
return { start: selectedDate, end: selectedEndDate };
|
|
7396
|
+
}
|
|
7397
|
+
if (selectedDate && hoveredDate && !isSameCalendarDay(hoveredDate, selectedDate)) {
|
|
7398
|
+
const earlier = hoveredDate < selectedDate ? hoveredDate : selectedDate;
|
|
7399
|
+
const later = hoveredDate > selectedDate ? hoveredDate : selectedDate;
|
|
7400
|
+
return { start: earlier, end: later };
|
|
7350
7401
|
}
|
|
7351
|
-
return void 0;
|
|
7402
|
+
return { start: selectedDate, end: void 0 };
|
|
7352
7403
|
}, [hoveredDate, selectedDate, selectedEndDate]);
|
|
7353
|
-
const
|
|
7354
|
-
if (!first || !second) return false;
|
|
7355
|
-
return moment(first).isSame(second, "day");
|
|
7356
|
-
};
|
|
7404
|
+
const prevOpenRef = useRef(false);
|
|
7357
7405
|
useEffect(() => {
|
|
7358
|
-
if (open) {
|
|
7406
|
+
if (open && !prevOpenRef.current) {
|
|
7359
7407
|
setSelectedDate(selectedDepartureDate);
|
|
7360
7408
|
setSelectedEndDate(selectedReturnDate);
|
|
7361
7409
|
setActiveTab(initialTab);
|
|
7362
7410
|
setHoveredDate(void 0);
|
|
7363
7411
|
}
|
|
7412
|
+
prevOpenRef.current = open;
|
|
7364
7413
|
}, [open, selectedDepartureDate, selectedReturnDate, initialTab]);
|
|
7365
7414
|
const handleTabChange = (tab) => {
|
|
7366
7415
|
setActiveTab(tab);
|
|
@@ -7384,18 +7433,19 @@ var ModalSelectDate = ({
|
|
|
7384
7433
|
setHoveredDate(void 0);
|
|
7385
7434
|
onSelectDepartureDate(date);
|
|
7386
7435
|
} else {
|
|
7387
|
-
|
|
7388
|
-
|
|
7436
|
+
const earlier = date < currentStart ? date : currentStart;
|
|
7437
|
+
const later = date > currentStart ? date : currentStart;
|
|
7438
|
+
if (isSameCalendarDay(date, currentStart)) {
|
|
7389
7439
|
setSelectedDate(date);
|
|
7390
|
-
|
|
7391
|
-
|
|
7392
|
-
|
|
7393
|
-
|
|
7394
|
-
|
|
7395
|
-
|
|
7396
|
-
|
|
7397
|
-
|
|
7398
|
-
|
|
7440
|
+
setSelectedEndDate(void 0);
|
|
7441
|
+
setHoveredDate(void 0);
|
|
7442
|
+
return;
|
|
7443
|
+
}
|
|
7444
|
+
setSelectedDate(earlier);
|
|
7445
|
+
setSelectedEndDate(later);
|
|
7446
|
+
onSelectDepartureDate(earlier);
|
|
7447
|
+
if (onSelectReturnDate) {
|
|
7448
|
+
onSelectReturnDate(later);
|
|
7399
7449
|
}
|
|
7400
7450
|
setHoveredDate(void 0);
|
|
7401
7451
|
handleClose();
|
|
@@ -7428,14 +7478,15 @@ var ModalSelectDate = ({
|
|
|
7428
7478
|
element.onmouseleave = null;
|
|
7429
7479
|
return;
|
|
7430
7480
|
}
|
|
7431
|
-
const
|
|
7432
|
-
const
|
|
7433
|
-
const
|
|
7481
|
+
const rangeStart = previewRange.start;
|
|
7482
|
+
const rangeEnd = previewRange.end;
|
|
7483
|
+
const startTime = rangeStart?.getTime();
|
|
7484
|
+
const endTime = rangeEnd?.getTime();
|
|
7434
7485
|
const currentTime = date.getTime();
|
|
7435
|
-
const isSameStartEnd = isSameCalendarDay(
|
|
7436
|
-
const isStartDay = isSameCalendarDay(date,
|
|
7437
|
-
const isEndDay = isSameCalendarDay(date,
|
|
7438
|
-
if (isStartDay && (!
|
|
7486
|
+
const isSameStartEnd = isSameCalendarDay(rangeStart, rangeEnd);
|
|
7487
|
+
const isStartDay = isSameCalendarDay(date, rangeStart);
|
|
7488
|
+
const isEndDay = isSameCalendarDay(date, rangeEnd);
|
|
7489
|
+
if (isStartDay && (!rangeEnd || isSameStartEnd)) {
|
|
7439
7490
|
addTokens(styles.rangeSingle);
|
|
7440
7491
|
} else {
|
|
7441
7492
|
if (isStartDay) {
|
|
@@ -7445,12 +7496,11 @@ var ModalSelectDate = ({
|
|
|
7445
7496
|
addTokens(styles.rangeEnd);
|
|
7446
7497
|
}
|
|
7447
7498
|
}
|
|
7448
|
-
if (endTime && currentTime > startTime && currentTime < endTime) {
|
|
7499
|
+
if (startTime && endTime && currentTime > startTime && currentTime < endTime) {
|
|
7449
7500
|
addTokens(selectedEndDate ? styles.rangeMiddle : styles.rangePreview);
|
|
7450
7501
|
}
|
|
7451
7502
|
if (!selectedEndDate) {
|
|
7452
7503
|
element.onmouseenter = () => {
|
|
7453
|
-
if (date < selectedDate) return;
|
|
7454
7504
|
setHoveredDate((prev) => {
|
|
7455
7505
|
if (isSameCalendarDay(prev, date)) {
|
|
7456
7506
|
return prev;
|
|
@@ -7468,7 +7518,7 @@ var ModalSelectDate = ({
|
|
|
7468
7518
|
},
|
|
7469
7519
|
[
|
|
7470
7520
|
activeTab,
|
|
7471
|
-
|
|
7521
|
+
previewRange,
|
|
7472
7522
|
selectedDate,
|
|
7473
7523
|
selectedEndDate,
|
|
7474
7524
|
styles.rangeEnd,
|
|
@@ -8848,8 +8898,8 @@ var DEFAULT_LABELS16 = {
|
|
|
8848
8898
|
recommendation: "Rekomendasi",
|
|
8849
8899
|
highestPrice: "Harga Tertinggi",
|
|
8850
8900
|
lowestPrice: "Harga Terendah",
|
|
8851
|
-
earliestDeparture: "
|
|
8852
|
-
latestDeparture: "
|
|
8901
|
+
earliestDeparture: "Pergi Paling Awal",
|
|
8902
|
+
latestDeparture: "Pergi Paling Akhir",
|
|
8853
8903
|
resetSortAriaLabel: "Hapus pengurutan"
|
|
8854
8904
|
},
|
|
8855
8905
|
en: {
|
|
@@ -8875,8 +8925,8 @@ var DEFAULT_SORT_OPTIONS = [
|
|
|
8875
8925
|
{ value: "recommended", sortBy: "recommendation", sortDir: "ASC", label: "Rekomendasi" },
|
|
8876
8926
|
{ value: "price-desc", sortBy: "price", sortDir: "DESC", label: "Harga Tertinggi" },
|
|
8877
8927
|
{ value: "price-asc", sortBy: "price", sortDir: "ASC", label: "Harga Terendah" },
|
|
8878
|
-
{ value: "departure-asc", sortBy: "departure", sortDir: "ASC", label: "
|
|
8879
|
-
{ value: "departure-desc", sortBy: "departure", sortDir: "DESC", label: "
|
|
8928
|
+
{ value: "departure-asc", sortBy: "departure", sortDir: "ASC", label: "Pergi Paling Awal" },
|
|
8929
|
+
{ value: "departure-desc", sortBy: "departure", sortDir: "DESC", label: "Pergi Paling Akhir" }
|
|
8880
8930
|
];
|
|
8881
8931
|
var getSortLabel = (value) => {
|
|
8882
8932
|
const option = DEFAULT_SORT_OPTIONS.find((opt) => opt.value === value);
|
|
@@ -9771,9 +9821,9 @@ var DEFAULT_LABELS19 = {
|
|
|
9771
9821
|
toLabel: "Ke",
|
|
9772
9822
|
toPlaceholder: "Pilih pelabuhan tujuan",
|
|
9773
9823
|
toRequired: "Pelabuhan tujuan wajib diisi",
|
|
9774
|
-
departureDateLabel: "Tanggal
|
|
9775
|
-
departureDatePlaceholder: "Pilih Tanggal
|
|
9776
|
-
departureDateRequired: "Tanggal
|
|
9824
|
+
departureDateLabel: "Tanggal Pergi",
|
|
9825
|
+
departureDatePlaceholder: "Pilih Tanggal Pergi",
|
|
9826
|
+
departureDateRequired: "Tanggal Pergi wajib diisi",
|
|
9777
9827
|
roundTripLabel: "Pulang Pergi",
|
|
9778
9828
|
returnDateLabel: "Tanggal Pulang",
|
|
9779
9829
|
returnDatePlaceholder: "Pilih Tanggal Pulang",
|