@devtravelcode/widget-native 1.0.0
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/LICENSE +18 -0
- package/dist/App.d.ts +10 -0
- package/dist/App.js +192 -0
- package/dist/TravelHubWidget.d.ts +12 -0
- package/dist/TravelHubWidget.js +58 -0
- package/dist/components/ErrorBoundary.d.ts +18 -0
- package/dist/components/ErrorBoundary.js +63 -0
- package/dist/components/ui/Modal.d.ts +11 -0
- package/dist/components/ui/Modal.js +66 -0
- package/dist/components/ui/Skeleton.d.ts +8 -0
- package/dist/components/ui/Skeleton.js +33 -0
- package/dist/components/ui/badge.d.ts +11 -0
- package/dist/components/ui/badge.js +54 -0
- package/dist/components/ui/button.d.ts +14 -0
- package/dist/components/ui/button.js +101 -0
- package/dist/components/ui/card.d.ts +16 -0
- package/dist/components/ui/card.js +51 -0
- package/dist/components/ui/input.d.ts +8 -0
- package/dist/components/ui/input.js +61 -0
- package/dist/components/ui/label.d.ts +8 -0
- package/dist/components/ui/label.js +17 -0
- package/dist/context/WidgetContext.d.ts +29 -0
- package/dist/context/WidgetContext.js +64 -0
- package/dist/icons/CarIcon.d.ts +4 -0
- package/dist/icons/CarIcon.js +3 -0
- package/dist/icons/CloseIcon.d.ts +7 -0
- package/dist/icons/CloseIcon.js +3 -0
- package/dist/icons/FlightIcon.d.ts +4 -0
- package/dist/icons/FlightIcon.js +3 -0
- package/dist/icons/HotelIcon.d.ts +4 -0
- package/dist/icons/HotelIcon.js +3 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/lib/utils.js +3 -0
- package/dist/locales/widgetTranslations.d.ts +1 -0
- package/dist/locales/widgetTranslations.js +732 -0
- package/dist/modules/hooks/useAirportSearch.d.ts +21 -0
- package/dist/modules/hooks/useAirportSearch.js +48 -0
- package/dist/modules/hooks/useCarOffers.d.ts +7 -0
- package/dist/modules/hooks/useCarOffers.js +47 -0
- package/dist/modules/hooks/useCountriesByCodes.d.ts +4 -0
- package/dist/modules/hooks/useCountriesByCodes.js +60 -0
- package/dist/modules/hooks/useCountriesSearch.d.ts +11 -0
- package/dist/modules/hooks/useCountriesSearch.js +55 -0
- package/dist/modules/hooks/useDefaultHotelLocation.d.ts +7 -0
- package/dist/modules/hooks/useDefaultHotelLocation.js +44 -0
- package/dist/modules/hooks/useDetectNationality.d.ts +1 -0
- package/dist/modules/hooks/useDetectNationality.js +20 -0
- package/dist/modules/hooks/useFlightSearch.d.ts +20 -0
- package/dist/modules/hooks/useFlightSearch.js +243 -0
- package/dist/modules/hooks/useHotelDetails.d.ts +7 -0
- package/dist/modules/hooks/useHotelDetails.js +80 -0
- package/dist/modules/hooks/useHotelLocations.d.ts +5 -0
- package/dist/modules/hooks/useHotelLocations.js +42 -0
- package/dist/modules/hooks/useHotelMapData.d.ts +12 -0
- package/dist/modules/hooks/useHotelMapData.js +78 -0
- package/dist/modules/hooks/useHotelOffers.d.ts +11 -0
- package/dist/modules/hooks/useHotelOffers.js +122 -0
- package/dist/modules/hooks/useHotelSearchSSE.d.ts +18 -0
- package/dist/modules/hooks/useHotelSearchSSE.js +411 -0
- package/dist/modules/hooks/useSearchExpiration.d.ts +6 -0
- package/dist/modules/hooks/useSearchExpiration.js +35 -0
- package/dist/modules/hooks/useTranslationsHub.d.ts +5 -0
- package/dist/modules/hooks/useTranslationsHub.js +48 -0
- package/dist/modules/navbar/Navbar.d.ts +8 -0
- package/dist/modules/navbar/Navbar.js +69 -0
- package/dist/modules/search-form/AgeSelector.d.ts +9 -0
- package/dist/modules/search-form/AgeSelector.js +109 -0
- package/dist/modules/search-form/CustomSelect.d.ts +14 -0
- package/dist/modules/search-form/CustomSelect.js +94 -0
- package/dist/modules/search-form/FiltersSkeleton.d.ts +6 -0
- package/dist/modules/search-form/FiltersSkeleton.js +35 -0
- package/dist/modules/search-form/NationalityInput.d.ts +18 -0
- package/dist/modules/search-form/NationalityInput.js +172 -0
- package/dist/modules/search-form/Pagination.d.ts +8 -0
- package/dist/modules/search-form/Pagination.js +84 -0
- package/dist/modules/search-form/SearchExpiredPopup.d.ts +10 -0
- package/dist/modules/search-form/SearchExpiredPopup.js +91 -0
- package/dist/modules/search-form/SkeletonWidget.d.ts +2 -0
- package/dist/modules/search-form/SkeletonWidget.js +33 -0
- package/dist/modules/search-form/TimePicker.d.ts +9 -0
- package/dist/modules/search-form/TimePicker.js +182 -0
- package/dist/modules/search-form/cars/CarEmptyState.d.ts +6 -0
- package/dist/modules/search-form/cars/CarEmptyState.js +42 -0
- package/dist/modules/search-form/cars/CarFiltersSkeleton.d.ts +6 -0
- package/dist/modules/search-form/cars/CarFiltersSkeleton.js +35 -0
- package/dist/modules/search-form/cars/CarOffersList.d.ts +43 -0
- package/dist/modules/search-form/cars/CarOffersList.js +214 -0
- package/dist/modules/search-form/cars/CarResults.d.ts +25 -0
- package/dist/modules/search-form/cars/CarResults.js +116 -0
- package/dist/modules/search-form/cars/CarSearchForm.d.ts +19 -0
- package/dist/modules/search-form/cars/CarSearchForm.js +173 -0
- package/dist/modules/search-form/cars/CarSkeleton.d.ts +6 -0
- package/dist/modules/search-form/cars/CarSkeleton.js +46 -0
- package/dist/modules/search-form/cars/CarTopOffersSlider.d.ts +20 -0
- package/dist/modules/search-form/cars/CarTopOffersSlider.js +100 -0
- package/dist/modules/search-form/cars/car-filters/CarFilters.d.ts +8 -0
- package/dist/modules/search-form/cars/car-filters/CarFilters.js +318 -0
- package/dist/modules/search-form/cars/car-filters/FilterSection.d.ts +9 -0
- package/dist/modules/search-form/cars/car-filters/FilterSection.js +30 -0
- package/dist/modules/search-form/cars/car-filters/index.d.ts +6 -0
- package/dist/modules/search-form/cars/car-filters/index.js +3 -0
- package/dist/modules/search-form/cars/car-filters/useCarFilters.d.ts +24 -0
- package/dist/modules/search-form/cars/car-filters/useCarFilters.js +121 -0
- package/dist/modules/search-form/flight/AirlinesSelector.d.ts +8 -0
- package/dist/modules/search-form/flight/AirlinesSelector.js +235 -0
- package/dist/modules/search-form/flight/CabinClassSelector.d.ts +9 -0
- package/dist/modules/search-form/flight/CabinClassSelector.js +63 -0
- package/dist/modules/search-form/flight/DatePicker.d.ts +12 -0
- package/dist/modules/search-form/flight/DatePicker.js +536 -0
- package/dist/modules/search-form/flight/FlightSearchForm.d.ts +18 -0
- package/dist/modules/search-form/flight/FlightSearchForm.js +147 -0
- package/dist/modules/search-form/flight/LocationInput.d.ts +11 -0
- package/dist/modules/search-form/flight/LocationInput.js +294 -0
- package/dist/modules/search-form/flight/PassengersPicker.d.ts +16 -0
- package/dist/modules/search-form/flight/PassengersPicker.js +203 -0
- package/dist/modules/search-form/flight/SwitchLocationBtn.d.ts +9 -0
- package/dist/modules/search-form/flight/SwitchLocationBtn.js +48 -0
- package/dist/modules/search-form/flight/flight-filters/FiltersContent.d.ts +21 -0
- package/dist/modules/search-form/flight/flight-filters/FiltersContent.js +145 -0
- package/dist/modules/search-form/flight/flight-filters/FlightFiltersDynamic.d.ts +11 -0
- package/dist/modules/search-form/flight/flight-filters/FlightFiltersDynamic.js +213 -0
- package/dist/modules/search-form/flight/flight-filters/RangeBlock.d.ts +22 -0
- package/dist/modules/search-form/flight/flight-filters/RangeBlock.js +164 -0
- package/dist/modules/search-form/flight/flight-filters/index.d.ts +1 -0
- package/dist/modules/search-form/flight/flight-filters/index.js +1 -0
- package/dist/modules/search-form/flight/flight-results/FlightAdditionalInfo.d.ts +16 -0
- package/dist/modules/search-form/flight/flight-results/FlightAdditionalInfo.js +229 -0
- package/dist/modules/search-form/flight/flight-results/FlightBaggageToggle.d.ts +15 -0
- package/dist/modules/search-form/flight/flight-results/FlightBaggageToggle.js +110 -0
- package/dist/modules/search-form/flight/flight-results/FlightCard.d.ts +14 -0
- package/dist/modules/search-form/flight/flight-results/FlightCard.js +436 -0
- package/dist/modules/search-form/flight/flight-results/FlightInfo.d.ts +12 -0
- package/dist/modules/search-form/flight/flight-results/FlightInfo.js +48 -0
- package/dist/modules/search-form/flight/flight-results/FlightPriceBlock.d.ts +11 -0
- package/dist/modules/search-form/flight/flight-results/FlightPriceBlock.js +36 -0
- package/dist/modules/search-form/flight/flight-results/FlightResults.d.ts +22 -0
- package/dist/modules/search-form/flight/flight-results/FlightResults.js +109 -0
- package/dist/modules/search-form/flight/flight-results/FlightSegments.d.ts +40 -0
- package/dist/modules/search-form/flight/flight-results/FlightSegments.js +162 -0
- package/dist/modules/search-form/flight/flight-results/FlightsSkeleton.d.ts +6 -0
- package/dist/modules/search-form/flight/flight-results/FlightsSkeleton.js +52 -0
- package/dist/modules/search-form/flight/flight-results/ProvidersLoader.d.ts +9 -0
- package/dist/modules/search-form/flight/flight-results/ProvidersLoader.js +242 -0
- package/dist/modules/search-form/hotel/DatePicker.d.ts +1 -0
- package/dist/modules/search-form/hotel/DatePicker.js +1 -0
- package/dist/modules/search-form/hotel/GuestSelector.d.ts +13 -0
- package/dist/modules/search-form/hotel/GuestSelector.js +272 -0
- package/dist/modules/search-form/hotel/GuestSelectorMobilePopup.d.ts +2 -0
- package/dist/modules/search-form/hotel/GuestSelectorMobilePopup.js +1 -0
- package/dist/modules/search-form/hotel/HotelLocation.d.ts +17 -0
- package/dist/modules/search-form/hotel/HotelLocation.js +178 -0
- package/dist/modules/search-form/hotel/HotelLocationMobilePopup.d.ts +2 -0
- package/dist/modules/search-form/hotel/HotelLocationMobilePopup.js +1 -0
- package/dist/modules/search-form/hotel/HotelResults.d.ts +21 -0
- package/dist/modules/search-form/hotel/HotelResults.js +333 -0
- package/dist/modules/search-form/hotel/HotelSearchForm.d.ts +13 -0
- package/dist/modules/search-form/hotel/HotelSearchForm.js +130 -0
- package/dist/modules/search-form/hotel/HotelsSkeleton.d.ts +6 -0
- package/dist/modules/search-form/hotel/HotelsSkeleton.js +40 -0
- package/dist/modules/search-form/hotel/PassengersPicker.d.ts +2 -0
- package/dist/modules/search-form/hotel/PassengersPicker.js +1 -0
- package/dist/modules/search-form/hotel/components/HotelCard.d.ts +11 -0
- package/dist/modules/search-form/hotel/components/HotelCard.js +180 -0
- package/dist/modules/search-form/hotel/components/HotelEmptyState.d.ts +6 -0
- package/dist/modules/search-form/hotel/components/HotelEmptyState.js +34 -0
- package/dist/modules/search-form/hotel/components/HotelGallery.d.ts +6 -0
- package/dist/modules/search-form/hotel/components/HotelGallery.js +77 -0
- package/dist/modules/search-form/hotel/components/HotelList.d.ts +9 -0
- package/dist/modules/search-form/hotel/components/HotelList.js +12 -0
- package/dist/modules/search-form/hotel/components/HotelMap.d.ts +26 -0
- package/dist/modules/search-form/hotel/components/HotelMap.js +707 -0
- package/dist/modules/search-form/hotel/components/HotelPin.d.ts +7 -0
- package/dist/modules/search-form/hotel/components/HotelPin.js +1 -0
- package/dist/modules/search-form/hotel/hotel-filters/HotelFilters.d.ts +29 -0
- package/dist/modules/search-form/hotel/hotel-filters/HotelFilters.js +339 -0
- package/dist/modules/search-form/hotel/hotel-filters/HotelFiltersBar.d.ts +3 -0
- package/dist/modules/search-form/hotel/hotel-filters/HotelFiltersBar.js +2 -0
- package/dist/modules/search-form/hotel/hotel-filters/HotelFiltersContent.d.ts +2 -0
- package/dist/modules/search-form/hotel/hotel-filters/HotelFiltersContent.js +1 -0
- package/dist/modules/search-form/hotel/hotel-filters/HotelFiltersDynamic.d.ts +2 -0
- package/dist/modules/search-form/hotel/hotel-filters/HotelFiltersDynamic.js +1 -0
- package/dist/modules/search-form/hotel/hotel-filters/HotelFiltersMobilePopup.d.ts +2 -0
- package/dist/modules/search-form/hotel/hotel-filters/HotelFiltersMobilePopup.js +1 -0
- package/dist/modules/search-form/hotel/hotel-filters/RangeBlock.d.ts +1 -0
- package/dist/modules/search-form/hotel/hotel-filters/RangeBlock.js +1 -0
- package/dist/modules/search-form/hotel/hotel-filters/index.d.ts +1 -0
- package/dist/modules/search-form/hotel/hotel-filters/index.js +1 -0
- package/dist/modules/tabs/FlightsTab.d.ts +1 -0
- package/dist/modules/tabs/FlightsTab.js +1 -0
- package/dist/modules/tabs/HotelsTab.d.ts +1 -0
- package/dist/modules/tabs/HotelsTab.js +1 -0
- package/dist/store/index.d.ts +22 -0
- package/dist/store/index.js +19 -0
- package/dist/theme/colors.d.ts +56 -0
- package/dist/theme/colors.js +56 -0
- package/dist/theme/formStyles.d.ts +76 -0
- package/dist/theme/formStyles.js +78 -0
- package/dist/utils/applyWidgetColors.d.ts +1 -0
- package/dist/utils/applyWidgetColors.js +2 -0
- package/dist/utils/dateTime.d.ts +2 -0
- package/dist/utils/dateTime.js +23 -0
- package/dist/utils/fetchSSE.d.ts +23 -0
- package/dist/utils/fetchSSE.js +104 -0
- package/dist/utils/getToken.d.ts +3 -0
- package/dist/utils/getToken.js +12 -0
- package/package.json +64 -0
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect, useRef } from "react";
|
|
3
|
+
import { View, Text, TextInput, TouchableOpacity, Modal, FlatList, StyleSheet, ActivityIndicator, } from "react-native";
|
|
4
|
+
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
5
|
+
import Svg, { Circle, Path } from "react-native-svg";
|
|
6
|
+
import { useApiToken } from "../../../utils/getToken";
|
|
7
|
+
import { Colors, Spacing, BorderRadius, FontSize } from "../../../theme/colors";
|
|
8
|
+
import { CloseIcon } from "../../../store";
|
|
9
|
+
import { formStyles } from "../../../theme/formStyles";
|
|
10
|
+
const POPULAR_AIRLINES = [
|
|
11
|
+
{ id: 1, code: "LH", title: "Lufthansa" },
|
|
12
|
+
{ id: 2, code: "AF", title: "Air France" },
|
|
13
|
+
{ id: 3, code: "TK", title: "Turkish Airlines" },
|
|
14
|
+
{ id: 4, code: "FZ", title: "FlyDubai" },
|
|
15
|
+
{ id: 5, code: "EK", title: "Emirates" },
|
|
16
|
+
{ id: 6, code: "W6", title: "Wizz Air" },
|
|
17
|
+
];
|
|
18
|
+
const API_URL = "https://api.travel-code.com/v1/data/airlines";
|
|
19
|
+
const SearchIcon = () => (_jsxs(Svg, { width: 19, height: 18, viewBox: "0 0 19 18", fill: "none", children: [_jsx(Circle, { cx: 7, cy: 7, r: 6, stroke: Colors.primary, strokeWidth: 2 }), _jsx(Path, { d: "M12 11L17.2857 16.0902", stroke: Colors.primary, strokeWidth: 2, strokeLinecap: "round" })] }));
|
|
20
|
+
const AirlinesSelector = ({ value, onChange, translations, }) => {
|
|
21
|
+
const token = useApiToken();
|
|
22
|
+
const insets = useSafeAreaInsets();
|
|
23
|
+
const [query, setQuery] = useState("");
|
|
24
|
+
const [airlines, setAirlines] = useState([]);
|
|
25
|
+
const [loading, setLoading] = useState(false);
|
|
26
|
+
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
27
|
+
const debounceTimer = useRef(null);
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
if (query.length < 2) {
|
|
30
|
+
setAirlines([]);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (debounceTimer.current)
|
|
34
|
+
clearTimeout(debounceTimer.current);
|
|
35
|
+
const controller = new AbortController();
|
|
36
|
+
debounceTimer.current = setTimeout(async () => {
|
|
37
|
+
setLoading(true);
|
|
38
|
+
try {
|
|
39
|
+
const res = await fetch(`${API_URL}?limit=50&search=${encodeURIComponent(query)}`, {
|
|
40
|
+
headers: {
|
|
41
|
+
"Content-Type": "application/json",
|
|
42
|
+
Authorization: `Bearer ${token}`,
|
|
43
|
+
},
|
|
44
|
+
signal: controller.signal,
|
|
45
|
+
});
|
|
46
|
+
if (!res.ok)
|
|
47
|
+
throw new Error(`Error ${res.status}`);
|
|
48
|
+
const data = await res.json();
|
|
49
|
+
setAirlines(Array.isArray(data) ? data : data.data || []);
|
|
50
|
+
}
|
|
51
|
+
catch (e) {
|
|
52
|
+
if (e?.name !== "AbortError") {
|
|
53
|
+
console.error("Error loading airlines:", e);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
finally {
|
|
57
|
+
setLoading(false);
|
|
58
|
+
}
|
|
59
|
+
}, 300);
|
|
60
|
+
return () => {
|
|
61
|
+
if (debounceTimer.current)
|
|
62
|
+
clearTimeout(debounceTimer.current);
|
|
63
|
+
controller.abort();
|
|
64
|
+
};
|
|
65
|
+
}, [query, token]);
|
|
66
|
+
const toggleAirline = (code) => {
|
|
67
|
+
const updated = value.includes(code)
|
|
68
|
+
? value.filter((c) => c !== code)
|
|
69
|
+
: [...value, code];
|
|
70
|
+
onChange(updated);
|
|
71
|
+
};
|
|
72
|
+
const showPopular = !loading && (!query.trim() || query.length < 2) && airlines.length === 0;
|
|
73
|
+
const displayList = showPopular ? POPULAR_AIRLINES : airlines;
|
|
74
|
+
const selectedAirlines = value
|
|
75
|
+
.map((code) => POPULAR_AIRLINES.find((a) => a.code === code) ||
|
|
76
|
+
airlines.find((a) => a.code === code))
|
|
77
|
+
.filter(Boolean);
|
|
78
|
+
const renderAirlineItem = ({ item: airline }) => {
|
|
79
|
+
const isSelected = value.includes(airline.code);
|
|
80
|
+
return (_jsx(TouchableOpacity, { style: [styles.airlineItem, isSelected && styles.airlineItemSelected], onPress: () => toggleAirline(airline.code), activeOpacity: 0.7, children: _jsxs(View, { style: styles.airlineItemContent, children: [_jsx(View, { style: styles.airlineInfo, children: _jsxs(Text, { style: styles.airlineTitle, children: [airline.title, _jsx(Text, { style: styles.airlineCode, children: ` ${airline.code}` })] }) }), _jsx(View, { style: [
|
|
81
|
+
styles.checkbox,
|
|
82
|
+
isSelected && styles.checkboxSelected,
|
|
83
|
+
], children: isSelected && _jsx(Text, { style: styles.checkmark, children: "\u2713" }) })] }) }));
|
|
84
|
+
};
|
|
85
|
+
return (_jsxs(_Fragment, { children: [_jsxs(TouchableOpacity, { style: formStyles.inputTrigger, onPress: () => setIsModalOpen(true), activeOpacity: 0.8, children: [_jsx(Text, { style: formStyles.label, children: translations["airlines_label"] || "Airlines" }), value.length > 0 ? (_jsx(View, { style: styles.chipsRow, children: value.map((code) => {
|
|
86
|
+
const airline = POPULAR_AIRLINES.find((a) => a.code === code) ||
|
|
87
|
+
airlines.find((a) => a.code === code);
|
|
88
|
+
return (_jsxs(View, { style: styles.chip, children: [_jsx(Text, { style: styles.chipText, children: airline?.title || code }), _jsx(TouchableOpacity, { onPress: () => toggleAirline(code), hitSlop: { top: 4, bottom: 4, left: 4, right: 4 }, children: _jsx(Text, { style: styles.chipRemove, children: "x" }) })] }, code));
|
|
89
|
+
}) })) : (_jsx(Text, { style: formStyles.inputTriggerPlaceholder, children: translations["all_airlines_placeholder"] || "All airlines" }))] }), _jsx(Modal, { visible: isModalOpen, animationType: "slide", presentationStyle: "fullScreen", onRequestClose: () => setIsModalOpen(false), children: _jsxs(View, { style: [styles.modalContainer, { paddingTop: insets.top }], children: [_jsx(TouchableOpacity, { style: styles.closeButton, onPress: () => setIsModalOpen(false), hitSlop: { top: 8, bottom: 8, left: 8, right: 8 }, children: _jsx(CloseIcon, { size: 16 }) }), _jsxs(View, { style: styles.searchHeader, children: [_jsx(SearchIcon, {}), _jsx(TextInput, { autoFocus: true, style: styles.searchInput, value: query, onChangeText: setQuery, placeholder: translations["airlines_popup_placeholder"] ||
|
|
90
|
+
"Search airlines", placeholderTextColor: Colors.textTertiary, returnKeyType: "search" })] }), selectedAirlines.length > 0 && (_jsx(View, { style: styles.selectedChipsContainer, children: selectedAirlines.map((airline) => (_jsxs(View, { style: styles.chip, children: [_jsx(Text, { style: styles.chipText, children: airline.title }), _jsx(TouchableOpacity, { onPress: () => toggleAirline(airline.code), hitSlop: { top: 4, bottom: 4, left: 4, right: 4 }, children: _jsx(Text, { style: styles.chipRemove, children: "x" }) })] }, airline.code))) })), _jsxs(View, { style: styles.modalContent, children: [loading && (_jsxs(View, { style: styles.loadingContainer, children: [_jsx(ActivityIndicator, { size: "small", color: Colors.primary }), _jsx(Text, { style: styles.loadingText, children: translations["airlines_popup_loading"] || "Loading..." })] })), !loading &&
|
|
91
|
+
!showPopular &&
|
|
92
|
+
airlines.length === 0 &&
|
|
93
|
+
query.length >= 2 && (_jsx(Text, { style: styles.noResults, children: translations["airlines_popup_no_results"] ||
|
|
94
|
+
"Nothing found" })), !loading && (_jsxs(_Fragment, { children: [showPopular && (_jsx(Text, { style: styles.sectionTitle, children: translations["airlines_popup_popular_title"] ||
|
|
95
|
+
"Popular airlines" })), _jsx(FlatList, { data: displayList, renderItem: renderAirlineItem, keyExtractor: (item) => String(item.id), keyboardShouldPersistTaps: "handled", showsVerticalScrollIndicator: false })] }))] })] }) })] }));
|
|
96
|
+
};
|
|
97
|
+
const styles = StyleSheet.create({
|
|
98
|
+
chipsRow: {
|
|
99
|
+
flexDirection: "row",
|
|
100
|
+
flexWrap: "wrap",
|
|
101
|
+
gap: Spacing.sm,
|
|
102
|
+
},
|
|
103
|
+
chip: {
|
|
104
|
+
flexDirection: "row",
|
|
105
|
+
alignItems: "center",
|
|
106
|
+
backgroundColor: Colors.primaryLight,
|
|
107
|
+
borderRadius: BorderRadius.sm,
|
|
108
|
+
paddingHorizontal: Spacing.sm,
|
|
109
|
+
paddingVertical: Spacing.xs,
|
|
110
|
+
gap: Spacing.xs,
|
|
111
|
+
},
|
|
112
|
+
chipText: {
|
|
113
|
+
fontSize: FontSize.sm,
|
|
114
|
+
color: Colors.primary,
|
|
115
|
+
fontWeight: "500",
|
|
116
|
+
},
|
|
117
|
+
chipRemove: {
|
|
118
|
+
fontSize: FontSize.sm,
|
|
119
|
+
color: Colors.primary,
|
|
120
|
+
fontWeight: "600",
|
|
121
|
+
paddingLeft: Spacing.xs,
|
|
122
|
+
},
|
|
123
|
+
modalContainer: {
|
|
124
|
+
flex: 1,
|
|
125
|
+
backgroundColor: Colors.surface,
|
|
126
|
+
},
|
|
127
|
+
closeButton: {
|
|
128
|
+
alignSelf: "flex-end",
|
|
129
|
+
padding: Spacing.lg,
|
|
130
|
+
},
|
|
131
|
+
closeButtonText: {
|
|
132
|
+
fontSize: FontSize.xl,
|
|
133
|
+
color: Colors.textSecondary,
|
|
134
|
+
fontWeight: "600",
|
|
135
|
+
},
|
|
136
|
+
searchHeader: {
|
|
137
|
+
flexDirection: "row",
|
|
138
|
+
alignItems: "center",
|
|
139
|
+
paddingHorizontal: Spacing.lg,
|
|
140
|
+
paddingVertical: Spacing.md,
|
|
141
|
+
borderBottomWidth: 1,
|
|
142
|
+
borderBottomColor: Colors.border,
|
|
143
|
+
gap: Spacing.md,
|
|
144
|
+
},
|
|
145
|
+
searchInput: {
|
|
146
|
+
flex: 1,
|
|
147
|
+
fontSize: FontSize.lg,
|
|
148
|
+
color: Colors.text,
|
|
149
|
+
paddingVertical: Spacing.sm,
|
|
150
|
+
},
|
|
151
|
+
selectedChipsContainer: {
|
|
152
|
+
flexDirection: "row",
|
|
153
|
+
flexWrap: "wrap",
|
|
154
|
+
paddingHorizontal: Spacing.lg,
|
|
155
|
+
paddingVertical: Spacing.sm,
|
|
156
|
+
gap: Spacing.sm,
|
|
157
|
+
borderBottomWidth: 1,
|
|
158
|
+
borderBottomColor: Colors.border,
|
|
159
|
+
},
|
|
160
|
+
modalContent: {
|
|
161
|
+
flex: 1,
|
|
162
|
+
paddingHorizontal: Spacing.lg,
|
|
163
|
+
},
|
|
164
|
+
loadingContainer: {
|
|
165
|
+
flexDirection: "row",
|
|
166
|
+
alignItems: "center",
|
|
167
|
+
padding: Spacing.lg,
|
|
168
|
+
gap: Spacing.sm,
|
|
169
|
+
},
|
|
170
|
+
loadingText: {
|
|
171
|
+
fontSize: FontSize.md,
|
|
172
|
+
color: Colors.textSecondary,
|
|
173
|
+
},
|
|
174
|
+
noResults: {
|
|
175
|
+
padding: Spacing.lg,
|
|
176
|
+
fontSize: FontSize.md,
|
|
177
|
+
color: Colors.textTertiary,
|
|
178
|
+
},
|
|
179
|
+
sectionTitle: {
|
|
180
|
+
fontSize: FontSize.sm,
|
|
181
|
+
color: Colors.textTertiary,
|
|
182
|
+
fontWeight: "600",
|
|
183
|
+
textTransform: "uppercase",
|
|
184
|
+
letterSpacing: 0.5,
|
|
185
|
+
paddingVertical: Spacing.md,
|
|
186
|
+
},
|
|
187
|
+
airlineItem: {
|
|
188
|
+
paddingVertical: Spacing.md,
|
|
189
|
+
borderBottomWidth: StyleSheet.hairlineWidth,
|
|
190
|
+
borderBottomColor: Colors.borderLight,
|
|
191
|
+
},
|
|
192
|
+
airlineItemSelected: {
|
|
193
|
+
backgroundColor: Colors.primaryLight,
|
|
194
|
+
marginHorizontal: -Spacing.lg,
|
|
195
|
+
paddingHorizontal: Spacing.lg,
|
|
196
|
+
borderRadius: BorderRadius.sm,
|
|
197
|
+
},
|
|
198
|
+
airlineItemContent: {
|
|
199
|
+
flexDirection: "row",
|
|
200
|
+
alignItems: "center",
|
|
201
|
+
justifyContent: "space-between",
|
|
202
|
+
},
|
|
203
|
+
airlineInfo: {
|
|
204
|
+
flex: 1,
|
|
205
|
+
},
|
|
206
|
+
airlineTitle: {
|
|
207
|
+
fontSize: FontSize.md,
|
|
208
|
+
color: Colors.text,
|
|
209
|
+
fontWeight: "500",
|
|
210
|
+
},
|
|
211
|
+
airlineCode: {
|
|
212
|
+
fontSize: FontSize.md,
|
|
213
|
+
color: Colors.textSecondary,
|
|
214
|
+
fontWeight: "400",
|
|
215
|
+
},
|
|
216
|
+
checkbox: {
|
|
217
|
+
width: 22,
|
|
218
|
+
height: 22,
|
|
219
|
+
borderRadius: BorderRadius.sm,
|
|
220
|
+
borderWidth: 2,
|
|
221
|
+
borderColor: Colors.border,
|
|
222
|
+
alignItems: "center",
|
|
223
|
+
justifyContent: "center",
|
|
224
|
+
},
|
|
225
|
+
checkboxSelected: {
|
|
226
|
+
backgroundColor: Colors.primary,
|
|
227
|
+
borderColor: Colors.primary,
|
|
228
|
+
},
|
|
229
|
+
checkmark: {
|
|
230
|
+
color: Colors.textOnPrimary,
|
|
231
|
+
fontSize: FontSize.sm,
|
|
232
|
+
fontWeight: "700",
|
|
233
|
+
},
|
|
234
|
+
});
|
|
235
|
+
export default AirlinesSelector;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
type CabinClassSelectorProps = {
|
|
3
|
+
label: string;
|
|
4
|
+
value: string;
|
|
5
|
+
onChange: (val: string) => void;
|
|
6
|
+
translations: Record<string, string>;
|
|
7
|
+
};
|
|
8
|
+
declare const CabinClassSelector: React.FC<CabinClassSelectorProps>;
|
|
9
|
+
export default CabinClassSelector;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { View, Text, TouchableOpacity, StyleSheet, } from "react-native";
|
|
3
|
+
import { Colors, Spacing, BorderRadius, FontSize } from "../../../theme/colors";
|
|
4
|
+
import { formStyles } from "../../../theme/formStyles";
|
|
5
|
+
const CABIN_OPTIONS = [
|
|
6
|
+
{ value: "economy", labelKey: "cabin_economy", fallback: "Economy" },
|
|
7
|
+
{ value: "economy_premium", labelKey: "cabin_premium", fallback: "Premium Economy" },
|
|
8
|
+
{ value: "business", labelKey: "cabin_business", fallback: "Business" },
|
|
9
|
+
];
|
|
10
|
+
const CabinClassSelector = ({ label, value, onChange, translations, }) => {
|
|
11
|
+
return (_jsxs(View, { style: styles.container, children: [label ? _jsx(Text, { style: formStyles.label, children: label }) : null, _jsx(View, { style: styles.optionsRow, children: CABIN_OPTIONS.map((option) => {
|
|
12
|
+
const isSelected = value === option.value;
|
|
13
|
+
return (_jsxs(TouchableOpacity, { style: styles.option, onPress: () => onChange(option.value), activeOpacity: 0.7, children: [_jsx(View, { style: [
|
|
14
|
+
styles.radio,
|
|
15
|
+
isSelected && styles.radioSelected,
|
|
16
|
+
], children: isSelected && _jsx(View, { style: styles.radioInner }) }), _jsx(Text, { style: [
|
|
17
|
+
styles.optionText,
|
|
18
|
+
isSelected && styles.optionTextSelected,
|
|
19
|
+
], children: translations[option.labelKey] || option.fallback })] }, option.value));
|
|
20
|
+
}) })] }));
|
|
21
|
+
};
|
|
22
|
+
const styles = StyleSheet.create({
|
|
23
|
+
container: {
|
|
24
|
+
marginTop: Spacing.sm,
|
|
25
|
+
},
|
|
26
|
+
optionsRow: {
|
|
27
|
+
flexDirection: "row",
|
|
28
|
+
flexWrap: "wrap",
|
|
29
|
+
gap: Spacing.lg,
|
|
30
|
+
},
|
|
31
|
+
option: {
|
|
32
|
+
flexDirection: "row",
|
|
33
|
+
alignItems: "center",
|
|
34
|
+
gap: Spacing.sm,
|
|
35
|
+
},
|
|
36
|
+
radio: {
|
|
37
|
+
width: 20,
|
|
38
|
+
height: 20,
|
|
39
|
+
borderRadius: BorderRadius.full,
|
|
40
|
+
borderWidth: 2,
|
|
41
|
+
borderColor: Colors.border,
|
|
42
|
+
alignItems: "center",
|
|
43
|
+
justifyContent: "center",
|
|
44
|
+
},
|
|
45
|
+
radioSelected: {
|
|
46
|
+
borderColor: Colors.primary,
|
|
47
|
+
},
|
|
48
|
+
radioInner: {
|
|
49
|
+
width: 10,
|
|
50
|
+
height: 10,
|
|
51
|
+
borderRadius: BorderRadius.full,
|
|
52
|
+
backgroundColor: Colors.primary,
|
|
53
|
+
},
|
|
54
|
+
optionText: {
|
|
55
|
+
fontSize: FontSize.md,
|
|
56
|
+
color: Colors.textSecondary,
|
|
57
|
+
},
|
|
58
|
+
optionTextSelected: {
|
|
59
|
+
color: Colors.text,
|
|
60
|
+
fontWeight: "500",
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
export default CabinClassSelector;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
type DatePickerProps = {
|
|
3
|
+
value: [string, string];
|
|
4
|
+
onChange: (val: [string, string]) => void;
|
|
5
|
+
minDate?: string;
|
|
6
|
+
maxDate?: string;
|
|
7
|
+
lang: string;
|
|
8
|
+
translations: Record<string, string>;
|
|
9
|
+
mode?: "flight" | "hotel" | "car";
|
|
10
|
+
};
|
|
11
|
+
declare const DatePicker: React.FC<DatePickerProps>;
|
|
12
|
+
export default DatePicker;
|