mautourco-components 0.2.21 → 0.2.23
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/dist/components/atoms/Checkbox/Checkbox.d.ts +3 -2
- package/dist/components/atoms/Checkbox/Checkbox.js +16 -6
- package/dist/components/atoms/Icon/icons/PlusCircleIcon.js +1 -1
- package/dist/components/atoms/Inputs/Input/Input.d.ts +1 -1
- package/dist/components/molecules/AddItemButton/AddItemButton.css +2088 -0
- package/dist/components/molecules/AddItemButton/AddItemButton.d.ts +7 -0
- package/dist/components/molecules/AddItemButton/AddItemButton.js +19 -0
- package/dist/components/molecules/BookingPax/BookingPax.d.ts +43 -0
- package/dist/components/molecules/BookingPax/BookingPax.js +43 -0
- package/dist/components/molecules/BookingPax/BookingPaxAccom.d.ts +34 -0
- package/dist/components/molecules/BookingPax/BookingPaxClient/BookingPaxClient.css +10 -0
- package/dist/components/molecules/BookingPax/BookingPaxClient/BookingPaxClient.d.ts +89 -1
- package/dist/components/molecules/BookingPax/BookingPaxClient/BookingPaxClient.js +34 -11
- package/dist/components/molecules/BookingPax/BookingPaxExcursion.d.ts +43 -0
- package/dist/components/molecules/BookingPax/BookingPaxExcursion.js +19 -0
- package/dist/components/molecules/BookingPax/BookingPaxHeader.d.ts +15 -0
- package/dist/components/molecules/BookingPax/BookingPaxHeader.js +13 -0
- package/dist/components/molecules/BookingPax/BookingPaxLayout/BookingPaxLayout.d.ts +30 -0
- package/dist/components/molecules/BookingPax/BookingPaxLayout/BookingPaxLayout.js +15 -0
- package/dist/components/molecules/BookingPax/BookingPaxRemarks.d.ts +14 -0
- package/dist/components/molecules/BookingPax/BookingPaxRemarks.js +11 -0
- package/dist/components/molecules/BookingPax/BookingPaxTransfer.d.ts +51 -0
- package/dist/components/molecules/BookingPax/BookingPaxTransfer.js +19 -2
- package/dist/components/molecules/BookingPax/index.d.ts +1 -0
- package/dist/components/molecules/BookingPax/index.js +1 -0
- package/dist/components/molecules/Calendar/DateTime.d.ts +5 -5
- package/dist/components/molecules/Calendar/DateTime.js +48 -37
- package/dist/components/molecules/DialogContentPolicy/DialogCancellationList.d.ts +20 -0
- package/dist/components/molecules/DialogContentPolicy/DialogCancellationList.js +17 -6
- package/dist/components/molecules/DialogContentPolicy/DialogContentPolicy.d.ts +18 -0
- package/dist/components/molecules/DialogContentPolicy/DialogContentPolicy.js +14 -3
- package/dist/components/molecules/ServiceSelector/ServiceSelector.d.ts +3 -0
- package/dist/components/molecules/ServiceSelector/ServiceSelector.js +23 -12
- package/dist/components/organisms/Booking/BookingPaxList.d.ts +64 -0
- package/dist/components/organisms/Booking/BookingPaxList.js +19 -0
- package/dist/components/organisms/BookingAddItem/AddItemNewService.d.ts +12 -0
- package/dist/components/organisms/BookingAddItem/AddItemNewService.js +48 -0
- package/dist/components/organisms/BookingAddItem/AddItemSelector.d.ts +9 -0
- package/dist/components/organisms/BookingAddItem/AddItemSelector.js +23 -0
- package/dist/components/organisms/BookingAddItem/BookingAddItem.d.ts +16 -0
- package/dist/components/organisms/BookingAddItem/BookingAddItem.js +66 -0
- package/dist/components/organisms/BookingAddItem/index.d.ts +3 -0
- package/dist/components/organisms/BookingAddItem/index.js +3 -0
- package/dist/components/organisms/DateTimePicker/DateTimePicker.js +11 -7
- package/dist/components/organisms/Dialog/Dialog.d.ts +1 -1
- package/dist/components/organisms/Dialog/Dialog.js +4 -4
- package/dist/components/organisms/DialogBookingConfirm/BookingCancellationPolicy.d.ts +29 -0
- package/dist/components/organisms/DialogBookingConfirm/BookingCancellationPolicy.js +31 -0
- package/dist/components/organisms/DialogBookingConfirm/BookingMailSent.d.ts +29 -0
- package/dist/components/organisms/DialogBookingConfirm/BookingMailSent.js +31 -0
- package/dist/components/organisms/DialogBookingConfirm/BookingReference.d.ts +35 -0
- package/dist/components/organisms/DialogBookingConfirm/BookingReference.js +37 -0
- package/dist/components/organisms/DialogBookingConfirm/BookingSuccess.d.ts +35 -0
- package/dist/components/organisms/DialogBookingConfirm/BookingSuccess.js +33 -0
- package/dist/components/organisms/DialogBookingConfirm/DialogBookingConfirm.d.ts +39 -2
- package/dist/components/organisms/DialogBookingConfirm/DialogBookingConfirm.js +25 -1
- package/dist/components/organisms/DialogBookingConfirm/index.d.ts +5 -0
- package/dist/components/organisms/DialogBookingConfirm/index.js +1 -0
- package/dist/components/organisms/PaxSelector/PaxSelector.d.ts +1 -0
- package/dist/components/organisms/PaxSelector/PaxSelector.js +50 -28
- package/dist/components/organisms/TabCancellationPolicy/CancellationAccom.d.ts +25 -0
- package/dist/components/organisms/TabCancellationPolicy/CancellationAccom.js +16 -0
- package/dist/components/organisms/TabCancellationPolicy/CancellationBody.d.ts +24 -0
- package/dist/components/organisms/TabCancellationPolicy/CancellationBody.js +24 -0
- package/dist/components/organisms/TabCancellationPolicy/CancellationExcursion.d.ts +30 -0
- package/dist/components/organisms/TabCancellationPolicy/CancellationExcursion.js +15 -0
- package/dist/components/organisms/TabCancellationPolicy/CancellationHeader.d.ts +23 -0
- package/dist/components/organisms/TabCancellationPolicy/CancellationHeader.js +23 -0
- package/dist/components/organisms/TabCancellationPolicy/CancellationTransfer.d.ts +22 -0
- package/dist/components/organisms/TabCancellationPolicy/CancellationTransfer.js +13 -0
- package/dist/components/organisms/TabCancellationPolicy/HeaderAccom.d.ts +22 -0
- package/dist/components/organisms/TabCancellationPolicy/HeaderAccom.js +13 -0
- package/dist/components/organisms/TabCancellationPolicy/HeaderExcursion.d.ts +18 -0
- package/dist/components/organisms/TabCancellationPolicy/HeaderExcursion.js +12 -0
- package/dist/components/organisms/TabCancellationPolicy/PolicyAccom/PolicyAccom.css +7 -0
- package/dist/components/organisms/TabCancellationPolicy/PolicyAccom/PolicyAccom.js +2 -1
- package/dist/components/organisms/TabCancellationPolicy/PolicyExcursion.d.ts +18 -0
- package/dist/components/organisms/TabCancellationPolicy/PolicyExcursion.js +12 -0
- package/dist/components/organisms/TabCancellationPolicy/PolicyTransfer.d.ts +11 -0
- package/dist/components/organisms/TabCancellationPolicy/PolicyTransfer.js +11 -0
- package/dist/components/organisms/TabCancellationPolicy/TabCancellationPolicy.d.ts +29 -0
- package/dist/components/organisms/TabCancellationPolicy/TabCancellationPolicy.js +29 -0
- package/dist/components/ui/popover.js +1 -1
- package/dist/index.d.ts +7 -0
- package/dist/index.js +4 -2
- package/dist/styles/components/checkbox.css +16 -9
- package/dist/styles/components/molecule/calendarInput.css +3 -4
- package/dist/styles/components/molecule/service-selector.css +70 -21
- package/package.json +1 -2
- package/src/components/atoms/Checkbox/Checkbox.tsx +38 -23
- package/src/components/atoms/Icon/icons/PlusCircleIcon.tsx +2 -2
- package/src/components/atoms/Inputs/Input/Input.tsx +1 -1
- package/src/components/molecules/AddItemButton/AddItemButton.css +5 -0
- package/src/components/molecules/AddItemButton/AddItemButton.tsx +18 -0
- package/src/components/molecules/BookingPax/BookingPax.tsx +43 -0
- package/src/components/molecules/BookingPax/BookingPaxAccom.tsx +34 -0
- package/src/components/molecules/BookingPax/BookingPaxClient/BookingPaxClient.css +6 -0
- package/src/components/molecules/BookingPax/BookingPaxClient/BookingPaxClient.tsx +92 -18
- package/src/components/molecules/BookingPax/BookingPaxExcursion.tsx +43 -0
- package/src/components/molecules/BookingPax/BookingPaxHeader.tsx +28 -1
- package/src/components/molecules/BookingPax/BookingPaxLayout/BookingPaxLayout.tsx +30 -0
- package/src/components/molecules/BookingPax/BookingPaxRemarks.tsx +14 -0
- package/src/components/molecules/BookingPax/BookingPaxTransfer.tsx +52 -2
- package/src/components/molecules/BookingPax/index.ts +2 -0
- package/src/components/molecules/Calendar/DateTime.tsx +69 -53
- package/src/components/molecules/DialogContentPolicy/DialogCancellationList.tsx +32 -12
- package/src/components/molecules/DialogContentPolicy/DialogContentPolicy.tsx +27 -11
- package/src/components/molecules/ServiceSelector/ServiceSelector.tsx +91 -83
- package/src/components/organisms/Booking/BookingPaxList.tsx +64 -0
- package/src/components/organisms/BookingAddItem/AddItemNewService.tsx +95 -0
- package/src/components/organisms/BookingAddItem/AddItemSelector.tsx +43 -0
- package/src/components/organisms/BookingAddItem/BookingAddItem.tsx +120 -0
- package/src/components/organisms/BookingAddItem/index.ts +3 -0
- package/src/components/organisms/DateTimePicker/DateTimePicker.tsx +13 -7
- package/src/components/organisms/Dialog/Dialog.tsx +13 -20
- package/src/components/organisms/DialogBookingConfirm/BookingCancellationPolicy.tsx +44 -0
- package/src/components/organisms/DialogBookingConfirm/BookingMailSent.tsx +56 -0
- package/src/components/organisms/DialogBookingConfirm/BookingReference.tsx +74 -0
- package/src/components/organisms/DialogBookingConfirm/BookingSuccess.tsx +67 -0
- package/src/components/organisms/DialogBookingConfirm/DialogBookingConfirm.tsx +43 -2
- package/src/components/organisms/DialogBookingConfirm/index.ts +6 -0
- package/src/components/organisms/PaxSelector/PaxSelector.tsx +305 -193
- package/src/components/organisms/TabCancellationPolicy/CancellationAccom.tsx +25 -0
- package/src/components/organisms/TabCancellationPolicy/CancellationBody.tsx +24 -0
- package/src/components/organisms/TabCancellationPolicy/CancellationExcursion.tsx +30 -0
- package/src/components/organisms/TabCancellationPolicy/CancellationHeader.tsx +23 -0
- package/src/components/organisms/TabCancellationPolicy/CancellationTransfer.tsx +22 -0
- package/src/components/organisms/TabCancellationPolicy/HeaderAccom.tsx +22 -0
- package/src/components/organisms/TabCancellationPolicy/HeaderExcursion.tsx +18 -0
- package/src/components/organisms/TabCancellationPolicy/PolicyAccom/PolicyAccom.css +3 -0
- package/src/components/organisms/TabCancellationPolicy/PolicyAccom/PolicyAccom.tsx +3 -2
- package/src/components/organisms/TabCancellationPolicy/PolicyExcursion.tsx +18 -0
- package/src/components/organisms/TabCancellationPolicy/PolicyTransfer.tsx +11 -0
- package/src/components/organisms/TabCancellationPolicy/TabCancellationPolicy.tsx +29 -0
- package/src/components/ui/popover.tsx +2 -4
- package/src/styles/components/checkbox.css +16 -9
- package/src/styles/components/molecule/calendarInput.css +12 -13
- package/src/styles/components/molecule/service-selector.css +71 -23
- package/dist/components/ui/checkbox.d.ts +0 -4
- package/dist/components/ui/checkbox.js +0 -31
- package/src/components/ui/checkbox.tsx +0 -32
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
2
2
|
import Icon from '../../atoms/Icon/Icon';
|
|
3
3
|
import { Text } from '../../atoms/Typography/Typography';
|
|
4
4
|
|
|
@@ -18,6 +18,7 @@ export interface PaxData {
|
|
|
18
18
|
childAges?: number[];
|
|
19
19
|
/** Ages for infants (1-18 years) */
|
|
20
20
|
infantAges?: number[];
|
|
21
|
+
/** Client type */
|
|
21
22
|
clientType: ClientType;
|
|
22
23
|
}
|
|
23
24
|
|
|
@@ -100,9 +101,17 @@ interface AgeSelectorProps {
|
|
|
100
101
|
required?: boolean;
|
|
101
102
|
}
|
|
102
103
|
|
|
103
|
-
const AgeSelector: React.FC<AgeSelectorProps> = ({
|
|
104
|
+
const AgeSelector: React.FC<AgeSelectorProps> = ({
|
|
105
|
+
label,
|
|
106
|
+
value,
|
|
107
|
+
onChange,
|
|
108
|
+
ageRange,
|
|
109
|
+
required,
|
|
110
|
+
}) => {
|
|
104
111
|
const [isOpen, setIsOpen] = useState(false);
|
|
105
|
-
const [inputValue, setInputValue] = useState<string>(
|
|
112
|
+
const [inputValue, setInputValue] = useState<string>(
|
|
113
|
+
value !== undefined ? value.toString() : ''
|
|
114
|
+
);
|
|
106
115
|
const containerRef = useRef<HTMLDivElement>(null);
|
|
107
116
|
const inputRef = useRef<HTMLInputElement>(null);
|
|
108
117
|
|
|
@@ -129,11 +138,11 @@ const AgeSelector: React.FC<AgeSelectorProps> = ({ label, value, onChange, ageRa
|
|
|
129
138
|
|
|
130
139
|
const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
131
140
|
const newValue = e.target.value;
|
|
132
|
-
|
|
141
|
+
|
|
133
142
|
// Only allow numeric input or empty string
|
|
134
143
|
if (newValue === '' || /^\d+$/.test(newValue)) {
|
|
135
144
|
setInputValue(newValue);
|
|
136
|
-
|
|
145
|
+
|
|
137
146
|
// Only update if it's a valid number within range
|
|
138
147
|
const numValue = parseInt(newValue, 10);
|
|
139
148
|
if (newValue === '') {
|
|
@@ -178,7 +187,7 @@ const AgeSelector: React.FC<AgeSelectorProps> = ({ label, value, onChange, ageRa
|
|
|
178
187
|
setIsOpen(!isOpen);
|
|
179
188
|
};
|
|
180
189
|
|
|
181
|
-
const ageOptions = ageRange.map(age => age.toString());
|
|
190
|
+
const ageOptions = ageRange.map((age) => age.toString());
|
|
182
191
|
const displayValue = inputValue || undefined;
|
|
183
192
|
|
|
184
193
|
return (
|
|
@@ -187,8 +196,9 @@ const AgeSelector: React.FC<AgeSelectorProps> = ({ label, value, onChange, ageRa
|
|
|
187
196
|
{label}
|
|
188
197
|
{required && <span className="pax-selector__age-required"> *</span>}
|
|
189
198
|
</Text>
|
|
190
|
-
|
|
191
|
-
<div
|
|
199
|
+
<div className="dropdown-container pax-selector__age-dropdown-container">
|
|
200
|
+
<div
|
|
201
|
+
className={`dropdown-input ${isOpen ? 'dropdown-input--open pax-selector__age-dropdown-input--open' : ''} ${value !== undefined ? 'dropdown-input--selected' : 'dropdown-input--default'} pax-selector__age-dropdown-input`}>
|
|
192
202
|
<input
|
|
193
203
|
ref={inputRef}
|
|
194
204
|
type="text"
|
|
@@ -201,12 +211,12 @@ const AgeSelector: React.FC<AgeSelectorProps> = ({ label, value, onChange, ageRa
|
|
|
201
211
|
onFocus={() => setIsOpen(false)}
|
|
202
212
|
placeholder="--"
|
|
203
213
|
aria-label={`${label} age`}
|
|
204
|
-
style={{
|
|
205
|
-
background: 'transparent',
|
|
206
|
-
border: 'none',
|
|
214
|
+
style={{
|
|
215
|
+
background: 'transparent',
|
|
216
|
+
border: 'none',
|
|
207
217
|
outline: 'none',
|
|
208
218
|
width: '100%',
|
|
209
|
-
cursor: 'text'
|
|
219
|
+
cursor: 'text',
|
|
210
220
|
}}
|
|
211
221
|
/>
|
|
212
222
|
<button
|
|
@@ -226,13 +236,12 @@ const AgeSelector: React.FC<AgeSelectorProps> = ({ label, value, onChange, ageRa
|
|
|
226
236
|
cursor: 'pointer',
|
|
227
237
|
padding: 0,
|
|
228
238
|
display: 'flex',
|
|
229
|
-
alignItems: 'center'
|
|
230
|
-
}}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
className="dropdown-input__icon dropdown-input__icon--chevron"
|
|
239
|
+
alignItems: 'center',
|
|
240
|
+
}}>
|
|
241
|
+
<Icon
|
|
242
|
+
name="chevron-down"
|
|
243
|
+
size="sm"
|
|
244
|
+
className="dropdown-input__icon dropdown-input__icon--chevron"
|
|
236
245
|
/>
|
|
237
246
|
</button>
|
|
238
247
|
</div>
|
|
@@ -244,8 +253,7 @@ const AgeSelector: React.FC<AgeSelectorProps> = ({ label, value, onChange, ageRa
|
|
|
244
253
|
className={`dropdown-option ${value?.toString() === age ? 'dropdown-option--selected' : ''}`}
|
|
245
254
|
onClick={() => handleSelect(age)}
|
|
246
255
|
role="option"
|
|
247
|
-
aria-selected={value?.toString() === age}
|
|
248
|
-
>
|
|
256
|
+
aria-selected={value?.toString() === age}>
|
|
249
257
|
{age}
|
|
250
258
|
</div>
|
|
251
259
|
))}
|
|
@@ -264,12 +272,12 @@ interface StepperRowProps {
|
|
|
264
272
|
onChange: (value: number) => void;
|
|
265
273
|
}
|
|
266
274
|
|
|
267
|
-
const StepperRow: React.FC<StepperRowProps> = ({
|
|
268
|
-
label,
|
|
269
|
-
value,
|
|
270
|
-
min = 0,
|
|
271
|
-
max = 99,
|
|
272
|
-
onChange
|
|
275
|
+
const StepperRow: React.FC<StepperRowProps> = ({
|
|
276
|
+
label,
|
|
277
|
+
value,
|
|
278
|
+
min = 0,
|
|
279
|
+
max = 99,
|
|
280
|
+
onChange,
|
|
273
281
|
}) => {
|
|
274
282
|
const handleDecrement = () => {
|
|
275
283
|
if (value > min) {
|
|
@@ -285,7 +293,11 @@ const StepperRow: React.FC<StepperRowProps> = ({
|
|
|
285
293
|
|
|
286
294
|
return (
|
|
287
295
|
<div className="pax-selector__stepper">
|
|
288
|
-
<Text
|
|
296
|
+
<Text
|
|
297
|
+
size="base"
|
|
298
|
+
variant="bold"
|
|
299
|
+
color="default"
|
|
300
|
+
className="pax-selector__stepper-label">
|
|
289
301
|
{label}
|
|
290
302
|
</Text>
|
|
291
303
|
<div className="pax-selector__stepper-controls">
|
|
@@ -294,8 +306,7 @@ const StepperRow: React.FC<StepperRowProps> = ({
|
|
|
294
306
|
className="pax-selector__stepper-btn"
|
|
295
307
|
onClick={handleDecrement}
|
|
296
308
|
disabled={value <= min}
|
|
297
|
-
aria-label={`Decrease ${label}`}
|
|
298
|
-
>
|
|
309
|
+
aria-label={`Decrease ${label}`}>
|
|
299
310
|
<Icon name="minus" size="sm" />
|
|
300
311
|
</button>
|
|
301
312
|
<span className="pax-selector__stepper-count">{value}</span>
|
|
@@ -304,8 +315,7 @@ const StepperRow: React.FC<StepperRowProps> = ({
|
|
|
304
315
|
className="pax-selector__stepper-btn"
|
|
305
316
|
onClick={handleIncrement}
|
|
306
317
|
disabled={value >= max}
|
|
307
|
-
aria-label={`Increase ${label}`}
|
|
308
|
-
>
|
|
318
|
+
aria-label={`Increase ${label}`}>
|
|
309
319
|
<Icon name="plus" size="sm" />
|
|
310
320
|
</button>
|
|
311
321
|
</div>
|
|
@@ -354,19 +364,18 @@ const ClientTypeSelector: React.FC<ClientTypeSelectorProps> = ({ value, onChange
|
|
|
354
364
|
className="pax-selector__client-type-trigger"
|
|
355
365
|
onClick={() => setIsOpen(!isOpen)}
|
|
356
366
|
aria-expanded={isOpen}
|
|
357
|
-
aria-haspopup="listbox"
|
|
358
|
-
>
|
|
367
|
+
aria-haspopup="listbox">
|
|
359
368
|
<div className="pax-selector__client-type-content">
|
|
360
369
|
<Icon name="user-icon" size="sm" className="pax-selector__client-type-icon" />
|
|
361
370
|
<span className="pax-selector__client-type-text">{value}</span>
|
|
362
371
|
</div>
|
|
363
|
-
<Icon
|
|
364
|
-
name="chevron-down"
|
|
365
|
-
size="sm"
|
|
366
|
-
className={`pax-selector__client-type-chevron ${isOpen ? 'pax-selector__client-type-chevron--open' : ''}`}
|
|
372
|
+
<Icon
|
|
373
|
+
name="chevron-down"
|
|
374
|
+
size="sm"
|
|
375
|
+
className={`pax-selector__client-type-chevron ${isOpen ? 'pax-selector__client-type-chevron--open' : ''}`}
|
|
367
376
|
/>
|
|
368
377
|
</button>
|
|
369
|
-
|
|
378
|
+
|
|
370
379
|
{isOpen && (
|
|
371
380
|
<div className="pax-selector__client-type-dropdown" role="listbox">
|
|
372
381
|
{CLIENT_TYPES.map((type) => (
|
|
@@ -376,8 +385,7 @@ const ClientTypeSelector: React.FC<ClientTypeSelectorProps> = ({ value, onChange
|
|
|
376
385
|
className={`pax-selector__client-type-option ${value === type ? 'pax-selector__client-type-option--selected' : ''}`}
|
|
377
386
|
onClick={() => handleSelect(type)}
|
|
378
387
|
role="option"
|
|
379
|
-
aria-selected={value === type}
|
|
380
|
-
>
|
|
388
|
+
aria-selected={value === type}>
|
|
381
389
|
<Icon name="user-icon" size="sm" />
|
|
382
390
|
{type}
|
|
383
391
|
</button>
|
|
@@ -412,11 +420,18 @@ const RoomEditor: React.FC<RoomEditorProps> = ({
|
|
|
412
420
|
onChange,
|
|
413
421
|
onRemove,
|
|
414
422
|
}) => {
|
|
415
|
-
const handleFieldChange = (
|
|
423
|
+
const handleFieldChange = (
|
|
424
|
+
field: keyof PaxData,
|
|
425
|
+
value: number | ClientType | number[]
|
|
426
|
+
) => {
|
|
416
427
|
onChange({ ...room, [field]: value });
|
|
417
428
|
};
|
|
418
429
|
|
|
419
|
-
const handleAgeChange = (
|
|
430
|
+
const handleAgeChange = (
|
|
431
|
+
category: 'teenAges' | 'childAges' | 'infantAges',
|
|
432
|
+
index: number,
|
|
433
|
+
age: number
|
|
434
|
+
) => {
|
|
420
435
|
const ages = [...(room[category] || [])];
|
|
421
436
|
ages[index] = age;
|
|
422
437
|
handleFieldChange(category, ages);
|
|
@@ -430,21 +445,30 @@ const RoomEditor: React.FC<RoomEditorProps> = ({
|
|
|
430
445
|
|
|
431
446
|
// Adjust teen ages array
|
|
432
447
|
if (teenAges.length < room.teens) {
|
|
433
|
-
handleFieldChange('teenAges', [
|
|
448
|
+
handleFieldChange('teenAges', [
|
|
449
|
+
...teenAges,
|
|
450
|
+
...Array(room.teens - teenAges.length).fill(undefined),
|
|
451
|
+
]);
|
|
434
452
|
} else if (teenAges.length > room.teens) {
|
|
435
453
|
handleFieldChange('teenAges', teenAges.slice(0, room.teens));
|
|
436
454
|
}
|
|
437
455
|
|
|
438
456
|
// Adjust child ages array
|
|
439
457
|
if (childAges.length < room.children) {
|
|
440
|
-
handleFieldChange('childAges', [
|
|
458
|
+
handleFieldChange('childAges', [
|
|
459
|
+
...childAges,
|
|
460
|
+
...Array(room.children - childAges.length).fill(undefined),
|
|
461
|
+
]);
|
|
441
462
|
} else if (childAges.length > room.children) {
|
|
442
463
|
handleFieldChange('childAges', childAges.slice(0, room.children));
|
|
443
464
|
}
|
|
444
465
|
|
|
445
466
|
// Adjust infant ages array
|
|
446
467
|
if (infantAges.length < room.infants) {
|
|
447
|
-
handleFieldChange('infantAges', [
|
|
468
|
+
handleFieldChange('infantAges', [
|
|
469
|
+
...infantAges,
|
|
470
|
+
...Array(room.infants - infantAges.length).fill(undefined),
|
|
471
|
+
]);
|
|
448
472
|
} else if (infantAges.length > room.infants) {
|
|
449
473
|
handleFieldChange('infantAges', infantAges.slice(0, room.infants));
|
|
450
474
|
}
|
|
@@ -467,7 +491,11 @@ const RoomEditor: React.FC<RoomEditorProps> = ({
|
|
|
467
491
|
<div className="pax-selector__room-container">
|
|
468
492
|
<div className="pax-selector__room-header">
|
|
469
493
|
<div className="pax-selector__room-title">
|
|
470
|
-
<Text
|
|
494
|
+
<Text
|
|
495
|
+
size="lg"
|
|
496
|
+
variant="bold"
|
|
497
|
+
color="accent"
|
|
498
|
+
className="pax-selector__room-name">
|
|
471
499
|
Room {roomNumber}
|
|
472
500
|
</Text>
|
|
473
501
|
<Icon name="home" size="md" className="pax-selector__room-icon" />
|
|
@@ -477,8 +505,7 @@ const RoomEditor: React.FC<RoomEditorProps> = ({
|
|
|
477
505
|
type="button"
|
|
478
506
|
className="pax-selector__room-remove"
|
|
479
507
|
onClick={onRemove}
|
|
480
|
-
aria-label={`Remove room ${roomNumber}`}
|
|
481
|
-
>
|
|
508
|
+
aria-label={`Remove room ${roomNumber}`}>
|
|
482
509
|
<Icon name="close" size="sm" className="pax-selector__room-remove-icon" />
|
|
483
510
|
<span className="pax-selector__room-remove-text">Remove</span>
|
|
484
511
|
</button>
|
|
@@ -514,69 +541,86 @@ const RoomEditor: React.FC<RoomEditorProps> = ({
|
|
|
514
541
|
</div>
|
|
515
542
|
|
|
516
543
|
{/* Age specification section */}
|
|
517
|
-
{(
|
|
544
|
+
{(room.teens > 0 || room.children > 0 || room.infants > 0) && (
|
|
518
545
|
<div className="pax-selector__age-section">
|
|
519
|
-
<Text
|
|
546
|
+
<Text
|
|
547
|
+
size="base"
|
|
548
|
+
variant="bold"
|
|
549
|
+
color="default"
|
|
550
|
+
className="pax-selector__age-section-title">
|
|
520
551
|
Please specify the age :
|
|
521
552
|
</Text>
|
|
522
|
-
|
|
553
|
+
|
|
523
554
|
<div className="pax-selector__age-groups">
|
|
524
555
|
{/* Teen ages */}
|
|
525
|
-
{room.teens > 0 &&
|
|
526
|
-
|
|
527
|
-
{chunk
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
556
|
+
{room.teens > 0 &&
|
|
557
|
+
teenAgeChunks.map((chunk, chunkIndex) => (
|
|
558
|
+
<div key={`teen-chunk-${chunkIndex}`} className="pax-selector__age-row">
|
|
559
|
+
{chunk.map((age, ageIndex) => {
|
|
560
|
+
const actualIndex = chunkIndex * 2 + ageIndex;
|
|
561
|
+
return (
|
|
562
|
+
<AgeSelector
|
|
563
|
+
key={`teen-${actualIndex}`}
|
|
564
|
+
label="Teen"
|
|
565
|
+
value={age}
|
|
566
|
+
onChange={(selectedAge) =>
|
|
567
|
+
handleAgeChange('teenAges', actualIndex, selectedAge)
|
|
568
|
+
}
|
|
569
|
+
ageRange={CHILD_CATEGORY_AGES}
|
|
570
|
+
required
|
|
571
|
+
/>
|
|
572
|
+
);
|
|
573
|
+
})}
|
|
574
|
+
</div>
|
|
575
|
+
))}
|
|
542
576
|
|
|
543
577
|
{/* Child ages */}
|
|
544
|
-
{room.children > 0 &&
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
578
|
+
{room.children > 0 &&
|
|
579
|
+
childAgeChunks.map((chunk, chunkIndex) => (
|
|
580
|
+
<div
|
|
581
|
+
key={`child-chunk-${chunkIndex}`}
|
|
582
|
+
className="pax-selector__age-row">
|
|
583
|
+
{chunk.map((age, ageIndex) => {
|
|
584
|
+
const actualIndex = chunkIndex * 2 + ageIndex;
|
|
585
|
+
return (
|
|
586
|
+
<AgeSelector
|
|
587
|
+
key={`child-${actualIndex}`}
|
|
588
|
+
label="Child"
|
|
589
|
+
value={age}
|
|
590
|
+
onChange={(selectedAge) =>
|
|
591
|
+
handleAgeChange('childAges', actualIndex, selectedAge)
|
|
592
|
+
}
|
|
593
|
+
ageRange={CHILD_CATEGORY_AGES}
|
|
594
|
+
required
|
|
595
|
+
/>
|
|
596
|
+
);
|
|
597
|
+
})}
|
|
598
|
+
</div>
|
|
599
|
+
))}
|
|
561
600
|
|
|
562
601
|
{/* Infant ages */}
|
|
563
|
-
{room.infants > 0 &&
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
602
|
+
{room.infants > 0 &&
|
|
603
|
+
infantAgeChunks.map((chunk, chunkIndex) => (
|
|
604
|
+
<div
|
|
605
|
+
key={`infant-chunk-${chunkIndex}`}
|
|
606
|
+
className="pax-selector__age-row">
|
|
607
|
+
{chunk.map((age, ageIndex) => {
|
|
608
|
+
const actualIndex = chunkIndex * 2 + ageIndex;
|
|
609
|
+
return (
|
|
610
|
+
<AgeSelector
|
|
611
|
+
key={`infant-${actualIndex}`}
|
|
612
|
+
label="Infant"
|
|
613
|
+
value={age}
|
|
614
|
+
onChange={(selectedAge) =>
|
|
615
|
+
handleAgeChange('infantAges', actualIndex, selectedAge)
|
|
616
|
+
}
|
|
617
|
+
ageRange={CHILD_CATEGORY_AGES}
|
|
618
|
+
required
|
|
619
|
+
/>
|
|
620
|
+
);
|
|
621
|
+
})}
|
|
622
|
+
</div>
|
|
623
|
+
))}
|
|
580
624
|
</div>
|
|
581
625
|
</div>
|
|
582
626
|
)}
|
|
@@ -610,7 +654,9 @@ const PaxSelector: React.FC<PaxSelectorProps> = ({
|
|
|
610
654
|
defaultPaxData = DEFAULT_PAX_DATA_WITH_ADULTS,
|
|
611
655
|
}) => {
|
|
612
656
|
const [isOpen, setIsOpen] = useState(false);
|
|
613
|
-
const [internalData, setInternalData] = useState<PaxData>(
|
|
657
|
+
const [internalData, setInternalData] = useState<PaxData>(
|
|
658
|
+
value || defaultPaxData || DEFAULT_PAX_DATA
|
|
659
|
+
);
|
|
614
660
|
const [rooms, setRooms] = useState<RoomData[]>(
|
|
615
661
|
defaultRooms || [{ ...DEFAULT_PAX_DATA, roomId: '1' }]
|
|
616
662
|
);
|
|
@@ -626,7 +672,13 @@ const PaxSelector: React.FC<PaxSelectorProps> = ({
|
|
|
626
672
|
|
|
627
673
|
// Initialize with default pax data and trigger onChange on mount
|
|
628
674
|
useEffect(() => {
|
|
629
|
-
if (
|
|
675
|
+
if (
|
|
676
|
+
!hasInitialized.current &&
|
|
677
|
+
!value &&
|
|
678
|
+
defaultPaxData &&
|
|
679
|
+
!multipleRooms &&
|
|
680
|
+
onChange
|
|
681
|
+
) {
|
|
630
682
|
hasInitialized.current = true;
|
|
631
683
|
onChange(defaultPaxData);
|
|
632
684
|
}
|
|
@@ -644,7 +696,10 @@ const PaxSelector: React.FC<PaxSelectorProps> = ({
|
|
|
644
696
|
|
|
645
697
|
// Adjust teen ages array
|
|
646
698
|
if (teenAges.length < internalData.teens) {
|
|
647
|
-
updatedData.teenAges = [
|
|
699
|
+
updatedData.teenAges = [
|
|
700
|
+
...teenAges,
|
|
701
|
+
...Array(internalData.teens - teenAges.length).fill(undefined),
|
|
702
|
+
];
|
|
648
703
|
needsUpdate = true;
|
|
649
704
|
} else if (teenAges.length > internalData.teens) {
|
|
650
705
|
updatedData.teenAges = teenAges.slice(0, internalData.teens);
|
|
@@ -653,7 +708,10 @@ const PaxSelector: React.FC<PaxSelectorProps> = ({
|
|
|
653
708
|
|
|
654
709
|
// Adjust child ages array
|
|
655
710
|
if (childAges.length < internalData.children) {
|
|
656
|
-
updatedData.childAges = [
|
|
711
|
+
updatedData.childAges = [
|
|
712
|
+
...childAges,
|
|
713
|
+
...Array(internalData.children - childAges.length).fill(undefined),
|
|
714
|
+
];
|
|
657
715
|
needsUpdate = true;
|
|
658
716
|
} else if (childAges.length > internalData.children) {
|
|
659
717
|
updatedData.childAges = childAges.slice(0, internalData.children);
|
|
@@ -662,7 +720,10 @@ const PaxSelector: React.FC<PaxSelectorProps> = ({
|
|
|
662
720
|
|
|
663
721
|
// Adjust infant ages array
|
|
664
722
|
if (infantAges.length < internalData.infants) {
|
|
665
|
-
updatedData.infantAges = [
|
|
723
|
+
updatedData.infantAges = [
|
|
724
|
+
...infantAges,
|
|
725
|
+
...Array(internalData.infants - infantAges.length).fill(undefined),
|
|
726
|
+
];
|
|
666
727
|
needsUpdate = true;
|
|
667
728
|
} else if (infantAges.length > internalData.infants) {
|
|
668
729
|
updatedData.infantAges = infantAges.slice(0, internalData.infants);
|
|
@@ -694,7 +755,10 @@ const PaxSelector: React.FC<PaxSelectorProps> = ({
|
|
|
694
755
|
};
|
|
695
756
|
}, [isOpen]);
|
|
696
757
|
|
|
697
|
-
const handleDataChange = (
|
|
758
|
+
const handleDataChange = (
|
|
759
|
+
field: keyof PaxData,
|
|
760
|
+
newValue: number | ClientType | number[]
|
|
761
|
+
) => {
|
|
698
762
|
const newData = { ...internalData, [field]: newValue };
|
|
699
763
|
setInternalData(newData);
|
|
700
764
|
onChange?.(newData);
|
|
@@ -702,7 +766,10 @@ const PaxSelector: React.FC<PaxSelectorProps> = ({
|
|
|
702
766
|
|
|
703
767
|
const handleClear = () => {
|
|
704
768
|
if (multipleRooms) {
|
|
705
|
-
const clearedRooms = rooms.map(room => ({
|
|
769
|
+
const clearedRooms = rooms.map((room) => ({
|
|
770
|
+
...DEFAULT_PAX_DATA,
|
|
771
|
+
roomId: room.roomId,
|
|
772
|
+
}));
|
|
706
773
|
setRooms(clearedRooms);
|
|
707
774
|
onRoomsChange?.(clearedRooms);
|
|
708
775
|
} else {
|
|
@@ -718,9 +785,9 @@ const PaxSelector: React.FC<PaxSelectorProps> = ({
|
|
|
718
785
|
};
|
|
719
786
|
|
|
720
787
|
const handleAddRoom = () => {
|
|
721
|
-
const newRoom: RoomData = {
|
|
722
|
-
...DEFAULT_PAX_DATA,
|
|
723
|
-
roomId: `${rooms.length + 1}
|
|
788
|
+
const newRoom: RoomData = {
|
|
789
|
+
...DEFAULT_PAX_DATA,
|
|
790
|
+
roomId: `${rooms.length + 1}`,
|
|
724
791
|
};
|
|
725
792
|
const updatedRooms = [...rooms, newRoom];
|
|
726
793
|
setRooms(updatedRooms);
|
|
@@ -729,14 +796,14 @@ const PaxSelector: React.FC<PaxSelectorProps> = ({
|
|
|
729
796
|
};
|
|
730
797
|
|
|
731
798
|
const handleRemoveRoom = (roomId: string) => {
|
|
732
|
-
const updatedRooms = rooms.filter(room => room.roomId !== roomId);
|
|
799
|
+
const updatedRooms = rooms.filter((room) => room.roomId !== roomId);
|
|
733
800
|
setRooms(updatedRooms);
|
|
734
801
|
onRoomsChange?.(updatedRooms);
|
|
735
802
|
onRemoveRoom?.(roomId);
|
|
736
803
|
};
|
|
737
804
|
|
|
738
805
|
const handleRoomChange = (roomId: string, updatedRoom: RoomData) => {
|
|
739
|
-
const updatedRooms = rooms.map(room =>
|
|
806
|
+
const updatedRooms = rooms.map((room) =>
|
|
740
807
|
room.roomId === roomId ? updatedRoom : room
|
|
741
808
|
);
|
|
742
809
|
setRooms(updatedRooms);
|
|
@@ -745,8 +812,9 @@ const PaxSelector: React.FC<PaxSelectorProps> = ({
|
|
|
745
812
|
|
|
746
813
|
const getTotalPax = () => {
|
|
747
814
|
if (multipleRooms) {
|
|
748
|
-
return rooms.reduce(
|
|
749
|
-
total + room.adults + room.teens + room.children + room.infants,
|
|
815
|
+
return rooms.reduce(
|
|
816
|
+
(total, room) => total + room.adults + room.teens + room.children + room.infants,
|
|
817
|
+
0
|
|
750
818
|
);
|
|
751
819
|
}
|
|
752
820
|
const { adults, teens, children, infants } = internalData;
|
|
@@ -770,22 +838,23 @@ const PaxSelector: React.FC<PaxSelectorProps> = ({
|
|
|
770
838
|
className="pax-selector__trigger"
|
|
771
839
|
onClick={() => setIsOpen(!isOpen)}
|
|
772
840
|
aria-expanded={isOpen}
|
|
773
|
-
aria-haspopup="true"
|
|
774
|
-
>
|
|
841
|
+
aria-haspopup="true">
|
|
775
842
|
<Text size="sm" variant="regular" className="pax-selector__label">
|
|
776
843
|
{label}
|
|
777
844
|
</Text>
|
|
778
|
-
<div
|
|
845
|
+
<div
|
|
846
|
+
className={`pax-selector__input ${isOpen ? 'pax-selector__input--active' : ''}`}>
|
|
779
847
|
<div className="pax-selector__input-content">
|
|
780
848
|
<Icon name="user-icon" size="sm" className="pax-selector__input-icon" />
|
|
781
|
-
<span
|
|
849
|
+
<span
|
|
850
|
+
className={`pax-selector__input-text ${!hasPax ? 'pax-selector__input-placeholder' : ''}`}>
|
|
782
851
|
{getDisplayText()}
|
|
783
852
|
</span>
|
|
784
853
|
</div>
|
|
785
|
-
<Icon
|
|
786
|
-
name="chevron-down"
|
|
787
|
-
size="sm"
|
|
788
|
-
className={`pax-selector__chevron ${isOpen ? 'pax-selector__chevron--open' : ''}`}
|
|
854
|
+
<Icon
|
|
855
|
+
name="chevron-down"
|
|
856
|
+
size="sm"
|
|
857
|
+
className={`pax-selector__chevron ${isOpen ? 'pax-selector__chevron--open' : ''}`}
|
|
789
858
|
/>
|
|
790
859
|
</div>
|
|
791
860
|
</button>
|
|
@@ -799,8 +868,7 @@ const PaxSelector: React.FC<PaxSelectorProps> = ({
|
|
|
799
868
|
<button
|
|
800
869
|
type="button"
|
|
801
870
|
className="pax-selector__add-room"
|
|
802
|
-
onClick={handleAddRoom}
|
|
803
|
-
>
|
|
871
|
+
onClick={handleAddRoom}>
|
|
804
872
|
<Icon name="home" size="sm" className="pax-selector__add-room-icon" />
|
|
805
873
|
Add a room
|
|
806
874
|
<Icon name="plus" size="sm" className="pax-selector__add-room-icon" />
|
|
@@ -855,16 +923,25 @@ const PaxSelector: React.FC<PaxSelectorProps> = ({
|
|
|
855
923
|
</div>
|
|
856
924
|
|
|
857
925
|
{/* Age specification for single room */}
|
|
858
|
-
{(
|
|
926
|
+
{(internalData.teens > 0 ||
|
|
927
|
+
internalData.children > 0 ||
|
|
928
|
+
internalData.infants > 0) && (
|
|
859
929
|
<div className="pax-selector__age-section">
|
|
860
|
-
<Text
|
|
930
|
+
<Text
|
|
931
|
+
size="base"
|
|
932
|
+
variant="bold"
|
|
933
|
+
color="default"
|
|
934
|
+
className="pax-selector__age-section-title">
|
|
861
935
|
Please specify the age :
|
|
862
936
|
</Text>
|
|
863
|
-
|
|
937
|
+
|
|
864
938
|
<div className="pax-selector__age-groups">
|
|
865
939
|
{/* Helper function to chunk ages into rows of 2 */}
|
|
866
940
|
{(() => {
|
|
867
|
-
const chunkAges = (
|
|
941
|
+
const chunkAges = (
|
|
942
|
+
ages: (number | undefined)[],
|
|
943
|
+
category: string
|
|
944
|
+
) => {
|
|
868
945
|
const chunks: (number | undefined)[][] = [];
|
|
869
946
|
for (let i = 0; i < ages.length; i += 2) {
|
|
870
947
|
chunks.push(ages.slice(i, i + 2));
|
|
@@ -872,11 +949,24 @@ const PaxSelector: React.FC<PaxSelectorProps> = ({
|
|
|
872
949
|
return chunks;
|
|
873
950
|
};
|
|
874
951
|
|
|
875
|
-
const teenAgeChunks = chunkAges(
|
|
876
|
-
|
|
877
|
-
|
|
952
|
+
const teenAgeChunks = chunkAges(
|
|
953
|
+
internalData.teenAges || [],
|
|
954
|
+
'Teen'
|
|
955
|
+
);
|
|
956
|
+
const childAgeChunks = chunkAges(
|
|
957
|
+
internalData.childAges || [],
|
|
958
|
+
'Child'
|
|
959
|
+
);
|
|
960
|
+
const infantAgeChunks = chunkAges(
|
|
961
|
+
internalData.infantAges || [],
|
|
962
|
+
'Infant'
|
|
963
|
+
);
|
|
878
964
|
|
|
879
|
-
const handleAgeChange = (
|
|
965
|
+
const handleAgeChange = (
|
|
966
|
+
category: 'teenAges' | 'childAges' | 'infantAges',
|
|
967
|
+
index: number,
|
|
968
|
+
age: number
|
|
969
|
+
) => {
|
|
880
970
|
const ages = [...(internalData[category] || [])];
|
|
881
971
|
ages[index] = age;
|
|
882
972
|
handleDataChange(category, ages);
|
|
@@ -885,61 +975,88 @@ const PaxSelector: React.FC<PaxSelectorProps> = ({
|
|
|
885
975
|
return (
|
|
886
976
|
<>
|
|
887
977
|
{/* Teen ages */}
|
|
888
|
-
{internalData.teens > 0 &&
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
978
|
+
{internalData.teens > 0 &&
|
|
979
|
+
teenAgeChunks.map((chunk, chunkIndex) => (
|
|
980
|
+
<div
|
|
981
|
+
key={`teen-chunk-${chunkIndex}`}
|
|
982
|
+
className="pax-selector__age-row">
|
|
983
|
+
{chunk.map((age, ageIndex) => {
|
|
984
|
+
const actualIndex = chunkIndex * 2 + ageIndex;
|
|
985
|
+
return (
|
|
986
|
+
<AgeSelector
|
|
987
|
+
key={`teen-${actualIndex}`}
|
|
988
|
+
label="Teen"
|
|
989
|
+
value={age}
|
|
990
|
+
onChange={(selectedAge) =>
|
|
991
|
+
handleAgeChange(
|
|
992
|
+
'teenAges',
|
|
993
|
+
actualIndex,
|
|
994
|
+
selectedAge
|
|
995
|
+
)
|
|
996
|
+
}
|
|
997
|
+
ageRange={CHILD_CATEGORY_AGES}
|
|
998
|
+
required
|
|
999
|
+
/>
|
|
1000
|
+
);
|
|
1001
|
+
})}
|
|
1002
|
+
</div>
|
|
1003
|
+
))}
|
|
905
1004
|
|
|
906
1005
|
{/* Child ages */}
|
|
907
|
-
{internalData.children > 0 &&
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
1006
|
+
{internalData.children > 0 &&
|
|
1007
|
+
childAgeChunks.map((chunk, chunkIndex) => (
|
|
1008
|
+
<div
|
|
1009
|
+
key={`child-chunk-${chunkIndex}`}
|
|
1010
|
+
className="pax-selector__age-row">
|
|
1011
|
+
{chunk.map((age, ageIndex) => {
|
|
1012
|
+
const actualIndex = chunkIndex * 2 + ageIndex;
|
|
1013
|
+
return (
|
|
1014
|
+
<AgeSelector
|
|
1015
|
+
key={`child-${actualIndex}`}
|
|
1016
|
+
label="Child"
|
|
1017
|
+
value={age}
|
|
1018
|
+
onChange={(selectedAge) =>
|
|
1019
|
+
handleAgeChange(
|
|
1020
|
+
'childAges',
|
|
1021
|
+
actualIndex,
|
|
1022
|
+
selectedAge
|
|
1023
|
+
)
|
|
1024
|
+
}
|
|
1025
|
+
ageRange={CHILD_CATEGORY_AGES}
|
|
1026
|
+
required
|
|
1027
|
+
/>
|
|
1028
|
+
);
|
|
1029
|
+
})}
|
|
1030
|
+
</div>
|
|
1031
|
+
))}
|
|
924
1032
|
|
|
925
1033
|
{/* Infant ages */}
|
|
926
|
-
{internalData.infants > 0 &&
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
1034
|
+
{internalData.infants > 0 &&
|
|
1035
|
+
infantAgeChunks.map((chunk, chunkIndex) => (
|
|
1036
|
+
<div
|
|
1037
|
+
key={`infant-chunk-${chunkIndex}`}
|
|
1038
|
+
className="pax-selector__age-row">
|
|
1039
|
+
{chunk.map((age, ageIndex) => {
|
|
1040
|
+
const actualIndex = chunkIndex * 2 + ageIndex;
|
|
1041
|
+
return (
|
|
1042
|
+
<AgeSelector
|
|
1043
|
+
key={`infant-${actualIndex}`}
|
|
1044
|
+
label="Infant"
|
|
1045
|
+
value={age}
|
|
1046
|
+
onChange={(selectedAge) =>
|
|
1047
|
+
handleAgeChange(
|
|
1048
|
+
'infantAges',
|
|
1049
|
+
actualIndex,
|
|
1050
|
+
selectedAge
|
|
1051
|
+
)
|
|
1052
|
+
}
|
|
1053
|
+
ageRange={CHILD_CATEGORY_AGES}
|
|
1054
|
+
required
|
|
1055
|
+
/>
|
|
1056
|
+
);
|
|
1057
|
+
})}
|
|
1058
|
+
</div>
|
|
1059
|
+
))}
|
|
943
1060
|
</>
|
|
944
1061
|
);
|
|
945
1062
|
})()}
|
|
@@ -958,15 +1075,10 @@ const PaxSelector: React.FC<PaxSelectorProps> = ({
|
|
|
958
1075
|
<button
|
|
959
1076
|
type="button"
|
|
960
1077
|
className="pax-selector__clear-btn"
|
|
961
|
-
onClick={handleClear}
|
|
962
|
-
>
|
|
1078
|
+
onClick={handleClear}>
|
|
963
1079
|
Clear Pax
|
|
964
1080
|
</button>
|
|
965
|
-
<button
|
|
966
|
-
type="button"
|
|
967
|
-
className="pax-selector__done-btn"
|
|
968
|
-
onClick={handleDone}
|
|
969
|
-
>
|
|
1081
|
+
<button type="button" className="pax-selector__done-btn" onClick={handleDone}>
|
|
970
1082
|
Done
|
|
971
1083
|
</button>
|
|
972
1084
|
</div>
|