mautourco-components 0.2.57 → 0.2.59
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/ActionDropdown/ActionDropdown.js +0 -1
- package/dist/components/molecules/BookingResume/ResumeAccom/ResumeAccom.js +1 -1
- package/dist/components/molecules/DialogContentPolicy/DialogCancellationAccom.js +1 -1
- package/dist/components/organisms/TabCancellationPolicy/HeaderAccom.js +1 -1
- package/dist/components/organisms/Table/Table.d.ts +4 -1
- package/dist/components/organisms/Table/Table.js +5 -5
- package/dist/hooks/useStays.d.ts +4 -1
- package/dist/hooks/useStays.js +9 -3
- package/dist/index.d.ts +17 -16
- package/dist/index.js +3 -1
- package/package.json +1 -1
- package/src/components/molecules/ActionDropdown/ActionDropdown.tsx +0 -2
- package/src/components/molecules/BookingResume/ResumeAccom/ResumeAccom.tsx +1 -1
- package/src/components/molecules/DialogContentPolicy/DialogCancellationAccom.tsx +1 -1
- package/src/components/organisms/TabCancellationPolicy/HeaderAccom.tsx +1 -1
- package/src/components/organisms/Table/Table.tsx +17 -7
|
@@ -17,7 +17,6 @@ import './ActionDropdown.css';
|
|
|
17
17
|
export function ActionDropdown(props) {
|
|
18
18
|
var data = props.data, children = props.children, _a = props.maxWidth, maxWidth = _a === void 0 ? '153px' : _a;
|
|
19
19
|
var _b = useState(false), open = _b[0], setOpen = _b[1];
|
|
20
|
-
console.log(open);
|
|
21
20
|
return (_jsxs(Popover, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverTrigger, { children: children !== null && children !== void 0 ? children : (_jsx("span", { className: "action-dropdown-trigger", children: _jsx(Icon, { name: "more-vertical" }) })) }), _jsx(PopoverContent, { className: "action-dropdown", style: { '--max-width': maxWidth }, align: "end", side: "bottom", avoidCollisions: false, children: data.map(function (item, index) {
|
|
22
21
|
var defaultButton = (_jsx("button", { onClick: function () {
|
|
23
22
|
var _a;
|
|
@@ -10,6 +10,6 @@ import { BookingResumeLayout } from '../BookingResumeLayout/BookingResumeLayout'
|
|
|
10
10
|
import './ResumeAccom.css';
|
|
11
11
|
export function ResumeAccom(props) {
|
|
12
12
|
var image = props.image, dates = props.dates, clientType = props.clientType, pax = props.pax, rooms = props.rooms, hotelName = props.hotelName;
|
|
13
|
-
var stay = useStays(dates);
|
|
13
|
+
var stay = useStays(dates).stay;
|
|
14
14
|
return (_jsxs(BookingResumeLayout, { title: "Accommodation", icon: "accom", image: image, className: "resume-accom", children: [_jsx(ServiceTitle, { title: hotelName }), _jsxs("div", { className: "space-y-2 mt-4", children: [_jsx(DateDisplay, { dates: dates, colorMode: "green" }), _jsxs(TextWithIcon, { icon: "night", children: [stay, " Nights"] }), _jsxs(Text, { variant: "medium", size: "sm", leading: "4", children: [_jsx("strong", { children: "Client types:" }), " ", clientType] }), _jsx(PaxDisplay, { pax: pax }), _jsx("div", { children: rooms.map(function (room, index) { return (_jsxs("div", { className: "space-y-1", children: [_jsx(TextWithIcon, { icon: "accom", textSize: "sm", textVariant: "medium", children: room.RoomName }), _jsx(ServiceInfo.Item, { icon: "utensils", iconSize: "sm", textSize: "sm", textLeading: "4", textVariant: "medium", label: "Meal-Plan", children: room.MealPlan })] }, "rm-".concat(index))); }) })] })] }));
|
|
15
15
|
}
|
|
@@ -8,6 +8,6 @@ import TextWithIcon from '../TextWithIcon/TextWithIcon';
|
|
|
8
8
|
import { CancellationLayout } from './CancellationLayout/CancellationLayout';
|
|
9
9
|
export function DialogCancellationAccom(props) {
|
|
10
10
|
var image = props.image, hotelName = props.hotelName, dates = props.dates, rooms = props.rooms, cancellationFee = props.cancellationFee, currency = props.currency;
|
|
11
|
-
var stay = useStays(dates);
|
|
11
|
+
var stay = useStays(dates).stay;
|
|
12
12
|
return (_jsx(CancellationLayout, { title: "Accommodation", icon: "accom", image: image, cancellationFee: cancellationFee, currency: currency, children: _jsxs("div", { className: "space-y-6", children: [_jsxs("div", { className: "space-y-1", children: [_jsx(Text, { variant: "bold", children: hotelName }), _jsx(DateDisplay, { dates: dates }), _jsxs(TextWithIcon, { icon: "night", textLeading: "4", children: [stay, " Nights"] })] }), _jsx("div", { className: "", children: rooms.map(function (room, index) { return (_jsxs("div", { className: "space-y-4", children: [_jsxs("div", { className: "space-y-1", children: [_jsxs(TextWithIcon, { icon: "accom", textLeading: "4", children: [index + 1, " Room"] }), _jsx(Text, { size: "sm", children: room.RoomName })] }), room.cancellation_policy.map(function (policy, pIndex) { return (_jsxs(Fragment, { children: [_jsxs(Chip, { type: "outline", color: "brand", isBlackText: true, children: ["Policy period applies", ' ', _jsx(DateDisplay, { dates: [policy.ValidFrom, policy.ValidTo], textSize: "xs" })] }), _jsxs(Text, { variant: "bold", size: "xs", leading: "4", children: [policy.Value, " % of total price"] }), _jsx(Text, { size: "xs", leading: "4", children: policy.Description })] }, "policy-".concat(pIndex))); })] }, "rm-".concat(index))); }) })] }) }));
|
|
13
13
|
}
|
|
@@ -18,6 +18,6 @@ import TextWithIcon from '../../molecules/TextWithIcon/TextWithIcon';
|
|
|
18
18
|
*/
|
|
19
19
|
export default function HeaderAccom(props) {
|
|
20
20
|
var hotelName = props.hotelName, pax = props.pax, dates = props.dates;
|
|
21
|
-
var stay = useStays(dates);
|
|
21
|
+
var stay = useStays(dates).stay;
|
|
22
22
|
return (_jsxs("div", { children: [_jsx(ServiceTitle, { title: hotelName, textSize: "sm" }), _jsx(TextWithIcon, { icon: "user", children: pax }), _jsx(DateDisplay, { dates: dates, arrowSize: "xs", calendarSize: "xs" }), _jsxs(TextWithIcon, { icon: "night", children: [stay, " Nights"] })] }));
|
|
23
23
|
}
|
|
@@ -24,7 +24,10 @@ export interface TableProps<T extends TableRowData<T>> {
|
|
|
24
24
|
/** Data for the table */
|
|
25
25
|
data: T[];
|
|
26
26
|
/** Callback function to be called when a row is clicked */
|
|
27
|
-
onClickRow?: (e: React.MouseEvent<HTMLTableRowElement>, row: T
|
|
27
|
+
onClickRow?: (e: React.MouseEvent<HTMLTableRowElement>, row: T, payload?: {
|
|
28
|
+
parentIndex?: number;
|
|
29
|
+
childIndex?: number;
|
|
30
|
+
}) => void;
|
|
28
31
|
/** Pagination configuration for the table */
|
|
29
32
|
pagination?: PaginationProps;
|
|
30
33
|
/** Total rows in the table */
|
|
@@ -33,7 +33,7 @@ import { TableCell } from './TableCell';
|
|
|
33
33
|
* @returns
|
|
34
34
|
*/
|
|
35
35
|
var NestedContent = function (_a) {
|
|
36
|
-
var rowIndex = _a.rowIndex, columns = _a.columns, children = _a.children, isGrouped = _a.isGrouped, onClickRow = _a.onClickRow;
|
|
36
|
+
var rowIndex = _a.rowIndex, columns = _a.columns, children = _a.children, isGrouped = _a.isGrouped, parentIndex = _a.parentIndex, onClickRow = _a.onClickRow;
|
|
37
37
|
var contentRef = useRef(null);
|
|
38
38
|
var _b = useState(0), height = _b[0], setHeight = _b[1];
|
|
39
39
|
useEffect(function () {
|
|
@@ -48,7 +48,7 @@ var NestedContent = function (_a) {
|
|
|
48
48
|
opacity: { duration: 0.15, ease: 'easeInOut' },
|
|
49
49
|
}, className: "table__nested-wrapper", children: _jsx("table", { className: "table", children: _jsx("tbody", { children: children.map(function (child, childIndex) { return (_jsx("tr", { className: cn(child.className, {
|
|
50
50
|
'table__row-clickable': onClickRow,
|
|
51
|
-
}), onClick: function (e) { return onClickRow === null || onClickRow === void 0 ? void 0 : onClickRow(e, child); }, children: _jsx(TableCell, { columns: columns, row: child, rowIndex: childIndex, childIndex: childIndex }) }, "ch-".concat(rowIndex, "-").concat(childIndex))); }) }) }) }));
|
|
51
|
+
}), onClick: function (e) { return onClickRow === null || onClickRow === void 0 ? void 0 : onClickRow(e, child, { parentIndex: parentIndex, childIndex: childIndex }); }, children: _jsx(TableCell, { columns: columns, row: child, rowIndex: childIndex, childIndex: childIndex }) }, "ch-".concat(rowIndex, "-").concat(childIndex))); }) }) }) }));
|
|
52
52
|
};
|
|
53
53
|
/**
|
|
54
54
|
* A table component for displaying structured data in rows and columns. Supports customizable column definitions and data rows.
|
|
@@ -85,12 +85,12 @@ export function Table(props) {
|
|
|
85
85
|
'table__row-nested': (_b = row.children) === null || _b === void 0 ? void 0 : _b.length,
|
|
86
86
|
'table__row-clickable': onClickRow,
|
|
87
87
|
'table__row-highlighted': row.isHighlighted,
|
|
88
|
-
}), onClick: function (e) { return onClickRow === null || onClickRow === void 0 ? void 0 : onClickRow(e, row); }, children: row.isHighlighted ? (_jsx("td", { colSpan: columns.length, className: "table__cell-highlighted", children: _jsx("div", { className: "table__row-div-highlighted", children: _jsx("table", { className: "table", children: _jsx("tbody", { children: _jsx("tr", { children: _jsx(TableCell, { columns: columns, row: row, rowIndex: rowIndex }) }) }) }) }) })) : (_jsx(TableCell, { columns: columns, row: row, rowIndex: rowIndex })) }));
|
|
89
|
-
return (_jsx(Fragment, { children: isGrouped ? (row.children && row.children.length > 0 ? (_jsx("tr", { className: "table__row-grouped", children: _jsx("td", { colSpan: columns.length, children: _jsx(NestedContent, { isGrouped: isGrouped, rowIndex: rowIndex, columns: columns, children: row.children || [], onClickRow: onClickRow }) }) })) : (defaultTable)) : !row.children ? (defaultTable) : (_jsx("tr", { className: "table__row-with-children",
|
|
88
|
+
}), onClick: function (e) { return onClickRow === null || onClickRow === void 0 ? void 0 : onClickRow(e, row, { parentIndex: rowIndex }); }, children: row.isHighlighted ? (_jsx("td", { colSpan: columns.length, className: "table__cell-highlighted", children: _jsx("div", { className: "table__row-div-highlighted", children: _jsx("table", { className: "table", children: _jsx("tbody", { children: _jsx("tr", { children: _jsx(TableCell, { columns: columns, row: row, rowIndex: rowIndex }) }) }) }) }) })) : (_jsx(TableCell, { columns: columns, row: row, rowIndex: rowIndex })) }));
|
|
89
|
+
return (_jsx(Fragment, { children: isGrouped ? (row.children && row.children.length > 0 ? (_jsx("tr", { className: "table__row-grouped", children: _jsx("td", { colSpan: columns.length, children: _jsx(NestedContent, { isGrouped: isGrouped, rowIndex: rowIndex, columns: columns, children: row.children || [], onClickRow: onClickRow, parentIndex: rowIndex }) }) })) : (defaultTable)) : !row.children ? (defaultTable) : (_jsx("tr", { className: "table__row-with-children", children: _jsx("td", { colSpan: columns.length, className: cn({
|
|
90
90
|
'table__children--visible': hasVisibleChildren,
|
|
91
91
|
}), children: _jsx("table", { className: "table", children: _jsxs("tbody", { children: [defaultTable, _jsx(AnimatePresence, { initial: false, children: hasVisibleChildren && (_jsx("tr", { className: cn('table__no-hover', {
|
|
92
92
|
'table__row-nested': row.children && row.children.length > 0,
|
|
93
|
-
}), children: _jsx("td", { colSpan: columns.length, className: "table__cell-nested", children: _jsx(NestedContent, { rowIndex: rowIndex, columns: columns, children: row.children || [] }) }) }, "nested-".concat(rowIndex))) })] }) }) }) })) }, "rw-".concat(rowIndex)));
|
|
93
|
+
}), children: _jsx("td", { colSpan: columns.length, className: "table__cell-nested", children: _jsx(NestedContent, { rowIndex: rowIndex, columns: columns, parentIndex: rowIndex, children: row.children || [], onClickRow: onClickRow }) }) }, "nested-".concat(rowIndex))) })] }) }) }) })) }, "rw-".concat(rowIndex)));
|
|
94
94
|
}), data.length === 0 && (_jsx("tr", { children: _jsx("td", { colSpan: columns.length, className: "table__cell-empty", children: _jsx(Text, { size: "md", variant: "bold", className: "text-center", children: "No data found" }) }) }))] })] }) }), hasTotal && (_jsx("div", { className: 'table__total-container', children: _jsx("table", { className: "table", children: _jsx("tbody", { className: cn('table__total', {
|
|
95
95
|
'table__total--dashed': isTotalBorderDash,
|
|
96
96
|
}), children: _jsxs("tr", { children: [_jsx("td", { colSpan: columns.length - 1 }), _jsx("td", { style: {
|
package/dist/hooks/useStays.d.ts
CHANGED
package/dist/hooks/useStays.js
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
import { differenceInDays } from 'date-fns';
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
3
|
export default function useStays(dates) {
|
|
4
|
-
var
|
|
5
|
-
if (!dates) {
|
|
4
|
+
var getStay = function (dates) {
|
|
5
|
+
if (!dates || (dates === null || dates === void 0 ? void 0 : dates.length) === 0) {
|
|
6
6
|
return 0;
|
|
7
7
|
}
|
|
8
8
|
if (dates.length) {
|
|
9
9
|
return differenceInDays(dates[1], dates[0]);
|
|
10
10
|
}
|
|
11
11
|
return 0;
|
|
12
|
+
};
|
|
13
|
+
var stay = useMemo(function () {
|
|
14
|
+
return getStay(dates);
|
|
12
15
|
}, [dates]);
|
|
13
|
-
return
|
|
16
|
+
return {
|
|
17
|
+
stay: stay,
|
|
18
|
+
getStay: getStay,
|
|
19
|
+
};
|
|
14
20
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export { DateDisplay } from './components/molecules/DateDisplay/DateDisplay';
|
|
|
17
17
|
export { DocketPrices } from './components/molecules/DocketPrices/DocketPrices';
|
|
18
18
|
export { PriceDisplay } from './components/molecules/PriceDisplay/PriceDisplay';
|
|
19
19
|
export { TransferDocket } from './components/molecules/TransferDocket/TransferDocket';
|
|
20
|
-
export { ActionDropdown, type ActionDropdownItem } from './components/molecules/ActionDropdown/ActionDropdown';
|
|
20
|
+
export { ActionDropdown, type ActionDropdownItem, } from './components/molecules/ActionDropdown/ActionDropdown';
|
|
21
21
|
export { AddItemButton } from './components/molecules/AddItemButton/AddItemButton';
|
|
22
22
|
export { default as AgeSelector } from './components/molecules/AgeSelector/AgeSelector';
|
|
23
23
|
export * from './components/molecules/BookingResume';
|
|
@@ -86,43 +86,44 @@ export { default as UserIcon } from './components/atoms/Icon/icons/User';
|
|
|
86
86
|
export { priceFormatter } from './lib/price-formatter';
|
|
87
87
|
export type { DividerProps } from './components/atoms/Divider/Divider';
|
|
88
88
|
export type { FeatureRowProps } from './components/molecules/FeatureRow/FeatureRow';
|
|
89
|
-
export type { LocationData, LocationDropdownProps, LocationGroup, LocationOption } from './components/molecules/LocationDropdown/LocationDropdown';
|
|
90
|
-
export type { ServiceOption, ServiceSelectorProps, ServiceType } from './components/molecules/ServiceSelector/ServiceSelector';
|
|
89
|
+
export type { LocationData, LocationDropdownProps, LocationGroup, LocationOption, } from './components/molecules/LocationDropdown/LocationDropdown';
|
|
90
|
+
export type { ServiceOption, ServiceSelectorProps, ServiceType, } from './components/molecules/ServiceSelector/ServiceSelector';
|
|
91
91
|
export type { StepperProps } from './components/molecules/Stepper/Stepper';
|
|
92
|
-
export type { CarBookingCardPriceRow, CarBookingCardProps, CarBookingCardSize, CarBookingCardState, CarBookingCardType } from './components/organisms/CarBookingCard/CarBookingCard';
|
|
93
|
-
export type { CardContainerProps, CardContainerSpacing } from './components/organisms/CardContainer/CardContainer';
|
|
92
|
+
export type { CarBookingCardPriceRow, CarBookingCardProps, CarBookingCardSize, CarBookingCardState, CarBookingCardType, } from './components/organisms/CarBookingCard/CarBookingCard';
|
|
93
|
+
export type { CardContainerProps, CardContainerSpacing, } from './components/organisms/CardContainer/CardContainer';
|
|
94
94
|
export type { DateTimePickerProps } from './components/organisms/DateTimePicker/DateTimePicker';
|
|
95
95
|
export type { DialogProps, DialogSize } from './components/organisms/Dialog/Dialog';
|
|
96
96
|
export type { FooterProps } from './components/organisms/Footer/Footer';
|
|
97
|
-
export type { DocketDetailsData, DocketServiceType, MultipleQuotationDocketProps } from './components/organisms/MultipleQuotationDocket';
|
|
97
|
+
export type { DocketDetailsData, DocketServiceType, MultipleQuotationDocketProps, } from './components/organisms/MultipleQuotationDocket';
|
|
98
98
|
export { CHILD_CATEGORY_AGES } from './components/organisms/PaxSelector/PaxSelector';
|
|
99
|
-
export type { ClientType, PaxData, PaxSelectorProps } from './components/organisms/PaxSelector/PaxSelector';
|
|
100
|
-
export type { RoundTripData, RoundTripProps, RoundTripTransfer } from './components/organisms/RoundTrip/RoundTrip';
|
|
101
|
-
export type { SearchBarTransferData, SearchBarTransferProps, TransferMode } from './components/organisms/SearchBarTransfer/SearchBarTransfer';
|
|
99
|
+
export type { ClientType, PaxData, PaxSelectorProps, } from './components/organisms/PaxSelector/PaxSelector';
|
|
100
|
+
export type { RoundTripData, RoundTripProps, RoundTripTransfer, } from './components/organisms/RoundTrip/RoundTrip';
|
|
101
|
+
export type { SearchBarTransferData, SearchBarTransferProps, TransferMode, } from './components/organisms/SearchBarTransfer/SearchBarTransfer';
|
|
102
102
|
export type { TopNavigationProps } from './components/organisms/TopNavigation/TopNavigation';
|
|
103
|
-
export type { TransferLineData, TransferLineProps, TransferType } from './components/organisms/TransferLine/TransferLine';
|
|
103
|
+
export type { TransferLineData, TransferLineProps, TransferType, } from './components/organisms/TransferLine/TransferLine';
|
|
104
104
|
export type { CheckboxProps } from './components/atoms/Checkbox/Checkbox';
|
|
105
105
|
export type { InputProps } from './components/atoms/Inputs/Input/Input';
|
|
106
106
|
export type { AddItemButtonProps } from './components/molecules/AddItemButton/AddItemButton';
|
|
107
107
|
export type { AgeSelectorProps } from './components/molecules/AgeSelector/AgeSelector';
|
|
108
|
-
export type { BreadcrumbsItem, BreadcrumbsProps } from './components/molecules/Breadcrumbs/Breadcrumbs';
|
|
108
|
+
export type { BreadcrumbsItem, BreadcrumbsProps, } from './components/molecules/Breadcrumbs/Breadcrumbs';
|
|
109
109
|
export type { DocketPricesProps } from './components/molecules/DocketPrices/DocketPrices';
|
|
110
110
|
export type { FromToProps } from './components/molecules/FromTo/FromTo';
|
|
111
111
|
export type { PaxChipsProps, PaxCount } from './components/molecules/PaxChips/PaxChips';
|
|
112
112
|
export type { PriceDisplayProps } from './components/molecules/PriceDisplay/PriceDisplay';
|
|
113
113
|
export type { SectionTitleProps } from './components/molecules/SectionTitle/SectionTitle';
|
|
114
|
-
export type { DetailsColProps, ItemColProps, RowAccommodationProps, RowExcursionProps, RowTransferProps } from './components/molecules/TableServiceItem';
|
|
114
|
+
export type { DetailsColProps, ItemColProps, RowAccommodationProps, RowExcursionProps, RowTransferProps, } from './components/molecules/TableServiceItem';
|
|
115
115
|
export type { ServiceAccommodationProps } from './components/molecules/TimelineItem/ServiceAccommodation';
|
|
116
116
|
export type { ServiceExcursionProps } from './components/molecules/TimelineItem/ServiceExcursion';
|
|
117
117
|
export type { ServiceTransferProps } from './components/molecules/TimelineItem/ServiceTransfer';
|
|
118
118
|
export type { TimelineHeaderProps } from './components/molecules/TimelineItem/TimelineHeader';
|
|
119
119
|
export type { ToastProps } from './components/molecules/Toast/Toast';
|
|
120
120
|
export type { TransferDocketProps } from './components/molecules/TransferDocket/TransferDocket';
|
|
121
|
-
export type { ComparisonData, DialogComparisonProps, MultiComparisonData } from './components/organisms/DialogComparison/DialogComparison';
|
|
121
|
+
export type { ComparisonData, DialogComparisonProps, MultiComparisonData, } from './components/organisms/DialogComparison/DialogComparison';
|
|
122
122
|
export type { DialogDeleteConfirmProps } from './components/organisms/DialogDeleteConfirm/DialogDeleteConfirm';
|
|
123
123
|
export type { DialogQuoteRenameProps } from './components/organisms/DialogQuoteRename/DialogQuoteRename';
|
|
124
124
|
export type { SelectedQuote } from './components/organisms/DialogSendingMail/DialogSendingMailMultiple/DialogSendingMailMultiple';
|
|
125
|
-
export type { FilterType, QuoteHeaderProps } from './components/organisms/QuoteHeader/QuoteHeader';
|
|
126
|
-
export type { TimelineProps, TimelineServices } from './components/organisms/Timeline/Timeline';
|
|
127
|
-
export type { AccomodationDocket as AccomodationDocketType, ExcursionDocket as ExcursionDocketType, OtherServiceDocket as OtherServiceDocketType, ServiceDocket as ServiceDocketType, TransferDocket as TransferDocketType } from './types/docket/services.types';
|
|
125
|
+
export type { FilterType, QuoteHeaderProps, } from './components/organisms/QuoteHeader/QuoteHeader';
|
|
126
|
+
export type { TimelineProps, TimelineServices, } from './components/organisms/Timeline/Timeline';
|
|
127
|
+
export type { AccomodationDocket as AccomodationDocketType, ExcursionDocket as ExcursionDocketType, OtherServiceDocket as OtherServiceDocketType, ServiceDocket as ServiceDocketType, TransferDocket as TransferDocketType, } from './types/docket/services.types';
|
|
128
128
|
export * from './types/table';
|
|
129
|
+
export * from './hooks/useStays';
|
package/dist/index.js
CHANGED
|
@@ -19,7 +19,7 @@ export { DocketPrices } from './components/molecules/DocketPrices/DocketPrices';
|
|
|
19
19
|
export { PriceDisplay } from './components/molecules/PriceDisplay/PriceDisplay';
|
|
20
20
|
export { TransferDocket } from './components/molecules/TransferDocket/TransferDocket';
|
|
21
21
|
// Molecules - Composed components
|
|
22
|
-
export { ActionDropdown } from './components/molecules/ActionDropdown/ActionDropdown';
|
|
22
|
+
export { ActionDropdown, } from './components/molecules/ActionDropdown/ActionDropdown';
|
|
23
23
|
export { AddItemButton } from './components/molecules/AddItemButton/AddItemButton';
|
|
24
24
|
export { default as AgeSelector } from './components/molecules/AgeSelector/AgeSelector';
|
|
25
25
|
export * from './components/molecules/BookingResume';
|
|
@@ -92,3 +92,5 @@ export { default as UserIcon } from './components/atoms/Icon/icons/User';
|
|
|
92
92
|
export { priceFormatter } from './lib/price-formatter';
|
|
93
93
|
export { CHILD_CATEGORY_AGES } from './components/organisms/PaxSelector/PaxSelector';
|
|
94
94
|
export * from './types/table';
|
|
95
|
+
// Hooks
|
|
96
|
+
export * from './hooks/useStays';
|
package/package.json
CHANGED
|
@@ -38,8 +38,6 @@ export function ActionDropdown(props: ActionDropdownProps) {
|
|
|
38
38
|
const { data, children, maxWidth = '153px' } = props;
|
|
39
39
|
const [open, setOpen] = useState(false);
|
|
40
40
|
|
|
41
|
-
console.log(open);
|
|
42
|
-
|
|
43
41
|
return (
|
|
44
42
|
<Popover open={open} onOpenChange={setOpen}>
|
|
45
43
|
<PopoverTrigger>
|
|
@@ -22,7 +22,7 @@ export interface ResumeAccomProps {
|
|
|
22
22
|
export function ResumeAccom(props: ResumeAccomProps) {
|
|
23
23
|
const { image, dates, clientType, pax, rooms, hotelName } = props;
|
|
24
24
|
|
|
25
|
-
const stay = useStays(dates);
|
|
25
|
+
const { stay } = useStays(dates);
|
|
26
26
|
|
|
27
27
|
return (
|
|
28
28
|
<BookingResumeLayout
|
|
@@ -18,7 +18,7 @@ export interface DialogCancellationAccomProps {
|
|
|
18
18
|
|
|
19
19
|
export function DialogCancellationAccom(props: DialogCancellationAccomProps) {
|
|
20
20
|
const { image, hotelName, dates, rooms, cancellationFee, currency } = props;
|
|
21
|
-
const stay = useStays(dates);
|
|
21
|
+
const { stay } = useStays(dates);
|
|
22
22
|
|
|
23
23
|
return (
|
|
24
24
|
<CancellationLayout
|
|
@@ -36,7 +36,14 @@ export interface TableProps<T extends TableRowData<T>> {
|
|
|
36
36
|
data: T[];
|
|
37
37
|
|
|
38
38
|
/** Callback function to be called when a row is clicked */
|
|
39
|
-
onClickRow?: (
|
|
39
|
+
onClickRow?: (
|
|
40
|
+
e: React.MouseEvent<HTMLTableRowElement>,
|
|
41
|
+
row: T,
|
|
42
|
+
payload?: {
|
|
43
|
+
parentIndex?: number;
|
|
44
|
+
childIndex?: number;
|
|
45
|
+
}
|
|
46
|
+
) => void;
|
|
40
47
|
|
|
41
48
|
/** Pagination configuration for the table */
|
|
42
49
|
pagination?: PaginationProps;
|
|
@@ -75,13 +82,15 @@ const NestedContent = <T extends TableRowData<T>>({
|
|
|
75
82
|
columns,
|
|
76
83
|
children,
|
|
77
84
|
isGrouped,
|
|
85
|
+
parentIndex,
|
|
78
86
|
onClickRow,
|
|
79
87
|
}: {
|
|
80
88
|
rowIndex: number;
|
|
81
89
|
columns: ColumnType<T>[];
|
|
82
90
|
children: T[];
|
|
83
91
|
isGrouped?: boolean;
|
|
84
|
-
|
|
92
|
+
parentIndex?: number;
|
|
93
|
+
onClickRow?: TableProps<T>['onClickRow'];
|
|
85
94
|
}) => {
|
|
86
95
|
const contentRef = useRef<HTMLDivElement>(null);
|
|
87
96
|
const [height, setHeight] = useState<number | 'auto'>(0);
|
|
@@ -114,7 +123,7 @@ const NestedContent = <T extends TableRowData<T>>({
|
|
|
114
123
|
className={cn(child.className, {
|
|
115
124
|
'table__row-clickable': onClickRow,
|
|
116
125
|
})}
|
|
117
|
-
onClick={(e) => onClickRow?.(e, child as T)}>
|
|
126
|
+
onClick={(e) => onClickRow?.(e, child as T, { parentIndex, childIndex })}>
|
|
118
127
|
<TableCell<T>
|
|
119
128
|
columns={columns}
|
|
120
129
|
row={child as T}
|
|
@@ -203,7 +212,7 @@ export function Table<T extends TableRowData<T>>(props: TableProps<T>) {
|
|
|
203
212
|
'table__row-clickable': onClickRow,
|
|
204
213
|
'table__row-highlighted': row.isHighlighted,
|
|
205
214
|
})}
|
|
206
|
-
onClick={(e) => onClickRow?.(e, row)}>
|
|
215
|
+
onClick={(e) => onClickRow?.(e, row, { parentIndex: rowIndex })}>
|
|
207
216
|
{row.isHighlighted ? (
|
|
208
217
|
<td colSpan={columns.length} className="table__cell-highlighted">
|
|
209
218
|
<div className="table__row-div-highlighted">
|
|
@@ -238,6 +247,7 @@ export function Table<T extends TableRowData<T>>(props: TableProps<T>) {
|
|
|
238
247
|
columns={columns}
|
|
239
248
|
children={row.children || []}
|
|
240
249
|
onClickRow={onClickRow}
|
|
250
|
+
parentIndex={rowIndex}
|
|
241
251
|
/>
|
|
242
252
|
</td>
|
|
243
253
|
</tr>
|
|
@@ -247,9 +257,7 @@ export function Table<T extends TableRowData<T>>(props: TableProps<T>) {
|
|
|
247
257
|
) : !row.children ? (
|
|
248
258
|
defaultTable
|
|
249
259
|
) : (
|
|
250
|
-
<tr
|
|
251
|
-
className="table__row-with-children"
|
|
252
|
-
onClick={(e) => onClickRow?.(e, row)}>
|
|
260
|
+
<tr className="table__row-with-children">
|
|
253
261
|
<td
|
|
254
262
|
colSpan={columns.length}
|
|
255
263
|
className={cn({
|
|
@@ -272,7 +280,9 @@ export function Table<T extends TableRowData<T>>(props: TableProps<T>) {
|
|
|
272
280
|
<NestedContent<T>
|
|
273
281
|
rowIndex={rowIndex}
|
|
274
282
|
columns={columns}
|
|
283
|
+
parentIndex={rowIndex}
|
|
275
284
|
children={row.children || []}
|
|
285
|
+
onClickRow={onClickRow}
|
|
276
286
|
/>
|
|
277
287
|
</td>
|
|
278
288
|
</tr>
|