mautourco-components 0.2.58 → 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.
@@ -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
  }
@@ -1 +1,4 @@
1
- export default function useStays(dates: string[]): number;
1
+ export default function useStays(dates?: string[]): {
2
+ stay: number;
3
+ getStay: (dates?: string[]) => number;
4
+ };
@@ -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 stay = useMemo(function () {
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 stay;
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mautourco-components",
3
- "version": "0.2.58",
3
+ "version": "0.2.59",
4
4
  "private": false,
5
5
  "description": "Bibliothèque de composants Mautourco pour le redesign",
6
6
  "main": "dist/index.js",
@@ -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
@@ -34,7 +34,7 @@ export interface HeaderAccomProps {
34
34
  export default function HeaderAccom(props: HeaderAccomProps) {
35
35
  const { hotelName, pax, dates } = props;
36
36
 
37
- const stay = useStays(dates);
37
+ const { stay } = useStays(dates);
38
38
 
39
39
  return (
40
40
  <div>