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
package/dist/components/molecules/DialogContentPolicy/CancellationLayout/CancellationLayout.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IconName } from '@/src/components/atoms/Icon/Icon';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import './CancellationLayout.css';
|
|
4
|
+
export interface CancellationLayoutProps {
|
|
5
|
+
title: React.ReactNode;
|
|
6
|
+
icon: IconName;
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
className?: string;
|
|
9
|
+
image: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const CancellationLayout: React.FC<CancellationLayoutProps>;
|
package/dist/components/molecules/DialogContentPolicy/CancellationLayout/CancellationLayout.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { cn } from '@/src/lib/utils';
|
|
14
|
+
import { ServiceTitle } from '../../ServiceTitle/ServiceTitle';
|
|
15
|
+
import './CancellationLayout.css';
|
|
16
|
+
export var CancellationLayout = function (props) {
|
|
17
|
+
var title = props.title, icon = props.icon, children = props.children, className = props.className, image = props.image;
|
|
18
|
+
return (_jsxs("div", __assign({ className: cn('cancellation-layout', className) }, { children: [_jsx(ServiceTitle, { title: title, icon: icon }), _jsxs("div", __assign({ className: "cancellation-layout__content" }, { children: [_jsx("div", __assign({ className: "cancellation-layout__content-left" }, { children: children })), _jsx("figure", __assign({ className: "cancellation-layout__content-right" }, { children: _jsx("img", { src: image, alt: (title === null || title === void 0 ? void 0 : title.toString()) || '', width: 150, height: 200 }) }))] }))] })));
|
|
19
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { RoomItem } from '@/src/types/table';
|
|
3
|
+
export interface DialogCancellationAccomProps {
|
|
4
|
+
image: string;
|
|
5
|
+
hotelName: string;
|
|
6
|
+
dates: string[];
|
|
7
|
+
rooms: RoomItem[];
|
|
8
|
+
}
|
|
9
|
+
export declare const DialogCancellationAccom: React.FC<DialogCancellationAccomProps>;
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import useStays from '@/src/hooks/useStays';
|
|
14
|
+
import { Fragment } from 'react';
|
|
15
|
+
import Chip from '../../atoms/Chip/Chip';
|
|
16
|
+
import { Text } from '../../atoms/Typography/Typography';
|
|
17
|
+
import { DateDisplay } from '../DateDisplay/DateDisplay';
|
|
18
|
+
import TextWithIcon from '../TextWithIcon/TextWithIcon';
|
|
19
|
+
import { CancellationLayout } from './CancellationLayout/CancellationLayout';
|
|
20
|
+
export var DialogCancellationAccom = function (props) {
|
|
21
|
+
var image = props.image, hotelName = props.hotelName, dates = props.dates, rooms = props.rooms;
|
|
22
|
+
var stay = useStays(dates);
|
|
23
|
+
return (_jsx(CancellationLayout, __assign({ title: "Accommodation", icon: "accom", image: image }, { children: _jsxs("div", __assign({ className: "space-y-6" }, { children: [_jsxs("div", __assign({ className: "space-y-1" }, { children: [_jsx(Text, __assign({ variant: "bold" }, { children: hotelName })), _jsx(DateDisplay, { dates: dates }), _jsxs(TextWithIcon, __assign({ icon: "night", textLeading: "4" }, { children: [stay, " Nights"] }))] })), _jsx("div", __assign({ className: "" }, { children: rooms.map(function (room, index) { return (_jsxs("div", __assign({ className: "space-y-4" }, { children: [_jsxs("div", __assign({ className: "space-y-1" }, { children: [_jsxs(TextWithIcon, __assign({ icon: "accom", textLeading: "4" }, { children: [index + 1, " Room"] })), _jsx(Text, __assign({ size: "sm" }, { children: room.RoomName }))] })), room.cancellation_policy.map(function (policy) { return (_jsxs(Fragment, { children: [_jsxs(Chip, __assign({ type: "outline", color: "brand", isBlackText: true }, { children: ["Policy period applies", ' ', _jsx(DateDisplay, { dates: [policy.ValidFrom, policy.ValidTo], textSize: "xs" })] })), _jsxs(Text, __assign({ variant: "bold", size: "xs", leading: "4" }, { children: [policy.Value, " % of total price"] })), _jsx(Text, __assign({ size: "xs", leading: "4" }, { children: policy.Description }))] }, "policy-".concat(index))); })] }), "rm-".concat(index))); }) }))] })) })));
|
|
24
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface DialogCancellationExcursionProps {
|
|
3
|
+
image: string;
|
|
4
|
+
excursionName: string;
|
|
5
|
+
date: string;
|
|
6
|
+
policy: {
|
|
7
|
+
title: string;
|
|
8
|
+
description: string;
|
|
9
|
+
};
|
|
10
|
+
details: {
|
|
11
|
+
duration: string;
|
|
12
|
+
meal: string;
|
|
13
|
+
accessibility: string;
|
|
14
|
+
transferType: string;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export declare const DialogCancellationExcursion: React.FC<DialogCancellationExcursionProps>;
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { Text } from '../../atoms/Typography/Typography';
|
|
14
|
+
import { DateDisplay } from '../DateDisplay/DateDisplay';
|
|
15
|
+
import { ServiceInfo } from '../ServiceInfo/ServiceInfo';
|
|
16
|
+
import { CancellationLayout } from './CancellationLayout/CancellationLayout';
|
|
17
|
+
export var DialogCancellationExcursion = function (props) {
|
|
18
|
+
var image = props.image, excursionName = props.excursionName, date = props.date, details = props.details, policy = props.policy;
|
|
19
|
+
return (_jsx(CancellationLayout, __assign({ title: "Excursion", icon: "map", image: image }, { children: _jsxs("div", __assign({ className: "space-y-6" }, { children: [_jsxs("div", __assign({ className: "space-y-1" }, { children: [_jsx(Text, __assign({ variant: "bold" }, { children: excursionName })), _jsx(DateDisplay, { dates: [date] })] })), _jsxs(ServiceInfo, { children: [_jsx(ServiceInfo.Item, __assign({ icon: "stopwatch", label: "Duration" }, { children: details.duration })), _jsx(ServiceInfo.Item, __assign({ icon: "utensils", label: "Meal" }, { children: details.meal })), _jsx(ServiceInfo.Item, __assign({ icon: "bike", label: "Difficulty" }, { children: details.accessibility })), _jsx(ServiceInfo.Item, __assign({ icon: "car", label: "Transfer Type" }, { children: details.transferType }))] }), _jsxs("div", __assign({ className: "" }, { children: [_jsx(Text, __assign({ variant: "bold", size: "xs", leading: "4" }, { children: policy.title })), _jsx(Text, __assign({ size: "xs", leading: "4" }, { children: policy.description }))] }))] })) })));
|
|
20
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DialogCancellationAccomProps } from './DialogCancellationAccom';
|
|
3
|
+
import { DialogCancellationExcursionProps } from './DialogCancellationExcursion';
|
|
4
|
+
export interface CancellationItem {
|
|
5
|
+
type: 'accommodation' | 'excursion';
|
|
6
|
+
data: DialogCancellationAccomProps | DialogCancellationExcursionProps;
|
|
7
|
+
}
|
|
8
|
+
export interface DialogCancellationListProps {
|
|
9
|
+
cancellations: CancellationItem[];
|
|
10
|
+
}
|
|
11
|
+
export declare const DialogCancellationList: React.FC<DialogCancellationListProps>;
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { DialogCancellationAccom, } from './DialogCancellationAccom';
|
|
14
|
+
import { DialogCancellationExcursion, } from './DialogCancellationExcursion';
|
|
15
|
+
import { DialogContentPolicy } from './DialogContentPolicy';
|
|
16
|
+
export var DialogCancellationList = function (props) {
|
|
17
|
+
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
|
+
return (_jsx(DialogContentPolicy, { children: cancellations.map(function (c, index) {
|
|
25
|
+
if (c.type === 'accommodation' && isAccommodation(c.data)) {
|
|
26
|
+
return _jsx(DialogCancellationAccom, __assign({}, c.data), "acc-".concat(index));
|
|
27
|
+
}
|
|
28
|
+
if (c.type === 'excursion' && isExcursion(c.data)) {
|
|
29
|
+
return _jsx(DialogCancellationExcursion, __assign({}, c.data), "exc-".concat(index));
|
|
30
|
+
}
|
|
31
|
+
return null;
|
|
32
|
+
}) }));
|
|
33
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface DialogContentPolicyProps {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
onSubmit?: () => void;
|
|
5
|
+
}
|
|
6
|
+
export declare const DialogContentPolicy: {
|
|
7
|
+
(props: DialogContentPolicyProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
Accommodation: React.FC<import("./DialogCancellationAccom").DialogCancellationAccomProps>;
|
|
9
|
+
Excursion: React.FC<import("./DialogCancellationExcursion").DialogCancellationExcursionProps>;
|
|
10
|
+
List: React.FC<import("./DialogCancellationList").DialogCancellationListProps>;
|
|
11
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { useState } from 'react';
|
|
14
|
+
import Button from '../../atoms/Button/Button';
|
|
15
|
+
import { Text } from '../../atoms/Typography/Typography';
|
|
16
|
+
import { Checkbox } from '../../ui/checkbox';
|
|
17
|
+
import { DialogCancellationAccom } from './DialogCancellationAccom';
|
|
18
|
+
import { DialogCancellationExcursion } from './DialogCancellationExcursion';
|
|
19
|
+
import { DialogCancellationList } from './DialogCancellationList';
|
|
20
|
+
export var DialogContentPolicy = function (props) {
|
|
21
|
+
var children = props.children, onSubmit = props.onSubmit;
|
|
22
|
+
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" }))] }))] })));
|
|
24
|
+
};
|
|
25
|
+
DialogContentPolicy.Accommodation = DialogCancellationAccom;
|
|
26
|
+
DialogContentPolicy.Excursion = DialogCancellationExcursion;
|
|
27
|
+
DialogContentPolicy.List = DialogCancellationList;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export * from './DialogContentPolicy';
|
|
2
|
+
export type { CancellationLayoutProps } from './CancellationLayout/CancellationLayout';
|
|
3
|
+
export type { DialogCancellationAccomProps } from './DialogCancellationAccom';
|
|
4
|
+
export type { DialogCancellationExcursionProps } from './DialogCancellationExcursion';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './DialogContentPolicy';
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { IconName } from '../../atoms/Icon/Icon';
|
|
3
|
+
import { IconBaseProps } from '../../atoms/Icon/icons/registry';
|
|
2
4
|
import { TextProps } from '../../atoms/Typography/Typography';
|
|
3
5
|
import './ServiceTitle.css';
|
|
4
6
|
export interface ServiceTitleProps {
|
|
5
|
-
title:
|
|
7
|
+
title: React.ReactNode;
|
|
6
8
|
textSize?: TextProps['size'];
|
|
9
|
+
textLeading?: TextProps['leading'];
|
|
10
|
+
textVariant?: TextProps['variant'];
|
|
11
|
+
icon?: IconName;
|
|
12
|
+
iconSize?: IconBaseProps['size'];
|
|
7
13
|
}
|
|
8
14
|
export declare const ServiceTitle: React.FC<ServiceTitleProps>;
|
|
@@ -9,10 +9,11 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import Icon from '../../atoms/Icon/Icon';
|
|
13
14
|
import { Text } from '../../atoms/Typography/Typography';
|
|
14
15
|
import './ServiceTitle.css';
|
|
15
16
|
export var ServiceTitle = function (props) {
|
|
16
|
-
var title = props.title, _a = props.textSize, textSize = _a === void 0 ? 'md' : _a;
|
|
17
|
-
return (
|
|
17
|
+
var title = props.title, _a = props.textSize, textSize = _a === void 0 ? 'md' : _a, icon = props.icon, _b = props.iconSize, iconSize = _b === void 0 ? 'sm' : _b, _c = props.textLeading, textLeading = _c === void 0 ? '5' : _c, _d = props.textVariant, textVariant = _d === void 0 ? 'bold' : _d;
|
|
18
|
+
return (_jsxs(Text, __assign({ className: "service-title", size: textSize, variant: textVariant, leading: textLeading, as: "div", color: "accent" }, { children: [icon && _jsx(Icon, { name: icon, size: iconSize }), _jsx("span", { children: title })] })));
|
|
18
19
|
};
|
|
@@ -7,5 +7,7 @@ declare function Booking(props: BookingProps): import("react/jsx-runtime").JSX.E
|
|
|
7
7
|
declare namespace Booking {
|
|
8
8
|
var Docket: React.FC<import("./BookingDocket/BookingDocket").BookingDocketProps>;
|
|
9
9
|
var Step: React.FC<import("./BookingStep/BookingStep").BookingStepProps>;
|
|
10
|
+
var Header: React.FC<import("./BookingHeader").BookingHeaderProps>;
|
|
11
|
+
var PaxList: React.FC<import("./BookingPaxList").BookingPaxProps>;
|
|
10
12
|
}
|
|
11
13
|
export default Booking;
|
|
@@ -24,6 +24,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
24
24
|
import { cn } from '@/src/lib/utils';
|
|
25
25
|
import './Booking.css';
|
|
26
26
|
import { BookingDocket } from './BookingDocket/BookingDocket';
|
|
27
|
+
import { BookingHeader } from './BookingHeader';
|
|
28
|
+
import { BookingPaxList } from './BookingPaxList';
|
|
27
29
|
import { BookingStep } from './BookingStep/BookingStep';
|
|
28
30
|
export default function Booking(props) {
|
|
29
31
|
var children = props.children, className = props.className, restProps = __rest(props, ["children", "className"]);
|
|
@@ -31,3 +33,5 @@ export default function Booking(props) {
|
|
|
31
33
|
}
|
|
32
34
|
Booking.Docket = BookingDocket;
|
|
33
35
|
Booking.Step = BookingStep;
|
|
36
|
+
Booking.Header = BookingHeader;
|
|
37
|
+
Booking.PaxList = BookingPaxList;
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { Heading, Text } from '../../atoms/Typography/Typography';
|
|
14
|
+
export var BookingHeader = function (props) {
|
|
15
|
+
var fileNumber = props.fileNumber, reference = props.reference, isBooking = props.isBooking, location = props.location;
|
|
16
|
+
return (_jsxs("div", __assign({ className: "space-y-2" }, { children: [_jsxs(Text, __assign({ color: "light" }, { children: ["File number: ", fileNumber] })), _jsxs(Heading, __assign({ level: 6, as: "h1", color: "brand" }, { children: [isBooking ? 'Booking' : 'Quotation', ": N\u00B0 ", reference] })), _jsx(Text, __assign({ color: "accent", size: "xl" }, { children: location }))] })));
|
|
17
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BookingPaxAccomProps, BookingPaxExcursionProps, BookingPaxTransferProps } from '../../molecules/BookingPax';
|
|
3
|
+
import { BookingPaxClientInfo, BookingPaxClientOptions } from '../../molecules/BookingPax/BookingPaxClient/BookingPaxClient';
|
|
4
|
+
export interface BookingPaxData {
|
|
5
|
+
type: 'accommodation' | 'excursion' | 'transfer';
|
|
6
|
+
data: Omit<BookingPaxAccomProps, 'clientsInfo'> | Omit<BookingPaxExcursionProps, 'clientsInfo'> | Omit<BookingPaxTransferProps, 'clientsInfo'>;
|
|
7
|
+
}
|
|
8
|
+
export interface BookingPaxAutoFilledData {
|
|
9
|
+
type: BookingPaxData['type'];
|
|
10
|
+
parentIndex: number;
|
|
11
|
+
roomIndex?: number;
|
|
12
|
+
selectedClients: BookingPaxClientInfo[];
|
|
13
|
+
}
|
|
14
|
+
export interface BookingPaxProps {
|
|
15
|
+
data: BookingPaxData[];
|
|
16
|
+
clientsInfo: BookingPaxClientInfo[];
|
|
17
|
+
isSubmitted?: boolean;
|
|
18
|
+
onPaxChange?: (index: number, type: BookingPaxData['type'], options: BookingPaxClientOptions) => void;
|
|
19
|
+
onRemarkChange?: (index: number, type: BookingPaxData['type'], value: string) => void;
|
|
20
|
+
onError?: (index: number, type: BookingPaxData['type'], hasError: boolean) => void;
|
|
21
|
+
onTimeChange?: (index: number, value: string | string[]) => void;
|
|
22
|
+
onFlightNumberChange?: (index: number, value: string) => void;
|
|
23
|
+
onAutoFilled?: (data: BookingPaxAutoFilledData[]) => void;
|
|
24
|
+
}
|
|
25
|
+
export declare const BookingPaxList: React.FC<BookingPaxProps>;
|
|
@@ -0,0 +1,117 @@
|
|
|
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 } from "react/jsx-runtime";
|
|
22
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
23
|
+
import { BookingPax, } from '../../molecules/BookingPax';
|
|
24
|
+
// Type guards for better type safety
|
|
25
|
+
var isAccommodationData = function (data) {
|
|
26
|
+
return 'rooms' in data && 'hotelName' in data && 'roomName' in data;
|
|
27
|
+
};
|
|
28
|
+
var isExcursionData = function (data) {
|
|
29
|
+
return 'name' in data && 'type' in data && !('from' in data);
|
|
30
|
+
};
|
|
31
|
+
var isTransferData = function (data) {
|
|
32
|
+
return 'from' in data && 'to' in data && 'type' in data;
|
|
33
|
+
};
|
|
34
|
+
export var BookingPaxList = function (props) {
|
|
35
|
+
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
|
+
var _a = useState([]), autoFilledData = _a[0], setAutoFilledData = _a[1];
|
|
37
|
+
// Memoized callback handlers to reduce re-renders
|
|
38
|
+
var handlePaxChange = useCallback(function (type, index, options) {
|
|
39
|
+
onPaxChange === null || onPaxChange === void 0 ? void 0 : onPaxChange(index, type, options);
|
|
40
|
+
}, [onPaxChange]);
|
|
41
|
+
var handleRemarkChange = useCallback(function (type, index, value) {
|
|
42
|
+
onRemarkChange === null || onRemarkChange === void 0 ? void 0 : onRemarkChange(index, type, value);
|
|
43
|
+
}, [onRemarkChange]);
|
|
44
|
+
var handleError = useCallback(function (index, type, hasError) {
|
|
45
|
+
onError === null || onError === void 0 ? void 0 : onError(index, type, hasError);
|
|
46
|
+
}, [onError]);
|
|
47
|
+
var handleTimeChange = useCallback(function (value, index) {
|
|
48
|
+
// Don't need type because only transfer has this callback
|
|
49
|
+
onTimeChange === null || onTimeChange === void 0 ? void 0 : onTimeChange(index, value);
|
|
50
|
+
}, [onTimeChange]);
|
|
51
|
+
var handleFlightNumberChange = useCallback(function (value, index) {
|
|
52
|
+
// Don't need type because only transfer has this callback
|
|
53
|
+
onFlightNumberChange === null || onFlightNumberChange === void 0 ? void 0 : onFlightNumberChange(index, value);
|
|
54
|
+
}, [onFlightNumberChange]);
|
|
55
|
+
var handleAutoFilled = useCallback(function (type) {
|
|
56
|
+
return function (paxCount, index, roomIndex) {
|
|
57
|
+
if (paxCount === clientsInfo.length) {
|
|
58
|
+
setAutoFilledData(function (prev) {
|
|
59
|
+
var findParentIndex = prev.find(function (d) { return d.parentIndex === index; });
|
|
60
|
+
if (findParentIndex) {
|
|
61
|
+
return prev;
|
|
62
|
+
}
|
|
63
|
+
return __spreadArray(__spreadArray([], prev, true), [
|
|
64
|
+
{
|
|
65
|
+
type: type,
|
|
66
|
+
parentIndex: index,
|
|
67
|
+
selectedClients: clientsInfo,
|
|
68
|
+
roomIndex: roomIndex,
|
|
69
|
+
},
|
|
70
|
+
], false);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
}, []);
|
|
75
|
+
useEffect(function () {
|
|
76
|
+
data.forEach(function (item, index) {
|
|
77
|
+
var type = item.type, itemData = item.data;
|
|
78
|
+
if (type === 'accommodation' && isAccommodationData(itemData)) {
|
|
79
|
+
var initAccom_1 = handleAutoFilled('accommodation');
|
|
80
|
+
// if(itemData.clientsInfo.length === itemData)
|
|
81
|
+
itemData.rooms.forEach(function (room, roomIndex) {
|
|
82
|
+
initAccom_1(room.paxCount, index, roomIndex);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
else if (type === 'excursion' && isExcursionData(itemData)) {
|
|
86
|
+
var initExcursion = handleAutoFilled('excursion');
|
|
87
|
+
initExcursion(itemData.paxCount, index);
|
|
88
|
+
}
|
|
89
|
+
else if (type === 'transfer' && isTransferData(itemData)) {
|
|
90
|
+
var initTransfer = handleAutoFilled('transfer');
|
|
91
|
+
initTransfer(itemData.paxCount, index);
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}, [data, handleAutoFilled]);
|
|
95
|
+
useEffect(function () {
|
|
96
|
+
onAutoFilled === null || onAutoFilled === void 0 ? void 0 : onAutoFilled(autoFilledData);
|
|
97
|
+
}, [autoFilledData, onAutoFilled]);
|
|
98
|
+
return (_jsx(BookingPax, { children: data.map(function (item, index) {
|
|
99
|
+
var type = item.type, itemData = item.data;
|
|
100
|
+
var callbacks = {
|
|
101
|
+
onPaxChange: function (options) {
|
|
102
|
+
return handlePaxChange(type, index, options);
|
|
103
|
+
},
|
|
104
|
+
onRemarkChange: function (value) { return handleRemarkChange(type, index, value); },
|
|
105
|
+
};
|
|
106
|
+
if (type === 'accommodation' && isAccommodationData(itemData)) {
|
|
107
|
+
return (_jsx(BookingPax.Accom, __assign({}, itemData, callbacks, { clientsInfo: clientsInfo, isSubmitted: isSubmitted, onError: function (roomIndex, hasError) { return handleError(roomIndex, type, hasError); } }), "bp-accom-".concat(index)));
|
|
108
|
+
}
|
|
109
|
+
if (type === 'excursion' && isExcursionData(itemData)) {
|
|
110
|
+
return (_jsx(BookingPax.Excursion, __assign({}, itemData, { clientsInfo: clientsInfo, isSubmitted: isSubmitted, onError: function (hasError) { return handleError(index, type, hasError); } }, callbacks), "bp-excursion-".concat(index)));
|
|
111
|
+
}
|
|
112
|
+
if (type === 'transfer' && isTransferData(itemData)) {
|
|
113
|
+
return (_jsx(BookingPax.Transfer, __assign({}, itemData, { onTimeChange: function (value) { return handleTimeChange(value, index); }, onFlightNumberChange: function (value) { return handleFlightNumberChange(value, index); }, clientsInfo: clientsInfo, isSubmitted: isSubmitted, onError: function (hasError) { return handleError(index, type, hasError); } }, callbacks), "bp-transfer-".concat(index)));
|
|
114
|
+
}
|
|
115
|
+
return null;
|
|
116
|
+
}) }));
|
|
117
|
+
};
|
|
@@ -12,10 +12,10 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import Button from '@/src/components/atoms/Button/Button';
|
|
14
14
|
import { StepperTimeline, } from '@/src/components/molecules/StepperTimeline/StepperTimeline';
|
|
15
|
-
import { useState } from 'react';
|
|
15
|
+
import { useEffect, useState } from 'react';
|
|
16
16
|
import './BookingStep.css';
|
|
17
17
|
export var BookingStep = function (props) {
|
|
18
|
-
var steps = props.steps, className = props.className, nextDisabled = props.nextDisabled, onStepChange = props.onStepChange, onNextClick = props.onNextClick;
|
|
18
|
+
var steps = props.steps, className = props.className, nextDisabled = props.nextDisabled, currentStep = props.currentStep, onStepChange = props.onStepChange, onNextClick = props.onNextClick;
|
|
19
19
|
var _a = useState(0), currentIndex = _a[0], setCurrentIndex = _a[1];
|
|
20
20
|
var handleStepChange = function (step, index) {
|
|
21
21
|
setCurrentIndex(index);
|
|
@@ -26,5 +26,8 @@ export var BookingStep = function (props) {
|
|
|
26
26
|
setCurrentIndex(currentStep);
|
|
27
27
|
onNextClick === null || onNextClick === void 0 ? void 0 : onNextClick(steps[currentStep], currentStep);
|
|
28
28
|
};
|
|
29
|
+
useEffect(function () {
|
|
30
|
+
setCurrentIndex(currentStep ? currentStep - 1 : 0);
|
|
31
|
+
}, [currentStep]);
|
|
29
32
|
return (_jsxs("div", __assign({ className: "booking-step" }, { children: [_jsx(StepperTimeline, { steps: steps, className: className, currentIndex: currentIndex, onChange: handleStepChange }), _jsx(Button, __assign({ trailingIcon: "arrow-right-outline", variant: "secondary", className: "w-[189px]", disabled: nextDisabled, onClick: handleNextClick }, { children: currentIndex === steps.length - 1 ? 'Confirm' : 'Next' }))] })));
|
|
30
33
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { DateTimeProps } from
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DateTimeProps } from '../../molecules/Calendar/DateTime';
|
|
3
|
+
import { IconName } from '../../atoms/Icon/Icon';
|
|
3
4
|
export interface DateTimePickerProps extends Partial<DateTimeProps> {
|
|
4
5
|
placeholder?: string;
|
|
5
6
|
disabled?: boolean;
|
|
@@ -9,9 +10,11 @@ export interface DateTimePickerProps extends Partial<DateTimeProps> {
|
|
|
9
10
|
/** Whether the calendar icon has full bg*/
|
|
10
11
|
iconBGFull?: boolean;
|
|
11
12
|
/** Position of the calendar icon: left or right */
|
|
12
|
-
iconPosition?:
|
|
13
|
+
iconPosition?: 'left' | 'right';
|
|
13
14
|
/** Show chevron on the right when icon is on the left */
|
|
14
15
|
showChevron?: boolean;
|
|
16
|
+
/** Icon to display on the left of the input */
|
|
17
|
+
icon?: IconName;
|
|
15
18
|
}
|
|
16
19
|
declare const DateTimePicker: React.FC<DateTimePickerProps>;
|
|
17
20
|
export default DateTimePicker;
|
|
@@ -10,29 +10,29 @@ 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 React, { useState } from
|
|
14
|
-
import CalendarInput from
|
|
15
|
-
import DateTime from
|
|
16
|
-
import { Popover,
|
|
17
|
-
import { format } from
|
|
13
|
+
import React, { useState } from 'react';
|
|
14
|
+
import CalendarInput from '../../molecules/Calendar/CalendarInput';
|
|
15
|
+
import DateTime from '../../molecules/Calendar/DateTime';
|
|
16
|
+
import { Popover, PopoverContent, PopoverTrigger } from '../../ui/popover';
|
|
17
|
+
import { format } from 'date-fns';
|
|
18
18
|
var formatDateRange = function (dateRange) {
|
|
19
19
|
var _a;
|
|
20
20
|
if (!dateRange || !dateRange.from)
|
|
21
|
-
return
|
|
21
|
+
return '';
|
|
22
22
|
var from = dateRange.from;
|
|
23
23
|
var to = (_a = dateRange.to) !== null && _a !== void 0 ? _a : dateRange.from;
|
|
24
24
|
if (+from === +to)
|
|
25
|
-
return format(from,
|
|
26
|
-
return "".concat(format(from,
|
|
25
|
+
return format(from, 'dd/MM/yyyy');
|
|
26
|
+
return "".concat(format(from, 'dd/MM/yyyy'), " - ").concat(format(to, 'dd/MM/yyyy'));
|
|
27
27
|
};
|
|
28
28
|
var DateTimePicker = function (_a) {
|
|
29
|
-
var _b = _a.placeholder, placeholder = _b === void 0 ?
|
|
29
|
+
var _b = _a.placeholder, placeholder = _b === void 0 ? 'Select date' : _b, _c = _a.disabled, disabled = _c === void 0 ? false : _c, _d = _a.mode, mode = _d === void 0 ? 'both' : _d, _e = _a.selectionMode, selectionMode = _e === void 0 ? 'range' : _e, _f = _a.numberOfMonths, numberOfMonths = _f === void 0 ? 2 : _f, _g = _a.disableBeforeToday, disableBeforeToday = _g === void 0 ? true : _g, _h = _a.disableToday, disableToday = _h === void 0 ? false : _h, onValueChange = _a.onValueChange, defaultValue = _a.defaultValue, _j = _a.iconBGFull, iconBGFull = _j === void 0 ? true : _j, _k = _a.iconPosition, iconPosition = _k === void 0 ? 'right' : _k, _l = _a.showChevron, showChevron = _l === void 0 ? false : _l, icon = _a.icon;
|
|
30
30
|
// Parse default value and set initial state
|
|
31
31
|
var parseDefaultValue = function () {
|
|
32
32
|
if (!defaultValue)
|
|
33
|
-
return { value:
|
|
33
|
+
return { value: '', dateRange: undefined };
|
|
34
34
|
try {
|
|
35
|
-
if (selectionMode ===
|
|
35
|
+
if (selectionMode === 'range' && Array.isArray(defaultValue)) {
|
|
36
36
|
// Handle range: ["yyyy-MM-dd", "yyyy-MM-dd"]
|
|
37
37
|
var fromStr = defaultValue[0], toStr = defaultValue[1];
|
|
38
38
|
var from = new Date(fromStr);
|
|
@@ -41,18 +41,18 @@ var DateTimePicker = function (_a) {
|
|
|
41
41
|
var displayValue = formatDateRange(dateRange);
|
|
42
42
|
return { value: displayValue, dateRange: dateRange };
|
|
43
43
|
}
|
|
44
|
-
else if (selectionMode ===
|
|
44
|
+
else if (selectionMode === 'single' && typeof defaultValue === 'string') {
|
|
45
45
|
// Handle single: "yyyy-MM-dd"
|
|
46
46
|
var date = new Date(defaultValue);
|
|
47
47
|
var dateRange = { from: date, to: date };
|
|
48
|
-
var displayValue = format(date,
|
|
48
|
+
var displayValue = format(date, 'dd/MM/yyyy');
|
|
49
49
|
return { value: displayValue, dateRange: dateRange };
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
catch (error) {
|
|
53
|
-
console.error(
|
|
53
|
+
console.error('Error parsing default date value:', error);
|
|
54
54
|
}
|
|
55
|
-
return { value:
|
|
55
|
+
return { value: '', dateRange: undefined };
|
|
56
56
|
};
|
|
57
57
|
var initialState = parseDefaultValue();
|
|
58
58
|
var _m = useState(initialState.value), value = _m[0], setValue = _m[1];
|
|
@@ -62,20 +62,22 @@ var DateTimePicker = function (_a) {
|
|
|
62
62
|
var handleDtChange = React.useCallback(function (payload) {
|
|
63
63
|
var _a;
|
|
64
64
|
var datePart = formatDateRange(payload.dateRange);
|
|
65
|
-
var time = payload.time
|
|
66
|
-
|
|
65
|
+
var time = payload.time
|
|
66
|
+
? "".concat(payload.time.hour, ":").concat(payload.time.minute, " ").concat(payload.time.meridiem)
|
|
67
|
+
: '';
|
|
68
|
+
var combined = [datePart, time].filter(Boolean).join(' ');
|
|
67
69
|
setValue(combined);
|
|
68
70
|
setSelectedDateRange(payload.dateRange);
|
|
69
71
|
setSelectedTime(payload.time);
|
|
70
72
|
// Return date strings in yyyy-MM-dd format for both modes
|
|
71
73
|
if (payload.dateRange) {
|
|
72
|
-
if (selectionMode ===
|
|
74
|
+
if (selectionMode === 'range') {
|
|
73
75
|
// Return array of date strings for range mode
|
|
74
76
|
var from = payload.dateRange.from;
|
|
75
77
|
var to = (_a = payload.dateRange.to) !== null && _a !== void 0 ? _a : payload.dateRange.from;
|
|
76
78
|
if (from && to) {
|
|
77
|
-
var fromStr = format(from,
|
|
78
|
-
var toStr = format(to,
|
|
79
|
+
var fromStr = format(from, 'yyyy-MM-dd');
|
|
80
|
+
var toStr = format(to, 'yyyy-MM-dd');
|
|
79
81
|
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange([fromStr, toStr]);
|
|
80
82
|
}
|
|
81
83
|
}
|
|
@@ -83,12 +85,16 @@ var DateTimePicker = function (_a) {
|
|
|
83
85
|
// Return single date string in yyyy-MM-dd format for single mode
|
|
84
86
|
var date = payload.dateRange.from;
|
|
85
87
|
if (date) {
|
|
86
|
-
var dateStr = format(date,
|
|
88
|
+
var dateStr = format(date, 'yyyy-MM-dd');
|
|
87
89
|
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(dateStr);
|
|
88
90
|
}
|
|
89
91
|
}
|
|
90
92
|
}
|
|
93
|
+
if (!payload.dateRange && payload.time) {
|
|
94
|
+
var timeStr = "".concat(payload.time.hour, ":").concat(payload.time.minute, " ").concat(payload.time.meridiem);
|
|
95
|
+
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(timeStr);
|
|
96
|
+
}
|
|
91
97
|
}, [onValueChange, selectionMode]);
|
|
92
|
-
return (_jsxs(Popover, __assign({ open: isOpen, onOpenChange: setIsOpen }, { children: [_jsx(PopoverTrigger, __assign({ asChild: true }, { children: _jsx("div", { children: _jsx(CalendarInput, { placeholder: placeholder, value: value, disabled: disabled, iconBGFull: iconBGFull, iconPosition: iconPosition, showChevron: showChevron, isOpen: isOpen }) }) })), _jsx(PopoverContent, __assign({ className: "w-auto p-0 border-transparent" }, { children: _jsx(DateTime, { mode: mode, selectionMode: selectionMode, numberOfMonths: numberOfMonths, disableBeforeToday: disableBeforeToday, disableToday: disableToday, onChange: handleDtChange, defaultDateRange: selectedDateRange, defaultTime: selectedTime }) }))] })));
|
|
98
|
+
return (_jsxs(Popover, __assign({ open: isOpen, onOpenChange: setIsOpen }, { children: [_jsx(PopoverTrigger, __assign({ asChild: true }, { children: _jsx("div", { children: _jsx(CalendarInput, { placeholder: placeholder, value: value, disabled: disabled, iconBGFull: iconBGFull, iconPosition: iconPosition, showChevron: showChevron, isOpen: isOpen, icon: icon }) }) })), _jsx(PopoverContent, __assign({ className: "w-auto p-0 border-transparent" }, { children: _jsx(DateTime, { mode: mode, selectionMode: selectionMode, numberOfMonths: numberOfMonths, disableBeforeToday: disableBeforeToday, disableToday: disableToday, onChange: handleDtChange, defaultDateRange: selectedDateRange, defaultTime: selectedTime }) }))] })));
|
|
93
99
|
};
|
|
94
100
|
export default DateTimePicker;
|