kupos-ui-components-lib 9.11.7 → 9.11.8
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 -4
- 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 -12
- 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 -1
- 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 +91 -21
- 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
|
|
|
@@ -171,7 +180,7 @@ function SeatSectionMobile({
|
|
|
171
180
|
className="w-[100%] flex flex-row justify-between items-center"
|
|
172
181
|
>
|
|
173
182
|
<span
|
|
174
|
-
className="min-[420]:text-[13px] text-[12px] bold-text"
|
|
183
|
+
className="min-[420]:text-[13px] text-[12px] bold-text whitespace-nowrap"
|
|
175
184
|
style={{ color: isSoldOut ? "#bbb" : "#464647" }}
|
|
176
185
|
>
|
|
177
186
|
{commonService.truncateSeatLabel(seat.label)}
|
|
@@ -324,15 +333,17 @@ function SeatSectionMobile({
|
|
|
324
333
|
seatPriceColor={seatPriceColor}
|
|
325
334
|
hasMultipleTypes={hasMultipleTypes}
|
|
326
335
|
textSize="text-[11px]"
|
|
336
|
+
isTrain={isTrain}
|
|
327
337
|
/>
|
|
328
338
|
));
|
|
329
339
|
}
|
|
330
340
|
|
|
331
|
-
|
|
341
|
+
const filteredSeats = seatTypesData
|
|
332
342
|
?.filter((item) => getFilteredSeats(item.label))
|
|
333
|
-
?.sort((a, b) => a.fare - b.fare)
|
|
334
|
-
|
|
335
|
-
|
|
343
|
+
?.sort((a, b) => a.fare - b.fare);
|
|
344
|
+
|
|
345
|
+
return (isTrain ? filteredSeats : filteredSeats?.slice(0, 2))?.map(
|
|
346
|
+
(type, i) => (
|
|
336
347
|
<SeatRow
|
|
337
348
|
key={i}
|
|
338
349
|
type={type}
|
|
@@ -343,16 +354,20 @@ function SeatSectionMobile({
|
|
|
343
354
|
seatPriceColor={seatPriceColor}
|
|
344
355
|
hasMultipleTypes={hasMultipleTypes}
|
|
345
356
|
textSize="text-[12px]"
|
|
357
|
+
isTrain={isTrain}
|
|
346
358
|
/>
|
|
347
|
-
)
|
|
359
|
+
),
|
|
360
|
+
);
|
|
348
361
|
};
|
|
349
362
|
|
|
350
363
|
const seats = removeDuplicateSeats
|
|
351
364
|
? getUniqueSeats(seatTypesData, 3)
|
|
352
|
-
:
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
365
|
+
: (() => {
|
|
366
|
+
const filtered = seatTypesData
|
|
367
|
+
?.filter((item) => getFilteredSeats(item.label))
|
|
368
|
+
?.sort((a, b) => a.fare - b.fare);
|
|
369
|
+
return isTrain ? filtered : filtered?.slice(0, 2);
|
|
370
|
+
})();
|
|
356
371
|
|
|
357
372
|
const discountedSeats = seats?.map((seat) => ({
|
|
358
373
|
...seat,
|
|
@@ -604,7 +619,7 @@ function SeatSectionMobile({
|
|
|
604
619
|
</div>
|
|
605
620
|
) : (
|
|
606
621
|
<div
|
|
607
|
-
className=
|
|
622
|
+
className={`flex flex-col justify-between ${isTrain ? "" : "h-[2.5rem]"} `}
|
|
608
623
|
style={{
|
|
609
624
|
gap: isSoldOut ? "0px" : "5px",
|
|
610
625
|
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) =>
|