kupos-ui-components-lib 9.11.6 → 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 +48 -14
- 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 +24 -16
- 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 +95 -23
- package/src/ui/mobileweb/DateTimeSectionMobile.tsx +47 -34
- package/src/ui/mobileweb/SeatSectionMobile.tsx +29 -13
- 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
|
|
|
@@ -150,7 +159,8 @@ function SeatSectionMobile({
|
|
|
150
159
|
|
|
151
160
|
const priceColor = isSoldOut ? "#bbb" : seatPriceColor;
|
|
152
161
|
const isMovilBus =
|
|
153
|
-
serviceItem?.operator_service_name === "MovilBus" ||
|
|
162
|
+
serviceItem?.operator_service_name === "MovilBus" ||
|
|
163
|
+
serviceItem?.operator_service_name === "Movil Bus";
|
|
154
164
|
|
|
155
165
|
// Fetch ALL unique seats (no slice limit) for the multi-row MovilBus case
|
|
156
166
|
const uniqueSeats = getUniqueSeats(seatTypesData ?? [], Infinity as number);
|
|
@@ -170,7 +180,7 @@ function SeatSectionMobile({
|
|
|
170
180
|
className="w-[100%] flex flex-row justify-between items-center"
|
|
171
181
|
>
|
|
172
182
|
<span
|
|
173
|
-
className="min-[420]:text-[13px] text-[12px] bold-text"
|
|
183
|
+
className="min-[420]:text-[13px] text-[12px] bold-text whitespace-nowrap"
|
|
174
184
|
style={{ color: isSoldOut ? "#bbb" : "#464647" }}
|
|
175
185
|
>
|
|
176
186
|
{commonService.truncateSeatLabel(seat.label)}
|
|
@@ -323,15 +333,17 @@ function SeatSectionMobile({
|
|
|
323
333
|
seatPriceColor={seatPriceColor}
|
|
324
334
|
hasMultipleTypes={hasMultipleTypes}
|
|
325
335
|
textSize="text-[11px]"
|
|
336
|
+
isTrain={isTrain}
|
|
326
337
|
/>
|
|
327
338
|
));
|
|
328
339
|
}
|
|
329
340
|
|
|
330
|
-
|
|
341
|
+
const filteredSeats = seatTypesData
|
|
331
342
|
?.filter((item) => getFilteredSeats(item.label))
|
|
332
|
-
?.sort((a, b) => a.fare - b.fare)
|
|
333
|
-
|
|
334
|
-
|
|
343
|
+
?.sort((a, b) => a.fare - b.fare);
|
|
344
|
+
|
|
345
|
+
return (isTrain ? filteredSeats : filteredSeats?.slice(0, 2))?.map(
|
|
346
|
+
(type, i) => (
|
|
335
347
|
<SeatRow
|
|
336
348
|
key={i}
|
|
337
349
|
type={type}
|
|
@@ -342,16 +354,20 @@ function SeatSectionMobile({
|
|
|
342
354
|
seatPriceColor={seatPriceColor}
|
|
343
355
|
hasMultipleTypes={hasMultipleTypes}
|
|
344
356
|
textSize="text-[12px]"
|
|
357
|
+
isTrain={isTrain}
|
|
345
358
|
/>
|
|
346
|
-
)
|
|
359
|
+
),
|
|
360
|
+
);
|
|
347
361
|
};
|
|
348
362
|
|
|
349
363
|
const seats = removeDuplicateSeats
|
|
350
364
|
? getUniqueSeats(seatTypesData, 3)
|
|
351
|
-
:
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
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
|
+
})();
|
|
355
371
|
|
|
356
372
|
const discountedSeats = seats?.map((seat) => ({
|
|
357
373
|
...seat,
|
|
@@ -603,7 +619,7 @@ function SeatSectionMobile({
|
|
|
603
619
|
</div>
|
|
604
620
|
) : (
|
|
605
621
|
<div
|
|
606
|
-
className=
|
|
622
|
+
className={`flex flex-col justify-between ${isTrain ? "" : "h-[2.5rem]"} `}
|
|
607
623
|
style={{
|
|
608
624
|
gap: isSoldOut ? "0px" : "5px",
|
|
609
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) =>
|