related-ui-components 2.1.9 → 2.2.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.
Files changed (29) hide show
  1. package/lib/module/app.js +2 -5
  2. package/lib/module/app.js.map +1 -1
  3. package/lib/module/components/TravelBooking/CarRentalForm.js +17 -13
  4. package/lib/module/components/TravelBooking/CarRentalForm.js.map +1 -1
  5. package/lib/module/components/TravelBooking/FlightForm.js +19 -10
  6. package/lib/module/components/TravelBooking/FlightForm.js.map +1 -1
  7. package/lib/module/components/TravelBooking/FlightSummary.js +5 -0
  8. package/lib/module/components/TravelBooking/FlightSummary.js.map +1 -1
  9. package/lib/module/components/TravelBooking/HotelForm.js +12 -3
  10. package/lib/module/components/TravelBooking/HotelForm.js.map +1 -1
  11. package/lib/module/index.js +7 -4
  12. package/lib/module/index.js.map +1 -1
  13. package/lib/typescript/src/app.d.ts.map +1 -1
  14. package/lib/typescript/src/components/TravelBooking/CarRentalForm.d.ts +8 -0
  15. package/lib/typescript/src/components/TravelBooking/CarRentalForm.d.ts.map +1 -1
  16. package/lib/typescript/src/components/TravelBooking/FlightForm.d.ts +7 -0
  17. package/lib/typescript/src/components/TravelBooking/FlightForm.d.ts.map +1 -1
  18. package/lib/typescript/src/components/TravelBooking/FlightSummary.d.ts.map +1 -1
  19. package/lib/typescript/src/components/TravelBooking/HotelForm.d.ts +6 -0
  20. package/lib/typescript/src/components/TravelBooking/HotelForm.d.ts.map +1 -1
  21. package/lib/typescript/src/index.d.ts +0 -1
  22. package/lib/typescript/src/index.d.ts.map +1 -1
  23. package/package.json +1 -1
  24. package/src/app.tsx +5 -2
  25. package/src/components/TravelBooking/CarRentalForm.tsx +96 -57
  26. package/src/components/TravelBooking/FlightForm.tsx +70 -47
  27. package/src/components/TravelBooking/FlightSummary.tsx +3 -1
  28. package/src/components/TravelBooking/HotelForm.tsx +71 -43
  29. package/src/index.ts +4 -4
@@ -1,5 +1,11 @@
1
1
  import { ThemeType, useTheme } from "../../theme";
2
- import React, { useCallback, useMemo, useRef, useState } from "react";
2
+ import React, {
3
+ useCallback,
4
+ useEffect,
5
+ useMemo,
6
+ useRef,
7
+ useState,
8
+ } from "react";
3
9
  import {
4
10
  View,
5
11
  Text,
@@ -15,8 +21,8 @@ import { Ionicons } from "@expo/vector-icons";
15
21
  import CustomInput from "../Input/Input";
16
22
  import DateRangePicker from "../DateRangePicker/DateRangePicker";
17
23
  import { Picker } from "@react-native-picker/picker";
18
- import SuggestionList from "../Suggestions/SuggestionList";
19
- import { FormInputType, HotelSuggestions } from "./types";
24
+ import SuggestionList from "../Suggestions/SuggestionList";
25
+ import { FormInputType, HotelSuggestions } from "./types";
20
26
  import { TextInput } from "react-native-gesture-handler";
21
27
 
22
28
  // --- Helper Types ---
@@ -40,6 +46,13 @@ export interface HotelFormProps {
40
46
  nationality: string | undefined;
41
47
  }) => void;
42
48
 
49
+ onSelectionChange?: (details: {
50
+ destination: LocationData | undefined; // Renamed from destintation
51
+ checkin: string | undefined; // Send YYYY-MM-DD
52
+ checkout: string | undefined; // Send YYYY-MM-DD
53
+ nationality: string | undefined;
54
+ }) => void;
55
+
43
56
  // Labels & Placeholders
44
57
  destinationLabel?: string;
45
58
  destinationPlaceholder?: string;
@@ -52,22 +65,22 @@ export interface HotelFormProps {
52
65
 
53
66
  // Data & Config
54
67
  suggestionData?: HotelSuggestions[];
55
- nationalityData?: { label: string; value: string }[];
68
+ nationalityData?: { label: string; value: string }[];
56
69
  calendarThemeOverrides?: object;
57
70
 
58
71
  // --- Style Props ---
59
72
  containerStyle?: StyleProp<ViewStyle>;
60
- inputWrapperStyle?: StyleProp<ViewStyle>;
73
+ inputWrapperStyle?: StyleProp<ViewStyle>;
61
74
  customInputContainerStyle?: StyleProp<ViewStyle>;
62
- labelStyle?: StyleProp<TextStyle>;
63
- checkoutRowStyle?: StyleProp<ViewStyle>;
75
+ labelStyle?: StyleProp<TextStyle>;
76
+ checkoutRowStyle?: StyleProp<ViewStyle>;
64
77
  searchButtonStyle?: StyleProp<ViewStyle>;
65
- searchIconStyle?: StyleProp<TextStyle>;
78
+ searchIconStyle?: StyleProp<TextStyle>;
66
79
 
67
80
  // DateRangePicker specific styles (passed down)
68
81
  dateRangePickerOuterContainerStyle?: StyleProp<ViewStyle>;
69
- dateRangePickerLabelStyle?: StyleProp<TextStyle>;
70
- dateRangePickerInputGroupStyle?: StyleProp<ViewStyle>;
82
+ dateRangePickerLabelStyle?: StyleProp<TextStyle>;
83
+ dateRangePickerInputGroupStyle?: StyleProp<ViewStyle>;
71
84
  dateRangePickerCalendarContainerStyle?: StyleProp<ViewStyle>;
72
85
 
73
86
  // SuggestionList specific styles
@@ -76,10 +89,10 @@ export interface HotelFormProps {
76
89
  suggestionItemTextStyle?: StyleProp<TextStyle>;
77
90
 
78
91
  // Nationality Picker specific styles
79
- nationalityPickerWrapperStyle?: StyleProp<ViewStyle>;
80
- nationalityPickerLabelStyle?: StyleProp<TextStyle>;
92
+ nationalityPickerWrapperStyle?: StyleProp<ViewStyle>;
93
+ nationalityPickerLabelStyle?: StyleProp<TextStyle>;
81
94
  pickerContainerStyle?: StyleProp<ViewStyle>;
82
- pickerStyle?: StyleProp<TextStyle>;
95
+ pickerStyle?: StyleProp<TextStyle>;
83
96
  }
84
97
 
85
98
  // Default Nationality Data (can be overridden by prop)
@@ -137,6 +150,7 @@ const HotelForm: React.FC<HotelFormProps> = ({
137
150
  nationalityPickerLabelStyle,
138
151
  pickerContainerStyle,
139
152
  pickerStyle,
153
+ onSelectionChange,
140
154
  }) => {
141
155
  const { theme, isRTL } = useTheme();
142
156
  const styles = useMemo(() => themedStyles(theme, isRTL), [theme, isRTL]);
@@ -158,6 +172,21 @@ const HotelForm: React.FC<HotelFormProps> = ({
158
172
  >(initialNationality);
159
173
  const [focusedInput, setFocusedInput] = useState<FormInputType>();
160
174
 
175
+ useEffect(() => {
176
+ onSelectionChange?.({
177
+ destination: destination,
178
+ checkin: checkinDate,
179
+ checkout: checkoutDate,
180
+ nationality: selectedNationality,
181
+ });
182
+ }, [
183
+ destination,
184
+ checkinDate,
185
+ checkoutDate,
186
+ selectedNationality,
187
+ onSelectionChange,
188
+ ]);
189
+
161
190
  // --- Handlers ---
162
191
  const handleSearch = useCallback(() => {
163
192
  onSearchPress?.({
@@ -236,8 +265,8 @@ const HotelForm: React.FC<HotelFormProps> = ({
236
265
  ]}
237
266
  labelStyle={[labelStyle, dateRangePickerLabelStyle]}
238
267
  inputGroupStyle={dateRangePickerInputGroupStyle}
239
- calendarContainerStyle={dateRangePickerCalendarContainerStyle}
240
- calendarThemeOverrides={calendarThemeOverrides}
268
+ calendarContainerStyle={dateRangePickerCalendarContainerStyle}
269
+ calendarThemeOverrides={calendarThemeOverrides}
241
270
  onDatesChange={(d) => {
242
271
  setCheckinDate(d.departure);
243
272
  setCheckoutDate(d.return);
@@ -249,15 +278,12 @@ const HotelForm: React.FC<HotelFormProps> = ({
249
278
 
250
279
  <View style={[styles.checkoutRow, checkoutRowStyle]}>
251
280
  <View
252
- style={[styles.nationalityPickerWrapper, nationalityPickerWrapperStyle]}
281
+ style={[
282
+ styles.nationalityPickerWrapper,
283
+ nationalityPickerWrapperStyle,
284
+ ]}
253
285
  >
254
- <Text
255
- style={[
256
- styles.label,
257
- labelStyle,
258
- nationalityPickerLabelStyle,
259
- ]}
260
- >
286
+ <Text style={[styles.label, labelStyle, nationalityPickerLabelStyle]}>
261
287
  {nationalityLabel}
262
288
  </Text>
263
289
  <View style={[styles.pickerContainer, pickerContainerStyle]}>
@@ -269,7 +295,7 @@ const HotelForm: React.FC<HotelFormProps> = ({
269
295
  >
270
296
  {nationalityData.map((nat) => (
271
297
  <Picker.Item
272
- key={nat.value || "placeholder"}
298
+ key={nat.value || "placeholder"}
273
299
  label={nat.label}
274
300
  value={nat.value}
275
301
  enabled={nat.value !== undefined}
@@ -279,18 +305,20 @@ const HotelForm: React.FC<HotelFormProps> = ({
279
305
  </View>
280
306
  </View>
281
307
 
282
- <TouchableOpacity
283
- style={[styles.searchButton, searchButtonStyle]}
284
- onPress={handleSearch}
285
- activeOpacity={0.8}
286
- >
287
- <Ionicons
288
- name={searchIconName}
289
- size={24}
290
- color={theme.onPrimary}
291
- style={searchIconStyle}
292
- />
293
- </TouchableOpacity>
308
+ {onSearchPress && (
309
+ <TouchableOpacity
310
+ style={[styles.searchButton, searchButtonStyle]}
311
+ onPress={handleSearch}
312
+ activeOpacity={0.8}
313
+ >
314
+ <Ionicons
315
+ name={searchIconName}
316
+ size={24}
317
+ color={theme.onPrimary}
318
+ style={searchIconStyle}
319
+ />
320
+ </TouchableOpacity>
321
+ )}
294
322
  </View>
295
323
  </View>
296
324
  );
@@ -306,8 +334,8 @@ const themedStyles = (theme: ThemeType, isRTL: boolean) =>
306
334
  borderBottomLeftRadius: 8,
307
335
  },
308
336
  inputWrapper: {
309
- marginBottom: 15,
310
- position: "relative",
337
+ marginBottom: 15,
338
+ position: "relative",
311
339
  },
312
340
  label: {
313
341
  color: theme.labelText,
@@ -318,12 +346,12 @@ const themedStyles = (theme: ThemeType, isRTL: boolean) =>
318
346
  marginBottom: 6,
319
347
  },
320
348
  dateRangePickerOuterContainer: {
321
- marginTop: 10,
349
+ marginTop: 10,
322
350
  },
323
351
  checkoutRow: {
324
352
  flexDirection: isRTL ? "row-reverse" : "row",
325
- alignItems: "flex-end",
326
- marginTop: 20,
353
+ alignItems: "flex-end",
354
+ marginTop: 20,
327
355
  gap: 10,
328
356
  },
329
357
  nationalityPickerWrapper: {
@@ -334,8 +362,8 @@ const themedStyles = (theme: ThemeType, isRTL: boolean) =>
334
362
  borderColor: theme.border,
335
363
  borderRadius: 8,
336
364
  backgroundColor: theme.surface,
337
- justifyContent: "center",
338
- height: 50,
365
+ justifyContent: "center",
366
+ height: 50,
339
367
  },
340
368
  picker: {
341
369
  width: "100%",
package/src/index.ts CHANGED
@@ -1,10 +1,10 @@
1
- import { registerRootComponent } from 'expo';
2
- import "react-native-reanimated";
1
+ // import { registerRootComponent } from 'expo';
2
+ // import "react-native-reanimated";
3
3
 
4
4
 
5
- import App from "./app";
5
+ // import App from "./app";
6
6
 
7
- registerRootComponent(App);
7
+ // registerRootComponent(App);
8
8
 
9
9
  export * from "./theme"
10
10
  export * from "./components";