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.
Files changed (109) hide show
  1. package/dist/components/atoms/Icon/icons/BusIcon.js +1 -1
  2. package/dist/components/atoms/Icon/icons/CatamaranIcon.js +1 -1
  3. package/dist/components/atoms/Icon/icons/ClockIcon.d.ts +4 -0
  4. package/dist/components/atoms/Icon/icons/ClockIcon.js +36 -0
  5. package/dist/components/atoms/Icon/icons/CloseCircleIcon.js +1 -1
  6. package/dist/components/atoms/Icon/icons/MapIcon.js +1 -1
  7. package/dist/components/atoms/Icon/icons/PlusCircleIcon.js +1 -1
  8. package/dist/components/atoms/Icon/icons/SeaIcon.js +1 -1
  9. package/dist/components/atoms/Icon/icons/registry.d.ts +1 -0
  10. package/dist/components/atoms/Icon/icons/registry.js +2 -0
  11. package/dist/components/atoms/Inputs/Input/Input.d.ts +2 -1
  12. package/dist/components/atoms/Inputs/Input/Input.js +1 -1
  13. package/dist/components/atoms/Inputs/Textarea/Textarea.d.ts +3 -1
  14. package/dist/components/atoms/Inputs/Textarea/Textarea.js +7 -5
  15. package/dist/components/molecules/BookingPax/BookingPax.d.ts +7 -0
  16. package/dist/components/molecules/BookingPax/BookingPax.js +21 -0
  17. package/dist/components/molecules/BookingPax/BookingPaxAccom.d.ts +22 -0
  18. package/dist/components/molecules/BookingPax/BookingPaxAccom.js +61 -0
  19. package/dist/components/molecules/BookingPax/BookingPaxClient/BookingPaxClient.css +2090 -0
  20. package/dist/components/molecules/BookingPax/BookingPaxClient/BookingPaxClient.d.ts +31 -0
  21. package/dist/components/molecules/BookingPax/BookingPaxClient/BookingPaxClient.js +96 -0
  22. package/dist/components/molecules/BookingPax/BookingPaxExcursion.d.ts +14 -0
  23. package/dist/components/molecules/BookingPax/BookingPaxExcursion.js +31 -0
  24. package/dist/components/molecules/BookingPax/BookingPaxHeader.d.ts +16 -0
  25. package/dist/components/molecules/BookingPax/BookingPaxHeader.js +28 -0
  26. package/dist/components/molecules/BookingPax/BookingPaxLayout/BookingPaxLayout.css +2103 -0
  27. package/dist/components/molecules/BookingPax/BookingPaxLayout/BookingPaxLayout.d.ts +11 -0
  28. package/dist/components/molecules/BookingPax/BookingPaxLayout/BookingPaxLayout.js +19 -0
  29. package/dist/components/molecules/BookingPax/BookingPaxRemarks.d.ts +5 -0
  30. package/dist/components/molecules/BookingPax/BookingPaxRemarks.js +37 -0
  31. package/dist/components/molecules/BookingPax/BookingPaxTransfer.d.ts +18 -0
  32. package/dist/components/molecules/BookingPax/BookingPaxTransfer.js +40 -0
  33. package/dist/components/molecules/BookingPax/index.d.ts +5 -0
  34. package/dist/components/molecules/BookingPax/index.js +1 -0
  35. package/dist/components/molecules/Calendar/CalendarInput.d.ts +6 -3
  36. package/dist/components/molecules/Calendar/CalendarInput.js +10 -10
  37. package/dist/components/molecules/DialogContentPolicy/CancellationLayout/CancellationLayout.css +2142 -0
  38. package/dist/components/molecules/DialogContentPolicy/CancellationLayout/CancellationLayout.d.ts +11 -0
  39. package/dist/components/molecules/DialogContentPolicy/CancellationLayout/CancellationLayout.js +19 -0
  40. package/dist/components/molecules/DialogContentPolicy/DialogCancellationAccom.d.ts +9 -0
  41. package/dist/components/molecules/DialogContentPolicy/DialogCancellationAccom.js +24 -0
  42. package/dist/components/molecules/DialogContentPolicy/DialogCancellationExcursion.d.ts +17 -0
  43. package/dist/components/molecules/DialogContentPolicy/DialogCancellationExcursion.js +20 -0
  44. package/dist/components/molecules/DialogContentPolicy/DialogCancellationList.d.ts +11 -0
  45. package/dist/components/molecules/DialogContentPolicy/DialogCancellationList.js +33 -0
  46. package/dist/components/molecules/DialogContentPolicy/DialogContentPolicy.d.ts +11 -0
  47. package/dist/components/molecules/DialogContentPolicy/DialogContentPolicy.js +27 -0
  48. package/dist/components/molecules/DialogContentPolicy/index.d.ts +4 -0
  49. package/dist/components/molecules/DialogContentPolicy/index.js +1 -0
  50. package/dist/components/molecules/ServiceTitle/ServiceTitle.css +3 -0
  51. package/dist/components/molecules/ServiceTitle/ServiceTitle.d.ts +7 -1
  52. package/dist/components/molecules/ServiceTitle/ServiceTitle.js +4 -3
  53. package/dist/components/organisms/Booking/Booking.d.ts +2 -0
  54. package/dist/components/organisms/Booking/Booking.js +4 -0
  55. package/dist/components/organisms/Booking/BookingHeader.d.ts +8 -0
  56. package/dist/components/organisms/Booking/BookingHeader.js +17 -0
  57. package/dist/components/organisms/Booking/BookingPaxList.d.ts +25 -0
  58. package/dist/components/organisms/Booking/BookingPaxList.js +117 -0
  59. package/dist/components/organisms/Booking/BookingStep/BookingStep.d.ts +1 -0
  60. package/dist/components/organisms/Booking/BookingStep/BookingStep.js +5 -2
  61. package/dist/components/organisms/DateTimePicker/DateTimePicker.d.ts +6 -3
  62. package/dist/components/organisms/DateTimePicker/DateTimePicker.js +28 -22
  63. package/dist/components/organisms/DialogBookingConfirm/DialogBookingConfirm.d.ts +10 -0
  64. package/dist/components/organisms/DialogBookingConfirm/DialogBookingConfirm.js +17 -0
  65. package/dist/components/ui/checkbox.d.ts +4 -0
  66. package/dist/components/ui/checkbox.js +31 -0
  67. package/dist/hooks/useBookingPax.d.ts +8 -0
  68. package/dist/hooks/useBookingPax.js +43 -0
  69. package/dist/index.d.ts +1 -0
  70. package/dist/index.js +1 -0
  71. package/package.json +2 -1
  72. package/src/components/atoms/Icon/icons/BusIcon.tsx +1 -1
  73. package/src/components/atoms/Icon/icons/CatamaranIcon.tsx +1 -1
  74. package/src/components/atoms/Icon/icons/ClockIcon.tsx +46 -0
  75. package/src/components/atoms/Icon/icons/CloseCircleIcon.tsx +1 -1
  76. package/src/components/atoms/Icon/icons/MapIcon.tsx +6 -2
  77. package/src/components/atoms/Icon/icons/PlusCircleIcon.tsx +1 -1
  78. package/src/components/atoms/Icon/icons/SeaIcon.tsx +1 -1
  79. package/src/components/atoms/Icon/icons/registry.tsx +2 -0
  80. package/src/components/atoms/Inputs/Input/Input.tsx +6 -5
  81. package/src/components/atoms/Inputs/Textarea/Textarea.tsx +18 -4
  82. package/src/components/molecules/BookingPax/BookingPax.tsx +12 -0
  83. package/src/components/molecules/BookingPax/BookingPaxAccom.tsx +120 -0
  84. package/src/components/molecules/BookingPax/BookingPaxClient/BookingPaxClient.css +4 -0
  85. package/src/components/molecules/BookingPax/BookingPaxClient/BookingPaxClient.tsx +188 -0
  86. package/src/components/molecules/BookingPax/BookingPaxExcursion.tsx +77 -0
  87. package/src/components/molecules/BookingPax/BookingPaxHeader.tsx +47 -0
  88. package/src/components/molecules/BookingPax/BookingPaxLayout/BookingPaxLayout.css +15 -0
  89. package/src/components/molecules/BookingPax/BookingPaxLayout/BookingPaxLayout.tsx +25 -0
  90. package/src/components/molecules/BookingPax/BookingPaxRemarks.tsx +46 -0
  91. package/src/components/molecules/BookingPax/BookingPaxTransfer.tsx +121 -0
  92. package/src/components/molecules/BookingPax/index.ts +9 -0
  93. package/src/components/molecules/Calendar/CalendarInput.tsx +26 -24
  94. package/src/components/molecules/DialogContentPolicy/CancellationLayout/CancellationLayout.css +37 -0
  95. package/src/components/molecules/DialogContentPolicy/CancellationLayout/CancellationLayout.tsx +28 -0
  96. package/src/components/molecules/DialogContentPolicy/DialogCancellationAccom.tsx +65 -0
  97. package/src/components/molecules/DialogContentPolicy/DialogCancellationExcursion.tsx +59 -0
  98. package/src/components/molecules/DialogContentPolicy/DialogCancellationList.tsx +49 -0
  99. package/src/components/molecules/DialogContentPolicy/DialogContentPolicy.tsx +45 -0
  100. package/src/components/molecules/DialogContentPolicy/index.ts +5 -0
  101. package/src/components/molecules/ServiceTitle/ServiceTitle.css +1 -1
  102. package/src/components/molecules/ServiceTitle/ServiceTitle.tsx +25 -7
  103. package/src/components/organisms/Booking/Booking.tsx +4 -0
  104. package/src/components/organisms/Booking/BookingHeader.tsx +24 -0
  105. package/src/components/organisms/Booking/BookingPaxList.tsx +224 -0
  106. package/src/components/organisms/Booking/BookingStep/BookingStep.tsx +8 -2
  107. package/src/components/organisms/DateTimePicker/DateTimePicker.tsx +69 -49
  108. package/src/components/organisms/DialogBookingConfirm/DialogBookingConfirm.tsx +25 -0
  109. package/src/components/ui/checkbox.tsx +32 -0
@@ -1,9 +1,10 @@
1
- import React, { useState } from "react";
2
- import CalendarInput from "../../molecules/Calendar/CalendarInput";
3
- import DateTime, { DateTimeProps } from "../../molecules/Calendar/DateTime";
4
- import { Popover, PopoverTrigger, PopoverContent } from "../../ui/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 "date-fns";
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?: "left" | "right";
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, "dd/MM/yyyy");
28
- return `${format(from, "dd/MM/yyyy")} - ${format(to, "dd/MM/yyyy")}`;
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 = "Select date",
35
+ placeholder = 'Select date',
33
36
  disabled = false,
34
- mode = "both",
35
- selectionMode = "range",
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 = "right",
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: "", dateRange: undefined };
51
+ if (!defaultValue) return { value: '', dateRange: undefined };
48
52
 
49
53
  try {
50
- if (selectionMode === "range" && Array.isArray(defaultValue)) {
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 === "single" && typeof defaultValue === "string") {
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, "dd/MM/yyyy");
66
+ const displayValue = format(date, 'dd/MM/yyyy');
63
67
  return { value: displayValue, dateRange };
64
68
  }
65
69
  } catch (error) {
66
- console.error("Error parsing default date value:", error);
70
+ console.error('Error parsing default date value:', error);
67
71
  }
68
72
 
69
- return { value: "", dateRange: undefined };
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<{ hour: string; minute: string; meridiem: "AM" | "PM" } | undefined>(undefined);
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((payload: { dateRange?: any; time?: { hour: string; minute: string; meridiem: "AM" | "PM" } }) => {
79
- const datePart = formatDateRange(payload.dateRange);
80
- const time = payload.time ? `${payload.time.hour}:${payload.time.minute} ${payload.time.meridiem}` : "";
81
- const combined = [datePart, time].filter(Boolean).join(" ");
82
- setValue(combined);
83
- setSelectedDateRange(payload.dateRange);
84
- setSelectedTime(payload.time);
85
-
86
- // Return date strings in yyyy-MM-dd format for both modes
87
- if (payload.dateRange) {
88
- if (selectionMode === "range") {
89
- // Return array of date strings for range mode
90
- const from = payload.dateRange.from;
91
- const to = payload.dateRange.to ?? payload.dateRange.from;
92
-
93
- if (from && to) {
94
- const fromStr = format(from, "yyyy-MM-dd");
95
- const toStr = format(to, "yyyy-MM-dd");
96
- onValueChange?.([fromStr, toStr]);
97
- }
98
- } else {
99
- // Return single date string in yyyy-MM-dd format for single mode
100
- const date = payload.dateRange.from;
101
- if (date) {
102
- const dateStr = format(date, "yyyy-MM-dd");
103
- onValueChange?.(dateStr);
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
- }, [onValueChange, selectionMode]);
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 };