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.
Files changed (141) hide show
  1. package/dist/components/atoms/Checkbox/Checkbox.d.ts +3 -2
  2. package/dist/components/atoms/Checkbox/Checkbox.js +16 -6
  3. package/dist/components/atoms/Icon/icons/PlusCircleIcon.js +1 -1
  4. package/dist/components/atoms/Inputs/Input/Input.d.ts +1 -1
  5. package/dist/components/molecules/AddItemButton/AddItemButton.css +2088 -0
  6. package/dist/components/molecules/AddItemButton/AddItemButton.d.ts +7 -0
  7. package/dist/components/molecules/AddItemButton/AddItemButton.js +19 -0
  8. package/dist/components/molecules/BookingPax/BookingPax.d.ts +43 -0
  9. package/dist/components/molecules/BookingPax/BookingPax.js +43 -0
  10. package/dist/components/molecules/BookingPax/BookingPaxAccom.d.ts +34 -0
  11. package/dist/components/molecules/BookingPax/BookingPaxClient/BookingPaxClient.css +10 -0
  12. package/dist/components/molecules/BookingPax/BookingPaxClient/BookingPaxClient.d.ts +89 -1
  13. package/dist/components/molecules/BookingPax/BookingPaxClient/BookingPaxClient.js +34 -11
  14. package/dist/components/molecules/BookingPax/BookingPaxExcursion.d.ts +43 -0
  15. package/dist/components/molecules/BookingPax/BookingPaxExcursion.js +19 -0
  16. package/dist/components/molecules/BookingPax/BookingPaxHeader.d.ts +15 -0
  17. package/dist/components/molecules/BookingPax/BookingPaxHeader.js +13 -0
  18. package/dist/components/molecules/BookingPax/BookingPaxLayout/BookingPaxLayout.d.ts +30 -0
  19. package/dist/components/molecules/BookingPax/BookingPaxLayout/BookingPaxLayout.js +15 -0
  20. package/dist/components/molecules/BookingPax/BookingPaxRemarks.d.ts +14 -0
  21. package/dist/components/molecules/BookingPax/BookingPaxRemarks.js +11 -0
  22. package/dist/components/molecules/BookingPax/BookingPaxTransfer.d.ts +51 -0
  23. package/dist/components/molecules/BookingPax/BookingPaxTransfer.js +19 -2
  24. package/dist/components/molecules/BookingPax/index.d.ts +1 -0
  25. package/dist/components/molecules/BookingPax/index.js +1 -0
  26. package/dist/components/molecules/Calendar/DateTime.d.ts +5 -5
  27. package/dist/components/molecules/Calendar/DateTime.js +48 -37
  28. package/dist/components/molecules/DialogContentPolicy/DialogCancellationList.d.ts +20 -0
  29. package/dist/components/molecules/DialogContentPolicy/DialogCancellationList.js +17 -6
  30. package/dist/components/molecules/DialogContentPolicy/DialogContentPolicy.d.ts +18 -0
  31. package/dist/components/molecules/DialogContentPolicy/DialogContentPolicy.js +14 -3
  32. package/dist/components/molecules/ServiceSelector/ServiceSelector.d.ts +3 -0
  33. package/dist/components/molecules/ServiceSelector/ServiceSelector.js +23 -12
  34. package/dist/components/organisms/Booking/BookingPaxList.d.ts +64 -0
  35. package/dist/components/organisms/Booking/BookingPaxList.js +19 -0
  36. package/dist/components/organisms/BookingAddItem/AddItemNewService.d.ts +12 -0
  37. package/dist/components/organisms/BookingAddItem/AddItemNewService.js +48 -0
  38. package/dist/components/organisms/BookingAddItem/AddItemSelector.d.ts +9 -0
  39. package/dist/components/organisms/BookingAddItem/AddItemSelector.js +23 -0
  40. package/dist/components/organisms/BookingAddItem/BookingAddItem.d.ts +16 -0
  41. package/dist/components/organisms/BookingAddItem/BookingAddItem.js +66 -0
  42. package/dist/components/organisms/BookingAddItem/index.d.ts +3 -0
  43. package/dist/components/organisms/BookingAddItem/index.js +3 -0
  44. package/dist/components/organisms/DateTimePicker/DateTimePicker.js +11 -7
  45. package/dist/components/organisms/Dialog/Dialog.d.ts +1 -1
  46. package/dist/components/organisms/Dialog/Dialog.js +4 -4
  47. package/dist/components/organisms/DialogBookingConfirm/BookingCancellationPolicy.d.ts +29 -0
  48. package/dist/components/organisms/DialogBookingConfirm/BookingCancellationPolicy.js +31 -0
  49. package/dist/components/organisms/DialogBookingConfirm/BookingMailSent.d.ts +29 -0
  50. package/dist/components/organisms/DialogBookingConfirm/BookingMailSent.js +31 -0
  51. package/dist/components/organisms/DialogBookingConfirm/BookingReference.d.ts +35 -0
  52. package/dist/components/organisms/DialogBookingConfirm/BookingReference.js +37 -0
  53. package/dist/components/organisms/DialogBookingConfirm/BookingSuccess.d.ts +35 -0
  54. package/dist/components/organisms/DialogBookingConfirm/BookingSuccess.js +33 -0
  55. package/dist/components/organisms/DialogBookingConfirm/DialogBookingConfirm.d.ts +39 -2
  56. package/dist/components/organisms/DialogBookingConfirm/DialogBookingConfirm.js +25 -1
  57. package/dist/components/organisms/DialogBookingConfirm/index.d.ts +5 -0
  58. package/dist/components/organisms/DialogBookingConfirm/index.js +1 -0
  59. package/dist/components/organisms/PaxSelector/PaxSelector.d.ts +1 -0
  60. package/dist/components/organisms/PaxSelector/PaxSelector.js +50 -28
  61. package/dist/components/organisms/TabCancellationPolicy/CancellationAccom.d.ts +25 -0
  62. package/dist/components/organisms/TabCancellationPolicy/CancellationAccom.js +16 -0
  63. package/dist/components/organisms/TabCancellationPolicy/CancellationBody.d.ts +24 -0
  64. package/dist/components/organisms/TabCancellationPolicy/CancellationBody.js +24 -0
  65. package/dist/components/organisms/TabCancellationPolicy/CancellationExcursion.d.ts +30 -0
  66. package/dist/components/organisms/TabCancellationPolicy/CancellationExcursion.js +15 -0
  67. package/dist/components/organisms/TabCancellationPolicy/CancellationHeader.d.ts +23 -0
  68. package/dist/components/organisms/TabCancellationPolicy/CancellationHeader.js +23 -0
  69. package/dist/components/organisms/TabCancellationPolicy/CancellationTransfer.d.ts +22 -0
  70. package/dist/components/organisms/TabCancellationPolicy/CancellationTransfer.js +13 -0
  71. package/dist/components/organisms/TabCancellationPolicy/HeaderAccom.d.ts +22 -0
  72. package/dist/components/organisms/TabCancellationPolicy/HeaderAccom.js +13 -0
  73. package/dist/components/organisms/TabCancellationPolicy/HeaderExcursion.d.ts +18 -0
  74. package/dist/components/organisms/TabCancellationPolicy/HeaderExcursion.js +12 -0
  75. package/dist/components/organisms/TabCancellationPolicy/PolicyAccom/PolicyAccom.css +7 -0
  76. package/dist/components/organisms/TabCancellationPolicy/PolicyAccom/PolicyAccom.js +2 -1
  77. package/dist/components/organisms/TabCancellationPolicy/PolicyExcursion.d.ts +18 -0
  78. package/dist/components/organisms/TabCancellationPolicy/PolicyExcursion.js +12 -0
  79. package/dist/components/organisms/TabCancellationPolicy/PolicyTransfer.d.ts +11 -0
  80. package/dist/components/organisms/TabCancellationPolicy/PolicyTransfer.js +11 -0
  81. package/dist/components/organisms/TabCancellationPolicy/TabCancellationPolicy.d.ts +29 -0
  82. package/dist/components/organisms/TabCancellationPolicy/TabCancellationPolicy.js +29 -0
  83. package/dist/components/ui/popover.js +1 -1
  84. package/dist/index.d.ts +7 -0
  85. package/dist/index.js +4 -2
  86. package/dist/styles/components/checkbox.css +16 -9
  87. package/dist/styles/components/molecule/calendarInput.css +3 -4
  88. package/dist/styles/components/molecule/service-selector.css +70 -21
  89. package/package.json +1 -2
  90. package/src/components/atoms/Checkbox/Checkbox.tsx +38 -23
  91. package/src/components/atoms/Icon/icons/PlusCircleIcon.tsx +2 -2
  92. package/src/components/atoms/Inputs/Input/Input.tsx +1 -1
  93. package/src/components/molecules/AddItemButton/AddItemButton.css +5 -0
  94. package/src/components/molecules/AddItemButton/AddItemButton.tsx +18 -0
  95. package/src/components/molecules/BookingPax/BookingPax.tsx +43 -0
  96. package/src/components/molecules/BookingPax/BookingPaxAccom.tsx +34 -0
  97. package/src/components/molecules/BookingPax/BookingPaxClient/BookingPaxClient.css +6 -0
  98. package/src/components/molecules/BookingPax/BookingPaxClient/BookingPaxClient.tsx +92 -18
  99. package/src/components/molecules/BookingPax/BookingPaxExcursion.tsx +43 -0
  100. package/src/components/molecules/BookingPax/BookingPaxHeader.tsx +28 -1
  101. package/src/components/molecules/BookingPax/BookingPaxLayout/BookingPaxLayout.tsx +30 -0
  102. package/src/components/molecules/BookingPax/BookingPaxRemarks.tsx +14 -0
  103. package/src/components/molecules/BookingPax/BookingPaxTransfer.tsx +52 -2
  104. package/src/components/molecules/BookingPax/index.ts +2 -0
  105. package/src/components/molecules/Calendar/DateTime.tsx +69 -53
  106. package/src/components/molecules/DialogContentPolicy/DialogCancellationList.tsx +32 -12
  107. package/src/components/molecules/DialogContentPolicy/DialogContentPolicy.tsx +27 -11
  108. package/src/components/molecules/ServiceSelector/ServiceSelector.tsx +91 -83
  109. package/src/components/organisms/Booking/BookingPaxList.tsx +64 -0
  110. package/src/components/organisms/BookingAddItem/AddItemNewService.tsx +95 -0
  111. package/src/components/organisms/BookingAddItem/AddItemSelector.tsx +43 -0
  112. package/src/components/organisms/BookingAddItem/BookingAddItem.tsx +120 -0
  113. package/src/components/organisms/BookingAddItem/index.ts +3 -0
  114. package/src/components/organisms/DateTimePicker/DateTimePicker.tsx +13 -7
  115. package/src/components/organisms/Dialog/Dialog.tsx +13 -20
  116. package/src/components/organisms/DialogBookingConfirm/BookingCancellationPolicy.tsx +44 -0
  117. package/src/components/organisms/DialogBookingConfirm/BookingMailSent.tsx +56 -0
  118. package/src/components/organisms/DialogBookingConfirm/BookingReference.tsx +74 -0
  119. package/src/components/organisms/DialogBookingConfirm/BookingSuccess.tsx +67 -0
  120. package/src/components/organisms/DialogBookingConfirm/DialogBookingConfirm.tsx +43 -2
  121. package/src/components/organisms/DialogBookingConfirm/index.ts +6 -0
  122. package/src/components/organisms/PaxSelector/PaxSelector.tsx +305 -193
  123. package/src/components/organisms/TabCancellationPolicy/CancellationAccom.tsx +25 -0
  124. package/src/components/organisms/TabCancellationPolicy/CancellationBody.tsx +24 -0
  125. package/src/components/organisms/TabCancellationPolicy/CancellationExcursion.tsx +30 -0
  126. package/src/components/organisms/TabCancellationPolicy/CancellationHeader.tsx +23 -0
  127. package/src/components/organisms/TabCancellationPolicy/CancellationTransfer.tsx +22 -0
  128. package/src/components/organisms/TabCancellationPolicy/HeaderAccom.tsx +22 -0
  129. package/src/components/organisms/TabCancellationPolicy/HeaderExcursion.tsx +18 -0
  130. package/src/components/organisms/TabCancellationPolicy/PolicyAccom/PolicyAccom.css +3 -0
  131. package/src/components/organisms/TabCancellationPolicy/PolicyAccom/PolicyAccom.tsx +3 -2
  132. package/src/components/organisms/TabCancellationPolicy/PolicyExcursion.tsx +18 -0
  133. package/src/components/organisms/TabCancellationPolicy/PolicyTransfer.tsx +11 -0
  134. package/src/components/organisms/TabCancellationPolicy/TabCancellationPolicy.tsx +29 -0
  135. package/src/components/ui/popover.tsx +2 -4
  136. package/src/styles/components/checkbox.css +16 -9
  137. package/src/styles/components/molecule/calendarInput.css +12 -13
  138. package/src/styles/components/molecule/service-selector.css +71 -23
  139. package/dist/components/ui/checkbox.d.ts +0 -4
  140. package/dist/components/ui/checkbox.js +0 -31
  141. package/src/components/ui/checkbox.tsx +0 -32
@@ -19,11 +19,28 @@ import { BookingPaxClient, } from './BookingPaxClient/BookingPaxClient';
19
19
  import { BookingPaxHeader } from './BookingPaxHeader';
20
20
  import { BookingPaxLayout } from './BookingPaxLayout/BookingPaxLayout';
21
21
  import { BookingPaxRemarks } from './BookingPaxRemarks';
22
- var mapType = {
22
+ export var mapTransferType = {
23
23
  ARV: 'Arrival',
24
24
  DEP: 'Departure',
25
25
  INH: 'Inter-Hotel',
26
26
  };
27
+ /**
28
+ * BookingPaxTransfer is a component that allows the user to display the booking pax transfer.
29
+ *
30
+ * @example
31
+ * <BookingPaxTransfer
32
+ * type="ARV"
33
+ * from="Plaisance Airport"
34
+ * to="Grand Paradise Hotel"
35
+ * clientsInfo={clientsInfo}
36
+ * paxCount={2}
37
+ * selectedClientsInfoIds={{ 0: [] }}
38
+ * isSubmitted={false}
39
+ * onPaxChange={onPaxChange}
40
+ *
41
+ * @param props - The props for the BookingPaxTransfer component.
42
+ * @returns The BookingPaxTransfer component.
43
+ */
27
44
  export var BookingPaxTransfer = function (props) {
28
45
  var from = props.from, to = props.to, type = props.type, clientsInfo = props.clientsInfo, paxCount = props.paxCount, selectedClientsInfoIds = props.selectedClientsInfoIds, isSubmitted = props.isSubmitted, onPaxChange = props.onPaxChange, onRemarkChange = props.onRemarkChange, onTimeChange = props.onTimeChange, onError = props.onError, onFlightNumberChange = props.onFlightNumberChange;
29
46
  var _a = useBookingPax(selectedClientsInfoIds), changeOptions = _a.changeOptions, onPaxOptionsChange = _a.onPaxOptionsChange, onSelectedClients = _a.onSelectedClients;
@@ -36,5 +53,5 @@ export var BookingPaxTransfer = function (props) {
36
53
  useEffect(function () {
37
54
  onSelectedClients(clientsInfo, onPaxChange);
38
55
  }, [changeOptions, onPaxChange]);
39
- return (_jsxs(BookingPaxLayout, __assign({ title: _jsxs(_Fragment, { children: ["Transfer", ' ', _jsxs(Text, __assign({ as: "span", color: "accent", variant: "bold", size: "xl", className: "italic" }, { children: ["(", mapType[type], ")"] }))] }), icon: "car", className: "booking-pax-accom", header: _jsx(BookingPaxHeader, { children: _jsx(BookingPaxHeader.Location, { from: from, to: to }) }) }, { children: [type === 'INH' ? (_jsx(DateTimePicker, { icon: "clock", mode: "time", onValueChange: onTimeChange, placeholder: "Time of Transfer" })) : (_jsx(Input, { icon: "arrival", iconPosition: "leading", placeholder: "Flight number", onChange: handleFlightNumberChange })), _jsx(BookingPaxClient, { id: id, clients: clientsInfo, selectedClientsInfoIds: selectedClientsInfoIds, selectedIndex: 0, paxCount: paxCount, isSubmitted: isSubmitted, onPaxChange: onPaxOptionsChange, onError: onError }), _jsx(BookingPaxRemarks, { onChange: onRemarkChange })] })));
56
+ return (_jsxs(BookingPaxLayout, __assign({ title: _jsxs(_Fragment, { children: ["Transfer", ' ', _jsxs(Text, __assign({ as: "span", color: "accent", variant: "bold", size: "xl", className: "italic" }, { children: ["(", mapTransferType[type], ")"] }))] }), icon: "car", className: "booking-pax-accom", header: _jsx(BookingPaxHeader, { children: _jsx(BookingPaxHeader.Location, { from: from, to: to }) }) }, { children: [type === 'INH' ? (_jsx(DateTimePicker, { icon: "clock", mode: "time", onValueChange: onTimeChange, placeholder: "Time of Transfer" })) : (_jsx(Input, { icon: "arrival", iconPosition: "leading", placeholder: "Flight number", onChange: handleFlightNumberChange })), _jsx(BookingPaxClient, { id: id, clients: clientsInfo, selectedClientsInfoIds: selectedClientsInfoIds, selectedIndex: 0, paxCount: paxCount, isSubmitted: isSubmitted, onPaxChange: onPaxOptionsChange, onError: onError }), _jsx(BookingPaxRemarks, { onChange: onRemarkChange })] })));
40
57
  };
@@ -2,4 +2,5 @@ export type { BookingPaxAccomProps, RoomData } from './BookingPaxAccom';
2
2
  export type { BookingPaxClientInfo, BookingPaxClientProps, } from './BookingPaxClient/BookingPaxClient';
3
3
  export type { BookingPaxExcursionProps } from './BookingPaxExcursion';
4
4
  export type { BookingPaxTransferProps } from './BookingPaxTransfer';
5
+ export { mapTransferType } from './BookingPaxTransfer';
5
6
  export * from './BookingPax';
@@ -1 +1,2 @@
1
+ export { mapTransferType } from './BookingPaxTransfer';
1
2
  export * from './BookingPax';
@@ -1,8 +1,8 @@
1
1
  /// <reference types="react" />
2
- import { DateRange } from "react-day-picker";
2
+ import { DateRange } from 'react-day-picker';
3
3
  export interface DateTimeProps {
4
- mode?: "calendar" | "time" | "both";
5
- selectionMode?: "single" | "range";
4
+ mode?: 'calendar' | 'time' | 'both';
5
+ selectionMode?: 'single' | 'range';
6
6
  numberOfMonths?: 1 | 2;
7
7
  disableBeforeToday?: boolean;
8
8
  disableToday?: boolean;
@@ -10,14 +10,14 @@ export interface DateTimeProps {
10
10
  defaultTime?: {
11
11
  hour: string;
12
12
  minute: string;
13
- meridiem: "AM" | "PM";
13
+ meridiem: 'AM' | 'PM';
14
14
  };
15
15
  onChange?: (payload: {
16
16
  dateRange?: DateRange;
17
17
  time?: {
18
18
  hour: string;
19
19
  minute: string;
20
- meridiem: "AM" | "PM";
20
+ meridiem: 'AM' | 'PM';
21
21
  };
22
22
  }) => void;
23
23
  }
@@ -10,23 +10,26 @@ var __assign = (this && this.__assign) || function () {
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
- import { useState, useEffect } from "react";
14
- import { Calendar } from "../../ui/calendar";
15
- import { Button } from "../../ui/button";
16
- import TimePicker from "./TimePicker";
17
- import Icon from "../../atoms/Icon/Icon";
13
+ import { useEffect, useState } from 'react';
14
+ import Icon from '../../atoms/Icon/Icon';
15
+ import { Button } from '../../ui/button';
16
+ import { Calendar } from '../../ui/calendar';
17
+ import TimePicker from './TimePicker';
18
18
  var DateTime = function (_a) {
19
19
  var _b, _c, _d;
20
- var _e = _a.mode, mode = _e === void 0 ? "both" : _e, _f = _a.selectionMode, selectionMode = _f === void 0 ? "range" : _f, _g = _a.numberOfMonths, numberOfMonths = _g === void 0 ? 2 : _g, _h = _a.disableBeforeToday, disableBeforeToday = _h === void 0 ? true : _h, _j = _a.disableToday, disableToday = _j === void 0 ? false : _j, defaultDateRange = _a.defaultDateRange, defaultTime = _a.defaultTime, onChange = _a.onChange;
20
+ var _e = _a.mode, mode = _e === void 0 ? 'both' : _e, _f = _a.selectionMode, selectionMode = _f === void 0 ? 'range' : _f, _g = _a.numberOfMonths, numberOfMonths = _g === void 0 ? 2 : _g, _h = _a.disableBeforeToday, disableBeforeToday = _h === void 0 ? true : _h, _j = _a.disableToday, disableToday = _j === void 0 ? false : _j, defaultDateRange = _a.defaultDateRange, defaultTime = _a.defaultTime, onChange = _a.onChange;
21
21
  var _k = useState(defaultDateRange), dateRange = _k[0], setDateRange = _k[1];
22
- var _l = useState((_b = defaultTime === null || defaultTime === void 0 ? void 0 : defaultTime.hour) !== null && _b !== void 0 ? _b : "12"), hours = _l[0], setHours = _l[1];
23
- var _m = useState((_c = defaultTime === null || defaultTime === void 0 ? void 0 : defaultTime.minute) !== null && _c !== void 0 ? _c : "00"), minutes = _m[0], setMinutes = _m[1];
24
- var _o = useState((_d = defaultTime === null || defaultTime === void 0 ? void 0 : defaultTime.meridiem) !== null && _d !== void 0 ? _d : "AM"), amPm = _o[0], setAmPm = _o[1];
22
+ var _l = useState(defaultDateRange === null || defaultDateRange === void 0 ? void 0 : defaultDateRange.from), month = _l[0], setMonth = _l[1];
23
+ var _m = useState((_b = defaultTime === null || defaultTime === void 0 ? void 0 : defaultTime.hour) !== null && _b !== void 0 ? _b : '12'), hours = _m[0], setHours = _m[1];
24
+ var _o = useState((_c = defaultTime === null || defaultTime === void 0 ? void 0 : defaultTime.minute) !== null && _c !== void 0 ? _c : '00'), minutes = _o[0], setMinutes = _o[1];
25
+ var _p = useState((_d = defaultTime === null || defaultTime === void 0 ? void 0 : defaultTime.meridiem) !== null && _d !== void 0 ? _d : 'AM'), amPm = _p[0], setAmPm = _p[1];
25
26
  // notify parent when date or time changes
26
27
  useEffect(function () {
27
28
  onChange === null || onChange === void 0 ? void 0 : onChange({
28
29
  dateRange: dateRange !== null && dateRange !== void 0 ? dateRange : undefined,
29
- time: mode === "calendar" ? undefined : { hour: hours, minute: minutes, meridiem: amPm },
30
+ time: mode === 'calendar'
31
+ ? undefined
32
+ : { hour: hours, minute: minutes, meridiem: amPm },
30
33
  });
31
34
  }, [dateRange, hours, minutes, amPm, onChange, mode]);
32
35
  var handleSelect = function (val) {
@@ -46,9 +49,9 @@ var DateTime = function (_a) {
46
49
  setDateRange(val);
47
50
  };
48
51
  var resetTime = function () {
49
- setHours("12");
50
- setMinutes("00");
51
- setAmPm("AM");
52
+ setHours('12');
53
+ setMinutes('00');
54
+ setAmPm('AM');
52
55
  };
53
56
  var clearSelection = function () {
54
57
  setDateRange(undefined);
@@ -59,7 +62,7 @@ var DateTime = function (_a) {
59
62
  today.setHours(0, 0, 0, 0);
60
63
  setDateRange({ from: today, to: today });
61
64
  };
62
- var calendarMode = selectionMode === "single" ? "single" : "range";
65
+ var calendarMode = selectionMode === 'single' ? 'single' : 'range';
63
66
  var buildDisabled = function () {
64
67
  var disabled = [];
65
68
  if (disableBeforeToday) {
@@ -75,32 +78,40 @@ var DateTime = function (_a) {
75
78
  return disabled.length ? disabled : undefined;
76
79
  };
77
80
  var disabledDays = buildDisabled();
78
- return (_jsxs("div", __assign({ className: "calendar--dropdown" }, { children: [mode !== "time" && (function () {
79
- var calendarProps = {
80
- mode: calendarMode,
81
- selected: dateRange,
82
- onSelect: handleSelect,
83
- weekStartsOn: 1,
84
- showOutsideDays: false,
85
- numberOfMonths: numberOfMonths,
86
- disabled: disabledDays,
87
- className: "p-0",
88
- formatters: {
89
- formatWeekdayName: function (weekday, options) {
90
- var _a;
91
- return weekday
92
- .toLocaleDateString((_a = options === null || options === void 0 ? void 0 : options.locale) === null || _a === void 0 ? void 0 : _a.code, { weekday: "short" })
93
- .toUpperCase();
81
+ useEffect(function () {
82
+ if (defaultDateRange) {
83
+ setMonth(defaultDateRange === null || defaultDateRange === void 0 ? void 0 : defaultDateRange.from);
84
+ }
85
+ }, [defaultDateRange]);
86
+ return (_jsxs("div", __assign({ className: "calendar--dropdown" }, { children: [mode !== 'time' &&
87
+ (function () {
88
+ var calendarProps = {
89
+ mode: calendarMode,
90
+ selected: dateRange,
91
+ onSelect: handleSelect,
92
+ weekStartsOn: 1,
93
+ month: month,
94
+ onMonthChange: setMonth,
95
+ showOutsideDays: false,
96
+ numberOfMonths: numberOfMonths,
97
+ disabled: disabledDays,
98
+ className: 'p-0',
99
+ formatters: {
100
+ formatWeekdayName: function (weekday, options) {
101
+ var _a;
102
+ return weekday
103
+ .toLocaleDateString((_a = options === null || options === void 0 ? void 0 : options.locale) === null || _a === void 0 ? void 0 : _a.code, { weekday: 'short' })
104
+ .toUpperCase();
105
+ },
94
106
  },
95
- },
96
- };
97
- return _jsx(Calendar, __assign({}, calendarProps));
98
- })(), mode !== "calendar" && (_jsx("div", __assign({ className: "".concat(mode === "both" ? "calendar--time_container_separated" : "") }, { children: _jsx(TimePicker, { label: "Time", hour: hours, minute: minutes, meridiem: amPm, onChange: function (h, m, mm) {
99
- var hh = String(Math.max(0, Math.min(12, Number(h || 0)))).padStart(2, "0");
100
- var mmn = String(Math.max(0, Math.min(59, Number(m || 0)))).padStart(2, "0");
107
+ };
108
+ return _jsx(Calendar, __assign({}, calendarProps));
109
+ })(), mode !== 'calendar' && (_jsx("div", __assign({ className: "".concat(mode === 'both' ? 'calendar--time_container_separated' : '') }, { children: _jsx(TimePicker, { label: "Time", hour: hours, minute: minutes, meridiem: amPm, onChange: function (h, m, mm) {
110
+ var hh = String(Math.max(0, Math.min(12, Number(h || 0)))).padStart(2, '0');
111
+ var mmn = String(Math.max(0, Math.min(59, Number(m || 0)))).padStart(2, '0');
101
112
  setHours(hh);
102
113
  setMinutes(mmn);
103
114
  setAmPm(mm);
104
- } }) }))), mode !== "time" && (_jsxs("div", __assign({ className: "calendar--footer" }, { children: [_jsxs(Button, __assign({ variant: "ghost", size: "sm", onClick: selectToday, type: "button", className: "calendar--footer--button", disabled: disableToday }, { children: [_jsx(Icon, { name: "calendar-outline", size: "sm" }), "Today"] })), _jsx(Button, __assign({ variant: "ghost", size: "sm", onClick: clearSelection, type: "button", className: "calendar--footer--button" }, { children: "Clear" }))] })))] })));
115
+ } }) }))), mode !== 'time' && (_jsxs("div", __assign({ className: "calendar--footer" }, { children: [_jsxs(Button, __assign({ variant: "ghost", size: "sm", onClick: selectToday, type: "button", className: "calendar--footer--button", disabled: disableToday }, { children: [_jsx(Icon, { name: "calendar-outline", size: "sm" }), "Today"] })), _jsx(Button, __assign({ variant: "ghost", size: "sm", onClick: clearSelection, type: "button", className: "calendar--footer--button" }, { children: "Clear" }))] })))] })));
105
116
  };
106
117
  export default DateTime;
@@ -2,10 +2,30 @@ import React from 'react';
2
2
  import { DialogCancellationAccomProps } from './DialogCancellationAccom';
3
3
  import { DialogCancellationExcursionProps } from './DialogCancellationExcursion';
4
4
  export interface CancellationItem {
5
+ /**
6
+ * The type of the cancellation.
7
+ */
5
8
  type: 'accommodation' | 'excursion';
9
+ /**
10
+ * The data of the cancellation.
11
+ */
6
12
  data: DialogCancellationAccomProps | DialogCancellationExcursionProps;
7
13
  }
8
14
  export interface DialogCancellationListProps {
15
+ /**
16
+ * The cancellations to display.
17
+ */
9
18
  cancellations: CancellationItem[];
10
19
  }
20
+ /**
21
+ * DialogCancellationList is a component that allows the user to display the cancellations.
22
+ *
23
+ * @example
24
+ * <DialogCancellationList
25
+ * cancellations={cancellations}
26
+ * />
27
+ *
28
+ * @param props - The props for the DialogCancellationList component.
29
+ * @returns The DialogCancellationList component.
30
+ */
11
31
  export declare const DialogCancellationList: React.FC<DialogCancellationListProps>;
@@ -13,14 +13,25 @@ import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import { DialogCancellationAccom, } from './DialogCancellationAccom';
14
14
  import { DialogCancellationExcursion, } from './DialogCancellationExcursion';
15
15
  import { DialogContentPolicy } from './DialogContentPolicy';
16
+ var isAccommodation = function (data) {
17
+ return 'hotelName' in data;
18
+ };
19
+ var isExcursion = function (data) {
20
+ return 'excursionName' in data;
21
+ };
22
+ /**
23
+ * DialogCancellationList is a component that allows the user to display the cancellations.
24
+ *
25
+ * @example
26
+ * <DialogCancellationList
27
+ * cancellations={cancellations}
28
+ * />
29
+ *
30
+ * @param props - The props for the DialogCancellationList component.
31
+ * @returns The DialogCancellationList component.
32
+ */
16
33
  export var DialogCancellationList = function (props) {
17
34
  var cancellations = props.cancellations;
18
- var isAccommodation = function (data) {
19
- return 'hotelName' in data;
20
- };
21
- var isExcursion = function (data) {
22
- return 'excursionName' in data;
23
- };
24
35
  return (_jsx(DialogContentPolicy, { children: cancellations.map(function (c, index) {
25
36
  if (c.type === 'accommodation' && isAccommodation(c.data)) {
26
37
  return _jsx(DialogCancellationAccom, __assign({}, c.data), "acc-".concat(index));
@@ -1,8 +1,26 @@
1
1
  import React from 'react';
2
2
  export interface DialogContentPolicyProps {
3
+ /**
4
+ * The children to display.
5
+ */
3
6
  children: React.ReactNode;
7
+ /**
8
+ * The callback function to call when the submit button is clicked.
9
+ */
4
10
  onSubmit?: () => void;
5
11
  }
12
+ /**
13
+ * DialogContentPolicy is a component that allows the user to display the cancellation policy.
14
+ *
15
+ * @example
16
+ * <DialogContentPolicy
17
+ * children={children}
18
+ * onSubmit={onSubmit}
19
+ * />
20
+ *
21
+ * @param props - The props for the DialogContentPolicy component.
22
+ * @returns The DialogContentPolicy component.
23
+ */
6
24
  export declare const DialogContentPolicy: {
7
25
  (props: DialogContentPolicyProps): import("react/jsx-runtime").JSX.Element;
8
26
  Accommodation: React.FC<import("./DialogCancellationAccom").DialogCancellationAccomProps>;
@@ -12,15 +12,26 @@ var __assign = (this && this.__assign) || function () {
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import { useState } from 'react';
14
14
  import Button from '../../atoms/Button/Button';
15
- import { Text } from '../../atoms/Typography/Typography';
16
- import { Checkbox } from '../../ui/checkbox';
15
+ import Checkbox from '../../atoms/Checkbox/Checkbox';
17
16
  import { DialogCancellationAccom } from './DialogCancellationAccom';
18
17
  import { DialogCancellationExcursion } from './DialogCancellationExcursion';
19
18
  import { DialogCancellationList } from './DialogCancellationList';
19
+ /**
20
+ * DialogContentPolicy is a component that allows the user to display the cancellation policy.
21
+ *
22
+ * @example
23
+ * <DialogContentPolicy
24
+ * children={children}
25
+ * onSubmit={onSubmit}
26
+ * />
27
+ *
28
+ * @param props - The props for the DialogContentPolicy component.
29
+ * @returns The DialogContentPolicy component.
30
+ */
20
31
  export var DialogContentPolicy = function (props) {
21
32
  var children = props.children, onSubmit = props.onSubmit;
22
33
  var _a = useState(false), accepted = _a[0], setAccepted = _a[1];
23
- return (_jsxs("div", __assign({ className: "cancellation-policy" }, { children: [children, _jsxs("div", __assign({ className: "flex justify-end gap-x-8 py-9" }, { children: [_jsxs("div", __assign({ className: "flex gap-x-2.5 items-center" }, { children: [_jsx("label", __assign({ htmlFor: "accept-terms" }, { children: _jsx(Text, __assign({ size: "sm", as: "span" }, { children: "I've read and accept the cancellation policy." })) })), _jsx(Checkbox, { id: "accept-terms", checked: accepted, onCheckedChange: setAccepted })] })), _jsx(Button, __assign({ className: "w-[250px]", variant: "secondary", disabled: !accepted, onClick: onSubmit }, { children: "Next" }))] }))] })));
34
+ return (_jsxs("div", __assign({ className: "cancellation-policy" }, { children: [children, _jsxs("div", __assign({ className: "flex justify-end gap-x-5 py-9" }, { children: [_jsx("div", __assign({ className: "flex gap-x-2.5 items-center" }, { children: _jsx(Checkbox, { checked: accepted, onChange: setAccepted, label: "I've read and accept the cancellation policy.", labelPosition: "leading" }) })), _jsx(Button, __assign({ className: "w-[250px]", variant: "secondary", disabled: !accepted, onClick: onSubmit }, { children: "Next" }))] }))] })));
24
35
  };
25
36
  DialogContentPolicy.Accommodation = DialogCancellationAccom;
26
37
  DialogContentPolicy.Excursion = DialogCancellationExcursion;
@@ -17,6 +17,9 @@ export interface ServiceSelectorProps {
17
17
  disabled?: boolean;
18
18
  /** Additional CSS classes */
19
19
  className?: string;
20
+ /** Options to display */
21
+ options?: ServiceOption[];
20
22
  }
23
+ export declare const DEFAULT_SERVICE_SELECTOR_OPTIONS: ServiceOption[];
21
24
  declare const ServiceSelector: React.FC<ServiceSelectorProps>;
22
25
  export default ServiceSelector;
@@ -10,10 +10,12 @@ var __assign = (this && this.__assign) || function () {
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
- import { useState, useRef, useEffect } from 'react';
13
+ import { cn } from '@/src/lib/utils';
14
+ import { useEffect, useRef, useState } from 'react';
15
+ import '../../../styles/components/molecule/service-selector.css';
14
16
  import Icon from '../../atoms/Icon/Icon';
15
17
  import { Text } from '../../atoms/Typography/Typography';
16
- import '../../../styles/components/molecule/service-selector.css';
18
+ import { Popover, PopoverContent, PopoverTrigger } from '../../ui/popover';
17
19
  var DEFAULT_OPTIONS = [
18
20
  {
19
21
  value: 'accommodation',
@@ -33,9 +35,11 @@ var DEFAULT_OPTIONS = [
33
35
  badge: 'Coming soon',
34
36
  },
35
37
  ];
38
+ export var DEFAULT_SERVICE_SELECTOR_OPTIONS = DEFAULT_OPTIONS;
36
39
  var ServiceSelector = function (_a) {
37
- var value = _a.value, onChange = _a.onChange, _b = _a.disabled, disabled = _b === void 0 ? false : _b, _c = _a.className, className = _c === void 0 ? '' : _c;
38
- var _d = useState(false), isOpen = _d[0], setIsOpen = _d[1];
40
+ var value = _a.value, onChange = _a.onChange, _b = _a.disabled, disabled = _b === void 0 ? false : _b, _c = _a.options, options = _c === void 0 ? DEFAULT_OPTIONS : _c, _d = _a.className, className = _d === void 0 ? '' : _d;
41
+ var _e = useState(value), selectedValue = _e[0], setSelectedValue = _e[1];
42
+ var _f = useState(false), isOpen = _f[0], setIsOpen = _f[1];
39
43
  var dropdownRef = useRef(null);
40
44
  // Close dropdown when clicking outside
41
45
  useEffect(function () {
@@ -59,27 +63,34 @@ var ServiceSelector = function (_a) {
59
63
  return;
60
64
  onChange(option.value);
61
65
  setIsOpen(false);
66
+ setSelectedValue(option.value);
62
67
  };
63
68
  var getDropdownState = function () {
64
69
  if (disabled)
65
70
  return 'disabled';
66
71
  // If a service is selected, always show selected state (even if open)
67
- if (value)
72
+ if (selectedValue)
68
73
  return 'selected';
69
74
  if (isOpen)
70
75
  return 'open';
71
76
  return 'default';
72
77
  };
73
- var selectedOption = value ? DEFAULT_OPTIONS.find(function (opt) { return opt.value === value; }) : null;
78
+ var defaultOptions = options.length > 0 ? options : DEFAULT_OPTIONS;
79
+ var selectedOption = selectedValue
80
+ ? defaultOptions.find(function (opt) { return opt.value === selectedValue; })
81
+ : null;
74
82
  var displayText = selectedOption ? selectedOption.label : 'Select a service';
75
- return (_jsxs("div", __assign({ ref: dropdownRef, className: "service-selector ".concat(className) }, { children: [_jsxs("button", __assign({ type: "button", className: "service-selector__trigger service-selector__trigger--".concat(getDropdownState()), onClick: handleToggleDropdown, disabled: disabled, "aria-expanded": isOpen, "aria-haspopup": "listbox" }, { children: [_jsxs("div", __assign({ className: "service-selector__trigger-content" }, { children: [selectedOption && (_jsx(Icon, { name: selectedOption.icon, size: "md", className: "service-selector__trigger-icon" })), _jsx(Text, __assign({ size: "base", variant: "bold", className: "service-selector__trigger-text" }, { children: displayText }))] })), _jsx(Icon, { name: "chevron-down-new", size: "sm", className: "service-selector__trigger-chevron", style: {
76
- transform: isOpen ? 'rotate(180deg)' : 'rotate(0deg)',
77
- transition: 'transform 0.3s cubic-bezier(0.4, 0, 0.2, 1)',
78
- transformOrigin: 'center'
79
- } })] })), isOpen && (_jsx("div", __assign({ className: "service-selector__panel", role: "listbox" }, { children: _jsx("div", __assign({ className: "service-selector__content" }, { children: _jsx("div", __assign({ className: "service-selector__options-wrapper" }, { children: DEFAULT_OPTIONS.map(function (option) {
83
+ useEffect(function () {
84
+ setSelectedValue(value);
85
+ }, [value]);
86
+ return (_jsxs(Popover, __assign({ open: isOpen, onOpenChange: setIsOpen }, { children: [_jsx(PopoverTrigger, __assign({ asChild: true }, { children: _jsxs("button", __assign({ type: "button", className: cn("service-selector__trigger service-selector__trigger--".concat(getDropdownState()), className), onClick: handleToggleDropdown, disabled: disabled, "aria-expanded": isOpen, "aria-haspopup": "listbox" }, { children: [_jsxs("div", __assign({ className: "service-selector__trigger-content" }, { children: [selectedOption && (_jsx(Icon, { name: selectedOption.icon, size: "md", className: "service-selector__trigger-icon" })), _jsx(Text, __assign({ size: "base", variant: "bold", className: "service-selector__trigger-text" }, { children: displayText }))] })), _jsx(Icon, { name: "chevron-down-new", size: "sm", className: "service-selector__trigger-chevron", style: {
87
+ transform: isOpen ? 'rotate(180deg)' : 'rotate(0deg)',
88
+ transition: 'transform 0.3s cubic-bezier(0.4, 0, 0.2, 1)',
89
+ transformOrigin: 'center',
90
+ } })] })) })), _jsx(PopoverContent, __assign({ className: "service-selector__panel", align: "start" }, { children: _jsx("div", __assign({ className: "service-selector__content" }, { children: _jsx("div", __assign({ className: "service-selector__options-wrapper" }, { children: defaultOptions.map(function (option) {
80
91
  var isSelected = value === option.value;
81
92
  var isDisabled = option.disabled || disabled;
82
93
  return (_jsxs("button", __assign({ type: "button", className: "service-selector__option ".concat(isSelected ? 'service-selector__option--selected' : '', " ").concat(isDisabled ? 'service-selector__option--disabled' : ''), onClick: function () { return handleOptionSelect(option); }, disabled: isDisabled, role: "option", "aria-selected": isSelected }, { children: [_jsx(Icon, { name: option.icon, size: "md", className: "service-selector__option-icon ".concat(isSelected ? 'service-selector__option-icon--selected' : '') }), _jsx(Text, __assign({ size: "base", variant: "bold", color: isSelected ? 'inverted' : 'default', className: "service-selector__option-text" }, { children: option.label })), option.badge && (_jsx("span", __assign({ className: "service-selector__option-badge" }, { children: option.badge })))] }), option.value));
83
- }) })) })) })))] })));
94
+ }) })) })) }))] })));
84
95
  };
85
96
  export default ServiceSelector;
@@ -2,24 +2,88 @@ import React from 'react';
2
2
  import { BookingPaxAccomProps, BookingPaxExcursionProps, BookingPaxTransferProps } from '../../molecules/BookingPax';
3
3
  import { BookingPaxClientInfo, BookingPaxClientOptions } from '../../molecules/BookingPax/BookingPaxClient/BookingPaxClient';
4
4
  export interface BookingPaxData {
5
+ /**
6
+ * The type of the booking pax.
7
+ */
5
8
  type: 'accommodation' | 'excursion' | 'transfer';
9
+ /**
10
+ * The data of the booking pax.
11
+ */
6
12
  data: Omit<BookingPaxAccomProps, 'clientsInfo'> | Omit<BookingPaxExcursionProps, 'clientsInfo'> | Omit<BookingPaxTransferProps, 'clientsInfo'>;
7
13
  }
8
14
  export interface BookingPaxAutoFilledData {
15
+ /**
16
+ * The type of the booking pax.
17
+ */
9
18
  type: BookingPaxData['type'];
19
+ /**
20
+ * The parent index of the booking pax.
21
+ */
10
22
  parentIndex: number;
23
+ /**
24
+ * The room index of the booking pax.
25
+ */
11
26
  roomIndex?: number;
27
+ /**
28
+ * The selected clients of the booking pax.
29
+ */
12
30
  selectedClients: BookingPaxClientInfo[];
13
31
  }
14
32
  export interface BookingPaxProps {
33
+ /**
34
+ * The data of the booking pax.
35
+ */
15
36
  data: BookingPaxData[];
37
+ /**
38
+ * The clients info of the booking pax.
39
+ */
16
40
  clientsInfo: BookingPaxClientInfo[];
41
+ /**
42
+ * Whether the booking pax is submitted.
43
+ */
17
44
  isSubmitted?: boolean;
45
+ /**
46
+ * The callback function to call when the pax changes.
47
+ */
18
48
  onPaxChange?: (index: number, type: BookingPaxData['type'], options: BookingPaxClientOptions) => void;
49
+ /**
50
+ * The callback function to call when the remark changes.
51
+ */
19
52
  onRemarkChange?: (index: number, type: BookingPaxData['type'], value: string) => void;
53
+ /**
54
+ * The callback function to call when the error changes.
55
+ */
20
56
  onError?: (index: number, type: BookingPaxData['type'], hasError: boolean) => void;
57
+ /**
58
+ * The callback function to call when the time changes.
59
+ */
21
60
  onTimeChange?: (index: number, value: string | string[]) => void;
61
+ /**
62
+ * The callback function to call when the flight number changes.
63
+ */
22
64
  onFlightNumberChange?: (index: number, value: string) => void;
65
+ /**
66
+ * The callback function to call when the auto filled data changes.
67
+ */
23
68
  onAutoFilled?: (data: BookingPaxAutoFilledData[]) => void;
24
69
  }
70
+ /**
71
+ * BookingPaxList is a component that allows the user to select the pax for a booking.
72
+ *
73
+ * @example
74
+ * <BookingPaxList
75
+ * data={data}
76
+ * clientsInfo={clientsInfo}
77
+ * isSubmitted={isSubmitted}
78
+ * onPaxChange={onPaxChange}
79
+ * onRemarkChange={onRemarkChange}
80
+ * onError={onError}
81
+ * onTimeChange={onTimeChange}
82
+ * onFlightNumberChange={onFlightNumberChange}
83
+ * onAutoFilled={onAutoFilled}
84
+ * />
85
+ *
86
+ * @param props - The props for the BookingPaxList component.
87
+ * @returns The BookingPaxList component.
88
+ */
25
89
  export declare const BookingPaxList: React.FC<BookingPaxProps>;
@@ -31,6 +31,25 @@ var isExcursionData = function (data) {
31
31
  var isTransferData = function (data) {
32
32
  return 'from' in data && 'to' in data && 'type' in data;
33
33
  };
34
+ /**
35
+ * BookingPaxList is a component that allows the user to select the pax for a booking.
36
+ *
37
+ * @example
38
+ * <BookingPaxList
39
+ * data={data}
40
+ * clientsInfo={clientsInfo}
41
+ * isSubmitted={isSubmitted}
42
+ * onPaxChange={onPaxChange}
43
+ * onRemarkChange={onRemarkChange}
44
+ * onError={onError}
45
+ * onTimeChange={onTimeChange}
46
+ * onFlightNumberChange={onFlightNumberChange}
47
+ * onAutoFilled={onAutoFilled}
48
+ * />
49
+ *
50
+ * @param props - The props for the BookingPaxList component.
51
+ * @returns The BookingPaxList component.
52
+ */
34
53
  export var BookingPaxList = function (props) {
35
54
  var data = props.data, isSubmitted = props.isSubmitted, clientsInfo = props.clientsInfo, onPaxChange = props.onPaxChange, onRemarkChange = props.onRemarkChange, onError = props.onError, onTimeChange = props.onTimeChange, onFlightNumberChange = props.onFlightNumberChange, onAutoFilled = props.onAutoFilled;
36
55
  var _a = useState([]), autoFilledData = _a[0], setAutoFilledData = _a[1];
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ import { BookingPaxClientInfo } from '../../molecules/BookingPax';
3
+ import { ServiceOption, ServiceType } from '../../molecules/ServiceSelector';
4
+ export interface AddItemNewServiceProps {
5
+ options?: ServiceOption[];
6
+ date: string | string[];
7
+ clients: BookingPaxClientInfo[];
8
+ onServiceChange: (service: ServiceType) => void;
9
+ onNext: (selectedClients: BookingPaxClientInfo[]) => void;
10
+ onBack: () => void;
11
+ }
12
+ export declare const AddItemNewService: React.FC<AddItemNewServiceProps>;
@@ -0,0 +1,48 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
13
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
14
+ if (ar || !(i in from)) {
15
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
16
+ ar[i] = from[i];
17
+ }
18
+ }
19
+ return to.concat(ar || Array.prototype.slice.call(from));
20
+ };
21
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
22
+ import { useCallback, useState } from 'react';
23
+ import Button from '../../atoms/Button/Button';
24
+ import Checkbox from '../../atoms/Checkbox/Checkbox';
25
+ import { Text } from '../../atoms/Typography/Typography';
26
+ import ServiceSelector from '../../molecules/ServiceSelector';
27
+ import DateTimePicker from '../DateTimePicker/DateTimePicker';
28
+ export var AddItemNewService = function (props) {
29
+ var date = props.date, options = props.options, clients = props.clients, onServiceChange = props.onServiceChange, onNext = props.onNext, onBack = props.onBack;
30
+ var _a = useState('accommodation'), service = _a[0], setService = _a[1];
31
+ var _b = useState([]), selectedClients = _b[0], setSelectedClients = _b[1];
32
+ var handleServiceChange = function (service) {
33
+ onServiceChange(service);
34
+ setService(service);
35
+ };
36
+ var isAccommodation = service === 'accommodation';
37
+ var selectionMode = isAccommodation ? 'range' : 'single';
38
+ var numberOfMonths = isAccommodation ? 2 : 1;
39
+ var handleClientChange = useCallback(function (client) {
40
+ if (selectedClients.includes(client)) {
41
+ setSelectedClients(selectedClients.filter(function (c) { return c.clientId !== client.clientId; }));
42
+ }
43
+ else {
44
+ setSelectedClients(__spreadArray(__spreadArray([], selectedClients, true), [client], false));
45
+ }
46
+ }, [selectedClients]);
47
+ return (_jsxs("div", __assign({ className: "space-y-9" }, { children: [_jsxs("div", __assign({ className: "flex sm:items-center gap-4 flex-col sm:flex-row" }, { children: [_jsx(ServiceSelector, { className: "sm:basis-[245px] xl:basis-[260px] shrink-0 grow-0", value: service, onChange: handleServiceChange, options: options }), _jsx("div", __assign({ className: "sm:basis-[245px] xl:basis-[260px] shrink-0 grow-0" }, { children: _jsx(DateTimePicker, { mode: "calendar", selectionMode: selectionMode, defaultValue: date, placeholder: "Select date", numberOfMonths: numberOfMonths, iconPosition: "left", iconBGFull: false, showChevron: true }) }))] })), _jsxs("div", __assign({ className: "space-y-4" }, { children: [_jsx(Text, __assign({ variant: "bold" }, { children: "Please select the pax affected by the new service" })), _jsx("ul", { children: clients.map(function (client, index) { return (_jsx("li", { children: _jsx(Checkbox, { id: "cl-".concat(index), label: "".concat(client.firstName, " ").concat(client.lastName, " (").concat(client.clientType).concat(client.clientType !== 'Adult' ? " - ".concat(client.age, " years old") : '', ")"), checked: selectedClients.some(function (c) { return c.clientId === client.clientId; }), onChange: function () { return handleClientChange(client); } }) }, "cl-".concat(index))); }) })] })), _jsxs("div", __assign({ className: "flex justify-end gap-x-4 [&>*]:w-[250px] pb-2" }, { children: [_jsx(Button, __assign({ variant: "outline-secondary", onClick: onBack }, { children: "Back" })), _jsx(Button, __assign({ variant: "secondary", onClick: function () { return onNext(selectedClients); }, disabled: selectedClients.length === 0 }, { children: "Next" }))] }))] })));
48
+ };
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ export declare enum AddItemType {
3
+ NEW = "NEW",
4
+ EXISTING = "EXISTING"
5
+ }
6
+ export interface AddItemSelectorProps {
7
+ onAddItem?: (type: AddItemType) => void;
8
+ }
9
+ export declare const AddItemSelector: React.FC<AddItemSelectorProps>;