mautourco-components 0.2.172 → 0.2.174
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/molecules/BookingPax/BookingPaxClient/BookingPaxClient.js +14 -4
- package/dist/components/molecules/BookingResume/BookingResume.css +9 -0
- package/dist/components/molecules/BookingResume/BookingResume.d.ts +1 -0
- package/dist/components/molecules/BookingResume/BookingResume.js +2 -1
- package/dist/components/organisms/Booking/BookingDocket/BookingDocket.js +2 -2
- package/package.json +1 -1
- package/src/components/molecules/BookingPax/BookingPaxClient/BookingPaxClient.tsx +14 -4
- package/src/components/molecules/BookingResume/BookingResume.css +3 -0
- package/src/components/molecules/BookingResume/BookingResume.tsx +2 -1
- package/src/components/organisms/Booking/BookingDocket/BookingDocket.tsx +3 -3
|
@@ -102,10 +102,20 @@ export function BookingPaxClient(props) {
|
|
|
102
102
|
var prevErrorRef = useRef(undefined);
|
|
103
103
|
useEffect(function () {
|
|
104
104
|
var _a;
|
|
105
|
-
var
|
|
106
|
-
if (
|
|
107
|
-
prevErrorRef.current
|
|
108
|
-
|
|
105
|
+
var selectedError = clients.length === paxCount;
|
|
106
|
+
if (selectedError) {
|
|
107
|
+
if (prevErrorRef.current !== selectedError) {
|
|
108
|
+
prevErrorRef.current = selectedError;
|
|
109
|
+
onError === null || onError === void 0 ? void 0 : onError(false);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
var hasError_1 = ((_a = selectedClientsInfoIds[selectedIndex]) === null || _a === void 0 ? void 0 : _a.length) !== paxCount ||
|
|
114
|
+
clients.length === paxCount;
|
|
115
|
+
if (prevErrorRef.current !== hasError_1) {
|
|
116
|
+
prevErrorRef.current = hasError_1;
|
|
117
|
+
onError === null || onError === void 0 ? void 0 : onError(hasError_1);
|
|
118
|
+
}
|
|
109
119
|
}
|
|
110
120
|
}, [selectedClientsInfoIds, selectedIndex, paxCount, onError]);
|
|
111
121
|
return (_jsxs("div", { className: "booking_spacing-y-2", children: [_jsxs(Text, { children: ["Please confirm the pax which applies on this service (", paxCount, " Pax)", ' ', _jsx(Text, { color: "state-error", as: "span", children: "*" })] }), _jsx("div", { className: cn('booking-pax-client', {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Do not edit directly, this file was auto-generated.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
.booking-resume > :not([hidden]) ~ :not([hidden]) {
|
|
6
|
+
--tw-space-y-reverse: 0;
|
|
7
|
+
margin-top: calc(2rem * calc(1 - var(--tw-space-y-reverse)));
|
|
8
|
+
margin-bottom: calc(2rem * var(--tw-space-y-reverse));
|
|
9
|
+
}
|
|
@@ -10,13 +10,14 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import './BookingResume.css';
|
|
13
14
|
import { BookingResumeLayout } from './BookingResumeLayout/BookingResumeLayout';
|
|
14
15
|
import { ResumeAccom } from './ResumeAccom/ResumeAccom';
|
|
15
16
|
import { ResumeExcursion } from './ResumeExcursion/ResumeExcursion';
|
|
16
17
|
import { ResumeOtherService } from './ResumeOtherService';
|
|
17
18
|
import { ResumeTransfer } from './ResumeTransfer';
|
|
18
19
|
export function BookingResume(props) {
|
|
19
|
-
return _jsx("div", __assign({ className: "booking-resume
|
|
20
|
+
return _jsx("div", __assign({ className: "booking-resume" }, props));
|
|
20
21
|
}
|
|
21
22
|
BookingResume.Layout = BookingResumeLayout;
|
|
22
23
|
BookingResume.Accommodation = ResumeAccom;
|
|
@@ -13,7 +13,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
13
13
|
import { useMobile } from '../../../../hooks/useMobile';
|
|
14
14
|
import { AnimatePresence, domAnimation, LazyMotion } from 'motion/react';
|
|
15
15
|
import * as motion from 'motion/react-m';
|
|
16
|
-
import { useLayoutEffect, useRef, useState } from 'react';
|
|
16
|
+
import { Fragment, useLayoutEffect, useRef, useState } from 'react';
|
|
17
17
|
import BookingDocketDeco from '../../../atoms/BookingDocketDeco/BookingDocketDeco';
|
|
18
18
|
import Icon from '../../../atoms/Icon/Icon';
|
|
19
19
|
import { Heading, Text } from '../../../atoms/Typography/Typography';
|
|
@@ -41,5 +41,5 @@ export function BookingDocket(props) {
|
|
|
41
41
|
setIsBookingOpen(true);
|
|
42
42
|
}
|
|
43
43
|
}, [isBookingOpen, resumes, isDesktop]);
|
|
44
|
-
return (_jsx(LazyMotion, { features: domAnimation, children: _jsxs("div", { className: "booking-docket__container", children: [!isDesktop && !isBookingOpen && (_jsx("div", { className: "flex justify-end mb-4", children: _jsxs(motion.button, { className: "booking-docket__mobile-button", onClick: handleBookingOpen, initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: { duration: 0.3 }, children: [_jsx(Icon, { name: "booking", size: "lg" }), _jsx(Text, { size: "lg", as: "span", variant: "bold", children: "Your booking" }), _jsx(Icon, { name: "eye", size: "lg" })] }, "booking-open") })), _jsx(AnimatePresence, { initial: false, children: isBookingOpen && (_jsx(motion.div, { className: "booking-docket", initial: { height: 0, opacity: 0 }, animate: { height: height, opacity: 1 }, exit: { height: 0 }, children: _jsxs("div", { ref: contentRef, children: [_jsxs("div", { className: "booking-docket__content", children: [_jsxs("div", { className: "space-y-3", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx(Heading, { level: 6, color: "accent", as: "h2", children: "Your Booking" }), _jsx("img", { src: logo, alt: "Mautourco Logo", width: 150 })] }), _jsxs("div", { className: "booking-docket__date-range", children: [_jsx(Text, { variant: "bold", size: "lg", children: "Booking file date range :" }), _jsx(DateDisplay, { dates: dates })] })] }), _jsx(BookingResume, { children: resumes.map(function (resume, index) { return (_jsxs(
|
|
44
|
+
return (_jsx(LazyMotion, { features: domAnimation, children: _jsxs("div", { className: "booking-docket__container", children: [!isDesktop && !isBookingOpen && (_jsx("div", { className: "flex justify-end mb-4", children: _jsxs(motion.button, { className: "booking-docket__mobile-button", onClick: handleBookingOpen, initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: { duration: 0.3 }, children: [_jsx(Icon, { name: "booking", size: "lg" }), _jsx(Text, { size: "lg", as: "span", variant: "bold", children: "Your booking" }), _jsx(Icon, { name: "eye", size: "lg" })] }, "booking-open") })), _jsx(AnimatePresence, { initial: false, children: isBookingOpen && (_jsx(motion.div, { className: "booking-docket", initial: { height: 0, opacity: 0 }, animate: { height: height, opacity: 1 }, exit: { height: 0 }, children: _jsxs("div", { ref: contentRef, children: [_jsxs("div", { className: "booking-docket__content", children: [_jsxs("div", { className: "space-y-3", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx(Heading, { level: 6, color: "accent", as: "h2", children: "Your Booking" }), _jsx("img", { src: logo, alt: "Mautourco Logo", width: 150 })] }), _jsxs("div", { className: "booking-docket__date-range", children: [_jsx(Text, { variant: "bold", size: "lg", children: "Booking file date range :" }), _jsx(DateDisplay, { dates: dates })] })] }), _jsx(BookingResume, { children: resumes.map(function (resume, index) { return (_jsxs(Fragment, { children: [resume.type === 'accommodation' && (_jsx(BookingResume.Accommodation, __assign({}, resume.data))), resume.type === 'transfer' && (_jsx(BookingResume.Transfer, __assign({}, resume.data))), resume.type === 'excursion' && (_jsx(BookingResume.Excursion, __assign({}, resume.data))), resume.type === 'otherService' && (_jsx(BookingResume.OtherService, __assign({}, resume.data)))] }, index)); }) })] }), _jsx("div", { className: "booking-docket__bg", children: _jsx(BookingDocketDeco, {}) })] }) }, "booking-docket")) }), !isDesktop && isBookingOpen && (_jsx("div", { className: "flex justify-end mt-10", children: _jsxs(motion.button, { className: "booking-docket__mobile-button", onClick: handleBookingOpen, initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: { duration: 0.3 }, children: [_jsx(Text, { size: "lg", as: "span", variant: "bold", children: "Close" }), _jsx(Icon, { name: "close-circle", size: "lg" })] }, "booking-close") }))] }) }));
|
|
45
45
|
}
|
package/package.json
CHANGED
|
@@ -217,10 +217,20 @@ export function BookingPaxClient(props: BookingPaxClientProps) {
|
|
|
217
217
|
const prevErrorRef = useRef<boolean | undefined>(undefined);
|
|
218
218
|
|
|
219
219
|
useEffect(() => {
|
|
220
|
-
const
|
|
221
|
-
if (
|
|
222
|
-
prevErrorRef.current
|
|
223
|
-
|
|
220
|
+
const selectedError = clients.length === paxCount;
|
|
221
|
+
if (selectedError) {
|
|
222
|
+
if (prevErrorRef.current !== selectedError) {
|
|
223
|
+
prevErrorRef.current = selectedError;
|
|
224
|
+
onError?.(false);
|
|
225
|
+
}
|
|
226
|
+
} else {
|
|
227
|
+
const hasError =
|
|
228
|
+
selectedClientsInfoIds[selectedIndex]?.length !== paxCount ||
|
|
229
|
+
clients.length === paxCount;
|
|
230
|
+
if (prevErrorRef.current !== hasError) {
|
|
231
|
+
prevErrorRef.current = hasError;
|
|
232
|
+
onError?.(hasError);
|
|
233
|
+
}
|
|
224
234
|
}
|
|
225
235
|
}, [selectedClientsInfoIds, selectedIndex, paxCount, onError]);
|
|
226
236
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import './BookingResume.css';
|
|
2
3
|
import { BookingResumeLayout } from './BookingResumeLayout/BookingResumeLayout';
|
|
3
4
|
import { ResumeAccom } from './ResumeAccom/ResumeAccom';
|
|
4
5
|
import { ResumeExcursion } from './ResumeExcursion/ResumeExcursion';
|
|
@@ -6,7 +7,7 @@ import { ResumeOtherService } from './ResumeOtherService';
|
|
|
6
7
|
import { ResumeTransfer } from './ResumeTransfer';
|
|
7
8
|
|
|
8
9
|
export function BookingResume(props: React.PropsWithChildren) {
|
|
9
|
-
return <div className="booking-resume
|
|
10
|
+
return <div className="booking-resume" {...props} />;
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
BookingResume.Layout = BookingResumeLayout;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useMobile } from '@/src/hooks/useMobile';
|
|
2
2
|
import { AnimatePresence, domAnimation, LazyMotion } from 'motion/react';
|
|
3
3
|
import * as motion from 'motion/react-m';
|
|
4
|
-
import { useLayoutEffect, useRef, useState } from 'react';
|
|
4
|
+
import { Fragment, useLayoutEffect, useRef, useState } from 'react';
|
|
5
5
|
|
|
6
6
|
import BookingDocketDeco from '@/src/components/atoms/BookingDocketDeco/BookingDocketDeco';
|
|
7
7
|
import Icon from '@/src/components/atoms/Icon/Icon';
|
|
@@ -105,7 +105,7 @@ export function BookingDocket(props: BookingDocketProps) {
|
|
|
105
105
|
</div>
|
|
106
106
|
<BookingResume>
|
|
107
107
|
{resumes.map((resume, index) => (
|
|
108
|
-
<
|
|
108
|
+
<Fragment key={index}>
|
|
109
109
|
{resume.type === 'accommodation' && (
|
|
110
110
|
<BookingResume.Accommodation
|
|
111
111
|
{...(resume.data as ResumeAccomProps)}
|
|
@@ -126,7 +126,7 @@ export function BookingDocket(props: BookingDocketProps) {
|
|
|
126
126
|
{...(resume.data as ResumeOtherServiceProps)}
|
|
127
127
|
/>
|
|
128
128
|
)}
|
|
129
|
-
</
|
|
129
|
+
</Fragment>
|
|
130
130
|
))}
|
|
131
131
|
</BookingResume>
|
|
132
132
|
</div>
|