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.
Files changed (29) hide show
  1. package/dist/components/ServiceItem/ServiceItemDesktop.d.ts +1 -1
  2. package/dist/components/ServiceItem/ServiceItemDesktop.js +22 -4
  3. package/dist/components/ServiceItem/ServiceItemMobile.d.ts +1 -1
  4. package/dist/components/ServiceItem/ServiceItemMobile.js +1 -1
  5. package/dist/components/ServiceItem/mobileTypes.d.ts +1 -0
  6. package/dist/components/ServiceItem/types.d.ts +7 -0
  7. package/dist/styles.css +6 -0
  8. package/dist/ui/BottomAmenities/BottomAmenities.d.ts +2 -1
  9. package/dist/ui/BottomAmenities/BottomAmenities.js +4 -2
  10. package/dist/ui/DateTimeSection/DateTimeSection.js +4 -4
  11. package/dist/ui/SeatSection/SeatSection.d.ts +7 -1
  12. package/dist/ui/SeatSection/SeatSection.js +44 -12
  13. package/dist/ui/mobileweb/DateTimeSectionMobile.d.ts +2 -1
  14. package/dist/ui/mobileweb/DateTimeSectionMobile.js +13 -7
  15. package/dist/ui/mobileweb/SeatSectionMobile.d.ts +2 -1
  16. package/dist/ui/mobileweb/SeatSectionMobile.js +22 -15
  17. package/dist/utils/CommonService.d.ts +1 -1
  18. package/dist/utils/CommonService.js +5 -1
  19. package/package.json +1 -1
  20. package/src/components/ServiceItem/ServiceItemDesktop.tsx +47 -1
  21. package/src/components/ServiceItem/ServiceItemMobile.tsx +2 -1
  22. package/src/components/ServiceItem/mobileTypes.ts +31 -26
  23. package/src/components/ServiceItem/types.ts +12 -0
  24. package/src/ui/BottomAmenities/BottomAmenities.tsx +5 -1
  25. package/src/ui/DateTimeSection/DateTimeSection.tsx +4 -4
  26. package/src/ui/SeatSection/SeatSection.tsx +91 -21
  27. package/src/ui/mobileweb/DateTimeSectionMobile.tsx +47 -34
  28. package/src/ui/mobileweb/SeatSectionMobile.tsx +27 -12
  29. 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
- {displayLabel}
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
- return seatTypesData
341
+ const filteredSeats = seatTypesData
332
342
  ?.filter((item) => getFilteredSeats(item.label))
333
- ?.sort((a, b) => a.fare - b.fare)
334
- ?.slice(0, 2)
335
- ?.map((type, i) => (
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
- : seatTypesData
353
- ?.filter((item) => getFilteredSeats(item.label))
354
- ?.sort((a, b) => a.fare - b.fare)
355
- ?.slice(0, 2);
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="flex flex-col justify-between h-[2.5rem] "
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) =>