kupos-ui-components-lib 9.11.2 → 9.11.4
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/components/ServiceItem/ServiceItemDesktop.d.ts +1 -1
- package/dist/components/ServiceItem/ServiceItemDesktop.js +22 -5
- package/dist/components/ServiceItem/ServiceItemMobile.d.ts +1 -1
- package/dist/components/ServiceItem/ServiceItemMobile.js +1 -1
- package/dist/components/ServiceItem/mobileTypes.d.ts +1 -0
- package/dist/components/ServiceItem/types.d.ts +7 -0
- package/dist/styles.css +6 -0
- package/dist/ui/BottomAmenities/BottomAmenities.d.ts +2 -1
- package/dist/ui/BottomAmenities/BottomAmenities.js +4 -2
- package/dist/ui/DateTimeSection/DateTimeSection.js +4 -4
- package/dist/ui/SeatSection/SeatSection.d.ts +7 -1
- package/dist/ui/SeatSection/SeatSection.js +44 -13
- package/dist/ui/mobileweb/DateTimeSectionMobile.d.ts +2 -1
- package/dist/ui/mobileweb/DateTimeSectionMobile.js +13 -7
- package/dist/ui/mobileweb/SeatSectionMobile.d.ts +2 -1
- package/dist/ui/mobileweb/SeatSectionMobile.js +22 -15
- package/dist/utils/CommonService.d.ts +1 -1
- package/dist/utils/CommonService.js +5 -1
- package/package.json +1 -1
- package/src/components/ServiceItem/ServiceItemDesktop.tsx +47 -2
- package/src/components/ServiceItem/ServiceItemMobile.tsx +2 -1
- package/src/components/ServiceItem/mobileTypes.ts +31 -26
- package/src/components/ServiceItem/types.ts +12 -0
- package/src/ui/BottomAmenities/BottomAmenities.tsx +5 -1
- package/src/ui/DateTimeSection/DateTimeSection.tsx +4 -4
- package/src/ui/SeatSection/SeatSection.tsx +95 -23
- package/src/ui/mobileweb/DateTimeSectionMobile.tsx +47 -34
- package/src/ui/mobileweb/SeatSectionMobile.tsx +27 -12
- package/src/utils/CommonService.ts +7 -1
|
@@ -31,6 +31,7 @@ interface SeatSectionMobileProps {
|
|
|
31
31
|
tooltipBgColor?: string;
|
|
32
32
|
showLastSeats?: boolean;
|
|
33
33
|
discountSeatPriceColor?: string;
|
|
34
|
+
isTrain?: boolean;
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
interface SeatRowProps {
|
|
@@ -42,6 +43,7 @@ interface SeatRowProps {
|
|
|
42
43
|
seatPriceColor: string;
|
|
43
44
|
hasMultipleTypes: boolean;
|
|
44
45
|
textSize: string;
|
|
46
|
+
isTrain?: boolean;
|
|
45
47
|
}
|
|
46
48
|
|
|
47
49
|
const SeatRow: React.FC<SeatRowProps> = ({
|
|
@@ -53,6 +55,7 @@ const SeatRow: React.FC<SeatRowProps> = ({
|
|
|
53
55
|
seatPriceColor,
|
|
54
56
|
hasMultipleTypes,
|
|
55
57
|
textSize,
|
|
58
|
+
isTrain,
|
|
56
59
|
}) => {
|
|
57
60
|
if (EXCEPTIONS.includes(type.label)) return null;
|
|
58
61
|
|
|
@@ -69,7 +72,12 @@ const SeatRow: React.FC<SeatRowProps> = ({
|
|
|
69
72
|
className={`min-[420]:text-[13px] ${textSize} `}
|
|
70
73
|
style={{ color: labelColor }}
|
|
71
74
|
>
|
|
72
|
-
{
|
|
75
|
+
{isTrain
|
|
76
|
+
? commonService.truncateSeatLabel(
|
|
77
|
+
commonService.capitalize(displayLabel),
|
|
78
|
+
8,
|
|
79
|
+
)
|
|
80
|
+
: displayLabel}
|
|
73
81
|
</span>
|
|
74
82
|
<span
|
|
75
83
|
className={`min-[420]:text-[13px] ${textSize} bold-text`}
|
|
@@ -118,6 +126,7 @@ function SeatSectionMobile({
|
|
|
118
126
|
tooltipBgColor,
|
|
119
127
|
showLastSeats,
|
|
120
128
|
discountSeatPriceColor,
|
|
129
|
+
isTrain,
|
|
121
130
|
}: SeatSectionMobileProps): React.ReactElement {
|
|
122
131
|
const hasMultipleTypes = (seatTypesData?.length ?? 0) > 2;
|
|
123
132
|
|
|
@@ -169,7 +178,7 @@ function SeatSectionMobile({
|
|
|
169
178
|
className="w-[100%] flex flex-row justify-between items-center"
|
|
170
179
|
>
|
|
171
180
|
<span
|
|
172
|
-
className="min-[420]:text-[13px] text-[12px] bold-text"
|
|
181
|
+
className="min-[420]:text-[13px] text-[12px] bold-text whitespace-nowrap"
|
|
173
182
|
style={{ color: isSoldOut ? "#bbb" : "#464647" }}
|
|
174
183
|
>
|
|
175
184
|
{commonService.truncateSeatLabel(seat.label)}
|
|
@@ -322,15 +331,17 @@ function SeatSectionMobile({
|
|
|
322
331
|
seatPriceColor={seatPriceColor}
|
|
323
332
|
hasMultipleTypes={hasMultipleTypes}
|
|
324
333
|
textSize="text-[11px]"
|
|
334
|
+
isTrain={isTrain}
|
|
325
335
|
/>
|
|
326
336
|
));
|
|
327
337
|
}
|
|
328
338
|
|
|
329
|
-
|
|
339
|
+
const filteredSeats = seatTypesData
|
|
330
340
|
?.filter((item) => getFilteredSeats(item.label))
|
|
331
|
-
?.sort((a, b) => a.fare - b.fare)
|
|
332
|
-
|
|
333
|
-
|
|
341
|
+
?.sort((a, b) => a.fare - b.fare);
|
|
342
|
+
|
|
343
|
+
return (isTrain ? filteredSeats : filteredSeats?.slice(0, 2))?.map(
|
|
344
|
+
(type, i) => (
|
|
334
345
|
<SeatRow
|
|
335
346
|
key={i}
|
|
336
347
|
type={type}
|
|
@@ -341,16 +352,20 @@ function SeatSectionMobile({
|
|
|
341
352
|
seatPriceColor={seatPriceColor}
|
|
342
353
|
hasMultipleTypes={hasMultipleTypes}
|
|
343
354
|
textSize="text-[12px]"
|
|
355
|
+
isTrain={isTrain}
|
|
344
356
|
/>
|
|
345
|
-
)
|
|
357
|
+
),
|
|
358
|
+
);
|
|
346
359
|
};
|
|
347
360
|
|
|
348
361
|
const seats = removeDuplicateSeats
|
|
349
362
|
? getUniqueSeats(seatTypesData, 3)
|
|
350
|
-
:
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
363
|
+
: (() => {
|
|
364
|
+
const filtered = seatTypesData
|
|
365
|
+
?.filter((item) => getFilteredSeats(item.label))
|
|
366
|
+
?.sort((a, b) => a.fare - b.fare);
|
|
367
|
+
return isTrain ? filtered : filtered?.slice(0, 2);
|
|
368
|
+
})();
|
|
354
369
|
|
|
355
370
|
const discountedSeats = seats?.map((seat) => ({
|
|
356
371
|
...seat,
|
|
@@ -602,7 +617,7 @@ function SeatSectionMobile({
|
|
|
602
617
|
</div>
|
|
603
618
|
) : (
|
|
604
619
|
<div
|
|
605
|
-
className=
|
|
620
|
+
className={`flex flex-col justify-between ${isTrain ? "" : "h-[2.5rem]"} `}
|
|
606
621
|
style={{
|
|
607
622
|
gap: isSoldOut ? "0px" : "5px",
|
|
608
623
|
justifyContent: hasMultipleTypes ? "space-between" : "center",
|
|
@@ -39,9 +39,15 @@ const commonService = {
|
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
41
|
|
|
42
|
-
truncateSeatLabel: (label: string | number): string => {
|
|
42
|
+
truncateSeatLabel: (label: string | number, maxLength?: number): string => {
|
|
43
43
|
if (typeof label !== "string") return String(label);
|
|
44
44
|
if (label.includes("(")) return label;
|
|
45
|
+
|
|
46
|
+
// If maxLength provided, hard-truncate regardless of word count
|
|
47
|
+
if (maxLength != null && label.length > maxLength) {
|
|
48
|
+
return label.slice(0, maxLength) + "...";
|
|
49
|
+
}
|
|
50
|
+
|
|
45
51
|
const words = label.trim().split(/\s+/);
|
|
46
52
|
|
|
47
53
|
const truncateWord = (word: string) =>
|