@asdp/ferryui 0.1.22-dev.10194 → 0.1.22-dev.10210
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 +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +46 -31
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +46 -31
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1144,6 +1144,7 @@ function useWindowSize() {
|
|
|
1144
1144
|
var DEFAULT_LABELS5 = {
|
|
1145
1145
|
id: {
|
|
1146
1146
|
availableSeatsLabel: "Tersedia",
|
|
1147
|
+
soldOutLabel: "Habis",
|
|
1147
1148
|
estimationPrefix: "Estimasi",
|
|
1148
1149
|
priceDetailsButton: "Rincian Harga",
|
|
1149
1150
|
policyButton: "Kebijakan",
|
|
@@ -1157,6 +1158,7 @@ var DEFAULT_LABELS5 = {
|
|
|
1157
1158
|
},
|
|
1158
1159
|
en: {
|
|
1159
1160
|
availableSeatsLabel: "Available",
|
|
1161
|
+
soldOutLabel: "Sold Out",
|
|
1160
1162
|
estimationPrefix: "Estimation",
|
|
1161
1163
|
priceDetailsButton: "Price Details",
|
|
1162
1164
|
policyButton: "Policy",
|
|
@@ -1449,7 +1451,7 @@ var CardTicket = ({
|
|
|
1449
1451
|
{
|
|
1450
1452
|
size: "large",
|
|
1451
1453
|
appearance: "filled",
|
|
1452
|
-
style: { backgroundColor: departureItem?.provider?.serviceColor, padding: "0.5rem" },
|
|
1454
|
+
style: { backgroundColor: departureItem?.availableTicket <= 0 ? tokens.colorNeutralForeground3 : departureItem?.provider?.serviceColor, padding: "0.5rem" },
|
|
1453
1455
|
iconPosition: "before",
|
|
1454
1456
|
shape: "rounded",
|
|
1455
1457
|
icon: /* @__PURE__ */ jsx(Icon, { icon: "fluent:info-24-regular" }),
|
|
@@ -1482,7 +1484,8 @@ var CardTicket = ({
|
|
|
1482
1484
|
className: styles.asdpLogo,
|
|
1483
1485
|
alt: mergedLabels.logoAlt,
|
|
1484
1486
|
height: 56,
|
|
1485
|
-
width: 82
|
|
1487
|
+
width: 82,
|
|
1488
|
+
style: departureItem?.availableTicket <= 0 ? { filter: "grayscale(100%)", opacity: 0.7 } : {}
|
|
1486
1489
|
}
|
|
1487
1490
|
)
|
|
1488
1491
|
}
|
|
@@ -1502,23 +1505,19 @@ var CardTicket = ({
|
|
|
1502
1505
|
justifyContent: "center",
|
|
1503
1506
|
alignItems: "center"
|
|
1504
1507
|
},
|
|
1505
|
-
children: /* @__PURE__ */
|
|
1508
|
+
children: /* @__PURE__ */ jsx(
|
|
1506
1509
|
Badge,
|
|
1507
1510
|
{
|
|
1508
1511
|
size: "large",
|
|
1509
|
-
style: {
|
|
1512
|
+
style: departureItem?.availableTicket <= 0 ? void 0 : {
|
|
1510
1513
|
color: departureItem?.availableTicket > 50 ? sharedColors.Shared_Green_Primary : sharedColors.Shared_Red_Primary
|
|
1511
1514
|
},
|
|
1512
|
-
appearance: "tint",
|
|
1515
|
+
appearance: departureItem?.availableTicket <= 0 ? "outline" : "tint",
|
|
1513
1516
|
color: departureItem?.availableTicket > 50 ? "success" : "danger",
|
|
1514
1517
|
iconPosition: "after",
|
|
1515
1518
|
shape: "rounded",
|
|
1516
1519
|
icon: /* @__PURE__ */ jsx(Icon, { icon: "fluent:ticket-diagonal-24-regular" }),
|
|
1517
|
-
children:
|
|
1518
|
-
mergedLabels.availableSeatsLabel,
|
|
1519
|
-
" ",
|
|
1520
|
-
departureItem?.availableTicket
|
|
1521
|
-
]
|
|
1520
|
+
children: departureItem?.availableTicket <= 0 ? mergedLabels.soldOutLabel : `${mergedLabels.availableSeatsLabel} ${departureItem?.availableTicket}`
|
|
1522
1521
|
}
|
|
1523
1522
|
)
|
|
1524
1523
|
}
|
|
@@ -1591,23 +1590,19 @@ var CardTicket = ({
|
|
|
1591
1590
|
/* @__PURE__ */ jsx(SkeletonItem, { style: { flex: 1, height: "32px", borderRadius: "16px" } })
|
|
1592
1591
|
] }) })
|
|
1593
1592
|
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1594
|
-
/* @__PURE__ */ jsx(Visible, { lg: true, xl: true, xxl: true, xxxl: true, children: /* @__PURE__ */
|
|
1593
|
+
/* @__PURE__ */ jsx(Visible, { lg: true, xl: true, xxl: true, xxxl: true, children: /* @__PURE__ */ jsx(
|
|
1595
1594
|
Badge,
|
|
1596
1595
|
{
|
|
1597
1596
|
size: "extra-large",
|
|
1598
|
-
style: {
|
|
1597
|
+
style: departureItem?.availableTicket <= 0 ? void 0 : {
|
|
1599
1598
|
color: departureItem?.availableTicket > 50 ? sharedColors.Shared_Green_Primary : sharedColors.Shared_Red_Primary
|
|
1600
1599
|
},
|
|
1601
|
-
appearance: "tint",
|
|
1600
|
+
appearance: departureItem?.availableTicket <= 0 ? "outline" : "tint",
|
|
1602
1601
|
color: departureItem?.availableTicket > 50 ? "success" : "danger",
|
|
1603
1602
|
iconPosition: "after",
|
|
1604
1603
|
shape: "rounded",
|
|
1605
1604
|
icon: /* @__PURE__ */ jsx(Icon, { icon: "fluent:ticket-diagonal-24-regular" }),
|
|
1606
|
-
children:
|
|
1607
|
-
mergedLabels.availableSeatsLabel,
|
|
1608
|
-
" ",
|
|
1609
|
-
departureItem?.availableTicket
|
|
1610
|
-
]
|
|
1605
|
+
children: departureItem?.availableTicket <= 0 ? mergedLabels.soldOutLabel : `${mergedLabels.availableSeatsLabel} ${departureItem?.availableTicket}`
|
|
1611
1606
|
}
|
|
1612
1607
|
) }),
|
|
1613
1608
|
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("div", { className: styles.ticketInfo, children: [
|
|
@@ -1638,8 +1633,8 @@ var CardTicket = ({
|
|
|
1638
1633
|
shape: "circular",
|
|
1639
1634
|
style: {
|
|
1640
1635
|
flex: 1,
|
|
1641
|
-
borderColor: tokens.colorBrandBackground,
|
|
1642
|
-
color: tokens.colorBrandBackground
|
|
1636
|
+
borderColor: departureItem?.availableTicket <= 0 ? tokens.colorNeutralForeground4 : tokens.colorBrandBackground,
|
|
1637
|
+
color: departureItem?.availableTicket <= 0 ? tokens.colorNeutralForeground4 : tokens.colorBrandBackground
|
|
1643
1638
|
},
|
|
1644
1639
|
icon: /* @__PURE__ */ jsx(Icon, { icon: "fluent:money-24-regular" }),
|
|
1645
1640
|
size: "medium",
|
|
@@ -1654,8 +1649,8 @@ var CardTicket = ({
|
|
|
1654
1649
|
shape: "circular",
|
|
1655
1650
|
style: {
|
|
1656
1651
|
flex: 1,
|
|
1657
|
-
borderColor: tokens.colorBrandBackground,
|
|
1658
|
-
color: tokens.colorBrandBackground
|
|
1652
|
+
borderColor: departureItem?.availableTicket <= 0 ? tokens.colorNeutralForeground4 : tokens.colorBrandBackground,
|
|
1653
|
+
color: departureItem?.availableTicket <= 0 ? tokens.colorNeutralForeground4 : tokens.colorBrandBackground
|
|
1659
1654
|
},
|
|
1660
1655
|
icon: /* @__PURE__ */ jsx(Icon, { icon: "fluent:document-bullet-list-24-regular" }),
|
|
1661
1656
|
size: "medium",
|
|
@@ -1678,7 +1673,7 @@ var CardTicket = ({
|
|
|
1678
1673
|
xxl: 4.5,
|
|
1679
1674
|
xxxl: 4.5,
|
|
1680
1675
|
style: { padding: 0, margin: 0 },
|
|
1681
|
-
children: /* @__PURE__ */ jsxs(Card, { className: styles.ticketRightCard, children: [
|
|
1676
|
+
children: /* @__PURE__ */ jsxs(Card, { className: styles.ticketRightCard, style: departureItem?.availableTicket <= 0 ? { background: "linear-gradient(75deg, #7A7A7A 0%, #4D4D4D 103.3%)" } : {}, children: [
|
|
1682
1677
|
isLoading ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1683
1678
|
/* @__PURE__ */ jsxs("div", { className: styles.priceCard, children: [
|
|
1684
1679
|
/* @__PURE__ */ jsxs(Skeleton, { style: { display: "flex", flexDirection: "column", gap: "8px", flex: 1 }, children: [
|
|
@@ -1722,11 +1717,11 @@ var CardTicket = ({
|
|
|
1722
1717
|
{
|
|
1723
1718
|
onClick: onSelectTicket,
|
|
1724
1719
|
appearance: "primary",
|
|
1725
|
-
style: { backgroundColor: brandColors["60"] },
|
|
1720
|
+
style: isVerifyingTicket || departureItem?.availableTicket <= 0 ? void 0 : { backgroundColor: brandColors["60"] },
|
|
1726
1721
|
size: "medium",
|
|
1727
1722
|
shape: "circular",
|
|
1728
1723
|
icon: isVerifyingTicket ? null : /* @__PURE__ */ jsx(Icon, { icon: "fluent:ticket-diagonal-24-filled" }),
|
|
1729
|
-
disabled: isVerifyingTicket,
|
|
1724
|
+
disabled: isVerifyingTicket || departureItem?.availableTicket <= 0,
|
|
1730
1725
|
children: isVerifyingTicket ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1731
1726
|
/* @__PURE__ */ jsx(Spinner, { size: "extra-tiny", style: { marginRight: "5px" } }),
|
|
1732
1727
|
" ",
|
|
@@ -11294,7 +11289,9 @@ var ModalPassengerForm = ({
|
|
|
11294
11289
|
idTypes,
|
|
11295
11290
|
ticketClassOptions,
|
|
11296
11291
|
onScanComplete,
|
|
11297
|
-
isLoading
|
|
11292
|
+
isLoading,
|
|
11293
|
+
minAge,
|
|
11294
|
+
maxAge
|
|
11298
11295
|
}) => {
|
|
11299
11296
|
const styles = useStyles24();
|
|
11300
11297
|
const mergedLabels = { ...DEFAULT_LABELS23[language], ...labels };
|
|
@@ -11303,6 +11300,15 @@ var ModalPassengerForm = ({
|
|
|
11303
11300
|
...labels?.errors
|
|
11304
11301
|
};
|
|
11305
11302
|
const displayTitle = title || mergedLabels.title;
|
|
11303
|
+
const computeDateBound = (yearsOffset) => {
|
|
11304
|
+
const d = /* @__PURE__ */ new Date();
|
|
11305
|
+
d.setFullYear(d.getFullYear() - yearsOffset);
|
|
11306
|
+
const offset = d.getTimezoneOffset();
|
|
11307
|
+
const adjusted = new Date(d.getTime() - offset * 60 * 1e3);
|
|
11308
|
+
return adjusted.toISOString().split("T")[0];
|
|
11309
|
+
};
|
|
11310
|
+
const birthdateMaxDate = computeDateBound(minAge);
|
|
11311
|
+
const birthdateMinDate = computeDateBound(maxAge);
|
|
11306
11312
|
const [isModalSelectIdTypeOpen, setIsModalSelectIdTypeOpen] = useState(false);
|
|
11307
11313
|
const [isModalScanOpen, setIsModalScanOpen] = useState(false);
|
|
11308
11314
|
const [scannedIdType, setScannedIdType] = useState(null);
|
|
@@ -11890,14 +11896,23 @@ var ModalPassengerForm = ({
|
|
|
11890
11896
|
size: "large",
|
|
11891
11897
|
required: true,
|
|
11892
11898
|
disableFutureDates: true,
|
|
11899
|
+
min: birthdateMinDate,
|
|
11900
|
+
max: birthdateMaxDate,
|
|
11893
11901
|
validationRules: {
|
|
11894
11902
|
required: mergedErrors.requiredDate,
|
|
11895
11903
|
validate: (value) => {
|
|
11896
|
-
const
|
|
11897
|
-
|
|
11898
|
-
|
|
11899
|
-
|
|
11900
|
-
|
|
11904
|
+
const { years } = calculateAge(value);
|
|
11905
|
+
if (years < minAge) {
|
|
11906
|
+
return mergedErrors.minAge.replace(
|
|
11907
|
+
/\d+/,
|
|
11908
|
+
minAge.toString()
|
|
11909
|
+
);
|
|
11910
|
+
}
|
|
11911
|
+
if (years > maxAge) {
|
|
11912
|
+
return mergedErrors.maxAge.replace(
|
|
11913
|
+
/\d+/,
|
|
11914
|
+
maxAge.toString()
|
|
11915
|
+
);
|
|
11901
11916
|
}
|
|
11902
11917
|
return true;
|
|
11903
11918
|
}
|