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
@@ -0,0 +1,95 @@
1
+ import { useCallback, useState } from 'react';
2
+ import Button from '../../atoms/Button/Button';
3
+ import Checkbox from '../../atoms/Checkbox/Checkbox';
4
+ import { Text } from '../../atoms/Typography/Typography';
5
+ import { BookingPaxClientInfo } from '../../molecules/BookingPax';
6
+ import ServiceSelector, {
7
+ ServiceOption,
8
+ ServiceType,
9
+ } from '../../molecules/ServiceSelector';
10
+ import DateTimePicker from '../DateTimePicker/DateTimePicker';
11
+
12
+ export interface AddItemNewServiceProps {
13
+ options?: ServiceOption[];
14
+ date: string | string[];
15
+ clients: BookingPaxClientInfo[];
16
+ onServiceChange: (service: ServiceType) => void;
17
+ onNext: (selectedClients: BookingPaxClientInfo[]) => void;
18
+ onBack: () => void;
19
+ }
20
+
21
+ export const AddItemNewService: React.FC<AddItemNewServiceProps> = (props) => {
22
+ const { date, options, clients, onServiceChange, onNext, onBack } = props;
23
+ const [service, setService] = useState<ServiceType>('accommodation');
24
+ const [selectedClients, setSelectedClients] = useState<BookingPaxClientInfo[]>([]);
25
+ const handleServiceChange = (service: ServiceType) => {
26
+ onServiceChange(service);
27
+ setService(service);
28
+ };
29
+
30
+ const isAccommodation = service === 'accommodation';
31
+ const selectionMode = isAccommodation ? 'range' : 'single';
32
+ const numberOfMonths = isAccommodation ? 2 : 1;
33
+
34
+ const handleClientChange = useCallback(
35
+ (client: BookingPaxClientInfo) => {
36
+ if (selectedClients.includes(client)) {
37
+ setSelectedClients(selectedClients.filter((c) => c.clientId !== client.clientId));
38
+ } else {
39
+ setSelectedClients([...selectedClients, client]);
40
+ }
41
+ },
42
+ [selectedClients]
43
+ );
44
+
45
+ return (
46
+ <div className="space-y-9">
47
+ <div className="flex sm:items-center gap-4 flex-col sm:flex-row">
48
+ <ServiceSelector
49
+ className="sm:basis-[245px] xl:basis-[260px] shrink-0 grow-0"
50
+ value={service}
51
+ onChange={handleServiceChange}
52
+ options={options}
53
+ />
54
+ <div className="sm:basis-[245px] xl:basis-[260px] shrink-0 grow-0">
55
+ <DateTimePicker
56
+ mode="calendar"
57
+ selectionMode={selectionMode}
58
+ defaultValue={date}
59
+ placeholder="Select date"
60
+ numberOfMonths={numberOfMonths}
61
+ iconPosition="left"
62
+ iconBGFull={false}
63
+ showChevron={true}
64
+ />
65
+ </div>
66
+ </div>
67
+ <div className="space-y-4">
68
+ <Text variant="bold">Please select the pax affected by the new service</Text>
69
+ <ul>
70
+ {clients.map((client, index) => (
71
+ <li key={`cl-${index}`}>
72
+ <Checkbox
73
+ id={`cl-${index}`}
74
+ label={`${client.firstName} ${client.lastName} (${client.clientType}${client.clientType !== 'Adult' ? ` - ${client.age} years old` : ''})`}
75
+ checked={selectedClients.some((c) => c.clientId === client.clientId)}
76
+ onChange={() => handleClientChange(client)}
77
+ />
78
+ </li>
79
+ ))}
80
+ </ul>
81
+ </div>
82
+ <div className="flex justify-end gap-x-4 [&>*]:w-[250px] pb-2">
83
+ <Button variant="outline-secondary" onClick={onBack}>
84
+ Back
85
+ </Button>
86
+ <Button
87
+ variant="secondary"
88
+ onClick={() => onNext(selectedClients)}
89
+ disabled={selectedClients.length === 0}>
90
+ Next
91
+ </Button>
92
+ </div>
93
+ </div>
94
+ );
95
+ };
@@ -0,0 +1,43 @@
1
+ import { Text } from '../../atoms/Typography/Typography';
2
+ import { AddItemButton } from '../../molecules/AddItemButton/AddItemButton';
3
+
4
+ export enum AddItemType {
5
+ NEW = 'NEW',
6
+ EXISTING = 'EXISTING',
7
+ }
8
+
9
+ export interface AddItemSelectorProps {
10
+ onAddItem?: (type: AddItemType) => void;
11
+ }
12
+
13
+ export const AddItemSelector: React.FC<AddItemSelectorProps> = ({ onAddItem }) => {
14
+ return (
15
+ <div className="space-y-9">
16
+ <Text size="sm" variant="medium">
17
+ If you are sure you want to add this service, please confirm below. New prices and
18
+ cancellation policies will apply to the added service.
19
+ </Text>
20
+ <div className="grid grid-cols-2 gap-4">
21
+ <AddItemButton
22
+ label={
23
+ <>
24
+ Add new service <br /> and new pax
25
+ </>
26
+ }
27
+ onClick={() => onAddItem?.(AddItemType.NEW)}
28
+ />
29
+ <AddItemButton
30
+ label={
31
+ <>
32
+ Add new service <br /> for your existing pax
33
+ </>
34
+ }
35
+ onClick={() => onAddItem?.(AddItemType.EXISTING)}
36
+ />
37
+ </div>
38
+ <Text size="sm" variant="medium">
39
+ Note: This action is irreversible and cannot be undone.
40
+ </Text>
41
+ </div>
42
+ );
43
+ };
@@ -0,0 +1,120 @@
1
+ import { AnimatePresence, domAnimation, LazyMotion } from 'motion/react';
2
+ import * as motion from 'motion/react-m';
3
+ import React, { useLayoutEffect, useRef, useState } from 'react';
4
+ import { BookingPaxClientInfo } from '../../molecules/BookingPax';
5
+ import { ServiceOption, ServiceType } from '../../molecules/ServiceSelector';
6
+ import { DEFAULT_SERVICE_SELECTOR_OPTIONS } from '../../molecules/ServiceSelector/ServiceSelector';
7
+ import Dialog from '../Dialog/Dialog';
8
+ import { AddItemNewService } from './AddItemNewService';
9
+ import { AddItemSelector, AddItemType } from './AddItemSelector';
10
+
11
+ export interface BookingAddItemProps {
12
+ open: boolean;
13
+ serviceDate?: string | string[];
14
+ serviceOptions?: ServiceOption[];
15
+ clients: BookingPaxClientInfo[];
16
+ setOpen: (open: boolean) => void;
17
+ onAddItem?: (type: AddItemType) => void;
18
+ onServiceChange?: (service: ServiceType) => void;
19
+ onValidatePax?: (selectedClients: BookingPaxClientInfo[]) => void;
20
+ onBackToSelector?: () => void;
21
+ }
22
+
23
+ export const BookingAddItem: React.FC<BookingAddItemProps> = (props) => {
24
+ const {
25
+ open,
26
+ serviceDate = [],
27
+ serviceOptions = [],
28
+ clients,
29
+ setOpen,
30
+ onAddItem,
31
+ onServiceChange,
32
+ onValidatePax,
33
+ onBackToSelector,
34
+ } = props;
35
+ const [selectedType, setSelectedType] = useState<AddItemType | null>(null);
36
+ const contentRef = useRef<HTMLDivElement>(null);
37
+ const [contentHeight, setContentHeight] = useState<number | 'auto'>('auto');
38
+
39
+ const handleAddItem = (type: AddItemType) => {
40
+ onAddItem?.(type);
41
+ setSelectedType(type);
42
+ console.log(type);
43
+ };
44
+
45
+ const handleClose = () => {
46
+ setOpen(false);
47
+ setSelectedType(null);
48
+ };
49
+
50
+ // Measure and update content height when selectedType changes
51
+ useLayoutEffect(() => {
52
+ setTimeout(() => {
53
+ if (contentRef.current && open) {
54
+ const measuredHeight = contentRef.current.scrollHeight;
55
+ setContentHeight(measuredHeight);
56
+ }
57
+ }, 50);
58
+ }, [selectedType, open, serviceDate, serviceOptions, clients]);
59
+
60
+ const title =
61
+ selectedType === AddItemType.EXISTING
62
+ ? 'Add new service to your existing pax'
63
+ : 'Select how to add items to your booking';
64
+
65
+ return (
66
+ <Dialog
67
+ isOpen={open}
68
+ onClose={handleClose}
69
+ showFooter={false}
70
+ title={title}
71
+ className="!max-w-[798px]">
72
+ <LazyMotion features={domAnimation}>
73
+ <motion.div
74
+ animate={{ height: contentHeight }}
75
+ transition={{ duration: 0.2, ease: 'easeInOut' }}
76
+ style={{ overflow: 'hidden' }}>
77
+ <div ref={contentRef}>
78
+ <AnimatePresence mode="wait">
79
+ {selectedType === AddItemType.EXISTING ? (
80
+ <motion.div
81
+ key="add-item-new-service"
82
+ initial={{ opacity: 0, y: 10 }}
83
+ animate={{ opacity: 1, y: 0 }}
84
+ exit={{ opacity: 0, y: 10 }}
85
+ transition={{ duration: 0.25, ease: 'easeInOut' }}>
86
+ <AddItemNewService
87
+ date={serviceDate}
88
+ onServiceChange={(service) => onServiceChange?.(service)}
89
+ options={
90
+ serviceOptions.length > 0
91
+ ? serviceOptions
92
+ : DEFAULT_SERVICE_SELECTOR_OPTIONS.map(
93
+ ({ disabled, badge, ...option }) => option
94
+ )
95
+ }
96
+ clients={clients}
97
+ onNext={(selectedClients) => onValidatePax?.(selectedClients)}
98
+ onBack={() => {
99
+ onBackToSelector?.();
100
+ setSelectedType(null);
101
+ }}
102
+ />
103
+ </motion.div>
104
+ ) : (
105
+ <motion.div
106
+ key="add-item-selector"
107
+ initial={{ opacity: 0, y: 10 }}
108
+ animate={{ opacity: 1, y: 0 }}
109
+ exit={{ opacity: 0, y: 10 }}
110
+ transition={{ duration: 0.25, ease: 'easeInOut' }}>
111
+ <AddItemSelector onAddItem={handleAddItem} />
112
+ </motion.div>
113
+ )}
114
+ </AnimatePresence>
115
+ </div>
116
+ </motion.div>
117
+ </LazyMotion>
118
+ </Dialog>
119
+ );
120
+ };
@@ -0,0 +1,3 @@
1
+ export * from './AddItemNewService';
2
+ export * from './AddItemSelector';
3
+ export * from './BookingAddItem';
@@ -1,4 +1,4 @@
1
- import React, { useState } from 'react';
1
+ import React, { useEffect, useMemo, useState } from 'react';
2
2
  import CalendarInput from '../../molecules/Calendar/CalendarInput';
3
3
  import DateTime, { DateTimeProps } from '../../molecules/Calendar/DateTime';
4
4
  import { Popover, PopoverContent, PopoverTrigger } from '../../ui/popover';
@@ -47,7 +47,7 @@ const DateTimePicker: React.FC<DateTimePickerProps> = ({
47
47
  icon,
48
48
  }) => {
49
49
  // Parse default value and set initial state
50
- const parseDefaultValue = () => {
50
+ const parseDefaultValue = useMemo(() => {
51
51
  if (!defaultValue) return { value: '', dateRange: undefined };
52
52
 
53
53
  try {
@@ -64,6 +64,8 @@ const DateTimePicker: React.FC<DateTimePickerProps> = ({
64
64
  const date = new Date(defaultValue);
65
65
  const dateRange = { from: date, to: date };
66
66
  const displayValue = format(date, 'dd/MM/yyyy');
67
+ console.log('defaultValue', defaultValue, selectionMode, displayValue);
68
+
67
69
  return { value: displayValue, dateRange };
68
70
  }
69
71
  } catch (error) {
@@ -71,11 +73,10 @@ const DateTimePicker: React.FC<DateTimePickerProps> = ({
71
73
  }
72
74
 
73
75
  return { value: '', dateRange: undefined };
74
- };
76
+ }, [defaultValue, selectionMode]);
75
77
 
76
- const initialState = parseDefaultValue();
77
- const [value, setValue] = useState<string>(initialState.value);
78
- const [selectedDateRange, setSelectedDateRange] = useState<any>(initialState.dateRange);
78
+ const [value, setValue] = useState<string>(parseDefaultValue.value);
79
+ const [selectedDateRange, setSelectedDateRange] = useState<any>([]);
79
80
  const [selectedTime, setSelectedTime] = useState<
80
81
  { hour: string; minute: string; meridiem: 'AM' | 'PM' } | undefined
81
82
  >(undefined);
@@ -125,6 +126,11 @@ const DateTimePicker: React.FC<DateTimePickerProps> = ({
125
126
  [onValueChange, selectionMode]
126
127
  );
127
128
 
129
+ useEffect(() => {
130
+ setValue(parseDefaultValue.value);
131
+ setSelectedDateRange(parseDefaultValue.dateRange);
132
+ }, [defaultValue]);
133
+
128
134
  return (
129
135
  <Popover open={isOpen} onOpenChange={setIsOpen}>
130
136
  <PopoverTrigger asChild>
@@ -142,7 +148,7 @@ const DateTimePicker: React.FC<DateTimePickerProps> = ({
142
148
  </div>
143
149
  </PopoverTrigger>
144
150
 
145
- <PopoverContent className="w-auto p-0 border-transparent">
151
+ <PopoverContent className="w-auto border-transparent !p-0">
146
152
  <DateTime
147
153
  mode={mode}
148
154
  selectionMode={selectionMode}
@@ -1,9 +1,9 @@
1
- import React, { useEffect, useCallback, useRef } from 'react';
1
+ import React, { useCallback, useEffect, useRef } from 'react';
2
2
  import { createPortal } from 'react-dom';
3
3
  import { useMobile } from '../../../hooks/useMobile';
4
+ import '../../../styles/components/organism/dialog.css';
4
5
  import Button from '../../atoms/Button/Button';
5
6
  import Icon from '../../atoms/Icon/Icon';
6
- import '../../../styles/components/organism/dialog.css';
7
7
 
8
8
  /**
9
9
  * Size variants for the Dialog component
@@ -25,7 +25,7 @@ export interface DialogProps {
25
25
  /**
26
26
  * Title displayed in the dialog header
27
27
  */
28
- title: string;
28
+ title?: string;
29
29
  /**
30
30
  * Content to be rendered in the dialog body
31
31
  */
@@ -109,7 +109,7 @@ export interface DialogProps {
109
109
  export const Dialog: React.FC<DialogProps> = ({
110
110
  isOpen,
111
111
  onClose,
112
- title,
112
+ title = '',
113
113
  children,
114
114
  footer,
115
115
  size = 'responsive',
@@ -210,8 +210,10 @@ export const Dialog: React.FC<DialogProps> = ({
210
210
  };
211
211
 
212
212
  // Generate unique IDs for accessibility
213
- const titleId = ariaLabelledBy || `dialog-title-${title.replace(/\s+/g, '-').toLowerCase()}`;
214
- const bodyId = ariaDescribedBy || `dialog-body-${title.replace(/\s+/g, '-').toLowerCase()}`;
213
+ const titleId =
214
+ ariaLabelledBy || `dialog-title-${title.replace(/\s+/g, '-').toLowerCase()}`;
215
+ const bodyId =
216
+ ariaDescribedBy || `dialog-body-${title.replace(/\s+/g, '-').toLowerCase()}`;
215
217
 
216
218
  // Build class names
217
219
  const contentClasses = [
@@ -273,11 +275,7 @@ export const Dialog: React.FC<DialogProps> = ({
273
275
  const dialogContent = (
274
276
  <>
275
277
  {/* Overlay */}
276
- <div
277
- className="dialog-overlay"
278
- onClick={handleOverlayClick}
279
- aria-hidden="true"
280
- />
278
+ <div className="dialog-overlay" onClick={handleOverlayClick} aria-hidden="true" />
281
279
 
282
280
  {/* Dialog container */}
283
281
  <div
@@ -288,8 +286,7 @@ export const Dialog: React.FC<DialogProps> = ({
288
286
  aria-describedby={bodyId}
289
287
  ref={dialogRef}
290
288
  tabIndex={-1}
291
- onClick={handleOverlayClick}
292
- >
289
+ onClick={handleOverlayClick}>
293
290
  {/* Dialog content */}
294
291
  <div className={contentClasses}>
295
292
  {/* Header */}
@@ -302,8 +299,7 @@ export const Dialog: React.FC<DialogProps> = ({
302
299
  type="button"
303
300
  className={closeButtonClasses}
304
301
  onClick={onClose}
305
- aria-label="Close dialog"
306
- >
302
+ aria-label="Close dialog">
307
303
  <Icon name="close" size="md" />
308
304
  </button>
309
305
  )}
@@ -324,15 +320,13 @@ export const Dialog: React.FC<DialogProps> = ({
324
320
  <Button
325
321
  variant="outline-secondary"
326
322
  size={isMobileSize ? 'sm' : 'md'}
327
- onClick={handleSecondaryClick}
328
- >
323
+ onClick={handleSecondaryClick}>
329
324
  {secondaryButtonText}
330
325
  </Button>
331
326
  <Button
332
327
  variant="secondary"
333
328
  size={isMobileSize ? 'sm' : 'md'}
334
- onClick={handlePrimaryClick}
335
- >
329
+ onClick={handlePrimaryClick}>
336
330
  {primaryButtonText}
337
331
  </Button>
338
332
  </div>
@@ -349,4 +343,3 @@ export const Dialog: React.FC<DialogProps> = ({
349
343
  };
350
344
 
351
345
  export default Dialog;
352
-
@@ -0,0 +1,44 @@
1
+ import { DialogContentPolicy } from '../../molecules/DialogContentPolicy';
2
+ import { CancellationItem } from '../../molecules/DialogContentPolicy/DialogCancellationList';
3
+ import { DialogBookingConfirm } from './DialogBookingConfirm';
4
+
5
+ export interface BookingCancellationPolicyProps {
6
+ /**
7
+ * Whether the dialog is open.
8
+ */
9
+ open: boolean;
10
+ /**
11
+ * The callback function to call when the dialog is closed.
12
+ */
13
+ setOpen: (open: boolean) => void;
14
+ /**
15
+ * The cancellations to display.
16
+ */
17
+ cancellations: CancellationItem[];
18
+ }
19
+
20
+ /**
21
+ * BookingCancellationPolicy is a component that allows the user to display the booking cancellation policy.
22
+ *
23
+ * @example
24
+ * <BookingCancellationPolicy
25
+ * open={open}
26
+ * setOpen={setOpen}
27
+ * cancellations={cancellations}
28
+ * />
29
+ *
30
+ * @param props - The props for the BookingCancellationPolicy component.
31
+ * @returns The BookingCancellationPolicy component.
32
+ */
33
+ export const BookingCancellationPolicy = (props: BookingCancellationPolicyProps) => {
34
+ const { open, setOpen, cancellations } = props;
35
+ return (
36
+ <DialogBookingConfirm
37
+ open={open}
38
+ setOpen={setOpen}
39
+ title="Confirmation of Terms & Cancellation policy"
40
+ className="!max-w-[800px]">
41
+ <DialogContentPolicy.List cancellations={cancellations} />
42
+ </DialogBookingConfirm>
43
+ );
44
+ };
@@ -0,0 +1,56 @@
1
+ import { Button, Heading } from '@/src';
2
+ import React from 'react';
3
+ import { DialogBookingConfirm } from './DialogBookingConfirm';
4
+
5
+ export interface BookingMailSentProps {
6
+ /**
7
+ * Whether the dialog is open.
8
+ */
9
+ open: boolean;
10
+ /**
11
+ * The callback function to call when the dialog is closed.
12
+ */
13
+ setOpen: (open: boolean) => void;
14
+ /**
15
+ * The callback function to call when the next button is clicked.
16
+ */
17
+ onNext: () => void;
18
+ }
19
+
20
+ /**
21
+ * BookingMailSent is a component that allows the user to display the booking mail sent confirmation.
22
+ *
23
+ * @example
24
+ * <BookingMailSent
25
+ * open={open}
26
+ * setOpen={setOpen}
27
+ * onNext={onNext}
28
+ * />
29
+ *
30
+ * @param props - The props for the BookingMailSent component.
31
+ * @returns
32
+ */
33
+ export const BookingMailSent: React.FC<BookingMailSentProps> = (props) => {
34
+ const { open, setOpen, onNext } = props;
35
+ return (
36
+ <DialogBookingConfirm open={open} setOpen={setOpen} className="!max-w-[800px]">
37
+ <div className="space-y-9">
38
+ <div className="space-y-8">
39
+ <img
40
+ src="/images/svg/booking-mail-sent.svg"
41
+ alt="Booking success"
42
+ className="mx-auto"
43
+ width={150}
44
+ height={150}
45
+ />
46
+ <Heading as="p" level={6} variant="medium" className="text-center">
47
+ You will receive a copy of your booking in your mail inbox.
48
+ </Heading>
49
+ </div>
50
+ <Button variant="secondary" onClick={onNext} className="w-full">
51
+ Go to booking grid
52
+ </Button>
53
+ </div>
54
+ </DialogBookingConfirm>
55
+ );
56
+ };
@@ -0,0 +1,74 @@
1
+ import React, { useState } from 'react';
2
+ import Button from '../../atoms/Button/Button';
3
+ import Input from '../../atoms/Inputs/Input/Input';
4
+ import { Text } from '../../atoms/Typography/Typography';
5
+ import { DialogBookingConfirm } from './DialogBookingConfirm';
6
+
7
+ export interface BookingReferenceProps {
8
+ /**
9
+ * Whether the dialog is open.
10
+ */
11
+ open: boolean;
12
+ /**
13
+ * The callback function to call when the dialog is closed.
14
+ */
15
+ setOpen: (open: boolean) => void;
16
+ /**
17
+ * The callback function to call when the cancel button is clicked.
18
+ */
19
+ onCancel: () => void;
20
+ /**
21
+ * The callback function to call when the confirm button is clicked.
22
+ */
23
+ onConfirm: (ref: string) => void;
24
+ }
25
+
26
+ /**
27
+ * BookingReference is a component that allows the user to display the booking reference.
28
+ *
29
+ * @example
30
+ * <BookingReference
31
+ * open={open}
32
+ * setOpen={setOpen}
33
+ * onCancel={onCancel}
34
+ * onConfirm={onConfirm}
35
+ * />
36
+ *
37
+ *
38
+ * @param props - The props for the BookingReference component.
39
+ * @returns The BookingReference component.
40
+ */
41
+ export const BookingReference: React.FC<BookingReferenceProps> = (props) => {
42
+ const { open, setOpen, onCancel, onConfirm } = props;
43
+ const [reference, setReference] = useState('');
44
+ return (
45
+ <DialogBookingConfirm
46
+ open={open}
47
+ setOpen={setOpen}
48
+ title="Reference number"
49
+ className="!max-w-[500px]">
50
+ <div className="space-y-9">
51
+ <div className="space-y-2">
52
+ <label>
53
+ <Text as="span" size="sm">
54
+ Reference number
55
+ </Text>
56
+ </label>
57
+ <Input
58
+ placeholder="Please insert a reference number"
59
+ value={reference}
60
+ onChange={(e) => setReference(e.target.value)}
61
+ />
62
+ </div>
63
+ <div className="grid grid-cols-2 gap-x-4">
64
+ <Button variant="outline-secondary" onClick={onCancel}>
65
+ Cancel
66
+ </Button>
67
+ <Button variant="secondary" onClick={() => onConfirm(reference)}>
68
+ Confirm booking
69
+ </Button>
70
+ </div>
71
+ </div>
72
+ </DialogBookingConfirm>
73
+ );
74
+ };
@@ -0,0 +1,67 @@
1
+ import { Button, Heading, Text } from '@/src';
2
+ import React from 'react';
3
+ import { DialogBookingConfirm } from './DialogBookingConfirm';
4
+
5
+ export interface BookingSuccessProps {
6
+ /**
7
+ * Whether the dialog is open.
8
+ */
9
+ open: boolean;
10
+ /**
11
+ * The name of the booking.
12
+ */
13
+ bookingName: string;
14
+ /**
15
+ * The callback function to call when the dialog is closed.
16
+ */
17
+ setOpen: (open: boolean) => void;
18
+ /**
19
+ * The callback function to call when the next button is clicked.
20
+ */
21
+ onNext: () => void;
22
+ }
23
+
24
+ /**
25
+ * BookingSuccess is a component that allows the user to display the booking success.
26
+ *
27
+ * @example
28
+ * <BookingSuccess
29
+ * open={open}
30
+ * bookingName={bookingName}
31
+ * setOpen={setOpen}
32
+ * onNext={onNext}
33
+ * />
34
+ *
35
+ *
36
+ * @param props - The props for the BookingSuccess component.
37
+ * @returns The BookingSuccess component.
38
+ */
39
+ export const BookingSuccess: React.FC<BookingSuccessProps> = (props) => {
40
+ const { open, bookingName, setOpen, onNext } = props;
41
+ return (
42
+ <DialogBookingConfirm open={open} setOpen={setOpen} className="!max-w-[800px]">
43
+ <div className="space-y-9">
44
+ <div className="space-y-8">
45
+ <img
46
+ src="/images/svg/booking-confirm.svg"
47
+ alt="Booking success"
48
+ className="mx-auto"
49
+ width={150}
50
+ height={150}
51
+ />
52
+ <div className="text-center">
53
+ <Heading as="p" level={6} variant="medium">
54
+ Your booking has been successfully confirmed!
55
+ </Heading>
56
+ <Text variant="bold" size="lg">
57
+ "{bookingName}"
58
+ </Text>
59
+ </div>
60
+ </div>
61
+ <Button variant="secondary" onClick={onNext} className="w-full">
62
+ Confirm booking
63
+ </Button>
64
+ </div>
65
+ </DialogBookingConfirm>
66
+ );
67
+ };