related-ui-components 1.6.8 → 1.7.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 (37) hide show
  1. package/lib/commonjs/components/Filters/Filters.js +118 -146
  2. package/lib/commonjs/components/Filters/Filters.js.map +1 -1
  3. package/lib/commonjs/components/TravelBooking/FlightForm.js +1 -1
  4. package/lib/commonjs/components/TravelBooking/FlightForm.js.map +1 -1
  5. package/lib/commonjs/components/TravelBooking/FlightSummary.js +1 -1
  6. package/lib/commonjs/components/TravelBooking/FlightSummary.js.map +1 -1
  7. package/lib/commonjs/components/TravelBooking/HotelSummary.js +1 -1
  8. package/lib/commonjs/components/TravelBooking/HotelSummary.js.map +1 -1
  9. package/lib/commonjs/components/TravelBooking/SummaryBar.js +2 -2
  10. package/lib/commonjs/components/TravelBooking/SummaryBar.js.map +1 -1
  11. package/lib/commonjs/theme/Colors.js +32 -2
  12. package/lib/commonjs/theme/Colors.js.map +1 -1
  13. package/lib/module/components/Filters/Filters.js +119 -147
  14. package/lib/module/components/Filters/Filters.js.map +1 -1
  15. package/lib/module/components/TravelBooking/FlightForm.js +1 -1
  16. package/lib/module/components/TravelBooking/FlightForm.js.map +1 -1
  17. package/lib/module/components/TravelBooking/FlightSummary.js +1 -1
  18. package/lib/module/components/TravelBooking/FlightSummary.js.map +1 -1
  19. package/lib/module/components/TravelBooking/HotelSummary.js +1 -1
  20. package/lib/module/components/TravelBooking/HotelSummary.js.map +1 -1
  21. package/lib/module/components/TravelBooking/SummaryBar.js +2 -2
  22. package/lib/module/components/TravelBooking/SummaryBar.js.map +1 -1
  23. package/lib/module/theme/Colors.js +32 -2
  24. package/lib/module/theme/Colors.js.map +1 -1
  25. package/lib/typescript/commonjs/components/Filters/Filters.d.ts.map +1 -1
  26. package/lib/typescript/commonjs/theme/Colors.d.ts +11 -1
  27. package/lib/typescript/commonjs/theme/Colors.d.ts.map +1 -1
  28. package/lib/typescript/module/components/Filters/Filters.d.ts.map +1 -1
  29. package/lib/typescript/module/theme/Colors.d.ts +11 -1
  30. package/lib/typescript/module/theme/Colors.d.ts.map +1 -1
  31. package/package.json +1 -1
  32. package/src/components/Filters/Filters.tsx +133 -166
  33. package/src/components/TravelBooking/FlightForm.tsx +1 -1
  34. package/src/components/TravelBooking/FlightSummary.tsx +1 -1
  35. package/src/components/TravelBooking/HotelSummary.tsx +1 -1
  36. package/src/components/TravelBooking/SummaryBar.tsx +2 -2
  37. package/src/theme/Colors.ts +36 -3
@@ -148,26 +148,14 @@ const Filters: React.FC<FiltersProps> = ({
148
148
  visible = true,
149
149
  }) => {
150
150
  const { theme, isRTL: themeIsRTL } = useTheme();
151
- const isRTL = isRTLProp ?? themeIsRTL ?? I18nManager.isRTL;
151
+ const isRTL = isRTLProp ?? themeIsRTL ?? I18nManager.isRTL;
152
152
  const bottomSheetRef = useRef<BottomSheet>(null);
153
153
  const styles = createStyles(theme, isRTL);
154
154
  const checkboxColor = checkboxColorProp ?? theme.primary;
155
- const [isVisible, setIsVisible] = useState(visible);
156
-
157
- useEffect(() => {
158
- if (visible) {
159
- setIsVisible(true);
160
- setTimeout(() => bottomSheetRef.current?.snapToIndex(bottomSheetIndex), 0);
161
- } else {
162
- bottomSheetRef.current?.close();
163
- setIsVisible(false);
164
- }
165
- }, [visible, bottomSheetIndex]);
166
155
 
167
156
  const handleSheetChanges = useCallback(
168
157
  (index: number) => {
169
158
  if (index === -1) {
170
- setIsVisible(false);
171
159
  if (onClose) {
172
160
  onClose();
173
161
  }
@@ -182,20 +170,16 @@ const Filters: React.FC<FiltersProps> = ({
182
170
  sortOptions.find((option) => option.checked)?.id || null
183
171
  );
184
172
 
185
- const [selectedBrands, setSelectedBrands] = useState<
186
- Record<string, boolean>
187
- >(
173
+ const [selectedBrands, setSelectedBrands] = useState<Record<string, boolean>>(
188
174
  brands.reduce((acc, option) => {
189
175
  acc[option.id] = option.checked || false;
190
176
  return acc;
191
177
  }, {} as Record<string, boolean>)
192
178
  );
193
- const [pointsRange, setPointsRange] = useState<{ min: number; max: number }>(
194
- {
195
- min: rangeInitialMin,
196
- max: rangeInitialMax,
197
- }
198
- );
179
+ const [pointsRange, setPointsRange] = useState<{ min: number; max: number }>({
180
+ min: rangeInitialMin,
181
+ max: rangeInitialMax,
182
+ });
199
183
 
200
184
  const handleCheckboxChange = (id: number) => {
201
185
  setCheckedItem(id);
@@ -208,9 +192,14 @@ const Filters: React.FC<FiltersProps> = ({
208
192
  }));
209
193
  };
210
194
 
211
- const closeBottomSheet = useCallback(() => {
212
- bottomSheetRef.current?.close();
213
- }, [/* onClose */]);
195
+ const closeBottomSheet = useCallback(
196
+ () => {
197
+ bottomSheetRef.current?.close();
198
+ },
199
+ [
200
+ /* onClose */
201
+ ]
202
+ );
214
203
 
215
204
  const handleApplyFilter = () => {
216
205
  if (onActionButtonPress) {
@@ -249,7 +238,7 @@ const Filters: React.FC<FiltersProps> = ({
249
238
  (props: BottomSheetBackdropProps) => (
250
239
  <BottomSheetBackdrop
251
240
  {...props}
252
- appearsOnIndex={0}
241
+ appearsOnIndex={0}
253
242
  disappearsOnIndex={-1}
254
243
  pressBehavior="close"
255
244
  opacity={0.5}
@@ -258,160 +247,138 @@ const Filters: React.FC<FiltersProps> = ({
258
247
  []
259
248
  );
260
249
 
261
- if (!visible) {
262
- return null;
263
- }
264
-
265
250
  return (
266
- <GestureHandlerRootView style={styles.gestureHandlerRoot}>
267
- <BottomSheet
268
- ref={bottomSheetRef}
269
- index={isVisible ? bottomSheetIndex : -1}
270
- onChange={handleSheetChanges}
271
- handleComponent={() => null}
272
- style={bottomSheetStyle}
273
- backgroundStyle={{ backgroundColor: theme.surface }}
274
- handleIndicatorStyle={[styles.handleIndicator, handleIndicatorStyle]}
275
- enablePanDownToClose={true}
276
- backdropComponent={renderBackdrop}
277
- >
278
- <View style={[styles.container, containerStyle]}>
279
- <View style={[styles.header, headerStyle]}>
280
- <Text style={[styles.title, titleStyle]}>{headerTitleText}</Text>
281
- <TouchableOpacity onPress={handleResetAll}>
282
- <Text style={[styles.resetText, resetTextStyle]}>
283
- {headerResetText}
251
+ <BottomSheet
252
+ ref={bottomSheetRef}
253
+ index={visible ? bottomSheetIndex : -1}
254
+ onChange={handleSheetChanges}
255
+ handleComponent={() => null}
256
+ style={bottomSheetStyle}
257
+ backgroundStyle={{ backgroundColor: theme.surface }}
258
+ handleIndicatorStyle={[styles.handleIndicator, handleIndicatorStyle]}
259
+ enablePanDownToClose={true}
260
+ backdropComponent={renderBackdrop}
261
+ >
262
+ <View style={[styles.container, containerStyle]}>
263
+ <View style={[styles.header, headerStyle]}>
264
+ <Text style={[styles.title, titleStyle]}>{headerTitleText}</Text>
265
+ <TouchableOpacity onPress={handleResetAll}>
266
+ <Text style={[styles.resetText, resetTextStyle]}>
267
+ {headerResetText}
268
+ </Text>
269
+ </TouchableOpacity>
270
+ </View>
271
+ <BottomSheetView style={{ paddingBottom: 75 }}>
272
+ {sortOptions && sortOptions.length > 0 && (
273
+ <View style={[styles.section, sectionStyle, sortSectionStyle]}>
274
+ <Text style={[styles.sectionTitle, sectionTitleStyle]}>
275
+ {sortSectionTitle}
284
276
  </Text>
285
- </TouchableOpacity>
286
- </View>
287
- <BottomSheetView style={{ paddingBottom: 75 }}>
288
- {sortOptions && sortOptions.length > 0 && (
289
- <View style={[styles.section, sectionStyle, sortSectionStyle]}>
290
- <Text style={[styles.sectionTitle, sectionTitleStyle]}>
291
- {sortSectionTitle}
292
- </Text>
293
- {sortOptions.map((option) => (
294
- <View
295
- style={[styles.optionRow, optionRowStyle]}
296
- key={option.id}
297
- >
298
- <Checkbox
299
- value={option.id == checkedItem}
300
- color={checkboxColor}
301
- hitSlop={{ top: 10, right: 10, bottom: 10, left: 10 }}
302
- onValueChange={() => handleCheckboxChange(option.id)}
303
- />
304
- <Text style={[styles.optionText, optionTextStyle]}>
305
- {option.name}
306
- </Text>
307
- </View>
308
- ))}
309
- </View>
310
- )}
277
+ {sortOptions.map((option) => (
278
+ <View
279
+ style={[styles.optionRow, optionRowStyle]}
280
+ key={option.id}
281
+ >
282
+ <Checkbox
283
+ value={option.id == checkedItem}
284
+ color={checkboxColor}
285
+ hitSlop={{ top: 10, right: 10, bottom: 10, left: 10 }}
286
+ onValueChange={() => handleCheckboxChange(option.id)}
287
+ />
288
+ <Text style={[styles.optionText, optionTextStyle]}>
289
+ {option.name}
290
+ </Text>
291
+ </View>
292
+ ))}
293
+ </View>
294
+ )}
311
295
 
312
- {showPointsRange && (
313
- <View style={[styles.section, sectionStyle]}>
314
- <Text style={[styles.sectionTitle, sectionTitleStyle]}>
315
- {pointsRangeSectionTitle}
316
- </Text>
317
- <PointsRangeSelector
318
- resetKey={resetCounter}
319
- initialMax={rangeInitialMax}
320
- initialMin={rangeInitialMin}
321
- minLimit={rangeMinLimit}
322
- maxLimit={rangeMaxLimit}
323
- isRTL={isRTL}
324
- containerStyle={pointsRangeContainerStyle}
325
- inputsContainerStyle={pointsRangeInputsContainerStyle}
326
- customInputContainerStyle={
327
- pointsRangeCustomInputContainerStyle
328
- }
329
- customInputFieldStyle={pointsRangeCustomInputFieldStyle}
330
- sliderContainerStyle={pointsRangeSliderContainerStyle}
331
- multiSliderContainerStyle={
332
- pointsRangeMultiSliderContainerStyle
333
- }
334
- trackStyle={pointsRangeTrackStyle}
335
- selectedTrackStyle={pointsRangeSelectedTrackStyle}
336
- unselectedTrackStyle={pointsRangeUnselectedTrackStyle}
337
- markerStyle={pointsRangeMarkerStyle}
338
- markerEnabledStyle={pointsRangeMarkerEnabledStyle}
339
- markerDisabledStyle={pointsRangeMarkerDisabledStyle}
340
- markerDotStyle={pointsRangeMarkerDotStyle}
341
- inputProps={pointsRangeInputProps}
342
- multiSliderProps={pointsRangeMultiSliderProps}
343
- onChange={(min: number, max: number) => {
344
- setPointsRange({ min, max });
345
- }}
346
- />
347
- </View>
348
- )}
296
+ {showPointsRange && (
297
+ <View style={[styles.section, sectionStyle]}>
298
+ <Text style={[styles.sectionTitle, sectionTitleStyle]}>
299
+ {pointsRangeSectionTitle}
300
+ </Text>
301
+ <PointsRangeSelector
302
+ resetKey={resetCounter}
303
+ initialMax={rangeInitialMax}
304
+ initialMin={rangeInitialMin}
305
+ minLimit={rangeMinLimit}
306
+ maxLimit={rangeMaxLimit}
307
+ isRTL={isRTL}
308
+ containerStyle={pointsRangeContainerStyle}
309
+ inputsContainerStyle={pointsRangeInputsContainerStyle}
310
+ customInputContainerStyle={pointsRangeCustomInputContainerStyle}
311
+ customInputFieldStyle={pointsRangeCustomInputFieldStyle}
312
+ sliderContainerStyle={pointsRangeSliderContainerStyle}
313
+ multiSliderContainerStyle={pointsRangeMultiSliderContainerStyle}
314
+ trackStyle={pointsRangeTrackStyle}
315
+ selectedTrackStyle={pointsRangeSelectedTrackStyle}
316
+ unselectedTrackStyle={pointsRangeUnselectedTrackStyle}
317
+ markerStyle={pointsRangeMarkerStyle}
318
+ markerEnabledStyle={pointsRangeMarkerEnabledStyle}
319
+ markerDisabledStyle={pointsRangeMarkerDisabledStyle}
320
+ markerDotStyle={pointsRangeMarkerDotStyle}
321
+ inputProps={pointsRangeInputProps}
322
+ multiSliderProps={pointsRangeMultiSliderProps}
323
+ onChange={(min: number, max: number) => {
324
+ setPointsRange({ min, max });
325
+ }}
326
+ />
327
+ </View>
328
+ )}
349
329
 
350
- {brands && brands.length > 0 && (
351
- <View style={[styles.section, sectionStyle]}>
352
- <Text style={[styles.sectionTitle, sectionTitleStyle]}>
353
- {brandSectionTile}
354
- </Text>
355
- <View style={[styles.brandsGrid, brandContainerStyle]}>
356
- {brands.map((brand) => (
357
- <BrandIcon
358
- key={brand.id}
359
- size={50}
360
- selected={selectedBrands[brand.id]}
361
- onPress={() => handleBrandSelect(brand.id.toString())}
362
- brand={{
363
- id: brand.id,
364
- name: brand.name,
365
- logo: brand.logo,
366
- }}
367
- selectionIndicatorIcon={
368
- brandActiveIcon || (
369
- <Ionicons
370
- name="checkmark-outline"
371
- color={theme.onPrimary}
372
- />
373
- )
374
- }
375
- selectionIndicatorStyle={brandActiveIconStyle}
376
- />
377
- ))}
378
- </View>
330
+ {brands && brands.length > 0 && (
331
+ <View style={[styles.section, sectionStyle]}>
332
+ <Text style={[styles.sectionTitle, sectionTitleStyle]}>
333
+ {brandSectionTile}
334
+ </Text>
335
+ <View style={[styles.brandsGrid, brandContainerStyle]}>
336
+ {brands.map((brand) => (
337
+ <BrandIcon
338
+ key={brand.id}
339
+ size={50}
340
+ selected={selectedBrands[brand.id]}
341
+ onPress={() => handleBrandSelect(brand.id.toString())}
342
+ brand={{
343
+ id: brand.id,
344
+ name: brand.name,
345
+ logo: brand.logo,
346
+ }}
347
+ selectionIndicatorIcon={
348
+ brandActiveIcon || (
349
+ <Ionicons
350
+ name="checkmark-outline"
351
+ color={theme.onPrimary}
352
+ />
353
+ )
354
+ }
355
+ selectionIndicatorStyle={brandActiveIconStyle}
356
+ />
357
+ ))}
379
358
  </View>
380
- )}
359
+ </View>
360
+ )}
381
361
 
382
- <TouchableOpacity
383
- style={[styles.applyButton, applyButtonStyle]}
384
- onPress={handleApplyFilter}
385
- >
386
- <Text style={[styles.applyButtonText, applyButtonTextStyle]}>
387
- {applyButtonText}
388
- </Text>
389
- </TouchableOpacity>
390
- </BottomSheetView>
391
- </View>
392
- </BottomSheet>
393
- </GestureHandlerRootView>
362
+ <TouchableOpacity
363
+ style={[styles.applyButton, applyButtonStyle]}
364
+ onPress={handleApplyFilter}
365
+ >
366
+ <Text style={[styles.applyButtonText, applyButtonTextStyle]}>
367
+ {applyButtonText}
368
+ </Text>
369
+ </TouchableOpacity>
370
+ </BottomSheetView>
371
+ </View>
372
+ </BottomSheet>
394
373
  );
395
374
  };
396
375
 
397
376
  const createStyles = (theme: ThemeType, isRTL: boolean) =>
398
377
  StyleSheet.create({
399
- // overlayContainer is likely not needed anymore
400
- // overlay: { ... }, // Removed - handled by backdropComponent
401
- gestureHandlerRoot: {
402
- // Style needed for GestureHandlerRootView if it needs specific layout,
403
- // often just flex: 1 or position absolute covering the screen
404
- position: 'absolute',
405
- top: 0,
406
- left: 0,
407
- right: 0,
408
- bottom: 0,
409
- zIndex: 1000, // Ensure it's above other content
410
- },
411
378
  container: {
412
379
  flex: 1,
413
380
  paddingHorizontal: 25,
414
- backgroundColor: theme.surface, // Background is set on BottomSheet backgroundStyle now
381
+ backgroundColor: theme.surface,
415
382
  },
416
383
  handleIndicator: {
417
384
  width: 40,
@@ -445,7 +445,7 @@ const themedStyles = (theme: ThemeType, isRTL: boolean) =>
445
445
  },
446
446
  suggestionAirportText: {
447
447
  fontSize: 14,
448
- color: theme.onSurfaceVariant,
448
+ color: theme.onSurface,
449
449
  },
450
450
  });
451
451
 
@@ -380,7 +380,7 @@ const themedStyles = (theme: ThemeType, isRTL: boolean) =>
380
380
  },
381
381
  passengerDescription: {
382
382
  fontSize: 12,
383
- color: theme.secondaryText || theme.onSurface,
383
+ color: theme.text || theme.onSurface,
384
384
  opacity: 0.8,
385
385
  },
386
386
  });
@@ -323,7 +323,7 @@ const themedStyles = (theme: ThemeType, isRTL: boolean) =>
323
323
  },
324
324
  guestDescription: {
325
325
  fontSize: 12,
326
- color: theme.secondaryText || theme.onSurface,
326
+ color: theme.onSurface,
327
327
  opacity: 0.8,
328
328
  },
329
329
  addRoomButton: {
@@ -163,7 +163,7 @@ const SummaryBar: React.FC<SummaryBarProps> = ({
163
163
  <Ionicons
164
164
  name={isExpanded ? "chevron-up" : "chevron-down"}
165
165
  size={22}
166
- color={theme.secondaryText || theme.border}
166
+ color={ theme.border}
167
167
  style={iconStyle}
168
168
  />
169
169
  </TouchableOpacity>
@@ -210,7 +210,7 @@ const themedStyles = (theme: ThemeType) =>
210
210
  paddingHorizontal: 16,
211
211
  },
212
212
  summaryText: {
213
- color: theme.onSurfaceVariant || theme.onSurface,
213
+ color: theme.onSurface,
214
214
  fontSize: 15,
215
215
  fontWeight: "500",
216
216
  flex: 1,
@@ -3,8 +3,11 @@ export interface ThemeType {
3
3
  // Core
4
4
  background: string; // Main screen background
5
5
  surface: string; // Background for components like cards, dialogs, sheets
6
+ surfaceVariant: string;
6
7
  primary: string; // Main accent color for interactive elements
8
+ primaryVariant: string
7
9
  secondary: string; // Secondary accent color or for elements on primary
10
+ secondaryVariant: string
8
11
  error: string; // Error states, destructive actions
9
12
  success: string; // Success states
10
13
  warning: string; // Warning states
@@ -31,9 +34,15 @@ export interface ThemeType {
31
34
  labelText: string; // Color of labels for inputs
32
35
  placeholderText: string; // Color of placeholder text in inputs
33
36
  helper: string; // Helper text below inputs
34
-
35
- // Allow for additional keys if needed later
36
- [key: string]: string;
37
+
38
+ spacing: {
39
+ xs: number;
40
+ s: number;
41
+ m: number;
42
+ l: number;
43
+ xl: number;
44
+ xxl: number;
45
+ }
37
46
  }
38
47
 
39
48
  // Updated Light Theme - True black and white oriented, less muted
@@ -41,8 +50,11 @@ export const lightTheme: ThemeType = {
41
50
  // Core
42
51
  background: "#F8F8F8", // Very light pure gray
43
52
  surface: "#FFFFFF", // Pure white for cards/dialogs
53
+ surfaceVariant: "#FFFFFF", // Pure white for cards/dialogs
44
54
  primary: "#333333", // Pure dark gray, almost black
55
+ primaryVariant: "#333333", // Pure dark gray, almost black
45
56
  secondary: "#777777", // Medium gray without color tint
57
+ secondaryVariant: "#777777", // Medium gray without color tint
46
58
  error: "#E53935", // Vibrant but pure red
47
59
  success: "#43A047", // Vibrant but pure green
48
60
  warning: "#F57C00", // Vibrant but pure orange
@@ -69,6 +81,15 @@ export const lightTheme: ThemeType = {
69
81
  labelText: "#444444", // Dark gray for labels
70
82
  placeholderText: "#999999", // Medium gray for placeholders
71
83
  helper: "#777777", // Medium gray for helper text
84
+
85
+ spacing: {
86
+ xs: 4,
87
+ s: 8,
88
+ m: 16,
89
+ l: 24,
90
+ xl: 32,
91
+ xxl: 64,
92
+ },
72
93
  };
73
94
 
74
95
  // Updated Dark Theme - True black and white oriented, less muted
@@ -76,8 +97,11 @@ export const darkTheme: ThemeType = {
76
97
  // Core
77
98
  background: "#121212", // Very dark gray, nearly black
78
99
  surface: "#1E1E1E", // Dark gray for surface elements
100
+ surfaceVariant: "#1E1E1E", // Dark gray for surface elements
79
101
  primary: "#E0E0E0", // Light gray without tint
102
+ primaryVariant: "#E0E0E0",
80
103
  secondary: "#757575", // Medium gray without tint
104
+ secondaryVariant: "#757575",
81
105
  error: "#F44336", // Vibrant but pure red
82
106
  success: "#4CAF50", // Vibrant but pure green
83
107
  warning: "#FF9800", // Vibrant but pure orange
@@ -104,4 +128,13 @@ export const darkTheme: ThemeType = {
104
128
  labelText: "#E0E0E0", // Light gray for labels
105
129
  placeholderText: "#9E9E9E", // Medium gray for placeholders
106
130
  helper: "#9E9E9E", // Medium gray for helper text
131
+
132
+ spacing: {
133
+ xs: 4,
134
+ s: 8,
135
+ m: 16,
136
+ l: 24,
137
+ xl: 32,
138
+ xxl: 64,
139
+ },
107
140
  };