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.
- package/lib/commonjs/components/Filters/Filters.js +118 -146
- package/lib/commonjs/components/Filters/Filters.js.map +1 -1
- package/lib/commonjs/components/TravelBooking/FlightForm.js +1 -1
- package/lib/commonjs/components/TravelBooking/FlightForm.js.map +1 -1
- package/lib/commonjs/components/TravelBooking/FlightSummary.js +1 -1
- package/lib/commonjs/components/TravelBooking/FlightSummary.js.map +1 -1
- package/lib/commonjs/components/TravelBooking/HotelSummary.js +1 -1
- package/lib/commonjs/components/TravelBooking/HotelSummary.js.map +1 -1
- package/lib/commonjs/components/TravelBooking/SummaryBar.js +2 -2
- package/lib/commonjs/components/TravelBooking/SummaryBar.js.map +1 -1
- package/lib/commonjs/theme/Colors.js +32 -2
- package/lib/commonjs/theme/Colors.js.map +1 -1
- package/lib/module/components/Filters/Filters.js +119 -147
- package/lib/module/components/Filters/Filters.js.map +1 -1
- package/lib/module/components/TravelBooking/FlightForm.js +1 -1
- package/lib/module/components/TravelBooking/FlightForm.js.map +1 -1
- package/lib/module/components/TravelBooking/FlightSummary.js +1 -1
- package/lib/module/components/TravelBooking/FlightSummary.js.map +1 -1
- package/lib/module/components/TravelBooking/HotelSummary.js +1 -1
- package/lib/module/components/TravelBooking/HotelSummary.js.map +1 -1
- package/lib/module/components/TravelBooking/SummaryBar.js +2 -2
- package/lib/module/components/TravelBooking/SummaryBar.js.map +1 -1
- package/lib/module/theme/Colors.js +32 -2
- package/lib/module/theme/Colors.js.map +1 -1
- package/lib/typescript/commonjs/components/Filters/Filters.d.ts.map +1 -1
- package/lib/typescript/commonjs/theme/Colors.d.ts +11 -1
- package/lib/typescript/commonjs/theme/Colors.d.ts.map +1 -1
- package/lib/typescript/module/components/Filters/Filters.d.ts.map +1 -1
- package/lib/typescript/module/theme/Colors.d.ts +11 -1
- package/lib/typescript/module/theme/Colors.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/Filters/Filters.tsx +133 -166
- package/src/components/TravelBooking/FlightForm.tsx +1 -1
- package/src/components/TravelBooking/FlightSummary.tsx +1 -1
- package/src/components/TravelBooking/HotelSummary.tsx +1 -1
- package/src/components/TravelBooking/SummaryBar.tsx +2 -2
- 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
|
-
|
|
196
|
-
|
|
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
|
-
|
|
213
|
-
|
|
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
|
-
<
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
>
|
|
278
|
-
<View style={[styles.
|
|
279
|
-
<
|
|
280
|
-
|
|
281
|
-
<
|
|
282
|
-
|
|
283
|
-
|
|
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
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
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
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
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
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
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
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
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,
|
|
381
|
+
backgroundColor: theme.surface,
|
|
415
382
|
},
|
|
416
383
|
handleIndicator: {
|
|
417
384
|
width: 40,
|
|
@@ -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={
|
|
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.
|
|
213
|
+
color: theme.onSurface,
|
|
214
214
|
fontSize: 15,
|
|
215
215
|
fontWeight: "500",
|
|
216
216
|
flex: 1,
|
package/src/theme/Colors.ts
CHANGED
|
@@ -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
|
-
|
|
36
|
-
|
|
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
|
};
|