@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,101 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { TouchableOpacity, Text, StyleSheet, ActivityIndicator, } from 'react-native';
|
|
3
|
+
import { Colors, Spacing, BorderRadius, FontSize } from '../../theme/colors';
|
|
4
|
+
const getVariantStyles = (variant) => {
|
|
5
|
+
switch (variant) {
|
|
6
|
+
case 'default':
|
|
7
|
+
return {
|
|
8
|
+
container: { backgroundColor: Colors.primary },
|
|
9
|
+
text: { color: Colors.textOnPrimary },
|
|
10
|
+
};
|
|
11
|
+
case 'outline':
|
|
12
|
+
return {
|
|
13
|
+
container: {
|
|
14
|
+
backgroundColor: Colors.transparent,
|
|
15
|
+
borderWidth: 1,
|
|
16
|
+
borderColor: Colors.border,
|
|
17
|
+
},
|
|
18
|
+
text: { color: Colors.text },
|
|
19
|
+
};
|
|
20
|
+
case 'secondary':
|
|
21
|
+
return {
|
|
22
|
+
container: { backgroundColor: Colors.primaryLight },
|
|
23
|
+
text: { color: Colors.primary },
|
|
24
|
+
};
|
|
25
|
+
case 'ghost':
|
|
26
|
+
return {
|
|
27
|
+
container: { backgroundColor: Colors.transparent },
|
|
28
|
+
text: { color: Colors.text },
|
|
29
|
+
};
|
|
30
|
+
case 'destructive':
|
|
31
|
+
return {
|
|
32
|
+
container: { backgroundColor: Colors.error },
|
|
33
|
+
text: { color: Colors.textOnPrimary },
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const getSizeStyles = (size) => {
|
|
38
|
+
switch (size) {
|
|
39
|
+
case 'sm':
|
|
40
|
+
return {
|
|
41
|
+
container: {
|
|
42
|
+
paddingVertical: Spacing.xs,
|
|
43
|
+
paddingHorizontal: Spacing.md,
|
|
44
|
+
borderRadius: BorderRadius.sm,
|
|
45
|
+
},
|
|
46
|
+
text: { fontSize: FontSize.sm },
|
|
47
|
+
};
|
|
48
|
+
case 'md':
|
|
49
|
+
return {
|
|
50
|
+
container: {
|
|
51
|
+
paddingVertical: Spacing.sm + 2,
|
|
52
|
+
paddingHorizontal: Spacing.lg,
|
|
53
|
+
borderRadius: BorderRadius.md,
|
|
54
|
+
},
|
|
55
|
+
text: { fontSize: FontSize.md },
|
|
56
|
+
};
|
|
57
|
+
case 'lg':
|
|
58
|
+
return {
|
|
59
|
+
container: {
|
|
60
|
+
paddingVertical: Spacing.md,
|
|
61
|
+
paddingHorizontal: Spacing.xl,
|
|
62
|
+
borderRadius: BorderRadius.md,
|
|
63
|
+
},
|
|
64
|
+
text: { fontSize: FontSize.lg },
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
export function Button({ variant = 'default', size = 'md', children, loading = false, disabled, style, textStyle, ...rest }) {
|
|
69
|
+
const variantStyles = getVariantStyles(variant);
|
|
70
|
+
const sizeStyles = getSizeStyles(size);
|
|
71
|
+
return (_jsx(TouchableOpacity, { activeOpacity: 0.7, disabled: disabled || loading, style: [
|
|
72
|
+
styles.base,
|
|
73
|
+
sizeStyles.container,
|
|
74
|
+
variantStyles.container,
|
|
75
|
+
disabled && styles.disabled,
|
|
76
|
+
style,
|
|
77
|
+
], ...rest, children: loading ? (_jsx(ActivityIndicator, { size: "small", color: variantStyles.text.color })) : typeof children === 'string' ? (_jsx(Text, { style: [
|
|
78
|
+
styles.text,
|
|
79
|
+
sizeStyles.text,
|
|
80
|
+
variantStyles.text,
|
|
81
|
+
disabled && styles.disabledText,
|
|
82
|
+
textStyle,
|
|
83
|
+
], children: children })) : (children) }));
|
|
84
|
+
}
|
|
85
|
+
const styles = StyleSheet.create({
|
|
86
|
+
base: {
|
|
87
|
+
flexDirection: 'row',
|
|
88
|
+
alignItems: 'center',
|
|
89
|
+
justifyContent: 'center',
|
|
90
|
+
gap: Spacing.sm,
|
|
91
|
+
},
|
|
92
|
+
text: {
|
|
93
|
+
fontWeight: '600',
|
|
94
|
+
},
|
|
95
|
+
disabled: {
|
|
96
|
+
opacity: 0.5,
|
|
97
|
+
},
|
|
98
|
+
disabledText: {
|
|
99
|
+
opacity: 0.5,
|
|
100
|
+
},
|
|
101
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ViewStyle, TextStyle, ViewProps } from 'react-native';
|
|
3
|
+
interface CardProps extends ViewProps {
|
|
4
|
+
style?: ViewStyle;
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
interface CardTitleProps {
|
|
8
|
+
style?: TextStyle;
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export declare function Card({ style, children, ...rest }: CardProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare function CardHeader({ style, children, ...rest }: CardProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare function CardTitle({ style, children }: CardTitleProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare function CardContent({ style, children, ...rest }: CardProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare function CardFooter({ style, children, ...rest }: CardProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { View, Text, StyleSheet } from 'react-native';
|
|
3
|
+
import { Colors, Spacing, BorderRadius, FontSize } from '../../theme/colors';
|
|
4
|
+
export function Card({ style, children, ...rest }) {
|
|
5
|
+
return (_jsx(View, { style: [styles.card, style], ...rest, children: children }));
|
|
6
|
+
}
|
|
7
|
+
export function CardHeader({ style, children, ...rest }) {
|
|
8
|
+
return (_jsx(View, { style: [styles.header, style], ...rest, children: children }));
|
|
9
|
+
}
|
|
10
|
+
export function CardTitle({ style, children }) {
|
|
11
|
+
return _jsx(Text, { style: [styles.title, style], children: children });
|
|
12
|
+
}
|
|
13
|
+
export function CardContent({ style, children, ...rest }) {
|
|
14
|
+
return (_jsx(View, { style: [styles.content, style], ...rest, children: children }));
|
|
15
|
+
}
|
|
16
|
+
export function CardFooter({ style, children, ...rest }) {
|
|
17
|
+
return (_jsx(View, { style: [styles.footer, style], ...rest, children: children }));
|
|
18
|
+
}
|
|
19
|
+
const styles = StyleSheet.create({
|
|
20
|
+
card: {
|
|
21
|
+
backgroundColor: Colors.surface,
|
|
22
|
+
borderRadius: BorderRadius.lg,
|
|
23
|
+
borderWidth: 1,
|
|
24
|
+
borderColor: Colors.border,
|
|
25
|
+
shadowColor: Colors.black,
|
|
26
|
+
shadowOffset: { width: 0, height: 1 },
|
|
27
|
+
shadowOpacity: 0.05,
|
|
28
|
+
shadowRadius: 3,
|
|
29
|
+
elevation: 2,
|
|
30
|
+
},
|
|
31
|
+
header: {
|
|
32
|
+
padding: Spacing.lg,
|
|
33
|
+
gap: Spacing.xs,
|
|
34
|
+
},
|
|
35
|
+
title: {
|
|
36
|
+
fontSize: FontSize.xl,
|
|
37
|
+
fontWeight: '600',
|
|
38
|
+
color: Colors.text,
|
|
39
|
+
lineHeight: FontSize.xl * 1.3,
|
|
40
|
+
},
|
|
41
|
+
content: {
|
|
42
|
+
paddingHorizontal: Spacing.lg,
|
|
43
|
+
paddingBottom: Spacing.lg,
|
|
44
|
+
},
|
|
45
|
+
footer: {
|
|
46
|
+
flexDirection: 'row',
|
|
47
|
+
alignItems: 'center',
|
|
48
|
+
paddingHorizontal: Spacing.lg,
|
|
49
|
+
paddingBottom: Spacing.lg,
|
|
50
|
+
},
|
|
51
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TextInputProps, ViewStyle, TextStyle } from 'react-native';
|
|
2
|
+
export interface InputProps extends TextInputProps {
|
|
3
|
+
label?: string;
|
|
4
|
+
error?: string;
|
|
5
|
+
containerStyle?: ViewStyle;
|
|
6
|
+
inputStyle?: TextStyle;
|
|
7
|
+
}
|
|
8
|
+
export declare function Input({ label, error, containerStyle, inputStyle, editable, ...rest }: InputProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { View, TextInput, Text, StyleSheet, } from 'react-native';
|
|
4
|
+
import { Colors, Spacing, BorderRadius, FontSize } from '../../theme/colors';
|
|
5
|
+
export function Input({ label, error, containerStyle, inputStyle, editable = true, ...rest }) {
|
|
6
|
+
const [focused, setFocused] = useState(false);
|
|
7
|
+
const borderColor = error
|
|
8
|
+
? Colors.error
|
|
9
|
+
: focused
|
|
10
|
+
? Colors.borderFocus
|
|
11
|
+
: Colors.border;
|
|
12
|
+
return (_jsxs(View, { style: [styles.container, containerStyle], children: [label ? _jsx(Text, { style: styles.label, children: label }) : null, _jsx(TextInput, { placeholderTextColor: Colors.textTertiary, editable: editable, style: [
|
|
13
|
+
styles.input,
|
|
14
|
+
{ borderColor },
|
|
15
|
+
focused && styles.inputFocused,
|
|
16
|
+
!editable && styles.inputDisabled,
|
|
17
|
+
error ? styles.inputError : null,
|
|
18
|
+
inputStyle,
|
|
19
|
+
], onFocus: (e) => {
|
|
20
|
+
setFocused(true);
|
|
21
|
+
rest.onFocus?.(e);
|
|
22
|
+
}, onBlur: (e) => {
|
|
23
|
+
setFocused(false);
|
|
24
|
+
rest.onBlur?.(e);
|
|
25
|
+
}, ...rest }), error ? _jsx(Text, { style: styles.errorText, children: error }) : null] }));
|
|
26
|
+
}
|
|
27
|
+
const styles = StyleSheet.create({
|
|
28
|
+
container: {
|
|
29
|
+
gap: Spacing.xs,
|
|
30
|
+
},
|
|
31
|
+
label: {
|
|
32
|
+
fontSize: FontSize.sm,
|
|
33
|
+
fontWeight: '500',
|
|
34
|
+
color: Colors.text,
|
|
35
|
+
marginBottom: 2,
|
|
36
|
+
},
|
|
37
|
+
input: {
|
|
38
|
+
height: 44,
|
|
39
|
+
borderWidth: 1,
|
|
40
|
+
borderColor: Colors.border,
|
|
41
|
+
borderRadius: BorderRadius.md,
|
|
42
|
+
paddingHorizontal: Spacing.md,
|
|
43
|
+
fontSize: FontSize.md,
|
|
44
|
+
color: Colors.text,
|
|
45
|
+
backgroundColor: Colors.surface,
|
|
46
|
+
},
|
|
47
|
+
inputFocused: {
|
|
48
|
+
borderWidth: 2,
|
|
49
|
+
},
|
|
50
|
+
inputDisabled: {
|
|
51
|
+
opacity: 0.5,
|
|
52
|
+
backgroundColor: Colors.surfaceSecondary,
|
|
53
|
+
},
|
|
54
|
+
inputError: {
|
|
55
|
+
borderWidth: 1.5,
|
|
56
|
+
},
|
|
57
|
+
errorText: {
|
|
58
|
+
fontSize: FontSize.sm,
|
|
59
|
+
color: Colors.error,
|
|
60
|
+
},
|
|
61
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TextStyle, TextProps } from 'react-native';
|
|
3
|
+
export interface LabelProps extends TextProps {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
style?: TextStyle;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function Label({ children, style, disabled, ...rest }: LabelProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Text, StyleSheet } from 'react-native';
|
|
3
|
+
import { Colors, FontSize } from '../../theme/colors';
|
|
4
|
+
export function Label({ children, style, disabled, ...rest }) {
|
|
5
|
+
return (_jsx(Text, { style: [styles.label, disabled && styles.disabled, style], ...rest, children: children }));
|
|
6
|
+
}
|
|
7
|
+
const styles = StyleSheet.create({
|
|
8
|
+
label: {
|
|
9
|
+
fontSize: FontSize.sm,
|
|
10
|
+
fontWeight: '500',
|
|
11
|
+
color: Colors.text,
|
|
12
|
+
lineHeight: FontSize.sm * 1.4,
|
|
13
|
+
},
|
|
14
|
+
disabled: {
|
|
15
|
+
opacity: 0.7,
|
|
16
|
+
},
|
|
17
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
type WidgetContextType = {
|
|
3
|
+
token: string;
|
|
4
|
+
config: any;
|
|
5
|
+
setConfig: (c: any) => void;
|
|
6
|
+
dateTimeFormat: string;
|
|
7
|
+
lang: string;
|
|
8
|
+
currency: string;
|
|
9
|
+
isPreview: boolean;
|
|
10
|
+
colors: WidgetColors;
|
|
11
|
+
};
|
|
12
|
+
export type WidgetColors = {
|
|
13
|
+
primary: string;
|
|
14
|
+
primaryRgba85: string;
|
|
15
|
+
banner: string;
|
|
16
|
+
input: string;
|
|
17
|
+
textHeadings: string;
|
|
18
|
+
form: string;
|
|
19
|
+
};
|
|
20
|
+
type WidgetProviderProps = {
|
|
21
|
+
token: string;
|
|
22
|
+
initialConfig: any;
|
|
23
|
+
lang?: string;
|
|
24
|
+
currency?: string;
|
|
25
|
+
children: React.ReactNode;
|
|
26
|
+
};
|
|
27
|
+
export declare const WidgetProvider: React.FC<WidgetProviderProps>;
|
|
28
|
+
export declare const useWidget: () => WidgetContextType;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext, useEffect, useState } from "react";
|
|
3
|
+
const defaultColors = {
|
|
4
|
+
primary: '#306DDE',
|
|
5
|
+
primaryRgba85: 'rgba(48,109,222,0.85)',
|
|
6
|
+
banner: '#1a1a2e',
|
|
7
|
+
input: '#f5f5f5',
|
|
8
|
+
textHeadings: '#ffffff',
|
|
9
|
+
form: '#ffffff',
|
|
10
|
+
};
|
|
11
|
+
function extractColors(config) {
|
|
12
|
+
const colors = config?.colors;
|
|
13
|
+
if (!colors)
|
|
14
|
+
return defaultColors;
|
|
15
|
+
const get = (key) => colors[key]?.hex || '';
|
|
16
|
+
const hexToRgba = (hex, alpha) => {
|
|
17
|
+
if (!hex || !hex.startsWith('#'))
|
|
18
|
+
return '';
|
|
19
|
+
const r = parseInt(hex.slice(1, 3), 16);
|
|
20
|
+
const g = parseInt(hex.slice(3, 5), 16);
|
|
21
|
+
const b = parseInt(hex.slice(5, 7), 16);
|
|
22
|
+
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
|
|
23
|
+
};
|
|
24
|
+
return {
|
|
25
|
+
primary: get('buttons') || defaultColors.primary,
|
|
26
|
+
primaryRgba85: hexToRgba(get('buttons'), 0.85) || defaultColors.primaryRgba85,
|
|
27
|
+
banner: get('banner') || defaultColors.banner,
|
|
28
|
+
input: get('input') || defaultColors.input,
|
|
29
|
+
textHeadings: get('text_headings') || defaultColors.textHeadings,
|
|
30
|
+
form: get('form') || defaultColors.form,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
const WidgetContext = createContext({
|
|
34
|
+
token: "",
|
|
35
|
+
config: {},
|
|
36
|
+
setConfig: () => { },
|
|
37
|
+
lang: "en",
|
|
38
|
+
currency: "USD",
|
|
39
|
+
isPreview: false,
|
|
40
|
+
dateTimeFormat: "europe",
|
|
41
|
+
colors: defaultColors,
|
|
42
|
+
});
|
|
43
|
+
export const WidgetProvider = ({ token, initialConfig, lang: propLang, currency: propCurrency, children, }) => {
|
|
44
|
+
const [config, setConfig] = useState(initialConfig || {});
|
|
45
|
+
const lang = (config?.form?.language || propLang || "en").toLowerCase();
|
|
46
|
+
const currency = config?.form?.currency || propCurrency || "USD";
|
|
47
|
+
const dateTimeFormat = config?.dateTimeFormat || "europe";
|
|
48
|
+
const isPreview = initialConfig?.mode === "preview";
|
|
49
|
+
const colors = extractColors(config);
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
setConfig(initialConfig);
|
|
52
|
+
}, [initialConfig]);
|
|
53
|
+
return (_jsx(WidgetContext.Provider, { value: {
|
|
54
|
+
token,
|
|
55
|
+
config,
|
|
56
|
+
setConfig,
|
|
57
|
+
lang,
|
|
58
|
+
currency,
|
|
59
|
+
dateTimeFormat,
|
|
60
|
+
isPreview,
|
|
61
|
+
colors,
|
|
62
|
+
}, children: children }));
|
|
63
|
+
};
|
|
64
|
+
export const useWidget = () => useContext(WidgetContext);
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import Svg, { Path } from "react-native-svg";
|
|
3
|
+
export const CarIcon = ({ size = 24, color = "#306DDE" }) => (_jsxs(Svg, { width: size, height: size, viewBox: "0 0 24 24", fill: "none", children: [_jsx(Path, { d: "M4.34735 10.0293C4.02678 9.99304 3.77154 9.97973 3.52356 9.93376C3.07598 9.8503 2.91873 9.50554 3.1776 9.13054C3.33547 8.89929 3.55008 8.71245 3.80086 8.58791C4.05164 8.46337 4.33019 8.4053 4.60984 8.41926C4.92557 8.41926 5.05863 8.66119 5.12758 8.99869C5.19774 8.89587 5.24855 8.82813 5.29452 8.75675C5.58847 8.21482 5.91871 7.68862 6.16064 7.1237C6.46064 6.42451 6.9941 6.0725 7.69692 5.94669C8.33556 5.81695 8.98216 5.73006 9.63239 5.68661C11.638 5.60315 13.6461 5.55597 15.6469 5.80758C15.9106 5.84024 16.1707 5.8971 16.4307 5.95274C17.1396 6.10637 17.6888 6.43661 18.0033 7.15273C18.2743 7.78055 18.6408 8.36845 18.9432 8.93337C19.0968 8.77006 19.2154 8.55111 19.3932 8.47853C19.5967 8.40612 19.82 8.41303 20.0186 8.49789C20.3578 8.64272 20.6656 8.85227 20.9247 9.11482C21.2501 9.47772 21.0674 9.86602 20.5799 9.94949C20.3319 9.99304 20.0791 10.0051 19.8662 10.0281C20.1009 10.4225 20.4166 10.8047 20.5666 11.2438C20.7166 11.6829 20.742 12.1886 20.7614 12.6676C20.7904 13.4273 20.7686 14.1894 20.7686 14.989C20.6174 14.9974 20.488 15.0107 20.3597 15.0107C14.8316 15.0107 9.30296 15.0136 3.77396 15.0192C3.44977 15.0192 3.35784 14.9273 3.36993 14.6103C3.39292 13.9813 3.38929 13.3511 3.36993 12.7221C3.34453 11.7071 3.53687 10.789 4.34735 10.0293Z", fill: color }), _jsx(Path, { d: "M3.30901 15.3444L12.0572 15.3442H20.6569C20.6617 15.6179 20.6915 15.7336 20.6569 16.0051C20.5698 16.4539 20.2275 16.6959 19.7242 16.6959C14.5702 16.6959 9.41624 16.6959 4.26224 16.6959C3.68523 16.6959 3.33684 16.3535 3.30902 15.7789C3.29934 15.5878 3.30901 15.5549 3.30901 15.3444Z", fill: color }), _jsx(Path, { d: "M17.7134 16.9625C18.6884 16.7895 19.6622 17.1512 20.584 16.683C20.584 17.0459 20.6094 17.4088 20.5767 17.7596C20.5644 17.9436 20.4826 18.116 20.3478 18.2419C20.213 18.3677 20.0353 18.4375 19.8509 18.4371C19.3816 18.4552 18.9098 18.454 18.4404 18.4371C18.257 18.4355 18.0808 18.3654 17.9465 18.2405C17.8121 18.1156 17.7294 17.9449 17.7146 17.7621C17.6917 17.508 17.7134 17.2419 17.7134 16.9625Z", fill: color }), _jsx(Path, { d: "M3.42478 16.6459C3.87719 17.0088 4.37195 16.9157 4.84856 16.9217C5.32517 16.9278 5.78605 16.9217 6.31347 16.9217C6.31297 17.2326 6.2948 17.5432 6.25903 17.852C6.22819 18.0205 6.13805 18.1724 6.00493 18.2802C5.8718 18.3881 5.70448 18.4447 5.53323 18.4399C5.07477 18.4544 4.61388 18.4556 4.15542 18.4399C3.79252 18.429 3.46954 18.175 3.43566 17.835C3.39454 17.4649 3.42478 17.0826 3.42478 16.6459Z", fill: color })] }));
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import Svg, { Path } from "react-native-svg";
|
|
3
|
+
export const CloseIcon = ({ size = 13, color = "#B5B5C2", }) => (_jsx(Svg, { width: size, height: size, viewBox: "0 0 13 13", fill: "none", children: _jsx(Path, { d: "M1.11192 11.9759C1.42822 12.2922 1.94437 12.3051 2.25406 11.9954L6.54434 7.70512L10.7121 11.8729C11.0218 12.1826 11.5572 12.1895 11.8735 11.8732C12.1895 11.5571 12.1766 11.0278 11.8669 10.7181L7.69915 6.55031L11.9963 2.25316C12.3057 1.94374 12.2928 1.42759 11.9765 1.11129C11.6605 0.795264 11.1506 0.788656 10.8409 1.09835L6.54379 5.3955L2.37601 1.22773C2.06632 0.918039 1.53723 0.904825 1.22121 1.22085C0.905181 1.53687 0.911512 2.07285 1.2212 2.38254L5.38898 6.55031L1.0987 10.8406C0.789011 11.1503 0.795892 11.6598 1.11192 11.9759Z", fill: color }) }));
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import Svg, { Path } from "react-native-svg";
|
|
3
|
+
export const FlightIcon = ({ size = 24, color = "white" }) => (_jsx(Svg, { width: size, height: size, viewBox: "0 0 24 24", fill: "none", children: _jsx(Path, { d: "M5.42561 17.9099C4.88975 17.9214 4.35748 17.8186 3.86342 17.608C3.36936 17.3975 2.92459 17.0839 2.55802 16.6877C1.77944 15.8849 1.02827 15.0599 0.271624 14.2419C-0.139599 13.8044 -0.0875108 13.5669 0.452562 13.3017C0.946029 13.0614 1.44635 12.8364 1.93159 12.5808C2.0489 12.5105 2.18299 12.4741 2.31929 12.4756C2.45559 12.477 2.58889 12.5163 2.70469 12.5892C3.41199 12.9822 4.13575 13.3475 4.84168 13.7419C4.96185 13.8202 5.10087 13.8636 5.24367 13.8675C5.38647 13.8715 5.52761 13.8357 5.65179 13.7641C6.85119 13.1406 8.07115 12.5378 9.28288 11.9239C9.81336 11.6559 9.84489 11.4003 9.39803 10.992C7.78055 9.51056 6.16216 8.03375 4.54286 6.56157C4.03568 6.09908 4.06858 5.83936 4.67993 5.57687C5.48044 5.23799 6.27685 4.85606 7.17057 5.06577C7.63503 5.17499 8.08538 5.33859 8.51253 5.55326C10.3868 6.49768 12.2547 7.45923 14.1161 8.4379C14.6644 8.72401 15.1332 8.72817 15.6596 8.41846C16.6081 7.86292 17.5786 7.35182 18.704 7.25182C19.8627 7.12534 21.0346 7.26783 22.1309 7.66848C22.3947 7.75616 22.6236 7.92797 22.7832 8.15826C22.9428 8.38854 23.0246 8.66496 23.0163 8.94622C23.0163 9.55732 22.7148 9.99203 22.1679 10.2573C20.2168 11.2008 18.2672 12.1452 16.3189 13.0906C13.2813 14.56 10.2506 16.0419 7.2021 17.4863C6.6538 17.7432 6.04108 17.8432 5.45714 18.0154L5.42561 17.9099Z", fill: color }) }));
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import Svg, { Path } from "react-native-svg";
|
|
3
|
+
export const HotelIcon = ({ size = 24, color = "#306DDE" }) => (_jsxs(Svg, { width: size, height: size, viewBox: "0 0 24 24", fill: "none", children: [_jsx(Path, { d: "M19.7045 17.1467H4.28822C4.28822 17.3614 4.29681 17.5561 4.28822 17.7508C4.28955 17.8364 4.27389 17.9215 4.24217 18.0011C4.21044 18.0806 4.16327 18.1531 4.10337 18.2143C4.04348 18.2755 3.97205 18.3243 3.89321 18.3578C3.81437 18.3912 3.72968 18.4088 3.64403 18.4093C3.47772 18.4089 3.31831 18.3428 3.20057 18.2253C3.08284 18.1079 3.01634 17.9486 3.01558 17.7823C3.00556 16.2076 2.9798 14.6444 3.0299 13.0783C3.05996 12.1349 3.88882 11.4077 4.84509 11.3604C5.1314 11.3432 5.41771 11.3604 5.70401 11.3604H18.7095C20.2599 11.3604 21 12.0891 21 13.628C21 14.9536 21 16.2792 21 17.6048C21 18.1244 20.7438 18.4351 20.3386 18.4222C19.9335 18.4093 19.7216 18.1144 19.7159 17.6105C19.703 17.453 19.7045 17.317 19.7045 17.1467Z", fill: color }), _jsx(Path, { d: "M19.0653 10.0485H17.1356C17.1356 9.85811 17.1356 9.68919 17.1356 9.5217C17.1241 8.68568 16.6059 8.15601 15.7785 8.14456C15.193 8.13597 14.6089 8.14456 14.0248 8.14456C13.186 8.15315 12.6692 8.66421 12.6491 9.50309C12.6491 9.67058 12.6491 9.8395 12.6491 10.0757H11.3607C11.3607 9.85668 11.3607 9.66485 11.3607 9.47302C11.3407 8.68854 10.8196 8.16317 10.0351 8.15028C9.45107 8.14026 8.86701 8.15028 8.28151 8.15028C7.39109 8.15028 6.8786 8.6685 6.87001 9.56035C6.87001 9.71495 6.87001 9.87099 6.87001 10.0528H4.97465C4.95416 9.94403 4.94077 9.83405 4.93457 9.72354C4.93457 8.61172 4.93457 7.49989 4.93457 6.38806C4.93743 5.78538 5.15646 5.57208 5.77059 5.57208H18.225C18.8548 5.57208 19.0696 5.78538 19.0724 6.42098C19.0696 7.61775 19.0653 8.81165 19.0653 10.0485Z", fill: color })] }));
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TravelHubWidget } from './TravelHubWidget';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const defaultTranslations: Record<string, Record<string, string>>;
|