related-ui-components 1.3.3 → 1.3.5

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 (188) hide show
  1. package/lib/commonjs/app.js +39 -20
  2. package/lib/commonjs/app.js.map +1 -1
  3. package/lib/commonjs/components/DateRangePicker/DateRangePicker.js +358 -0
  4. package/lib/commonjs/components/DateRangePicker/DateRangePicker.js.map +1 -0
  5. package/lib/commonjs/components/DateRangePicker/index.js +4 -0
  6. package/lib/commonjs/components/DateRangePicker/index.js.map +1 -0
  7. package/lib/commonjs/components/Filters/Filters.js +1 -1
  8. package/lib/commonjs/components/Filters/Filters.js.map +1 -1
  9. package/lib/commonjs/components/Input/Input.js +2 -2
  10. package/lib/commonjs/components/Input/Input.js.map +1 -1
  11. package/lib/commonjs/components/NumericStepper/NumericStepper.js +103 -0
  12. package/lib/commonjs/components/NumericStepper/NumericStepper.js.map +1 -0
  13. package/lib/commonjs/components/NumericStepper/index.js +29 -0
  14. package/lib/commonjs/components/NumericStepper/index.js.map +1 -0
  15. package/lib/commonjs/components/SelectAmount/SelectAmount.js +189 -0
  16. package/lib/commonjs/components/SelectAmount/SelectAmount.js.map +1 -0
  17. package/lib/commonjs/components/SelectAmount/index.js +4 -0
  18. package/lib/commonjs/components/SelectAmount/index.js.map +1 -0
  19. package/lib/commonjs/components/Suggestions/SuggestionList.js +98 -0
  20. package/lib/commonjs/components/Suggestions/SuggestionList.js.map +1 -0
  21. package/lib/commonjs/components/TravelBooking/CarRentalForm.js +370 -0
  22. package/lib/commonjs/components/TravelBooking/CarRentalForm.js.map +1 -0
  23. package/lib/commonjs/components/TravelBooking/FlightForm.js +347 -0
  24. package/lib/commonjs/components/TravelBooking/FlightForm.js.map +1 -0
  25. package/lib/commonjs/components/TravelBooking/FlightSummary.js +257 -0
  26. package/lib/commonjs/components/TravelBooking/FlightSummary.js.map +1 -0
  27. package/lib/commonjs/components/TravelBooking/HotelForm.js +290 -0
  28. package/lib/commonjs/components/TravelBooking/HotelForm.js.map +1 -0
  29. package/lib/commonjs/components/TravelBooking/HotelSummary.js +246 -0
  30. package/lib/commonjs/components/TravelBooking/HotelSummary.js.map +1 -0
  31. package/lib/commonjs/components/TravelBooking/README.md +421 -0
  32. package/lib/commonjs/components/TravelBooking/SummaryBar.js +181 -0
  33. package/lib/commonjs/components/TravelBooking/SummaryBar.js.map +1 -0
  34. package/lib/commonjs/components/TravelBooking/TabSelector.js +115 -0
  35. package/lib/commonjs/components/TravelBooking/TabSelector.js.map +1 -0
  36. package/lib/commonjs/components/TravelBooking/TravelBooking.js +261 -0
  37. package/lib/commonjs/components/TravelBooking/TravelBooking.js.map +1 -0
  38. package/lib/commonjs/components/TravelBooking/index.js +22 -0
  39. package/lib/commonjs/components/TravelBooking/index.js.map +1 -0
  40. package/lib/commonjs/components/TravelBooking/types.js +15 -0
  41. package/lib/commonjs/components/TravelBooking/types.js.map +1 -0
  42. package/lib/commonjs/components/UnlockRewards/UnlockRewards.js +2 -2
  43. package/lib/commonjs/components/UnlockRewards/UnlockRewards.js.map +1 -1
  44. package/lib/commonjs/index.js +0 -5
  45. package/lib/commonjs/index.js.map +1 -1
  46. package/lib/module/app.js +43 -24
  47. package/lib/module/app.js.map +1 -1
  48. package/lib/module/components/DateRangePicker/DateRangePicker.js +350 -0
  49. package/lib/module/components/DateRangePicker/DateRangePicker.js.map +1 -0
  50. package/lib/module/components/DateRangePicker/index.js +4 -0
  51. package/lib/module/components/DateRangePicker/index.js.map +1 -0
  52. package/lib/module/components/Filters/Filters.js +1 -1
  53. package/lib/module/components/Filters/Filters.js.map +1 -1
  54. package/lib/module/components/Input/Input.js +2 -2
  55. package/lib/module/components/Input/Input.js.map +1 -1
  56. package/lib/module/components/NumericStepper/NumericStepper.js +96 -0
  57. package/lib/module/components/NumericStepper/NumericStepper.js.map +1 -0
  58. package/lib/module/components/NumericStepper/index.js +5 -0
  59. package/lib/module/components/NumericStepper/index.js.map +1 -0
  60. package/lib/module/components/SelectAmount/SelectAmount.js +184 -0
  61. package/lib/module/components/SelectAmount/SelectAmount.js.map +1 -0
  62. package/lib/module/components/SelectAmount/index.js +4 -0
  63. package/lib/module/components/SelectAmount/index.js.map +1 -0
  64. package/lib/module/components/Suggestions/SuggestionList.js +92 -0
  65. package/lib/module/components/Suggestions/SuggestionList.js.map +1 -0
  66. package/lib/module/components/TravelBooking/CarRentalForm.js +363 -0
  67. package/lib/module/components/TravelBooking/CarRentalForm.js.map +1 -0
  68. package/lib/module/components/TravelBooking/FlightForm.js +340 -0
  69. package/lib/module/components/TravelBooking/FlightForm.js.map +1 -0
  70. package/lib/module/components/TravelBooking/FlightSummary.js +254 -0
  71. package/lib/module/components/TravelBooking/FlightSummary.js.map +1 -0
  72. package/lib/module/components/TravelBooking/HotelForm.js +286 -0
  73. package/lib/module/components/TravelBooking/HotelForm.js.map +1 -0
  74. package/lib/module/components/TravelBooking/HotelSummary.js +239 -0
  75. package/lib/module/components/TravelBooking/HotelSummary.js.map +1 -0
  76. package/lib/module/components/TravelBooking/README.md +421 -0
  77. package/lib/module/components/TravelBooking/SummaryBar.js +174 -0
  78. package/lib/module/components/TravelBooking/SummaryBar.js.map +1 -0
  79. package/lib/module/components/TravelBooking/TabSelector.js +110 -0
  80. package/lib/module/components/TravelBooking/TabSelector.js.map +1 -0
  81. package/lib/module/components/TravelBooking/TravelBooking.js +243 -0
  82. package/lib/module/components/TravelBooking/TravelBooking.js.map +1 -0
  83. package/lib/module/components/TravelBooking/index.js +22 -0
  84. package/lib/module/components/TravelBooking/index.js.map +1 -0
  85. package/lib/module/components/TravelBooking/types.js +11 -0
  86. package/lib/module/components/TravelBooking/types.js.map +1 -0
  87. package/lib/module/components/UnlockRewards/UnlockRewards.js +2 -2
  88. package/lib/module/components/UnlockRewards/UnlockRewards.js.map +1 -1
  89. package/lib/module/index.js +7 -4
  90. package/lib/module/index.js.map +1 -1
  91. package/lib/typescript/commonjs/app.d.ts.map +1 -1
  92. package/lib/typescript/commonjs/components/DateRangePicker/DateRangePicker.d.ts +25 -0
  93. package/lib/typescript/commonjs/components/DateRangePicker/DateRangePicker.d.ts.map +1 -0
  94. package/lib/typescript/commonjs/components/DateRangePicker/index.d.ts +1 -0
  95. package/lib/typescript/commonjs/components/DateRangePicker/index.d.ts.map +1 -0
  96. package/lib/typescript/commonjs/components/NumericStepper/NumericStepper.d.ts +19 -0
  97. package/lib/typescript/commonjs/components/NumericStepper/NumericStepper.d.ts.map +1 -0
  98. package/lib/typescript/commonjs/components/NumericStepper/index.d.ts +3 -0
  99. package/lib/typescript/commonjs/components/NumericStepper/index.d.ts.map +1 -0
  100. package/lib/typescript/commonjs/components/SelectAmount/SelectAmount.d.ts +29 -0
  101. package/lib/typescript/commonjs/components/SelectAmount/SelectAmount.d.ts.map +1 -0
  102. package/lib/typescript/commonjs/components/SelectAmount/index.d.ts +1 -0
  103. package/lib/typescript/commonjs/components/SelectAmount/index.d.ts.map +1 -0
  104. package/lib/typescript/commonjs/components/Suggestions/SuggestionList.d.ts +14 -0
  105. package/lib/typescript/commonjs/components/Suggestions/SuggestionList.d.ts.map +1 -0
  106. package/lib/typescript/commonjs/components/TravelBooking/CarRentalForm.d.ts +58 -0
  107. package/lib/typescript/commonjs/components/TravelBooking/CarRentalForm.d.ts.map +1 -0
  108. package/lib/typescript/commonjs/components/TravelBooking/FlightForm.d.ts +57 -0
  109. package/lib/typescript/commonjs/components/TravelBooking/FlightForm.d.ts.map +1 -0
  110. package/lib/typescript/commonjs/components/TravelBooking/FlightSummary.d.ts +41 -0
  111. package/lib/typescript/commonjs/components/TravelBooking/FlightSummary.d.ts.map +1 -0
  112. package/lib/typescript/commonjs/components/TravelBooking/HotelForm.d.ts +52 -0
  113. package/lib/typescript/commonjs/components/TravelBooking/HotelForm.d.ts.map +1 -0
  114. package/lib/typescript/commonjs/components/TravelBooking/HotelSummary.d.ts +44 -0
  115. package/lib/typescript/commonjs/components/TravelBooking/HotelSummary.d.ts.map +1 -0
  116. package/lib/typescript/commonjs/components/TravelBooking/SummaryBar.d.ts +17 -0
  117. package/lib/typescript/commonjs/components/TravelBooking/SummaryBar.d.ts.map +1 -0
  118. package/lib/typescript/commonjs/components/TravelBooking/TabSelector.d.ts +17 -0
  119. package/lib/typescript/commonjs/components/TravelBooking/TabSelector.d.ts.map +1 -0
  120. package/lib/typescript/commonjs/components/TravelBooking/TravelBooking.d.ts +84 -0
  121. package/lib/typescript/commonjs/components/TravelBooking/TravelBooking.d.ts.map +1 -0
  122. package/lib/typescript/commonjs/components/TravelBooking/index.d.ts +1 -0
  123. package/lib/typescript/commonjs/components/TravelBooking/index.d.ts.map +1 -0
  124. package/lib/typescript/commonjs/components/TravelBooking/types.d.ts +26 -0
  125. package/lib/typescript/commonjs/components/TravelBooking/types.d.ts.map +1 -0
  126. package/lib/typescript/commonjs/index.d.ts +0 -1
  127. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  128. package/lib/typescript/module/app.d.ts.map +1 -1
  129. package/lib/typescript/module/components/DateRangePicker/DateRangePicker.d.ts +25 -0
  130. package/lib/typescript/module/components/DateRangePicker/DateRangePicker.d.ts.map +1 -0
  131. package/lib/typescript/module/components/DateRangePicker/index.d.ts +1 -0
  132. package/lib/typescript/module/components/DateRangePicker/index.d.ts.map +1 -0
  133. package/lib/typescript/module/components/NumericStepper/NumericStepper.d.ts +19 -0
  134. package/lib/typescript/module/components/NumericStepper/NumericStepper.d.ts.map +1 -0
  135. package/lib/typescript/module/components/NumericStepper/index.d.ts +3 -0
  136. package/lib/typescript/module/components/NumericStepper/index.d.ts.map +1 -0
  137. package/lib/typescript/module/components/SelectAmount/SelectAmount.d.ts +29 -0
  138. package/lib/typescript/module/components/SelectAmount/SelectAmount.d.ts.map +1 -0
  139. package/lib/typescript/module/components/SelectAmount/index.d.ts +1 -0
  140. package/lib/typescript/module/components/SelectAmount/index.d.ts.map +1 -0
  141. package/lib/typescript/module/components/Suggestions/SuggestionList.d.ts +14 -0
  142. package/lib/typescript/module/components/Suggestions/SuggestionList.d.ts.map +1 -0
  143. package/lib/typescript/module/components/TravelBooking/CarRentalForm.d.ts +58 -0
  144. package/lib/typescript/module/components/TravelBooking/CarRentalForm.d.ts.map +1 -0
  145. package/lib/typescript/module/components/TravelBooking/FlightForm.d.ts +57 -0
  146. package/lib/typescript/module/components/TravelBooking/FlightForm.d.ts.map +1 -0
  147. package/lib/typescript/module/components/TravelBooking/FlightSummary.d.ts +41 -0
  148. package/lib/typescript/module/components/TravelBooking/FlightSummary.d.ts.map +1 -0
  149. package/lib/typescript/module/components/TravelBooking/HotelForm.d.ts +52 -0
  150. package/lib/typescript/module/components/TravelBooking/HotelForm.d.ts.map +1 -0
  151. package/lib/typescript/module/components/TravelBooking/HotelSummary.d.ts +44 -0
  152. package/lib/typescript/module/components/TravelBooking/HotelSummary.d.ts.map +1 -0
  153. package/lib/typescript/module/components/TravelBooking/SummaryBar.d.ts +17 -0
  154. package/lib/typescript/module/components/TravelBooking/SummaryBar.d.ts.map +1 -0
  155. package/lib/typescript/module/components/TravelBooking/TabSelector.d.ts +17 -0
  156. package/lib/typescript/module/components/TravelBooking/TabSelector.d.ts.map +1 -0
  157. package/lib/typescript/module/components/TravelBooking/TravelBooking.d.ts +84 -0
  158. package/lib/typescript/module/components/TravelBooking/TravelBooking.d.ts.map +1 -0
  159. package/lib/typescript/module/components/TravelBooking/index.d.ts +1 -0
  160. package/lib/typescript/module/components/TravelBooking/index.d.ts.map +1 -0
  161. package/lib/typescript/module/components/TravelBooking/types.d.ts +26 -0
  162. package/lib/typescript/module/components/TravelBooking/types.d.ts.map +1 -0
  163. package/lib/typescript/module/index.d.ts +0 -1
  164. package/lib/typescript/module/index.d.ts.map +1 -1
  165. package/package.json +12 -8
  166. package/src/app.tsx +77 -13
  167. package/src/components/DateRangePicker/DateRangePicker.tsx +410 -0
  168. package/src/components/DateRangePicker/index.ts +2 -0
  169. package/src/components/Filters/Filters.tsx +1 -1
  170. package/src/components/Input/Input.tsx +1 -1
  171. package/src/components/NumericStepper/NumericStepper.tsx +117 -0
  172. package/src/components/NumericStepper/index.ts +2 -0
  173. package/src/components/SelectAmount/SelectAmount.tsx +217 -0
  174. package/src/components/SelectAmount/index.ts +2 -0
  175. package/src/components/Suggestions/SuggestionList.tsx +106 -0
  176. package/src/components/TravelBooking/CarRentalForm.tsx +440 -0
  177. package/src/components/TravelBooking/FlightForm.tsx +452 -0
  178. package/src/components/TravelBooking/FlightSummary.tsx +388 -0
  179. package/src/components/TravelBooking/HotelForm.tsx +365 -0
  180. package/src/components/TravelBooking/HotelSummary.tsx +340 -0
  181. package/src/components/TravelBooking/README.md +421 -0
  182. package/src/components/TravelBooking/SummaryBar.tsx +239 -0
  183. package/src/components/TravelBooking/TabSelector.tsx +158 -0
  184. package/src/components/TravelBooking/TravelBooking.tsx +407 -0
  185. package/src/components/TravelBooking/index.ts +20 -0
  186. package/src/components/TravelBooking/types.ts +28 -0
  187. package/src/components/UnlockRewards/UnlockRewards.tsx +2 -2
  188. package/src/index.ts +4 -4
@@ -0,0 +1 @@
1
+ {"version":3,"names":["default","NumericStepper"],"sourceRoot":"..\\..\\..\\..\\src","sources":["components/NumericStepper/index.ts"],"mappings":";;AAAA,SAAQA,OAAO,IAAIC,cAAc,QAAO,qBAAkB;AAC1D,cAAc,qBAAkB","ignoreList":[]}
@@ -0,0 +1,184 @@
1
+ "use strict";
2
+
3
+ import { useCallback, useMemo, useRef, useState } from "react";
4
+ import { useTheme } from "../../theme/index.js";
5
+ import { View, StyleSheet, Text, TouchableOpacity } from "react-native";
6
+ import Slider from "@react-native-community/slider";
7
+ import NumericStepper from "../NumericStepper/NumericStepper.js";
8
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
+ const SelectAmount = ({
10
+ isRTL,
11
+ conversionRate = 20,
12
+ minValue = 1,
13
+ maxValue = 1000,
14
+ pointsValue = 1,
15
+ step = 20,
16
+ title,
17
+ buttonText = "Redeem",
18
+ currencyLabel = "SAR",
19
+ pointsLabel = "points",
20
+ rowStyle,
21
+ labelStyle,
22
+ titleStyle,
23
+ containerStyle,
24
+ actionButtonStyle,
25
+ actionButtonTextStyle,
26
+ sliderContainerStyle,
27
+ stepperButtonStyle,
28
+ stepperButtonTextStyle,
29
+ stepperValueTextStyle,
30
+ currencyValueTextStyle,
31
+ onValueChange,
32
+ onClick
33
+ }) => {
34
+ const {
35
+ theme,
36
+ isRTL: rtl
37
+ } = useTheme();
38
+ isRTL = isRTL || rtl;
39
+ const styles = useMemo(() => themedStyles(theme, isRTL), [theme, isRTL]);
40
+ const sliding = useRef(false);
41
+ const clampedInitialValue = Math.max(minValue, Math.min(maxValue, pointsValue));
42
+ const [currentValue, setCurrentValue] = useState(clampedInitialValue);
43
+ const currencyValue = useMemo(() => {
44
+ return conversionRate > 0 ? Math.ceil(currentValue / conversionRate) : 0;
45
+ }, [currentValue, conversionRate]);
46
+ const handleValueChange = useCallback(newValue => {
47
+ let clampedValue = Math.max(minValue, Math.min(maxValue, newValue));
48
+ if (clampedValue !== currentValue && sliding.current) {
49
+ setCurrentValue(Math.round(clampedValue));
50
+ onValueChange?.(clampedValue);
51
+ }
52
+ }, [minValue, maxValue, step, currentValue]);
53
+ const handleIncrement = () => {
54
+ setCurrentValue(prev => prev + step);
55
+ };
56
+ const handleDecrement = () => {
57
+ setCurrentValue(prev => prev - step);
58
+ };
59
+ return /*#__PURE__*/_jsxs(View, {
60
+ style: [styles.mainContainer, containerStyle],
61
+ children: [title && /*#__PURE__*/_jsx(Text, {
62
+ style: [styles.title, titleStyle],
63
+ children: title
64
+ }), /*#__PURE__*/_jsxs(View, {
65
+ children: [/*#__PURE__*/_jsxs(View, {
66
+ style: [styles.row, rowStyle],
67
+ children: [/*#__PURE__*/_jsx(Text, {
68
+ style: [styles.label, labelStyle],
69
+ children: pointsLabel
70
+ }), /*#__PURE__*/_jsx(NumericStepper, {
71
+ value: currentValue,
72
+ minValue: minValue,
73
+ maxValue: maxValue,
74
+ onIncrement: handleIncrement,
75
+ onDecrement: handleDecrement,
76
+ isRTL: isRTL,
77
+ buttonStyle: stepperButtonStyle,
78
+ buttonTextStyle: stepperButtonTextStyle,
79
+ valueTextStyle: stepperValueTextStyle
80
+ })]
81
+ }), /*#__PURE__*/_jsxs(View, {
82
+ style: [styles.row, rowStyle],
83
+ children: [/*#__PURE__*/_jsx(Text, {
84
+ style: [styles.label, labelStyle],
85
+ children: currencyLabel
86
+ }), /*#__PURE__*/_jsxs(View, {
87
+ style: {
88
+ flexDirection: "row"
89
+ },
90
+ children: [/*#__PURE__*/_jsx(View, {
91
+ style: [styles.controlButton, {
92
+ opacity: 0
93
+ }]
94
+ }), /*#__PURE__*/_jsx(Text, {
95
+ style: [styles.currencyValueText, currencyValueTextStyle],
96
+ children: currencyValue
97
+ }), /*#__PURE__*/_jsx(View, {
98
+ style: [styles.controlButton, {
99
+ opacity: 0
100
+ }]
101
+ })]
102
+ })]
103
+ }), /*#__PURE__*/_jsx(Slider, {
104
+ step: step,
105
+ minimumValue: minValue,
106
+ maximumValue: maxValue,
107
+ onValueChange: handleValueChange,
108
+ onSlidingStart: () => sliding.current = true,
109
+ onSlidingComplete: () => sliding.current = false,
110
+ minimumTrackTintColor: theme.primary,
111
+ maximumTrackTintColor: theme.primary,
112
+ thumbTintColor: theme.primary,
113
+ inverted: isRTL,
114
+ style: sliderContainerStyle
115
+ })]
116
+ }), /*#__PURE__*/_jsx(TouchableOpacity, {
117
+ style: [styles.actionButton, actionButtonStyle],
118
+ onPress: () => onClick?.(currentValue),
119
+ children: /*#__PURE__*/_jsx(Text, {
120
+ style: [styles.actionButtonText, actionButtonTextStyle],
121
+ children: buttonText
122
+ })
123
+ })]
124
+ });
125
+ };
126
+ const themedStyles = (theme, isRTL) => StyleSheet.create({
127
+ mainContainer: {
128
+ width: "100%",
129
+ backgroundColor: theme.surface,
130
+ padding: 16
131
+ },
132
+ row: {
133
+ flexDirection: isRTL ? "row-reverse" : "row",
134
+ justifyContent: "space-between",
135
+ alignItems: "center",
136
+ marginBottom: 12
137
+ },
138
+ title: {
139
+ fontSize: 18,
140
+ fontWeight: "bold",
141
+ color: theme.onSurface,
142
+ marginBottom: 16,
143
+ textAlign: isRTL ? "right" : "left"
144
+ },
145
+ label: {
146
+ fontSize: 14,
147
+ color: theme.onSurface
148
+ },
149
+ controlButton: {
150
+ backgroundColor: theme.secondary,
151
+ width: 36,
152
+ height: 36,
153
+ borderRadius: 18,
154
+ justifyContent: "center",
155
+ alignItems: "center"
156
+ },
157
+ actionButton: {
158
+ backgroundColor: theme.primary,
159
+ paddingVertical: 12,
160
+ paddingHorizontal: 20,
161
+ borderRadius: 6,
162
+ alignItems: "center",
163
+ marginTop: 16
164
+ },
165
+ valueText: {
166
+ fontSize: 16,
167
+ color: theme.onSurface,
168
+ minWidth: 50,
169
+ textAlign: "center",
170
+ marginHorizontal: 8
171
+ },
172
+ currencyValueText: {
173
+ fontSize: 16,
174
+ color: theme.primary,
175
+ minWidth: 50,
176
+ textAlign: "center",
177
+ marginHorizontal: 8
178
+ },
179
+ actionButtonText: {
180
+ color: theme.onPrimary
181
+ }
182
+ });
183
+ export default SelectAmount;
184
+ //# sourceMappingURL=SelectAmount.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useCallback","useMemo","useRef","useState","useTheme","View","StyleSheet","Text","TouchableOpacity","Slider","NumericStepper","jsx","_jsx","jsxs","_jsxs","SelectAmount","isRTL","conversionRate","minValue","maxValue","pointsValue","step","title","buttonText","currencyLabel","pointsLabel","rowStyle","labelStyle","titleStyle","containerStyle","actionButtonStyle","actionButtonTextStyle","sliderContainerStyle","stepperButtonStyle","stepperButtonTextStyle","stepperValueTextStyle","currencyValueTextStyle","onValueChange","onClick","theme","rtl","styles","themedStyles","sliding","clampedInitialValue","Math","max","min","currentValue","setCurrentValue","currencyValue","ceil","handleValueChange","newValue","clampedValue","current","round","handleIncrement","prev","handleDecrement","style","mainContainer","children","row","label","value","onIncrement","onDecrement","buttonStyle","buttonTextStyle","valueTextStyle","flexDirection","controlButton","opacity","currencyValueText","minimumValue","maximumValue","onSlidingStart","onSlidingComplete","minimumTrackTintColor","primary","maximumTrackTintColor","thumbTintColor","inverted","actionButton","onPress","actionButtonText","create","width","backgroundColor","surface","padding","justifyContent","alignItems","marginBottom","fontSize","fontWeight","color","onSurface","textAlign","secondary","height","borderRadius","paddingVertical","paddingHorizontal","marginTop","valueText","minWidth","marginHorizontal","onPrimary"],"sourceRoot":"..\\..\\..\\..\\src","sources":["components/SelectAmount/SelectAmount.tsx"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAC9D,SAAoBC,QAAQ,QAAQ,sBAAa;AACjD,SACEC,IAAI,EACJC,UAAU,EACVC,IAAI,EACJC,gBAAgB,QAIX,cAAc;AACrB,OAAOC,MAAM,MAAM,gCAAgC;AACnD,OAAOC,cAAc,MAAM,qCAAkC;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AA6B9D,MAAMC,YAAyC,GAAGA,CAAC;EACjDC,KAAK;EACLC,cAAc,GAAG,EAAE;EACnBC,QAAQ,GAAG,CAAC;EACZC,QAAQ,GAAG,IAAI;EACfC,WAAW,GAAG,CAAC;EACfC,IAAI,GAAG,EAAE;EACTC,KAAK;EACLC,UAAU,GAAG,QAAQ;EACrBC,aAAa,GAAG,KAAK;EACrBC,WAAW,GAAG,QAAQ;EACtBC,QAAQ;EACRC,UAAU;EACVC,UAAU;EACVC,cAAc;EACdC,iBAAiB;EACjBC,qBAAqB;EACrBC,oBAAoB;EACpBC,kBAAkB;EAClBC,sBAAsB;EACtBC,qBAAqB;EACrBC,sBAAsB;EACtBC,aAAa;EACbC;AACF,CAAC,KAAK;EACJ,MAAM;IAAEC,KAAK;IAAEvB,KAAK,EAAEwB;EAAI,CAAC,GAAGpC,QAAQ,CAAC,CAAC;EACxCY,KAAK,GAAGA,KAAK,IAAIwB,GAAG;EAEpB,MAAMC,MAAM,GAAGxC,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AAQ,EAAE,EAAE;IACZE,KAAK,EAAE1D,KAAK,CAACyC,OAAO;IACpB2B,QAAQ,EAAE,EAAE;IACZR,SAAS,EAAE,QAAQ;IACnBS,gBAAgB,EAAE;EACpB,CAAC;EACDtB,gBAAgB,EAAE;IAChBW,KAAK,EAAE1D,KAAK,CAACsE;EACf;AACF,CAAC,CAAC;AAEJ,eAAe9F,YAAY","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ // export {default as SelectAmount} from "./SelectAmount";
2
+ // export * from "./SelectAmount";
3
+ "use strict";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"..\\..\\..\\..\\src","sources":["components/SelectAmount/index.ts"],"mappings":"AAAA;AACA;AAAA","ignoreList":[]}
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+
3
+ import React from "react"; // Ensure React is imported
4
+ import { View, Text, FlatList, StyleSheet
5
+
6
+ // Import this type
7
+ } from "react-native";
8
+ import { useTheme } from "@/theme"; // Adjust import path
9
+ import { jsx as _jsx } from "react/jsx-runtime";
10
+ const SuggestionList = ({
11
+ data,
12
+ visible,
13
+ renderItemContent,
14
+ containerStyle,
15
+ itemStyle,
16
+ // Style for the default wrapper
17
+ itemTextStyle,
18
+ // Style for the default text
19
+ listStyle
20
+ }) => {
21
+ const {
22
+ theme
23
+ } = useTheme();
24
+ const styles = suggestionStyles(theme);
25
+ if (!visible || data.length === 0) {
26
+ return null;
27
+ }
28
+ const renderListItem = ({
29
+ item
30
+ }) => {
31
+ const content = renderItemContent(item);
32
+ if (/*#__PURE__*/React.isValidElement(content)) {
33
+ return content;
34
+ }
35
+ if (content === null || content === undefined) {
36
+ return null;
37
+ }
38
+ return /*#__PURE__*/_jsx(View, {
39
+ style: [styles.suggestionItem, itemStyle],
40
+ children: /*#__PURE__*/_jsx(Text, {
41
+ style: [styles.suggestionText, itemTextStyle],
42
+ children: String(content)
43
+ })
44
+ });
45
+ };
46
+ return /*#__PURE__*/_jsx(View, {
47
+ style: [styles.suggestionContainer, containerStyle],
48
+ children: /*#__PURE__*/_jsx(FlatList, {
49
+ data: data,
50
+ showsVerticalScrollIndicator: false,
51
+ keyExtractor: (_, index) => index.toString(),
52
+ renderItem: renderListItem // Use the robust render function
53
+ ,
54
+ style: [styles.list, listStyle],
55
+ keyboardShouldPersistTaps: "handled"
56
+ })
57
+ });
58
+ };
59
+ const suggestionStyles = theme => StyleSheet.create({
60
+ suggestionContainer: {
61
+ // ... (keep as before)
62
+ position: "absolute",
63
+ left: 0,
64
+ right: 0,
65
+ backgroundColor: theme.surface,
66
+ borderColor: theme.border,
67
+ top: "100%",
68
+ borderWidth: 1,
69
+ borderBottomRightRadius: 5,
70
+ borderBottomLeftRadius: 5,
71
+ padding: 12,
72
+ zIndex: 10,
73
+ maxHeight: 150
74
+ },
75
+ list: {
76
+ flexGrow: 0
77
+ // padding: 12
78
+ },
79
+ // Default wrapper style (used if renderItemContent returns primitive)
80
+ suggestionItem: {
81
+ padding: 12,
82
+ borderBottomWidth: StyleSheet.hairlineWidth,
83
+ borderBottomColor: theme.border
84
+ },
85
+ // Default text style (used if renderItemContent returns primitive)
86
+ suggestionText: {
87
+ fontSize: 14,
88
+ color: theme.onSurface
89
+ }
90
+ });
91
+ export default SuggestionList;
92
+ //# sourceMappingURL=SuggestionList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","View","Text","FlatList","StyleSheet","useTheme","jsx","_jsx","SuggestionList","data","visible","renderItemContent","containerStyle","itemStyle","itemTextStyle","listStyle","theme","styles","suggestionStyles","length","renderListItem","item","content","isValidElement","undefined","style","suggestionItem","children","suggestionText","String","suggestionContainer","showsVerticalScrollIndicator","keyExtractor","_","index","toString","renderItem","list","keyboardShouldPersistTaps","create","position","left","right","backgroundColor","surface","borderColor","border","top","borderWidth","borderBottomRightRadius","borderBottomLeftRadius","padding","zIndex","maxHeight","flexGrow","borderBottomWidth","hairlineWidth","borderBottomColor","fontSize","color","onSurface"],"s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 import React, { useCallback, useMemo, useRef, useState } from "react";
5
+ import { View, Text, TouchableOpacity, StyleSheet } from "react-native";
6
+ import { Ionicons } from "@expo/vector-icons";
7
+ import CustomInput from "../Input/Input.js";
8
+ import DateRangePicker from "../DateRangePicker/DateRangePicker.js";
9
+ import { Picker } from "@react-native-picker/picker";
10
+ import SuggestionList from "../Suggestions/SuggestionList.js";
11
+ import { FormInputType } from "./types.js";
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ export const mockCarSuggestions = [{
14
+ id: 1,
15
+ city: "Beirut",
16
+ country: "Lebanon",
17
+ value: "BEIRUT, LEBANON"
18
+ }, {
19
+ id: 2,
20
+ city: "Dubai",
21
+ country: "UAE",
22
+ value: "DUBAI, UAE"
23
+ }, {
24
+ id: 3,
25
+ city: "London",
26
+ country: "UK",
27
+ value: "LONDON, UK"
28
+ }, {
29
+ id: 4,
30
+ city: "Paris",
31
+ country: "France",
32
+ value: "PARIS, FRANCE"
33
+ }, {
34
+ id: 5,
35
+ city: "New York",
36
+ country: "USA",
37
+ value: "NEW YORK, USA"
38
+ }];
39
+
40
+ // --- Helper Types ---
41
+
42
+ // --- Component Props ---
43
+
44
+ // --- Component ---
45
+ const CarRentalForm = ({
46
+ initialFromLocation,
47
+ initialToLocation,
48
+ initialPickupDate,
49
+ initialDropoffDate,
50
+ onSwapPress,
51
+ onSearchPress,
52
+ fromLabel = "PICK-UP",
53
+ toLabel = "DROP-OFF",
54
+ fromPlaceholder = "From Where?",
55
+ toPlaceholder = "To Where?",
56
+ pickupLabel = "PICK-UP DATE",
57
+ dropoffLabel = "DROP-OFF DATE",
58
+ swapIconName = "swap-horizontal",
59
+ searchIconName = "search",
60
+ calendarThemeOverrides = {},
61
+ containerStyle,
62
+ inputGroupContainerStyle,
63
+ // Added
64
+ inputWrapperStyle,
65
+ // Added
66
+ inputGroupStyle,
67
+ labelStyle,
68
+ swapButtonContainerStyle,
69
+ swapButtonStyle,
70
+ swapIconStyle,
71
+ pickupRowStyle,
72
+ searchButtonStyle,
73
+ searchIconStyle,
74
+ isOneWay,
75
+ suggestionData,
76
+ onInputFocus,
77
+ onTextChange,
78
+ dateRangePickerOuterContainerStyle,
79
+ dateRangePickerLabelStyle,
80
+ dateRangePickerInputGroupStyle,
81
+ dateRangePickerCalendarContainerStyle,
82
+ suggestionListContainerStyle,
83
+ suggestionItemStyle,
84
+ suggestionItemTextStyle,
85
+ agePickerWrapperStyle,
86
+ agePickerLabelStyle,
87
+ pickerContainerStyle,
88
+ pickerStyle
89
+ }) => {
90
+ const {
91
+ theme,
92
+ isRTL
93
+ } = useTheme();
94
+ const styles = useMemo(() => themedStyles(theme, isRTL), [theme, isRTL]);
95
+ const fromInputRef = useRef(null);
96
+ const toInputRef = useRef(null);
97
+
98
+ // --- State ---
99
+ const [fromLocation, setFromLocation] = useState(initialFromLocation);
100
+ const [toLocation, setToLocation] = useState(initialToLocation);
101
+ const [pickupDate, setPickupDate] = useState(initialPickupDate);
102
+ const [dropoffDate, setDropoffDate] = useState(initialDropoffDate);
103
+ const [age, setAge] = useState();
104
+ const [focusedInput, setFocusedInput] = useState();
105
+
106
+ // --- Handlers ---
107
+ const handleSwap = useCallback(() => {
108
+ const currentFrom = fromLocation;
109
+ const currentTo = toLocation;
110
+ setFromLocation(currentTo);
111
+ setToLocation(currentFrom);
112
+ onSwapPress?.(currentFrom, currentTo);
113
+ }, [fromLocation, toLocation, onSwapPress]);
114
+ const handleSearch = useCallback(() => {
115
+ onSearchPress?.({
116
+ from: fromLocation,
117
+ to: toLocation,
118
+ pickup: pickupDate,
119
+ dropoff: dropoffDate,
120
+ driverAge: age
121
+ });
122
+ }, [fromLocation, toLocation, pickupDate, dropoffDate, age, onSearchPress]);
123
+
124
+ // --- Shared Suggestion Render Item ---
125
+ const suggestionRenderItem = item => /*#__PURE__*/_jsx(TouchableOpacity, {
126
+ onPress: () => {
127
+ if (focusedInput === FormInputType.CAR_PICKUP) {
128
+ setFromLocation(item.value);
129
+ fromInputRef.current?.blur();
130
+ } else if (focusedInput === FormInputType.CAR_DROP_OFF) {
131
+ setToLocation(item.value);
132
+ toInputRef.current?.blur();
133
+ }
134
+ // setFocusedInput(undefined); // Hide suggestions after selection
135
+ },
136
+ style: [styles.suggestionItem, suggestionItemStyle] // Use new prop
137
+ ,
138
+ children: /*#__PURE__*/_jsx(Text, {
139
+ style: [styles.suggestionItemText, suggestionItemTextStyle],
140
+ children: item.value
141
+ })
142
+ }, item.id);
143
+ return /*#__PURE__*/_jsxs(View, {
144
+ style: [styles.container, containerStyle],
145
+ children: [/*#__PURE__*/_jsxs(View, {
146
+ style: [styles.inputGroupContainer, inputGroupContainerStyle],
147
+ children: [/*#__PURE__*/_jsxs(View, {
148
+ style: [styles.inputWrapper, inputWrapperStyle],
149
+ children: [/*#__PURE__*/_jsx(CustomInput, {
150
+ ref: fromInputRef,
151
+ onChangeText: t => {
152
+ onTextChange?.(t);
153
+ setFromLocation(t);
154
+ },
155
+ label: fromLabel,
156
+ value: fromLocation,
157
+ labelStyle: [styles.label, labelStyle],
158
+ placeholder: fromPlaceholder,
159
+ onFocus: () => {
160
+ onInputFocus?.(FormInputType.CAR_PICKUP);
161
+ setFocusedInput(FormInputType.CAR_PICKUP);
162
+ },
163
+ onBlur: () => {
164
+ // Delay blur slightly to allow suggestion press
165
+ setTimeout(() => {
166
+ if (focusedInput === FormInputType.CAR_PICKUP) {
167
+ setFocusedInput(undefined);
168
+ }
169
+ }, 150);
170
+ },
171
+ containerStyle: inputGroupStyle
172
+ }), suggestionData && /*#__PURE__*/_jsx(SuggestionList, {
173
+ data: suggestionData,
174
+ visible: focusedInput === FormInputType.CAR_PICKUP,
175
+ renderItemContent: suggestionRenderItem,
176
+ containerStyle: suggestionListContainerStyle
177
+ })]
178
+ }), /*#__PURE__*/_jsx(View, {
179
+ style: [styles.swapButtonContainer, swapButtonContainerStyle],
180
+ children: /*#__PURE__*/_jsx(TouchableOpacity, {
181
+ style: [styles.swapButton, swapButtonStyle],
182
+ onPress: handleSwap,
183
+ activeOpacity: 0.7,
184
+ children: /*#__PURE__*/_jsx(Ionicons, {
185
+ name: swapIconName,
186
+ size: 20,
187
+ color: theme.onSurface,
188
+ style: swapIconStyle
189
+ })
190
+ })
191
+ }), /*#__PURE__*/_jsxs(View, {
192
+ style: [styles.inputWrapper, inputWrapperStyle],
193
+ children: [/*#__PURE__*/_jsx(CustomInput, {
194
+ ref: toInputRef,
195
+ onChangeText: t => {
196
+ setToLocation(t);
197
+ onTextChange?.(t);
198
+ },
199
+ label: toLabel,
200
+ value: toLocation,
201
+ labelStyle: [styles.label, labelStyle],
202
+ placeholder: toPlaceholder,
203
+ onFocus: () => {
204
+ onInputFocus?.(FormInputType.CAR_DROP_OFF);
205
+ setFocusedInput(FormInputType.CAR_DROP_OFF);
206
+ },
207
+ onBlur: () => {
208
+ setTimeout(() => {
209
+ if (focusedInput === FormInputType.CAR_DROP_OFF) {
210
+ setFocusedInput(undefined);
211
+ }
212
+ }, 150);
213
+ },
214
+ containerStyle: inputGroupStyle
215
+ }), suggestionData && /*#__PURE__*/_jsx(SuggestionList, {
216
+ data: suggestionData,
217
+ visible: focusedInput === FormInputType.CAR_DROP_OFF,
218
+ renderItemContent: suggestionRenderItem,
219
+ containerStyle: suggestionListContainerStyle // Use new prop
220
+ })]
221
+ })]
222
+ }), /*#__PURE__*/_jsx(DateRangePicker, {
223
+ departureLabel: pickupLabel,
224
+ returnLabel: dropoffLabel,
225
+ outerContainerStyle: [styles.dateRangePickerOuterContainer, dateRangePickerOuterContainerStyle],
226
+ labelStyle: [labelStyle, dateRangePickerLabelStyle],
227
+ inputGroupStyle: dateRangePickerInputGroupStyle,
228
+ calendarContainerStyle: dateRangePickerCalendarContainerStyle,
229
+ calendarThemeOverrides: calendarThemeOverrides,
230
+ onDatesChange: d => {
231
+ setDropoffDate(d.return);
232
+ setPickupDate(d.departure);
233
+ },
234
+ isOneWay: isOneWay
235
+ }), /*#__PURE__*/_jsxs(View, {
236
+ style: [styles.pickupRow, pickupRowStyle],
237
+ children: [/*#__PURE__*/_jsxs(View, {
238
+ style: [styles.agePickerWrapper, agePickerWrapperStyle],
239
+ children: [/*#__PURE__*/_jsx(Text, {
240
+ style: [styles.label, labelStyle, agePickerLabelStyle],
241
+ children: "Driver's Age"
242
+ }), /*#__PURE__*/_jsx(View, {
243
+ style: [styles.pickerContainer, pickerContainerStyle],
244
+ children: /*#__PURE__*/_jsxs(Picker, {
245
+ selectedValue: age,
246
+ onValueChange: setAge,
247
+ style: [styles.picker, pickerStyle],
248
+ dropdownIconColor: theme.onSurface,
249
+ children: [/*#__PURE__*/_jsx(Picker.Item, {
250
+ label: "Select Age",
251
+ value: undefined,
252
+ enabled: false
253
+ }), Array.from({
254
+ length: 80 - 21 + 1
255
+ }, (_, i) => i + 21).map(n => /*#__PURE__*/_jsx(Picker.Item, {
256
+ label: n.toString(),
257
+ value: n
258
+ }, n))]
259
+ })
260
+ })]
261
+ }), /*#__PURE__*/_jsx(TouchableOpacity, {
262
+ style: [styles.searchButton, searchButtonStyle],
263
+ onPress: handleSearch,
264
+ activeOpacity: 0.8,
265
+ children: /*#__PURE__*/_jsx(Ionicons, {
266
+ name: searchIconName,
267
+ size: 24,
268
+ color: theme.onPrimary,
269
+ style: searchIconStyle
270
+ })
271
+ })]
272
+ })]
273
+ });
274
+ };
275
+
276
+ // --- Styles ---
277
+ const themedStyles = (theme, isRTL) => StyleSheet.create({
278
+ container: {
279
+ padding: 16,
280
+ backgroundColor: theme.surface,
281
+ borderBottomRightRadius: 8,
282
+ borderBottomLeftRadius: 8
283
+ },
284
+ inputGroupContainer: {
285
+ position: "relative"
286
+ },
287
+ inputWrapper: {
288
+ marginBottom: 15,
289
+ position: "relative"
290
+ },
291
+ label: {
292
+ color: theme.labelText,
293
+ fontSize: 12,
294
+ fontWeight: "600",
295
+ textTransform: "uppercase",
296
+ textAlign: isRTL ? "right" : "left",
297
+ marginBottom: 6
298
+ },
299
+ swapButtonContainer: {
300
+ // // Centering the button between the input wrappers
301
+ // position: "absolute",
302
+ // left: 0,
303
+ // right: 0,
304
+ // top: "50%", // Position roughly in the middle vertically
305
+ // transform: [{ translateY: -18 }], // Adjust based on button height / 2
306
+ alignItems: "center"
307
+ // zIndex: 1, // Ensure swap button is above inputs if they overlap slightly
308
+ },
309
+ swapButton: {
310
+ width: 36,
311
+ height: 36,
312
+ borderRadius: 18,
313
+ backgroundColor: theme.surface,
314
+ borderColor: theme.border,
315
+ borderWidth: 1,
316
+ justifyContent: "center",
317
+ alignItems: "center"
318
+ },
319
+ dateRangePickerOuterContainer: {
320
+ marginTop: 10 // Default margin, can be overridden
321
+ },
322
+ pickupRow: {
323
+ flexDirection: isRTL ? "row-reverse" : "row",
324
+ alignItems: "flex-end",
325
+ marginTop: 20,
326
+ gap: 10
327
+ },
328
+ agePickerWrapper: {
329
+ flex: 1
330
+ },
331
+ pickerContainer: {
332
+ borderWidth: 1,
333
+ borderColor: theme.border,
334
+ borderRadius: 8,
335
+ backgroundColor: theme.surface,
336
+ justifyContent: "center",
337
+ height: 50
338
+ },
339
+ picker: {
340
+ width: "100%",
341
+ color: theme.onSurface
342
+ },
343
+ searchButton: {
344
+ backgroundColor: theme.primary,
345
+ width: 50,
346
+ height: 50,
347
+ borderRadius: 8,
348
+ justifyContent: "center",
349
+ alignItems: "center"
350
+ },
351
+ suggestionItem: {
352
+ padding: 12,
353
+ borderBottomWidth: StyleSheet.hairlineWidth,
354
+ borderBottomColor: theme.border,
355
+ backgroundColor: theme.surface
356
+ },
357
+ suggestionItemText: {
358
+ fontSize: 14,
359
+ color: theme.onSurface
360
+ }
361
+ });
362
+ export default CarRentalForm;
363
+ //# sourceMappingURL=CarRentalForm.js.map