related-ui-components 2.7.5 → 2.7.7

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 (35) hide show
  1. package/lib/module/app.js +17 -57
  2. package/lib/module/app.js.map +1 -1
  3. package/lib/module/components/CarouselCardStack/CarouselCardStack.js +99 -81
  4. package/lib/module/components/CarouselCardStack/CarouselCardStack.js.map +1 -1
  5. package/lib/module/components/TravelBooking/FlightSummary.js +219 -112
  6. package/lib/module/components/TravelBooking/FlightSummary.js.map +1 -1
  7. package/lib/module/components/TravelBooking/HotelSummary.js +168 -37
  8. package/lib/module/components/TravelBooking/HotelSummary.js.map +1 -1
  9. package/lib/module/components/TravelBooking/SummaryBar.js +239 -172
  10. package/lib/module/components/TravelBooking/SummaryBar.js.map +1 -1
  11. package/lib/module/components/TravelBooking/TravelBooking.js +407 -241
  12. package/lib/module/components/TravelBooking/TravelBooking.js.map +1 -1
  13. package/lib/module/components/TravelBooking/index.js +5 -4
  14. package/lib/module/components/TravelBooking/index.js.map +1 -1
  15. package/lib/typescript/src/app.d.ts.map +1 -1
  16. package/lib/typescript/src/components/CarouselCardStack/CarouselCardStack.d.ts.map +1 -1
  17. package/lib/typescript/src/components/TravelBooking/FlightSummary.d.ts +25 -11
  18. package/lib/typescript/src/components/TravelBooking/FlightSummary.d.ts.map +1 -1
  19. package/lib/typescript/src/components/TravelBooking/HotelSummary.d.ts +14 -0
  20. package/lib/typescript/src/components/TravelBooking/HotelSummary.d.ts.map +1 -1
  21. package/lib/typescript/src/components/TravelBooking/SummaryBar.d.ts +1 -16
  22. package/lib/typescript/src/components/TravelBooking/SummaryBar.d.ts.map +1 -1
  23. package/lib/typescript/src/components/TravelBooking/TravelBooking.d.ts +1 -83
  24. package/lib/typescript/src/components/TravelBooking/TravelBooking.d.ts.map +1 -1
  25. package/lib/typescript/src/components/TravelBooking/index.d.ts +0 -4
  26. package/lib/typescript/src/components/TravelBooking/index.d.ts.map +1 -1
  27. package/package.json +1 -1
  28. package/src/app.tsx +18 -39
  29. package/src/components/CarouselCardStack/CarouselCardStack.tsx +130 -120
  30. package/src/components/TravelBooking/FlightSummary.tsx +264 -164
  31. package/src/components/TravelBooking/HotelSummary.tsx +243 -76
  32. package/src/components/TravelBooking/SummaryBar.tsx +239 -239
  33. package/src/components/TravelBooking/TravelBooking.tsx +407 -407
  34. package/src/components/TravelBooking/index.ts +4 -4
  35. package/src/index.ts +1 -1
@@ -1,407 +1,407 @@
1
- // src/components/TravelBooking.tsx (or wherever TravelBooking is)
2
- import React, { useState, useCallback, useMemo, useEffect } from "react";
3
- import { View, StyleSheet, StyleProp, ViewStyle, TextStyle } from "react-native"; // Import style types
4
- import TabSelector, { TabSelectorProps } from "./TabSelector"; // Adjust import path
5
- import FlightForm, { FlightFormProps } from "./FlightForm"; // Adjust import path
6
- import HotelForm, { HotelFormProps } from "./HotelForm"; // Adjust import path
7
- import CarRentalForm, {
8
- CarRentalFormProps,
9
- mockCarSuggestions,
10
- } from "./CarRentalForm"; // Adjust import path
11
- import { ThemeType, useTheme } from "../../theme"; // Adjust import path
12
- import SummaryBar, {
13
- SelectionCallbackDataType,
14
- SummaryBarProps,
15
- } from "./SummaryBar"; // Adjust import path
16
- import {
17
- FlightSuggestions,
18
- FormInputType,
19
- HotelSuggestions,
20
- CarSuggestions,
21
- } from "./types"; // Adjust import path
22
- import { FlightSelection, FlightSummaryProps } from "./FlightSummary";
23
- import { HotelSummaryProps, RoomState } from "./HotelSummary";
24
-
25
- // Define the possible tab names (can be overridden via props)
26
- type DefaultBookingType = "Flights" | "Hotels" | "Car Rentals";
27
- const DEFAULT_TABS: DefaultBookingType[] = ["Flights", "Hotels", "Car Rentals"];
28
-
29
- // Mock Data (Keep accessible for potential defaults)
30
- const DEFAULT_MOCK_FLIGHT_SUGGESTIONS: FlightSuggestions[] = [
31
- {
32
- id: 1,
33
- city: "London",
34
- value: "London, United Kingdom",
35
- airports: [
36
- "Heathrow Airport (LHR)",
37
- "Gatwick Airport (LGW)",
38
- "Stansted Airport (STN)",
39
- ],
40
- },
41
- {
42
- id: 2,
43
- city: "New York",
44
- value: "New York, USA",
45
- airports: [
46
- "John F. Kennedy Intl (JFK)",
47
- "LaGuardia Airport (LGA)",
48
- "Newark Liberty Intl (EWR)",
49
- ],
50
- },
51
- ];
52
- const DEFAULT_MOCK_HOTEL_SUGGESTIONS: HotelSuggestions[] = [
53
- { id: 1, city: "Beirut", country: "Lebanon", value: "BEIRUT, LEBANON" },
54
- {
55
- id: 2,
56
- city: "Dubai",
57
- country: "United Arab Emirates",
58
- value: "DUBAI, UNITED ARAB EMIRATES",
59
- },
60
- ];
61
- const DEFAULT_MOCK_CAR_SUGGESTIONS: CarSuggestions[] = mockCarSuggestions;
62
-
63
- // --- TravelBooking Props Interface ---
64
- export interface TravelBookingProps {
65
- /** Array of tab names. Defaults to ['Flights', 'Hotels', 'Car Rentals'] */
66
- tabs?: string[];
67
- /** The initially selected tab. Defaults to the first tab in the `tabs` array. */
68
- initialTab?: string;
69
- /** Callback when the selected tab changes */
70
- onTabChange?: (tab: string) => void;
71
- /** Callback when the search button is pressed in any form */
72
- onSearch?: (details: any) => void;
73
- /** Callback when any form input gains focus */
74
- onInputFocus?: (input: FormInputType) => void;
75
- /** Callback when text changes in location inputs */
76
- onTextChange?: (text: string) => void;
77
-
78
- /** Initial selection state for FlightSummary (if mode is 'flight') */
79
- initialFlightSelection?: FlightSelection;
80
- /** Initial selection state for HotelSummary (if mode is 'hotel') */
81
- initialHotelSelection?: RoomState[];
82
- /** Callback when the selection in SummaryBar changes */
83
- onSummarySelectionChange?: (selection: SelectionCallbackDataType) => void;
84
-
85
- /** Suggestion data for FlightForm */
86
- flightSuggestionData?: FlightSuggestions[];
87
- /** Suggestion data for HotelForm */
88
- hotelSuggestionData?: HotelSuggestions[];
89
- /** Suggestion data for CarRentalForm */
90
- carSuggestionData?: CarSuggestions[];
91
-
92
- // --- Common Style Props ---
93
- /** Style for the root container of each form */
94
- formContainerStyle?: StyleProp<ViewStyle>;
95
- /** Style for input labels */
96
- labelStyle?: StyleProp<TextStyle>;
97
- /** Style for the CustomInput's TextInput component */
98
- inputStyle?: StyleProp<ViewStyle>; // Renamed from commonInputStyle for clarity
99
- /** Style for the touchable wrapper around date displays (if applicable) */
100
- inputTouchableStyle?: StyleProp<ViewStyle>;
101
- /** Style for the text inside inputs or date displays */
102
- inputTextStyle?: StyleProp<TextStyle>;
103
- /** Style for the container holding the date picker(s) and search button */
104
- dateSearchRowStyle?: StyleProp<ViewStyle>;
105
- /** Style for the individual date display groups within DateRangePicker */
106
- dateInputGroupStyle?: StyleProp<ViewStyle>;
107
- /** Style for the search button */
108
- searchButtonStyle?: StyleProp<ViewStyle>;
109
- /** Style for the search icon */
110
- searchIconStyle?: StyleProp<TextStyle>;
111
- /** Theme overrides for the calendar component */
112
- calendarThemeOverrides?: object;
113
- /** Style for the container wrapping the calendar modal/view */
114
- calendarContainerStyle?: StyleProp<ViewStyle>;
115
- /** Style for the container wrapping the swap button (Flights/Cars) */
116
- swapButtonContainerStyle?: StyleProp<ViewStyle>;
117
- /** Style for the swap button itself (Flights/Cars) */
118
- swapButtonStyle?: StyleProp<ViewStyle>;
119
- /** Style for the swap icon (Flights/Cars) */
120
- swapIconStyle?: StyleProp<TextStyle>;
121
- /** Style for the container wrapping the input fields (Flights/Cars) */
122
- inputGroupContainerStyle?: StyleProp<ViewStyle>; // Added for consistency
123
-
124
- // --- Nested Props for Child Components ---
125
-
126
- /** Props to pass down to the TabSelector component */
127
- tabSelectorProps?: Omit<
128
- TabSelectorProps,
129
- "tabs" | "initialTab" | "onTabChange" // Controlled by TravelBooking
130
- >;
131
-
132
- /** Props to pass down to the SummaryBar component */
133
- summaryBarProps?: Omit<
134
- SummaryBarProps,
135
- | "mode"
136
- | "initialSelection"
137
- | "onSelectionChange"
138
- | "flightProps"
139
- | "hotelProps" // Controlled or derived by TravelBooking
140
- >;
141
-
142
- /** Props to pass down to the FlightSummary component (via SummaryBar) */
143
- flightSummaryProps?: Omit<
144
- FlightSummaryProps,
145
- "selection" | "onSelectionChange" // Controlled by SummaryBar/TravelBooking
146
- >;
147
-
148
- /** Props to pass down to the HotelSummary component (via SummaryBar) */
149
- hotelSummaryProps?: Omit<
150
- HotelSummaryProps,
151
- "selection" | "onSelectionChange" // Controlled by SummaryBar/TravelBooking
152
- >;
153
-
154
- /** Props to pass down to the FlightForm component */
155
- /** Props to pass down to the FlightForm component */
156
- flightFormProps?: Omit<
157
- FlightFormProps,
158
- "isOneWay" | "onSearchPress" | "onInputFocus" | "suggestionData" | "onTextChange" // Controlled or derived by TravelBooking
159
- >;
160
-
161
- /** Props to pass down to the HotelForm component */
162
- hotelFormProps?: Omit<
163
- HotelFormProps,
164
- "onSearchPress" | "onInputFocus" | "suggestionData" | "onTextChange" // Controlled by TravelBooking
165
- >;
166
-
167
- /** Props to pass down to the CarRentalForm component */
168
- carRentalFormProps?: Omit<
169
- CarRentalFormProps,
170
- "onSearchPress" | "onInputFocus" | "suggestionData" | "onTextChange"// Controlled by TravelBooking
171
- >;
172
- }
173
-
174
- // --- TravelBooking Component Implementation ---
175
- const TravelBooking: React.FC<TravelBookingProps> = ({
176
- tabs = DEFAULT_TABS,
177
- initialTab,
178
- onTabChange,
179
- onSearch,
180
- initialFlightSelection,
181
- initialHotelSelection,
182
- onSummarySelectionChange,
183
- flightSuggestionData = DEFAULT_MOCK_FLIGHT_SUGGESTIONS, // Provide defaults
184
- hotelSuggestionData = DEFAULT_MOCK_HOTEL_SUGGESTIONS, // Provide defaults
185
- carSuggestionData = DEFAULT_MOCK_CAR_SUGGESTIONS, // Provide defaults
186
- tabSelectorProps,
187
- summaryBarProps,
188
- flightFormProps,
189
- hotelFormProps,
190
- carRentalFormProps,
191
- onInputFocus,
192
- onTextChange,
193
- // Destructure common style props
194
- formContainerStyle,
195
- labelStyle,
196
- inputStyle,
197
- inputTouchableStyle,
198
- inputTextStyle,
199
- dateSearchRowStyle,
200
- dateInputGroupStyle,
201
- searchButtonStyle,
202
- searchIconStyle,
203
- calendarThemeOverrides,
204
- calendarContainerStyle,
205
- swapButtonContainerStyle,
206
- swapButtonStyle,
207
- swapIconStyle,
208
- inputGroupContainerStyle, // Added
209
- }) => {
210
- const { theme } = useTheme();
211
- const styles = useMemo(() => themedStyles(theme), [theme]);
212
-
213
- const actualInitialTab = useMemo(
214
- () => initialTab ?? (tabs.length > 0 ? tabs[0] : ""),
215
- [initialTab, tabs]
216
- );
217
-
218
- const [selectedTab, setSelectedTab] = useState<string>(actualInitialTab);
219
- const [selectedOptions, setSelectedOptions] = useState<
220
- SelectionCallbackDataType | undefined
221
- >(
222
- actualInitialTab === tabs[0] && tabs[0] === "Flights"
223
- ? initialFlightSelection
224
- : actualInitialTab === tabs[1] && tabs[1] === "Hotels"
225
- ? initialHotelSelection
226
- : undefined
227
- );
228
-
229
- // --- Handlers ---
230
- const handleTabChange = useCallback(
231
- (tab: string) => {
232
- setSelectedTab(tab);
233
- if (tab === "Flights") {
234
- setSelectedOptions(initialFlightSelection);
235
- } else if (tab === "Hotels") {
236
- setSelectedOptions(initialHotelSelection);
237
- } else {
238
- setSelectedOptions(undefined);
239
- }
240
- onTabChange?.(tab);
241
- },
242
- [onTabChange, initialFlightSelection, initialHotelSelection]
243
- );
244
-
245
- const handleInternalSummarySelectionChange = useCallback(
246
- (selection: SelectionCallbackDataType) => {
247
- setSelectedOptions(selection);
248
- onSummarySelectionChange?.(selection);
249
- },
250
- [onSummarySelectionChange]
251
- );
252
-
253
- const handleInternalSearch = useCallback(
254
- (details: any) => {
255
- console.log("Internal Search Triggered:", details);
256
- onSearch?.(details);
257
- },
258
- [onSearch]
259
- );
260
-
261
- const handleInternalTextChange = useCallback(
262
- (text: string) => {
263
- onTextChange?.(text);
264
- },
265
- [onTextChange] // Added dependency
266
- );
267
-
268
- const handleInternalInputFocus = useCallback(
269
- (input: FormInputType) => {
270
- console.log("Input Focused:", input);
271
- onInputFocus?.(input);
272
- },
273
- [onInputFocus] // Added dependency
274
- );
275
-
276
- // Determine SummaryBar mode
277
- const summaryBarMode = useMemo(() => {
278
- if (selectedTab === "Flights") return "flight";
279
- if (selectedTab === "Hotels") return "hotel";
280
- return undefined;
281
- }, [selectedTab]);
282
-
283
- // --- Render Content Logic ---
284
- const renderContent = () => {
285
- const commonFormProps = {
286
- containerStyle: formContainerStyle,
287
- labelStyle: labelStyle,
288
- inputStyle: inputStyle,
289
- inputTouchableStyle: inputTouchableStyle,
290
- inputTextStyle: inputTextStyle,
291
- dateInputGroupStyle: dateInputGroupStyle,
292
- searchButtonStyle: searchButtonStyle,
293
- searchIconStyle: searchIconStyle,
294
- calendarThemeOverrides: calendarThemeOverrides,
295
- calendarContainerStyle: calendarContainerStyle,
296
- };
297
-
298
- switch (selectedTab) {
299
- case "Flights": {
300
- let isOneWay = false;
301
- if (
302
- selectedOptions &&
303
- typeof selectedOptions === "object" &&
304
- !Array.isArray(selectedOptions) &&
305
- "flightType" in selectedOptions
306
- ) {
307
- isOneWay = selectedOptions.flightType === "ONE_WAY";
308
- }
309
- return (
310
- <FlightForm
311
- // Pass common props first
312
- {...commonFormProps}
313
- departureRowStyle={dateSearchRowStyle} // Map specific row style
314
- swapButtonContainerStyle={swapButtonContainerStyle} // Pass swap styles
315
- swapButtonStyle={swapButtonStyle}
316
- swapIconStyle={swapIconStyle}
317
-
318
- // Pass specific FlightForm props (will override common ones if keys match)
319
- {...flightFormProps}
320
-
321
- // Pass controlled props
322
- isOneWay={isOneWay}
323
- onSearchPress={handleInternalSearch}
324
- onInputFocus={handleInternalInputFocus}
325
- onTextChange={handleInternalTextChange}
326
- suggestionData={flightSuggestionData}
327
- />
328
- );
329
- }
330
- case "Hotels":
331
- return (
332
- <HotelForm
333
- // Pass common props first
334
- {...commonFormProps}
335
- checkoutRowStyle={dateSearchRowStyle} // Map specific row style
336
-
337
- // Pass specific HotelForm props (will override common ones if keys match)
338
- {...hotelFormProps}
339
-
340
- // Pass controlled props
341
- onSearchPress={handleInternalSearch}
342
- onInputFocus={handleInternalInputFocus}
343
- onTextChange={handleInternalTextChange}
344
- suggestionData={hotelSuggestionData}
345
- />
346
- );
347
- case "Car Rentals":
348
- return (
349
- <CarRentalForm
350
- // Pass common props first
351
- {...commonFormProps}
352
- pickupRowStyle={dateSearchRowStyle} // Map specific row style
353
- swapButtonContainerStyle={swapButtonContainerStyle} // Pass swap styles
354
- swapButtonStyle={swapButtonStyle}
355
- swapIconStyle={swapIconStyle}
356
- inputGroupStyle={inputGroupContainerStyle} // Map input group style
357
-
358
- // Pass specific CarRentalForm props (will override common ones if keys match)
359
- {...carRentalFormProps}
360
-
361
- // Pass controlled props
362
- onSearchPress={handleInternalSearch}
363
- onInputFocus={handleInternalInputFocus}
364
- onTextChange={handleInternalTextChange}
365
- suggestionData={carSuggestionData}
366
- />
367
- );
368
- default:
369
- console.warn(`No content defined for tab: ${selectedTab}`);
370
- return null;
371
- }
372
- };
373
-
374
- return (
375
- <View style={styles.container}>
376
- {/* Conditionally render SummaryBar */}
377
- {summaryBarMode && (
378
- <SummaryBar
379
- {...summaryBarProps}
380
- mode={summaryBarMode}
381
- onSelectionChange={handleInternalSummarySelectionChange}
382
- />
383
- )}
384
-
385
- <TabSelector
386
- {...tabSelectorProps}
387
- tabs={tabs}
388
- initialTab={selectedTab} // Use state for controlled component
389
- onTabChange={handleTabChange}
390
- />
391
-
392
- <View style={styles.contentContainer}>{renderContent()}</View>
393
- </View>
394
- );
395
- };
396
-
397
- const themedStyles = (theme: ThemeType) =>
398
- StyleSheet.create({
399
- container: {
400
- // Removed flex: 1 to allow content to determine height naturally
401
- },
402
- contentContainer: {
403
- // Removed flex: 1
404
- },
405
- });
406
-
407
- export default TravelBooking;
1
+ // // src/components/TravelBooking.tsx (or wherever TravelBooking is)
2
+ // import React, { useState, useCallback, useMemo, useEffect } from "react";
3
+ // import { View, StyleSheet, StyleProp, ViewStyle, TextStyle } from "react-native"; // Import style types
4
+ // import TabSelector, { TabSelectorProps } from "./TabSelector"; // Adjust import path
5
+ // import FlightForm, { FlightFormProps } from "./FlightForm"; // Adjust import path
6
+ // import HotelForm, { HotelFormProps } from "./HotelForm"; // Adjust import path
7
+ // import CarRentalForm, {
8
+ // CarRentalFormProps,
9
+ // mockCarSuggestions,
10
+ // } from "./CarRentalForm"; // Adjust import path
11
+ // import { ThemeType, useTheme } from "../../theme"; // Adjust import path
12
+ // import SummaryBar, {
13
+ // SelectionCallbackDataType,
14
+ // SummaryBarProps,
15
+ // } from "./SummaryBar"; // Adjust import path
16
+ // import {
17
+ // FlightSuggestions,
18
+ // FormInputType,
19
+ // HotelSuggestions,
20
+ // CarSuggestions,
21
+ // } from "./types"; // Adjust import path
22
+ // import { FlightSelection, FlightSummaryProps } from "./FlightSummary";
23
+ // import { HotelSummaryProps, RoomState } from "./HotelSummary";
24
+
25
+ // // Define the possible tab names (can be overridden via props)
26
+ // type DefaultBookingType = "Flights" | "Hotels" | "Car Rentals";
27
+ // const DEFAULT_TABS: DefaultBookingType[] = ["Flights", "Hotels", "Car Rentals"];
28
+
29
+ // // Mock Data (Keep accessible for potential defaults)
30
+ // const DEFAULT_MOCK_FLIGHT_SUGGESTIONS: FlightSuggestions[] = [
31
+ // {
32
+ // id: 1,
33
+ // city: "London",
34
+ // value: "London, United Kingdom",
35
+ // airports: [
36
+ // "Heathrow Airport (LHR)",
37
+ // "Gatwick Airport (LGW)",
38
+ // "Stansted Airport (STN)",
39
+ // ],
40
+ // },
41
+ // {
42
+ // id: 2,
43
+ // city: "New York",
44
+ // value: "New York, USA",
45
+ // airports: [
46
+ // "John F. Kennedy Intl (JFK)",
47
+ // "LaGuardia Airport (LGA)",
48
+ // "Newark Liberty Intl (EWR)",
49
+ // ],
50
+ // },
51
+ // ];
52
+ // const DEFAULT_MOCK_HOTEL_SUGGESTIONS: HotelSuggestions[] = [
53
+ // { id: 1, city: "Beirut", country: "Lebanon", value: "BEIRUT, LEBANON" },
54
+ // {
55
+ // id: 2,
56
+ // city: "Dubai",
57
+ // country: "United Arab Emirates",
58
+ // value: "DUBAI, UNITED ARAB EMIRATES",
59
+ // },
60
+ // ];
61
+ // const DEFAULT_MOCK_CAR_SUGGESTIONS: CarSuggestions[] = mockCarSuggestions;
62
+
63
+ // // --- TravelBooking Props Interface ---
64
+ // export interface TravelBookingProps {
65
+ // /** Array of tab names. Defaults to ['Flights', 'Hotels', 'Car Rentals'] */
66
+ // tabs?: string[];
67
+ // /** The initially selected tab. Defaults to the first tab in the `tabs` array. */
68
+ // initialTab?: string;
69
+ // /** Callback when the selected tab changes */
70
+ // onTabChange?: (tab: string) => void;
71
+ // /** Callback when the search button is pressed in any form */
72
+ // onSearch?: (details: any) => void;
73
+ // /** Callback when any form input gains focus */
74
+ // onInputFocus?: (input: FormInputType) => void;
75
+ // /** Callback when text changes in location inputs */
76
+ // onTextChange?: (text: string) => void;
77
+
78
+ // /** Initial selection state for FlightSummary (if mode is 'flight') */
79
+ // initialFlightSelection?: FlightSelection;
80
+ // /** Initial selection state for HotelSummary (if mode is 'hotel') */
81
+ // initialHotelSelection?: RoomState[];
82
+ // /** Callback when the selection in SummaryBar changes */
83
+ // onSummarySelectionChange?: (selection: SelectionCallbackDataType) => void;
84
+
85
+ // /** Suggestion data for FlightForm */
86
+ // flightSuggestionData?: FlightSuggestions[];
87
+ // /** Suggestion data for HotelForm */
88
+ // hotelSuggestionData?: HotelSuggestions[];
89
+ // /** Suggestion data for CarRentalForm */
90
+ // carSuggestionData?: CarSuggestions[];
91
+
92
+ // // --- Common Style Props ---
93
+ // /** Style for the root container of each form */
94
+ // formContainerStyle?: StyleProp<ViewStyle>;
95
+ // /** Style for input labels */
96
+ // labelStyle?: StyleProp<TextStyle>;
97
+ // /** Style for the CustomInput's TextInput component */
98
+ // inputStyle?: StyleProp<ViewStyle>; // Renamed from commonInputStyle for clarity
99
+ // /** Style for the touchable wrapper around date displays (if applicable) */
100
+ // inputTouchableStyle?: StyleProp<ViewStyle>;
101
+ // /** Style for the text inside inputs or date displays */
102
+ // inputTextStyle?: StyleProp<TextStyle>;
103
+ // /** Style for the container holding the date picker(s) and search button */
104
+ // dateSearchRowStyle?: StyleProp<ViewStyle>;
105
+ // /** Style for the individual date display groups within DateRangePicker */
106
+ // dateInputGroupStyle?: StyleProp<ViewStyle>;
107
+ // /** Style for the search button */
108
+ // searchButtonStyle?: StyleProp<ViewStyle>;
109
+ // /** Style for the search icon */
110
+ // searchIconStyle?: StyleProp<TextStyle>;
111
+ // /** Theme overrides for the calendar component */
112
+ // calendarThemeOverrides?: object;
113
+ // /** Style for the container wrapping the calendar modal/view */
114
+ // calendarContainerStyle?: StyleProp<ViewStyle>;
115
+ // /** Style for the container wrapping the swap button (Flights/Cars) */
116
+ // swapButtonContainerStyle?: StyleProp<ViewStyle>;
117
+ // /** Style for the swap button itself (Flights/Cars) */
118
+ // swapButtonStyle?: StyleProp<ViewStyle>;
119
+ // /** Style for the swap icon (Flights/Cars) */
120
+ // swapIconStyle?: StyleProp<TextStyle>;
121
+ // /** Style for the container wrapping the input fields (Flights/Cars) */
122
+ // inputGroupContainerStyle?: StyleProp<ViewStyle>; // Added for consistency
123
+
124
+ // // --- Nested Props for Child Components ---
125
+
126
+ // /** Props to pass down to the TabSelector component */
127
+ // tabSelectorProps?: Omit<
128
+ // TabSelectorProps,
129
+ // "tabs" | "initialTab" | "onTabChange" // Controlled by TravelBooking
130
+ // >;
131
+
132
+ // /** Props to pass down to the SummaryBar component */
133
+ // summaryBarProps?: Omit<
134
+ // SummaryBarProps,
135
+ // | "mode"
136
+ // | "initialSelection"
137
+ // | "onSelectionChange"
138
+ // | "flightProps"
139
+ // | "hotelProps" // Controlled or derived by TravelBooking
140
+ // >;
141
+
142
+ // /** Props to pass down to the FlightSummary component (via SummaryBar) */
143
+ // flightSummaryProps?: Omit<
144
+ // FlightSummaryProps,
145
+ // "selection" | "onSelectionChange" // Controlled by SummaryBar/TravelBooking
146
+ // >;
147
+
148
+ // /** Props to pass down to the HotelSummary component (via SummaryBar) */
149
+ // hotelSummaryProps?: Omit<
150
+ // HotelSummaryProps,
151
+ // "selection" | "onSelectionChange" // Controlled by SummaryBar/TravelBooking
152
+ // >;
153
+
154
+ // /** Props to pass down to the FlightForm component */
155
+ // /** Props to pass down to the FlightForm component */
156
+ // flightFormProps?: Omit<
157
+ // FlightFormProps,
158
+ // "isOneWay" | "onSearchPress" | "onInputFocus" | "suggestionData" | "onTextChange" // Controlled or derived by TravelBooking
159
+ // >;
160
+
161
+ // /** Props to pass down to the HotelForm component */
162
+ // hotelFormProps?: Omit<
163
+ // HotelFormProps,
164
+ // "onSearchPress" | "onInputFocus" | "suggestionData" | "onTextChange" // Controlled by TravelBooking
165
+ // >;
166
+
167
+ // /** Props to pass down to the CarRentalForm component */
168
+ // carRentalFormProps?: Omit<
169
+ // CarRentalFormProps,
170
+ // "onSearchPress" | "onInputFocus" | "suggestionData" | "onTextChange"// Controlled by TravelBooking
171
+ // >;
172
+ // }
173
+
174
+ // // --- TravelBooking Component Implementation ---
175
+ // const TravelBooking: React.FC<TravelBookingProps> = ({
176
+ // tabs = DEFAULT_TABS,
177
+ // initialTab,
178
+ // onTabChange,
179
+ // onSearch,
180
+ // initialFlightSelection,
181
+ // initialHotelSelection,
182
+ // onSummarySelectionChange,
183
+ // flightSuggestionData = DEFAULT_MOCK_FLIGHT_SUGGESTIONS, // Provide defaults
184
+ // hotelSuggestionData = DEFAULT_MOCK_HOTEL_SUGGESTIONS, // Provide defaults
185
+ // carSuggestionData = DEFAULT_MOCK_CAR_SUGGESTIONS, // Provide defaults
186
+ // tabSelectorProps,
187
+ // summaryBarProps,
188
+ // flightFormProps,
189
+ // hotelFormProps,
190
+ // carRentalFormProps,
191
+ // onInputFocus,
192
+ // onTextChange,
193
+ // // Destructure common style props
194
+ // formContainerStyle,
195
+ // labelStyle,
196
+ // inputStyle,
197
+ // inputTouchableStyle,
198
+ // inputTextStyle,
199
+ // dateSearchRowStyle,
200
+ // dateInputGroupStyle,
201
+ // searchButtonStyle,
202
+ // searchIconStyle,
203
+ // calendarThemeOverrides,
204
+ // calendarContainerStyle,
205
+ // swapButtonContainerStyle,
206
+ // swapButtonStyle,
207
+ // swapIconStyle,
208
+ // inputGroupContainerStyle, // Added
209
+ // }) => {
210
+ // const { theme } = useTheme();
211
+ // const styles = useMemo(() => themedStyles(theme), [theme]);
212
+
213
+ // const actualInitialTab = useMemo(
214
+ // () => initialTab ?? (tabs.length > 0 ? tabs[0] : ""),
215
+ // [initialTab, tabs]
216
+ // );
217
+
218
+ // const [selectedTab, setSelectedTab] = useState<string>(actualInitialTab);
219
+ // const [selectedOptions, setSelectedOptions] = useState<
220
+ // SelectionCallbackDataType | undefined
221
+ // >(
222
+ // actualInitialTab === tabs[0] && tabs[0] === "Flights"
223
+ // ? initialFlightSelection
224
+ // : actualInitialTab === tabs[1] && tabs[1] === "Hotels"
225
+ // ? initialHotelSelection
226
+ // : undefined
227
+ // );
228
+
229
+ // // --- Handlers ---
230
+ // const handleTabChange = useCallback(
231
+ // (tab: string) => {
232
+ // setSelectedTab(tab);
233
+ // if (tab === "Flights") {
234
+ // setSelectedOptions(initialFlightSelection);
235
+ // } else if (tab === "Hotels") {
236
+ // setSelectedOptions(initialHotelSelection);
237
+ // } else {
238
+ // setSelectedOptions(undefined);
239
+ // }
240
+ // onTabChange?.(tab);
241
+ // },
242
+ // [onTabChange, initialFlightSelection, initialHotelSelection]
243
+ // );
244
+
245
+ // const handleInternalSummarySelectionChange = useCallback(
246
+ // (selection: SelectionCallbackDataType) => {
247
+ // setSelectedOptions(selection);
248
+ // onSummarySelectionChange?.(selection);
249
+ // },
250
+ // [onSummarySelectionChange]
251
+ // );
252
+
253
+ // const handleInternalSearch = useCallback(
254
+ // (details: any) => {
255
+ // console.log("Internal Search Triggered:", details);
256
+ // onSearch?.(details);
257
+ // },
258
+ // [onSearch]
259
+ // );
260
+
261
+ // const handleInternalTextChange = useCallback(
262
+ // (text: string) => {
263
+ // onTextChange?.(text);
264
+ // },
265
+ // [onTextChange] // Added dependency
266
+ // );
267
+
268
+ // const handleInternalInputFocus = useCallback(
269
+ // (input: FormInputType) => {
270
+ // console.log("Input Focused:", input);
271
+ // onInputFocus?.(input);
272
+ // },
273
+ // [onInputFocus] // Added dependency
274
+ // );
275
+
276
+ // // Determine SummaryBar mode
277
+ // const summaryBarMode = useMemo(() => {
278
+ // if (selectedTab === "Flights") return "flight";
279
+ // if (selectedTab === "Hotels") return "hotel";
280
+ // return undefined;
281
+ // }, [selectedTab]);
282
+
283
+ // // --- Render Content Logic ---
284
+ // const renderContent = () => {
285
+ // const commonFormProps = {
286
+ // containerStyle: formContainerStyle,
287
+ // labelStyle: labelStyle,
288
+ // inputStyle: inputStyle,
289
+ // inputTouchableStyle: inputTouchableStyle,
290
+ // inputTextStyle: inputTextStyle,
291
+ // dateInputGroupStyle: dateInputGroupStyle,
292
+ // searchButtonStyle: searchButtonStyle,
293
+ // searchIconStyle: searchIconStyle,
294
+ // calendarThemeOverrides: calendarThemeOverrides,
295
+ // calendarContainerStyle: calendarContainerStyle,
296
+ // };
297
+
298
+ // switch (selectedTab) {
299
+ // case "Flights": {
300
+ // let isOneWay = false;
301
+ // if (
302
+ // selectedOptions &&
303
+ // typeof selectedOptions === "object" &&
304
+ // !Array.isArray(selectedOptions) &&
305
+ // "flightType" in selectedOptions
306
+ // ) {
307
+ // isOneWay = selectedOptions.flightType === "ONE_WAY";
308
+ // }
309
+ // return (
310
+ // <FlightForm
311
+ // // Pass common props first
312
+ // {...commonFormProps}
313
+ // departureRowStyle={dateSearchRowStyle} // Map specific row style
314
+ // swapButtonContainerStyle={swapButtonContainerStyle} // Pass swap styles
315
+ // swapButtonStyle={swapButtonStyle}
316
+ // swapIconStyle={swapIconStyle}
317
+
318
+ // // Pass specific FlightForm props (will override common ones if keys match)
319
+ // {...flightFormProps}
320
+
321
+ // // Pass controlled props
322
+ // isOneWay={isOneWay}
323
+ // onSearchPress={handleInternalSearch}
324
+ // onInputFocus={handleInternalInputFocus}
325
+ // onTextChange={handleInternalTextChange}
326
+ // suggestionData={flightSuggestionData}
327
+ // />
328
+ // );
329
+ // }
330
+ // case "Hotels":
331
+ // return (
332
+ // <HotelForm
333
+ // // Pass common props first
334
+ // {...commonFormProps}
335
+ // checkoutRowStyle={dateSearchRowStyle} // Map specific row style
336
+
337
+ // // Pass specific HotelForm props (will override common ones if keys match)
338
+ // {...hotelFormProps}
339
+
340
+ // // Pass controlled props
341
+ // onSearchPress={handleInternalSearch}
342
+ // onInputFocus={handleInternalInputFocus}
343
+ // onTextChange={handleInternalTextChange}
344
+ // suggestionData={hotelSuggestionData}
345
+ // />
346
+ // );
347
+ // case "Car Rentals":
348
+ // return (
349
+ // <CarRentalForm
350
+ // // Pass common props first
351
+ // {...commonFormProps}
352
+ // pickupRowStyle={dateSearchRowStyle} // Map specific row style
353
+ // swapButtonContainerStyle={swapButtonContainerStyle} // Pass swap styles
354
+ // swapButtonStyle={swapButtonStyle}
355
+ // swapIconStyle={swapIconStyle}
356
+ // inputGroupStyle={inputGroupContainerStyle} // Map input group style
357
+
358
+ // // Pass specific CarRentalForm props (will override common ones if keys match)
359
+ // {...carRentalFormProps}
360
+
361
+ // // Pass controlled props
362
+ // onSearchPress={handleInternalSearch}
363
+ // onInputFocus={handleInternalInputFocus}
364
+ // onTextChange={handleInternalTextChange}
365
+ // suggestionData={carSuggestionData}
366
+ // />
367
+ // );
368
+ // default:
369
+ // console.warn(`No content defined for tab: ${selectedTab}`);
370
+ // return null;
371
+ // }
372
+ // };
373
+
374
+ // return (
375
+ // <View style={styles.container}>
376
+ // {/* Conditionally render SummaryBar */}
377
+ // {summaryBarMode && (
378
+ // <SummaryBar
379
+ // {...summaryBarProps}
380
+ // mode={summaryBarMode}
381
+ // onSelectionChange={handleInternalSummarySelectionChange}
382
+ // />
383
+ // )}
384
+
385
+ // <TabSelector
386
+ // {...tabSelectorProps}
387
+ // tabs={tabs}
388
+ // initialTab={selectedTab} // Use state for controlled component
389
+ // onTabChange={handleTabChange}
390
+ // />
391
+
392
+ // <View style={styles.contentContainer}>{renderContent()}</View>
393
+ // </View>
394
+ // );
395
+ // };
396
+
397
+ // const themedStyles = (theme: ThemeType) =>
398
+ // StyleSheet.create({
399
+ // container: {
400
+ // // Removed flex: 1 to allow content to determine height naturally
401
+ // },
402
+ // contentContainer: {
403
+ // // Removed flex: 1
404
+ // },
405
+ // });
406
+
407
+ // export default TravelBooking;