kupos-ui-components-lib 7.0.1 → 7.0.2
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/RatingHover.js +13 -10
- package/dist/components/ServiceItem/RatingItem.d.ts +1 -0
- package/dist/components/ServiceItem/RatingItem.js +2 -2
- package/dist/components/ServiceItem/ServiceItemDesktop.js +7 -2
- package/dist/components/ServiceItem/ServiceItemMobile.js +2 -2
- package/dist/styles.css +3 -0
- package/package.json +1 -1
- package/src/components/ServiceItem/RatingHover.tsx +16 -6
- package/src/components/ServiceItem/RatingItem.tsx +10 -2
- package/src/components/ServiceItem/ServiceItemDesktop.tsx +11 -6
- package/src/components/ServiceItem/ServiceItemMobile.tsx +2 -2
|
@@ -13,12 +13,14 @@ const RatingHover = ({ serviceItem, isSoldOut, colors, t = (key) => key, transla
|
|
|
13
13
|
tooltip.style.display = "none";
|
|
14
14
|
} }),
|
|
15
15
|
React.createElement("div", { className: "hidden group-hover:block absolute left-[80px] -bottom-[160px] z-20 mt-2 w-[280px] rounded-lg shadow-service-2 bg-white overflow-hidden rounded-[14px] border-[2px]", style: {
|
|
16
|
-
borderColor: colors.ratingBorderColor,
|
|
16
|
+
borderColor: isSoldOut ? "#c0c0c0" : colors.ratingBorderColor,
|
|
17
17
|
color: isSoldOut ? "#c0c0c0" : "",
|
|
18
18
|
} },
|
|
19
|
-
React.createElement("div", { className: "pt-[20px] text-center"
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
React.createElement("div", { className: "pt-[20px] text-center", style: {
|
|
20
|
+
color: isSoldOut ? "#c0c0c0" : "#464647",
|
|
21
|
+
} },
|
|
22
|
+
React.createElement("div", { className: "text-[12px] bold-text" }, translation === null || translation === void 0 ? void 0 : translation.ratingMouseOverText),
|
|
23
|
+
React.createElement("div", { className: "text-[12px] font-light" }, serviceItem.operator_service_name)),
|
|
22
24
|
React.createElement("div", { className: "px-3 py-2 flex flex-col gap-[10px] font9" },
|
|
23
25
|
React.createElement(RatingItem, { rating: serviceItem.operator_details[6] &&
|
|
24
26
|
serviceItem.operator_details[6][Object.keys(serviceItem.operator_details[6] &&
|
|
@@ -27,7 +29,7 @@ const RatingHover = ({ serviceItem, isSoldOut, colors, t = (key) => key, transla
|
|
|
27
29
|
serviceItem.operator_details[6])[0]]).toFixed(1)
|
|
28
30
|
? +parseFloat(serviceItem.operator_details[6][Object.keys(serviceItem.operator_details[6] &&
|
|
29
31
|
serviceItem.operator_details[6])[0]]).toFixed(1)
|
|
30
|
-
: 0, label: translation === null || translation === void 0 ? void 0 : translation.busQuality }),
|
|
32
|
+
: 0, label: translation === null || translation === void 0 ? void 0 : translation.busQuality, isSoldOut: isSoldOut }),
|
|
31
33
|
React.createElement(RatingItem, { rating: serviceItem.operator_details[6] &&
|
|
32
34
|
serviceItem.operator_details[6][Object.keys(serviceItem.operator_details[6] &&
|
|
33
35
|
serviceItem.operator_details[6])[1]] &&
|
|
@@ -35,7 +37,7 @@ const RatingHover = ({ serviceItem, isSoldOut, colors, t = (key) => key, transla
|
|
|
35
37
|
serviceItem.operator_details[6])[1]]).toFixed(1)
|
|
36
38
|
? +parseFloat(serviceItem.operator_details[6][Object.keys(serviceItem.operator_details[6] &&
|
|
37
39
|
serviceItem.operator_details[6])[1]]).toFixed(1)
|
|
38
|
-
: 0, label: translation === null || translation === void 0 ? void 0 : translation.punctuality }),
|
|
40
|
+
: 0, label: translation === null || translation === void 0 ? void 0 : translation.punctuality, isSoldOut: isSoldOut }),
|
|
39
41
|
React.createElement(RatingItem, { rating: serviceItem.operator_details[6] &&
|
|
40
42
|
serviceItem.operator_details[6][Object.keys(serviceItem.operator_details[6] &&
|
|
41
43
|
serviceItem.operator_details[6])[2]] &&
|
|
@@ -43,7 +45,7 @@ const RatingHover = ({ serviceItem, isSoldOut, colors, t = (key) => key, transla
|
|
|
43
45
|
serviceItem.operator_details[6])[2]]).toFixed(1)
|
|
44
46
|
? +parseFloat(serviceItem.operator_details[6][Object.keys(serviceItem.operator_details[6] &&
|
|
45
47
|
serviceItem.operator_details[6])[2]]).toFixed(1)
|
|
46
|
-
: 0, label: translation === null || translation === void 0 ? void 0 : translation.serviceQuality }),
|
|
48
|
+
: 0, label: translation === null || translation === void 0 ? void 0 : translation.serviceQuality, isSoldOut: isSoldOut }),
|
|
47
49
|
React.createElement(RatingItem, { rating: serviceItem.operator_details[6] &&
|
|
48
50
|
serviceItem.operator_details[6][Object.keys(serviceItem.operator_details[6] &&
|
|
49
51
|
serviceItem.operator_details[6])[3]] &&
|
|
@@ -51,9 +53,10 @@ const RatingHover = ({ serviceItem, isSoldOut, colors, t = (key) => key, transla
|
|
|
51
53
|
serviceItem.operator_details[6])[3]]).toFixed(1)
|
|
52
54
|
? +parseFloat(serviceItem.operator_details[6][Object.keys(serviceItem.operator_details[6] &&
|
|
53
55
|
serviceItem.operator_details[6])[3]]).toFixed(1)
|
|
54
|
-
: 0, label: translation === null || translation === void 0 ? void 0 : translation.serviceRecommendation })),
|
|
55
|
-
React.createElement("div", { className: "px-1 py-2 text-center text-[12px]
|
|
56
|
-
backgroundColor: colors.ratingBottomColor,
|
|
56
|
+
: 0, label: translation === null || translation === void 0 ? void 0 : translation.serviceRecommendation, isSoldOut: isSoldOut })),
|
|
57
|
+
React.createElement("div", { className: "px-1 py-2 text-center text-[12px] font9", style: {
|
|
58
|
+
backgroundColor: isSoldOut ? "#f5f5f5" : colors.ratingBottomColor,
|
|
59
|
+
color: isSoldOut ? "#c0c0c1" : "#ff8f45",
|
|
57
60
|
} }, `${translation === null || translation === void 0 ? void 0 : translation.ratingMouseOverCalculationText} ${Object.values(serviceItem.operator_details)[5]} ${translation === null || translation === void 0 ? void 0 : translation.ratingMouseOverCalculationUsers}`))),
|
|
58
61
|
React.createElement("span", { className: "text-[#464647] text-[13.33px]" }, typeof serviceItem.operator_details[1] === "number"
|
|
59
62
|
? serviceItem.operator_details[1].toFixed(1)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
const RatingItem = ({ rating, label }) => {
|
|
2
|
+
const RatingItem = ({ rating, label, isSoldOut, }) => {
|
|
3
3
|
// Calculate percentage for styling
|
|
4
4
|
const percentage = ((rating / 5) * 100).toFixed(0);
|
|
5
5
|
// Determine color based on rating percentage
|
|
@@ -14,7 +14,7 @@ const RatingItem = ({ rating, label }) => {
|
|
|
14
14
|
return "green";
|
|
15
15
|
};
|
|
16
16
|
const colorClass = getColorClass();
|
|
17
|
-
return (React.createElement("div", { className: "rating_item flex items-center mb-2" },
|
|
17
|
+
return (React.createElement("div", { className: "rating_item flex items-center mb-2", style: { opacity: isSoldOut ? 0.5 : 1 } },
|
|
18
18
|
React.createElement("div", { className: "rating_circle relative" },
|
|
19
19
|
React.createElement("div", { className: `c100 small p${percentage} ${colorClass}` },
|
|
20
20
|
React.createElement("span", { className: "text-[#464647] font-medium text-[12px]" }, rating.toFixed(1)),
|
|
@@ -599,9 +599,14 @@ function ServiceItemPB({ serviceItem, onBookButtonPress, colors, metaData, child
|
|
|
599
599
|
(serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.available_seats) > 0 && (React.createElement("div", { className: "text-[12px] text-[red] mt-1 text-center" }, "\u00A1 \u00DAltimos Asientos!")))) : null,
|
|
600
600
|
React.createElement("div", { className: `${"flex justify-between items-center mt-[15px] items-center border-t border-[#eee] mt-[15px] pt-[10px]"}` },
|
|
601
601
|
React.createElement("div", { className: "flex items-center " },
|
|
602
|
-
React.createElement("div", { className: `flex items-center
|
|
602
|
+
React.createElement("div", { className: `flex items-center ${showRating ? "cursor-pointer" : ""}`, style: {
|
|
603
|
+
color: isSoldOut ? "#c0c0c0" : "",
|
|
604
|
+
} },
|
|
603
605
|
showRating ? (React.createElement(RatingHover, { serviceItem: serviceItem, isSoldOut: isSoldOut, colors: colors, t: t, translation: translation })) : null,
|
|
604
|
-
React.createElement("span", { className: "ml-[10px]
|
|
606
|
+
React.createElement("span", { className: "ml-[10px] text-[13.33px]", style: {
|
|
607
|
+
marginLeft: showRating ? "10px" : "0",
|
|
608
|
+
color: isSoldOut ? "#c0c0c0" : "#464647",
|
|
609
|
+
} }, serviceItem.operator_details[2]))),
|
|
605
610
|
serviceItem.duration && (React.createElement("div", { className: "flex items-baseline relative text-[#464647]" },
|
|
606
611
|
React.createElement("div", { className: `w-[18px] h-auto mr-[4px] ${isSoldOut ? "grayscale" : ""}` }, renderIcon("hours", "14px")),
|
|
607
612
|
React.createElement("div", { className: `cursor-default group text-[13.33px] ${isSoldOut ? "text-[#c0c0c0]" : ""}` },
|
|
@@ -232,7 +232,7 @@ function ServiceItemMobile({ serviceItem, onBookButtonPress, colors, busStage, o
|
|
|
232
232
|
? "mt-[20px]"
|
|
233
233
|
: "mt-[10px]"} `, style: { backgroundColor: "#fff", zIndex: 1 } },
|
|
234
234
|
React.createElement("div", { className: "border border-[#E6E6E6] rounded-[20px]", style: { backgroundColor: "#fff", zIndex: 1 } },
|
|
235
|
-
React.createElement("div", { className: `p-[
|
|
235
|
+
React.createElement("div", { className: `p-[12px] ${(serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.train_type_label) === "Tren Express (Nuevo)" ||
|
|
236
236
|
showTopLabel ||
|
|
237
237
|
(serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.is_direct_trip) ||
|
|
238
238
|
(serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.is_transpordo)
|
|
@@ -302,7 +302,7 @@ function ServiceItemMobile({ serviceItem, onBookButtonPress, colors, busStage, o
|
|
|
302
302
|
isSoldOut ? (React.createElement("div", { className: "flex justify-end" },
|
|
303
303
|
React.createElement("span", { className: "min-[420]:text-[13px] text-[11px] text-[#ccc]" }, "Agotado"))) : null))),
|
|
304
304
|
React.createElement("div", { className: "bg-[#E6E6E6] -ml-[12px] -mr-[12px] mt-[10px] mb-[10px] h-[1px]" }),
|
|
305
|
-
React.createElement("div", { className: `${"flex justify-between items-center
|
|
305
|
+
React.createElement("div", { className: `${"flex justify-between items-center items-center "}` },
|
|
306
306
|
React.createElement("div", null,
|
|
307
307
|
React.createElement("div", { className: "flex items-center " },
|
|
308
308
|
React.createElement("div", { className: "flex items-center cursor-pointer ", style: { color: isSoldOut ? "#bbb" : "text-[#464647]" } },
|
package/dist/styles.css
CHANGED
package/package.json
CHANGED
|
@@ -37,15 +37,20 @@ const RatingHover: React.FC<RatingHoverProps> = ({
|
|
|
37
37
|
<div
|
|
38
38
|
className="hidden group-hover:block absolute left-[80px] -bottom-[160px] z-20 mt-2 w-[280px] rounded-lg shadow-service-2 bg-white overflow-hidden rounded-[14px] border-[2px]"
|
|
39
39
|
style={{
|
|
40
|
-
borderColor: colors.ratingBorderColor,
|
|
40
|
+
borderColor: isSoldOut ? "#c0c0c0" : colors.ratingBorderColor,
|
|
41
41
|
color: isSoldOut ? "#c0c0c0" : "",
|
|
42
42
|
}}
|
|
43
43
|
>
|
|
44
|
-
<div
|
|
45
|
-
|
|
44
|
+
<div
|
|
45
|
+
className="pt-[20px] text-center"
|
|
46
|
+
style={{
|
|
47
|
+
color: isSoldOut ? "#c0c0c0" : "#464647",
|
|
48
|
+
}}
|
|
49
|
+
>
|
|
50
|
+
<div className="text-[12px] bold-text">
|
|
46
51
|
{translation?.ratingMouseOverText}
|
|
47
52
|
</div>
|
|
48
|
-
<div className="text-[12px] font-light
|
|
53
|
+
<div className="text-[12px] font-light">
|
|
49
54
|
{serviceItem.operator_service_name}
|
|
50
55
|
</div>
|
|
51
56
|
</div>
|
|
@@ -80,6 +85,7 @@ const RatingHover: React.FC<RatingHoverProps> = ({
|
|
|
80
85
|
: 0
|
|
81
86
|
}
|
|
82
87
|
label={translation?.busQuality}
|
|
88
|
+
isSoldOut={isSoldOut}
|
|
83
89
|
/>
|
|
84
90
|
<RatingItem
|
|
85
91
|
rating={
|
|
@@ -109,6 +115,7 @@ const RatingHover: React.FC<RatingHoverProps> = ({
|
|
|
109
115
|
: 0
|
|
110
116
|
}
|
|
111
117
|
label={translation?.punctuality}
|
|
118
|
+
isSoldOut={isSoldOut}
|
|
112
119
|
/>
|
|
113
120
|
<RatingItem
|
|
114
121
|
rating={
|
|
@@ -138,6 +145,7 @@ const RatingHover: React.FC<RatingHoverProps> = ({
|
|
|
138
145
|
: 0
|
|
139
146
|
}
|
|
140
147
|
label={translation?.serviceQuality}
|
|
148
|
+
isSoldOut={isSoldOut}
|
|
141
149
|
/>
|
|
142
150
|
<RatingItem
|
|
143
151
|
rating={
|
|
@@ -167,14 +175,16 @@ const RatingHover: React.FC<RatingHoverProps> = ({
|
|
|
167
175
|
: 0
|
|
168
176
|
}
|
|
169
177
|
label={translation?.serviceRecommendation}
|
|
178
|
+
isSoldOut={isSoldOut}
|
|
170
179
|
/>
|
|
171
180
|
</div>
|
|
172
181
|
|
|
173
182
|
{/* Footer */}
|
|
174
183
|
<div
|
|
175
|
-
className="px-1 py-2 text-center text-[12px]
|
|
184
|
+
className="px-1 py-2 text-center text-[12px] font9"
|
|
176
185
|
style={{
|
|
177
|
-
backgroundColor: colors.ratingBottomColor,
|
|
186
|
+
backgroundColor: isSoldOut ? "#f5f5f5" : colors.ratingBottomColor,
|
|
187
|
+
color: isSoldOut ? "#c0c0c1" : "#ff8f45",
|
|
178
188
|
}}
|
|
179
189
|
>
|
|
180
190
|
{`${translation?.ratingMouseOverCalculationText} ${
|
|
@@ -4,9 +4,14 @@ import React from "react";
|
|
|
4
4
|
interface RatingItemProps {
|
|
5
5
|
rating: number;
|
|
6
6
|
label: string;
|
|
7
|
+
isSoldOut?: boolean;
|
|
7
8
|
}
|
|
8
9
|
|
|
9
|
-
const RatingItem: React.FC<RatingItemProps> = ({
|
|
10
|
+
const RatingItem: React.FC<RatingItemProps> = ({
|
|
11
|
+
rating,
|
|
12
|
+
label,
|
|
13
|
+
isSoldOut,
|
|
14
|
+
}) => {
|
|
10
15
|
// Calculate percentage for styling
|
|
11
16
|
const percentage = ((rating / 5) * 100).toFixed(0);
|
|
12
17
|
|
|
@@ -22,7 +27,10 @@ const RatingItem: React.FC<RatingItemProps> = ({ rating, label }) => {
|
|
|
22
27
|
const colorClass = getColorClass();
|
|
23
28
|
|
|
24
29
|
return (
|
|
25
|
-
<div
|
|
30
|
+
<div
|
|
31
|
+
className="rating_item flex items-center mb-2"
|
|
32
|
+
style={{ opacity: isSoldOut ? 0.5 : 1 }}
|
|
33
|
+
>
|
|
26
34
|
<div className="rating_circle relative">
|
|
27
35
|
<div className={`c100 small p${percentage} ${colorClass}`}>
|
|
28
36
|
<span className="text-[#464647] font-medium text-[12px]">
|
|
@@ -1070,10 +1070,12 @@ function ServiceItemPB({
|
|
|
1070
1070
|
{/* Rating */}
|
|
1071
1071
|
<div className="flex items-center ">
|
|
1072
1072
|
<div
|
|
1073
|
-
className={`flex items-center
|
|
1074
|
-
|
|
1075
|
-
}
|
|
1076
|
-
style={{
|
|
1073
|
+
className={`flex items-center ${
|
|
1074
|
+
showRating ? "cursor-pointer" : ""
|
|
1075
|
+
}`}
|
|
1076
|
+
style={{
|
|
1077
|
+
color: isSoldOut ? "#c0c0c0" : "",
|
|
1078
|
+
}}
|
|
1077
1079
|
>
|
|
1078
1080
|
{showRating ? (
|
|
1079
1081
|
<RatingHover
|
|
@@ -1085,8 +1087,11 @@ function ServiceItemPB({
|
|
|
1085
1087
|
/>
|
|
1086
1088
|
) : null}
|
|
1087
1089
|
<span
|
|
1088
|
-
className="ml-[10px]
|
|
1089
|
-
style={{
|
|
1090
|
+
className="ml-[10px] text-[13.33px]"
|
|
1091
|
+
style={{
|
|
1092
|
+
marginLeft: showRating ? "10px" : "0",
|
|
1093
|
+
color: isSoldOut ? "#c0c0c0" : "#464647",
|
|
1094
|
+
}}
|
|
1090
1095
|
>
|
|
1091
1096
|
{serviceItem.operator_details[2]}
|
|
1092
1097
|
</span>
|
|
@@ -338,7 +338,7 @@ function ServiceItemMobile({
|
|
|
338
338
|
style={{ backgroundColor: "#fff", zIndex: 1 }}
|
|
339
339
|
>
|
|
340
340
|
<div
|
|
341
|
-
className={`p-[
|
|
341
|
+
className={`p-[12px] ${
|
|
342
342
|
serviceItem?.train_type_label === "Tren Express (Nuevo)" ||
|
|
343
343
|
showTopLabel ||
|
|
344
344
|
serviceItem?.is_direct_trip ||
|
|
@@ -543,7 +543,7 @@ function ServiceItemMobile({
|
|
|
543
543
|
</div>
|
|
544
544
|
<div className="bg-[#E6E6E6] -ml-[12px] -mr-[12px] mt-[10px] mb-[10px] h-[1px]"></div>
|
|
545
545
|
<div
|
|
546
|
-
className={`${"flex justify-between items-center
|
|
546
|
+
className={`${"flex justify-between items-center items-center "}`}
|
|
547
547
|
>
|
|
548
548
|
{/* Rating */}
|
|
549
549
|
<div>
|