mautourco-components 0.2.19 → 0.2.21
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/Icon/icons/BusIcon.js +1 -1
- package/dist/components/atoms/Icon/icons/CatamaranIcon.js +1 -1
- package/dist/components/atoms/Icon/icons/ClockIcon.d.ts +4 -0
- package/dist/components/atoms/Icon/icons/ClockIcon.js +36 -0
- package/dist/components/atoms/Icon/icons/CloseCircleIcon.js +1 -1
- package/dist/components/atoms/Icon/icons/MapIcon.js +1 -1
- package/dist/components/atoms/Icon/icons/PlusCircleIcon.js +1 -1
- package/dist/components/atoms/Icon/icons/SeaIcon.js +1 -1
- package/dist/components/atoms/Icon/icons/registry.d.ts +1 -0
- package/dist/components/atoms/Icon/icons/registry.js +2 -0
- package/dist/components/atoms/Inputs/Input/Input.d.ts +2 -1
- package/dist/components/atoms/Inputs/Input/Input.js +1 -1
- package/dist/components/atoms/Inputs/Textarea/Textarea.d.ts +3 -1
- package/dist/components/atoms/Inputs/Textarea/Textarea.js +7 -5
- package/dist/components/molecules/BookingPax/BookingPax.d.ts +7 -0
- package/dist/components/molecules/BookingPax/BookingPax.js +21 -0
- package/dist/components/molecules/BookingPax/BookingPaxAccom.d.ts +22 -0
- package/dist/components/molecules/BookingPax/BookingPaxAccom.js +61 -0
- package/dist/components/molecules/BookingPax/BookingPaxClient/BookingPaxClient.css +2090 -0
- package/dist/components/molecules/BookingPax/BookingPaxClient/BookingPaxClient.d.ts +31 -0
- package/dist/components/molecules/BookingPax/BookingPaxClient/BookingPaxClient.js +96 -0
- package/dist/components/molecules/BookingPax/BookingPaxExcursion.d.ts +14 -0
- package/dist/components/molecules/BookingPax/BookingPaxExcursion.js +31 -0
- package/dist/components/molecules/BookingPax/BookingPaxHeader.d.ts +16 -0
- package/dist/components/molecules/BookingPax/BookingPaxHeader.js +28 -0
- package/dist/components/molecules/BookingPax/BookingPaxLayout/BookingPaxLayout.css +2103 -0
- package/dist/components/molecules/BookingPax/BookingPaxLayout/BookingPaxLayout.d.ts +11 -0
- package/dist/components/molecules/BookingPax/BookingPaxLayout/BookingPaxLayout.js +19 -0
- package/dist/components/molecules/BookingPax/BookingPaxRemarks.d.ts +5 -0
- package/dist/components/molecules/BookingPax/BookingPaxRemarks.js +37 -0
- package/dist/components/molecules/BookingPax/BookingPaxTransfer.d.ts +18 -0
- package/dist/components/molecules/BookingPax/BookingPaxTransfer.js +40 -0
- package/dist/components/molecules/BookingPax/index.d.ts +5 -0
- package/dist/components/molecules/BookingPax/index.js +1 -0
- package/dist/components/molecules/Calendar/CalendarInput.d.ts +6 -3
- package/dist/components/molecules/Calendar/CalendarInput.js +10 -10
- package/dist/components/molecules/DialogContentPolicy/CancellationLayout/CancellationLayout.css +2142 -0
- package/dist/components/molecules/DialogContentPolicy/CancellationLayout/CancellationLayout.d.ts +11 -0
- package/dist/components/molecules/DialogContentPolicy/CancellationLayout/CancellationLayout.js +19 -0
- package/dist/components/molecules/DialogContentPolicy/DialogCancellationAccom.d.ts +9 -0
- package/dist/components/molecules/DialogContentPolicy/DialogCancellationAccom.js +24 -0
- package/dist/components/molecules/DialogContentPolicy/DialogCancellationExcursion.d.ts +17 -0
- package/dist/components/molecules/DialogContentPolicy/DialogCancellationExcursion.js +20 -0
- package/dist/components/molecules/DialogContentPolicy/DialogCancellationList.d.ts +11 -0
- package/dist/components/molecules/DialogContentPolicy/DialogCancellationList.js +33 -0
- package/dist/components/molecules/DialogContentPolicy/DialogContentPolicy.d.ts +11 -0
- package/dist/components/molecules/DialogContentPolicy/DialogContentPolicy.js +27 -0
- package/dist/components/molecules/DialogContentPolicy/index.d.ts +4 -0
- package/dist/components/molecules/DialogContentPolicy/index.js +1 -0
- package/dist/components/molecules/ServiceTitle/ServiceTitle.css +3 -0
- package/dist/components/molecules/ServiceTitle/ServiceTitle.d.ts +7 -1
- package/dist/components/molecules/ServiceTitle/ServiceTitle.js +4 -3
- package/dist/components/organisms/Booking/Booking.d.ts +2 -0
- package/dist/components/organisms/Booking/Booking.js +4 -0
- package/dist/components/organisms/Booking/BookingHeader.d.ts +8 -0
- package/dist/components/organisms/Booking/BookingHeader.js +17 -0
- package/dist/components/organisms/Booking/BookingPaxList.d.ts +25 -0
- package/dist/components/organisms/Booking/BookingPaxList.js +117 -0
- package/dist/components/organisms/Booking/BookingStep/BookingStep.d.ts +1 -0
- package/dist/components/organisms/Booking/BookingStep/BookingStep.js +5 -2
- package/dist/components/organisms/DateTimePicker/DateTimePicker.d.ts +6 -3
- package/dist/components/organisms/DateTimePicker/DateTimePicker.js +28 -22
- package/dist/components/organisms/DialogBookingConfirm/DialogBookingConfirm.d.ts +10 -0
- package/dist/components/organisms/DialogBookingConfirm/DialogBookingConfirm.js +17 -0
- package/dist/components/ui/checkbox.d.ts +4 -0
- package/dist/components/ui/checkbox.js +31 -0
- package/dist/hooks/useBookingPax.d.ts +8 -0
- package/dist/hooks/useBookingPax.js +43 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +2 -1
- package/src/components/atoms/Icon/icons/BusIcon.tsx +1 -1
- package/src/components/atoms/Icon/icons/CatamaranIcon.tsx +1 -1
- package/src/components/atoms/Icon/icons/ClockIcon.tsx +46 -0
- package/src/components/atoms/Icon/icons/CloseCircleIcon.tsx +1 -1
- package/src/components/atoms/Icon/icons/MapIcon.tsx +6 -2
- package/src/components/atoms/Icon/icons/PlusCircleIcon.tsx +1 -1
- package/src/components/atoms/Icon/icons/SeaIcon.tsx +1 -1
- package/src/components/atoms/Icon/icons/registry.tsx +2 -0
- package/src/components/atoms/Inputs/Input/Input.tsx +6 -5
- package/src/components/atoms/Inputs/Textarea/Textarea.tsx +18 -4
- package/src/components/molecules/BookingPax/BookingPax.tsx +12 -0
- package/src/components/molecules/BookingPax/BookingPaxAccom.tsx +120 -0
- package/src/components/molecules/BookingPax/BookingPaxClient/BookingPaxClient.css +4 -0
- package/src/components/molecules/BookingPax/BookingPaxClient/BookingPaxClient.tsx +188 -0
- package/src/components/molecules/BookingPax/BookingPaxExcursion.tsx +77 -0
- package/src/components/molecules/BookingPax/BookingPaxHeader.tsx +47 -0
- package/src/components/molecules/BookingPax/BookingPaxLayout/BookingPaxLayout.css +15 -0
- package/src/components/molecules/BookingPax/BookingPaxLayout/BookingPaxLayout.tsx +25 -0
- package/src/components/molecules/BookingPax/BookingPaxRemarks.tsx +46 -0
- package/src/components/molecules/BookingPax/BookingPaxTransfer.tsx +121 -0
- package/src/components/molecules/BookingPax/index.ts +9 -0
- package/src/components/molecules/Calendar/CalendarInput.tsx +26 -24
- package/src/components/molecules/DialogContentPolicy/CancellationLayout/CancellationLayout.css +37 -0
- package/src/components/molecules/DialogContentPolicy/CancellationLayout/CancellationLayout.tsx +28 -0
- package/src/components/molecules/DialogContentPolicy/DialogCancellationAccom.tsx +65 -0
- package/src/components/molecules/DialogContentPolicy/DialogCancellationExcursion.tsx +59 -0
- package/src/components/molecules/DialogContentPolicy/DialogCancellationList.tsx +49 -0
- package/src/components/molecules/DialogContentPolicy/DialogContentPolicy.tsx +45 -0
- package/src/components/molecules/DialogContentPolicy/index.ts +5 -0
- package/src/components/molecules/ServiceTitle/ServiceTitle.css +1 -1
- package/src/components/molecules/ServiceTitle/ServiceTitle.tsx +25 -7
- package/src/components/organisms/Booking/Booking.tsx +4 -0
- package/src/components/organisms/Booking/BookingHeader.tsx +24 -0
- package/src/components/organisms/Booking/BookingPaxList.tsx +224 -0
- package/src/components/organisms/Booking/BookingStep/BookingStep.tsx +8 -2
- package/src/components/organisms/DateTimePicker/DateTimePicker.tsx +69 -49
- package/src/components/organisms/DialogBookingConfirm/DialogBookingConfirm.tsx +25 -0
- package/src/components/ui/checkbox.tsx +32 -0
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import React, { useState } from
|
|
2
|
-
import CalendarInput from
|
|
3
|
-
import DateTime, { DateTimeProps } from
|
|
4
|
-
import { Popover,
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import CalendarInput from '../../molecules/Calendar/CalendarInput';
|
|
3
|
+
import DateTime, { DateTimeProps } from '../../molecules/Calendar/DateTime';
|
|
4
|
+
import { Popover, PopoverContent, PopoverTrigger } from '../../ui/popover';
|
|
5
5
|
|
|
6
|
-
import { format } from
|
|
6
|
+
import { format } from 'date-fns';
|
|
7
|
+
import { IconName } from '../../atoms/Icon/Icon';
|
|
7
8
|
|
|
8
9
|
export interface DateTimePickerProps extends Partial<DateTimeProps> {
|
|
9
10
|
placeholder?: string;
|
|
@@ -14,40 +15,43 @@ export interface DateTimePickerProps extends Partial<DateTimeProps> {
|
|
|
14
15
|
/** Whether the calendar icon has full bg*/
|
|
15
16
|
iconBGFull?: boolean;
|
|
16
17
|
/** Position of the calendar icon: left or right */
|
|
17
|
-
iconPosition?:
|
|
18
|
+
iconPosition?: 'left' | 'right';
|
|
18
19
|
/** Show chevron on the right when icon is on the left */
|
|
19
20
|
showChevron?: boolean;
|
|
21
|
+
/** Icon to display on the left of the input */
|
|
22
|
+
icon?: IconName;
|
|
20
23
|
}
|
|
21
24
|
|
|
22
25
|
const formatDateRange = (dateRange: any) => {
|
|
23
|
-
if (!dateRange || !dateRange.from) return
|
|
26
|
+
if (!dateRange || !dateRange.from) return '';
|
|
24
27
|
const from = dateRange.from;
|
|
25
28
|
const to = dateRange.to ?? dateRange.from;
|
|
26
|
-
|
|
27
|
-
if (+from === +to) return format(from,
|
|
28
|
-
return `${format(from,
|
|
29
|
+
|
|
30
|
+
if (+from === +to) return format(from, 'dd/MM/yyyy');
|
|
31
|
+
return `${format(from, 'dd/MM/yyyy')} - ${format(to, 'dd/MM/yyyy')}`;
|
|
29
32
|
};
|
|
30
33
|
|
|
31
34
|
const DateTimePicker: React.FC<DateTimePickerProps> = ({
|
|
32
|
-
placeholder =
|
|
35
|
+
placeholder = 'Select date',
|
|
33
36
|
disabled = false,
|
|
34
|
-
mode =
|
|
35
|
-
selectionMode =
|
|
37
|
+
mode = 'both',
|
|
38
|
+
selectionMode = 'range',
|
|
36
39
|
numberOfMonths = 2,
|
|
37
40
|
disableBeforeToday = true,
|
|
38
41
|
disableToday = false,
|
|
39
42
|
onValueChange,
|
|
40
43
|
defaultValue,
|
|
41
44
|
iconBGFull = true,
|
|
42
|
-
iconPosition =
|
|
45
|
+
iconPosition = 'right',
|
|
43
46
|
showChevron = false,
|
|
47
|
+
icon,
|
|
44
48
|
}) => {
|
|
45
49
|
// Parse default value and set initial state
|
|
46
50
|
const parseDefaultValue = () => {
|
|
47
|
-
if (!defaultValue) return { value:
|
|
51
|
+
if (!defaultValue) return { value: '', dateRange: undefined };
|
|
48
52
|
|
|
49
53
|
try {
|
|
50
|
-
if (selectionMode ===
|
|
54
|
+
if (selectionMode === 'range' && Array.isArray(defaultValue)) {
|
|
51
55
|
// Handle range: ["yyyy-MM-dd", "yyyy-MM-dd"]
|
|
52
56
|
const [fromStr, toStr] = defaultValue;
|
|
53
57
|
const from = new Date(fromStr);
|
|
@@ -55,56 +59,71 @@ const DateTimePicker: React.FC<DateTimePickerProps> = ({
|
|
|
55
59
|
const dateRange = { from, to };
|
|
56
60
|
const displayValue = formatDateRange(dateRange);
|
|
57
61
|
return { value: displayValue, dateRange };
|
|
58
|
-
} else if (selectionMode ===
|
|
62
|
+
} else if (selectionMode === 'single' && typeof defaultValue === 'string') {
|
|
59
63
|
// Handle single: "yyyy-MM-dd"
|
|
60
64
|
const date = new Date(defaultValue);
|
|
61
65
|
const dateRange = { from: date, to: date };
|
|
62
|
-
const displayValue = format(date,
|
|
66
|
+
const displayValue = format(date, 'dd/MM/yyyy');
|
|
63
67
|
return { value: displayValue, dateRange };
|
|
64
68
|
}
|
|
65
69
|
} catch (error) {
|
|
66
|
-
console.error(
|
|
70
|
+
console.error('Error parsing default date value:', error);
|
|
67
71
|
}
|
|
68
72
|
|
|
69
|
-
return { value:
|
|
73
|
+
return { value: '', dateRange: undefined };
|
|
70
74
|
};
|
|
71
75
|
|
|
72
76
|
const initialState = parseDefaultValue();
|
|
73
77
|
const [value, setValue] = useState<string>(initialState.value);
|
|
74
78
|
const [selectedDateRange, setSelectedDateRange] = useState<any>(initialState.dateRange);
|
|
75
|
-
const [selectedTime, setSelectedTime] = useState<
|
|
79
|
+
const [selectedTime, setSelectedTime] = useState<
|
|
80
|
+
{ hour: string; minute: string; meridiem: 'AM' | 'PM' } | undefined
|
|
81
|
+
>(undefined);
|
|
76
82
|
const [isOpen, setIsOpen] = useState(false);
|
|
77
83
|
|
|
78
|
-
const handleDtChange = React.useCallback(
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
84
|
+
const handleDtChange = React.useCallback(
|
|
85
|
+
(payload: {
|
|
86
|
+
dateRange?: any;
|
|
87
|
+
time?: { hour: string; minute: string; meridiem: 'AM' | 'PM' };
|
|
88
|
+
}) => {
|
|
89
|
+
const datePart = formatDateRange(payload.dateRange);
|
|
90
|
+
const time = payload.time
|
|
91
|
+
? `${payload.time.hour}:${payload.time.minute} ${payload.time.meridiem}`
|
|
92
|
+
: '';
|
|
93
|
+
const combined = [datePart, time].filter(Boolean).join(' ');
|
|
94
|
+
setValue(combined);
|
|
95
|
+
setSelectedDateRange(payload.dateRange);
|
|
96
|
+
setSelectedTime(payload.time);
|
|
97
|
+
|
|
98
|
+
// Return date strings in yyyy-MM-dd format for both modes
|
|
99
|
+
if (payload.dateRange) {
|
|
100
|
+
if (selectionMode === 'range') {
|
|
101
|
+
// Return array of date strings for range mode
|
|
102
|
+
const from = payload.dateRange.from;
|
|
103
|
+
const to = payload.dateRange.to ?? payload.dateRange.from;
|
|
104
|
+
|
|
105
|
+
if (from && to) {
|
|
106
|
+
const fromStr = format(from, 'yyyy-MM-dd');
|
|
107
|
+
const toStr = format(to, 'yyyy-MM-dd');
|
|
108
|
+
onValueChange?.([fromStr, toStr]);
|
|
109
|
+
}
|
|
110
|
+
} else {
|
|
111
|
+
// Return single date string in yyyy-MM-dd format for single mode
|
|
112
|
+
const date = payload.dateRange.from;
|
|
113
|
+
if (date) {
|
|
114
|
+
const dateStr = format(date, 'yyyy-MM-dd');
|
|
115
|
+
onValueChange?.(dateStr);
|
|
116
|
+
}
|
|
104
117
|
}
|
|
105
118
|
}
|
|
106
|
-
|
|
107
|
-
|
|
119
|
+
|
|
120
|
+
if (!payload.dateRange && payload.time) {
|
|
121
|
+
const timeStr = `${payload.time.hour}:${payload.time.minute} ${payload.time.meridiem}`;
|
|
122
|
+
onValueChange?.(timeStr);
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
[onValueChange, selectionMode]
|
|
126
|
+
);
|
|
108
127
|
|
|
109
128
|
return (
|
|
110
129
|
<Popover open={isOpen} onOpenChange={setIsOpen}>
|
|
@@ -118,6 +137,7 @@ const DateTimePicker: React.FC<DateTimePickerProps> = ({
|
|
|
118
137
|
iconPosition={iconPosition}
|
|
119
138
|
showChevron={showChevron}
|
|
120
139
|
isOpen={isOpen}
|
|
140
|
+
icon={icon}
|
|
121
141
|
/>
|
|
122
142
|
</div>
|
|
123
143
|
</PopoverTrigger>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Dialog from '../Dialog/Dialog';
|
|
3
|
+
|
|
4
|
+
interface DialogBookingConfirmProps {
|
|
5
|
+
open: boolean;
|
|
6
|
+
title: string;
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
setOpen: (open: boolean) => void;
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const DialogBookingConfirm = (props: DialogBookingConfirmProps) => {
|
|
13
|
+
const { open, title, children, setOpen, className } = props;
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<Dialog
|
|
17
|
+
isOpen={open}
|
|
18
|
+
onClose={() => setOpen(false)}
|
|
19
|
+
title={title}
|
|
20
|
+
className={className}
|
|
21
|
+
showFooter={false}>
|
|
22
|
+
{children}
|
|
23
|
+
</Dialog>
|
|
24
|
+
);
|
|
25
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
import { cn } from '@/src/lib/utils';
|
|
5
|
+
import Icon from '../atoms/Icon/Icon';
|
|
6
|
+
|
|
7
|
+
function Checkbox({
|
|
8
|
+
className,
|
|
9
|
+
...props
|
|
10
|
+
}: React.ComponentProps<typeof CheckboxPrimitive.Root>) {
|
|
11
|
+
return (
|
|
12
|
+
<CheckboxPrimitive.Root
|
|
13
|
+
data-slot="checkbox"
|
|
14
|
+
className={cn(
|
|
15
|
+
'w-5 h-5 border border-[var(--checkbox-color-checkbox-border-default-default)] data-[state=checked]:border-[var(--checkbox-color-checkbox-border-selected-default)] rounded-[var(--border-radius-rounded-sm)] data-[error=true]:border-[var(--checkbox-color-checkbox-border-default-error)] data-[error=true]:bg-[var(--checkbox-color-checkbox-background-error)] disabled:opacity-50 disabled:cursor-not-allowed',
|
|
16
|
+
className
|
|
17
|
+
)}
|
|
18
|
+
{...props}>
|
|
19
|
+
<CheckboxPrimitive.Indicator
|
|
20
|
+
data-slot="checkbox-indicator"
|
|
21
|
+
className="grid place-content-center text-current transition-none">
|
|
22
|
+
<Icon
|
|
23
|
+
name="check"
|
|
24
|
+
size="sm"
|
|
25
|
+
className="text-[var(--checkbox-color-checkbox-checked-default)]"
|
|
26
|
+
/>
|
|
27
|
+
</CheckboxPrimitive.Indicator>
|
|
28
|
+
</CheckboxPrimitive.Root>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { Checkbox };
|