kupos-ui-components-lib 10.4.75 → 10.4.76
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/styles.css +6 -0
- package/dist/ui/FeaturServiceUiMobile/FeatureServiceUiMobile.js +173 -108
- package/dist/ui/FeatureServiceUI/FeatureServiceUi.js +188 -139
- package/dist/ui/FeatureServiceUI/featureServiceShared.d.ts +20 -0
- package/dist/ui/FeatureServiceUI/featureServiceShared.js +66 -0
- package/package.json +1 -1
- package/src/ui/FeaturServiceUiMobile/FeatureServiceUiMobile.tsx +290 -70
- package/src/ui/FeatureServiceUI/FeatureServiceUi.tsx +321 -119
- package/src/ui/FeatureServiceUI/featureServiceShared.tsx +123 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import DateService from "../../utils/DateService";
|
|
3
|
+
|
|
4
|
+
// Shared helpers for FeatureServiceUi (desktop) and FeatureServiceUiMobile.
|
|
5
|
+
|
|
6
|
+
if (typeof document !== "undefined") {
|
|
7
|
+
let style = document.getElementById("feature-spin-style");
|
|
8
|
+
if (!style) {
|
|
9
|
+
style = document.createElement("style");
|
|
10
|
+
style.id = "feature-spin-style";
|
|
11
|
+
document.head.appendChild(style);
|
|
12
|
+
}
|
|
13
|
+
// Always (re)write so an older injected version doesn't stick around
|
|
14
|
+
style.textContent =
|
|
15
|
+
"@keyframes feature-spin { to { transform: rotate(360deg); } }" +
|
|
16
|
+
// Cards stay scrollable, but the scrollbar takes no width and is hidden
|
|
17
|
+
".feature-cards-scroll{scrollbar-width:none;-ms-overflow-style:none}" +
|
|
18
|
+
".feature-cards-scroll::-webkit-scrollbar{display:none;width:0;height:0}";
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const CARD_BORDER = "1px solid #363c48";
|
|
22
|
+
export const CARD_SELECTED_BORDER = "0.5px solid rgb(255, 92, 96)";
|
|
23
|
+
export const CARD_SELECTED_SHADOW = "inset 0 0 0 1px rgb(255, 92, 96)";
|
|
24
|
+
|
|
25
|
+
// "07:00" / "19:30" -> "07:00 am" / "07:30 pm"; leaves other formats untouched
|
|
26
|
+
export const formatDepartureTime = (time?: string) => {
|
|
27
|
+
if (!time) return "";
|
|
28
|
+
const match = /^(\d{1,2}):(\d{2})$/.exec(String(time).trim());
|
|
29
|
+
if (!match) return time;
|
|
30
|
+
const hours = parseInt(match[1], 10);
|
|
31
|
+
const hours12 = hours % 12 || 12;
|
|
32
|
+
const hh = hours12 < 10 ? `0${hours12}` : String(hours12);
|
|
33
|
+
return `${hh}:${match[2]} ${hours < 12 ? "am" : "pm"}`;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
// "2026-05-23" -> "Vie. 23 de mayo"
|
|
37
|
+
export const formatTravelDate = (travelDate?: string) => {
|
|
38
|
+
if (!travelDate) return "Vie. 23 de mayo";
|
|
39
|
+
const dayName = DateService.getDayNameFromDate(
|
|
40
|
+
travelDate,
|
|
41
|
+
"yyyy-mm-dd",
|
|
42
|
+
"half",
|
|
43
|
+
);
|
|
44
|
+
const day = parseInt(
|
|
45
|
+
DateService.getDateFromDate(travelDate, "yyyy-mm-dd"),
|
|
46
|
+
10,
|
|
47
|
+
);
|
|
48
|
+
const monthName = DateService.getMonthNameFromDate(
|
|
49
|
+
travelDate,
|
|
50
|
+
"yyyy-mm-dd",
|
|
51
|
+
"full",
|
|
52
|
+
);
|
|
53
|
+
return `${dayName.charAt(0).toUpperCase() + dayName.slice(1)}. ${day} de ${monthName}`;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
// Update a node's text without replacing the text node React is tracking
|
|
57
|
+
export const setNodeText = (node: Element | null, text: string) => {
|
|
58
|
+
if (!node) return;
|
|
59
|
+
const first = node.firstChild;
|
|
60
|
+
if (first && first.nodeType === 3 && node.childNodes.length === 1) {
|
|
61
|
+
first.nodeValue = text;
|
|
62
|
+
} else {
|
|
63
|
+
node.textContent = text;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export const OriginIcon = ({ size = 20 }: { size?: number }) => (
|
|
68
|
+
<svg width={size} height={size} viewBox="0 0 20 20" fill="none">
|
|
69
|
+
<circle cx="10" cy="10" r="8.5" stroke="#FF5C60" strokeWidth="1.6" />
|
|
70
|
+
<circle cx="10" cy="10" r="4.5" stroke="#FF5C60" strokeWidth="1.6" />
|
|
71
|
+
</svg>
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
export const DestinationIcon = ({ size = 20 }: { size?: number }) => (
|
|
75
|
+
<svg width={size} height={(size * 22) / 20} viewBox="0 0 20 22" fill="none">
|
|
76
|
+
<path
|
|
77
|
+
d="M10 20.5s-7-6.2-7-11.5a7 7 0 1 1 14 0c0 5.3-7 11.5-7 11.5z"
|
|
78
|
+
stroke="#FF5C60"
|
|
79
|
+
strokeWidth="1.6"
|
|
80
|
+
strokeLinejoin="round"
|
|
81
|
+
/>
|
|
82
|
+
<circle cx="10" cy="9" r="3" stroke="#FF5C60" strokeWidth="1.6" />
|
|
83
|
+
</svg>
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
export const CalendarIcon = ({ size = 20 }: { size?: number }) => (
|
|
87
|
+
<svg width={size} height={size} viewBox="0 0 20 20" fill="none">
|
|
88
|
+
<rect
|
|
89
|
+
x="2"
|
|
90
|
+
y="3.5"
|
|
91
|
+
width="16"
|
|
92
|
+
height="14.5"
|
|
93
|
+
rx="2"
|
|
94
|
+
stroke="#9b9b9b"
|
|
95
|
+
strokeWidth="1.4"
|
|
96
|
+
/>
|
|
97
|
+
<path
|
|
98
|
+
d="M2 7.5h16M6 2v3M14 2v3"
|
|
99
|
+
stroke="#9b9b9b"
|
|
100
|
+
strokeWidth="1.4"
|
|
101
|
+
strokeLinecap="round"
|
|
102
|
+
/>
|
|
103
|
+
<path
|
|
104
|
+
d="M6 11h.01M10 11h.01M14 11h.01M6 14.5h.01M10 14.5h.01M14 14.5h.01"
|
|
105
|
+
stroke="#9b9b9b"
|
|
106
|
+
strokeWidth="1.8"
|
|
107
|
+
strokeLinecap="round"
|
|
108
|
+
/>
|
|
109
|
+
</svg>
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
export const CrownIcon = ({
|
|
113
|
+
width = 18,
|
|
114
|
+
height = 14,
|
|
115
|
+
}: {
|
|
116
|
+
width?: number;
|
|
117
|
+
height?: number;
|
|
118
|
+
}) => (
|
|
119
|
+
<svg width={width} height={height} viewBox="0 0 24 18" fill="#fff">
|
|
120
|
+
<path d="M2 5.5l5 4.2L12 2l5 7.7 5-4.2-2 9.5H4L2 5.5z" />
|
|
121
|
+
<rect x="4" y="16" width="16" height="2" rx="1" />
|
|
122
|
+
</svg>
|
|
123
|
+
);
|