mautourco-components 0.2.51 → 0.2.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/components/molecules/ActionDropdown/ActionDropdown.css +1 -0
  2. package/dist/components/molecules/ActionDropdown/ActionDropdown.js +2 -1
  3. package/dist/components/molecules/DateDisplay/DateDisplay.js +1 -1
  4. package/dist/components/molecules/DetailsInfo/DetailsAction.js +4 -4
  5. package/dist/components/molecules/DetailsInfo/DetailsAgency/DetailsAgency.d.ts +3 -1
  6. package/dist/components/molecules/DetailsInfo/DetailsAgency/DetailsAgency.js +2 -2
  7. package/dist/components/molecules/DetailsInfo/DetailsClient/DetailsClient.css +6 -0
  8. package/dist/components/molecules/DetailsInfo/DetailsClient/DetailsClient.js +1 -1
  9. package/dist/components/organisms/TabCancellationPolicy/CancellationAccom.d.ts +2 -1
  10. package/dist/components/organisms/TabCancellationPolicy/CancellationAccom.js +4 -3
  11. package/dist/components/organisms/TabCancellationPolicy/PolicyAccom/PolicyAccom.css +1 -0
  12. package/dist/components/organisms/TabCancellationPolicy/TabCancellationPolicyLayout/TabCancellationPolicyLayout.css +2 -0
  13. package/dist/components/organisms/TabCancellationPolicy/TabCancellationPolicyLayout/TabCancellationPolicyLayout.d.ts +1 -1
  14. package/dist/components/organisms/TabCancellationPolicy/TabCancellationPolicyLayout/TabCancellationPolicyLayout.js +1 -1
  15. package/dist/components/organisms/Table/Table.css +3 -1
  16. package/dist/components/organisms/Table/Table.d.ts +2 -0
  17. package/dist/components/organisms/Table/Table.js +2 -2
  18. package/dist/components/ui/tooltip.js +2 -2
  19. package/package.json +1 -1
  20. package/src/components/molecules/ActionDropdown/ActionDropdown.css +1 -1
  21. package/src/components/molecules/ActionDropdown/ActionDropdown.tsx +5 -3
  22. package/src/components/molecules/DateDisplay/DateDisplay.tsx +1 -1
  23. package/src/components/molecules/DetailsInfo/DetailsAction.tsx +12 -8
  24. package/src/components/molecules/DetailsInfo/DetailsAgency/DetailsAgency.tsx +26 -15
  25. package/src/components/molecules/DetailsInfo/DetailsClient/DetailsClient.css +4 -0
  26. package/src/components/molecules/DetailsInfo/DetailsClient/DetailsClient.tsx +2 -2
  27. package/src/components/organisms/TabCancellationPolicy/CancellationAccom.tsx +22 -13
  28. package/src/components/organisms/TabCancellationPolicy/PolicyAccom/PolicyAccom.css +1 -1
  29. package/src/components/organisms/TabCancellationPolicy/TabCancellationPolicyLayout/TabCancellationPolicyLayout.css +2 -0
  30. package/src/components/organisms/TabCancellationPolicy/TabCancellationPolicyLayout/TabCancellationPolicyLayout.tsx +6 -4
  31. package/src/components/organisms/Table/Table.css +3 -1
  32. package/src/components/organisms/Table/Table.tsx +5 -1
  33. package/src/components/ui/tooltip.tsx +15 -4
@@ -39,6 +39,7 @@
39
39
  display: flex;
40
40
  height: 2rem;
41
41
  width: 2rem;
42
+ cursor: pointer;
42
43
  align-items: center;
43
44
  justify-content: center;
44
45
  border-radius: var(--border-radius-rounded-lg);
@@ -17,7 +17,8 @@ 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
- return (_jsxs(Popover, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverTrigger, { asChild: true, children: children !== null && children !== void 0 ? children : (_jsx("button", { 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) {
20
+ console.log(open);
21
+ 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) {
21
22
  var defaultButton = (_jsx("button", { onClick: function () {
22
23
  var _a;
23
24
  if (item.disabled) {
@@ -18,7 +18,7 @@ export function DateDisplay(props) {
18
18
  var _a = props.dates, dates = _a === void 0 ? [] : _a, _b = props.arrowSize, arrowSize = _b === void 0 ? 'sm' : _b, _c = props.calendarSize, calendarSize = _c === void 0 ? 'sm' : _c, _d = props.textSize, textSize = _d === void 0 ? 'sm' : _d, _e = props.colorMode, colorMode = _e === void 0 ? 'black' : _e, _f = props.className, className = _f === void 0 ? '' : _f;
19
19
  var formattedDates = useMemo(function () {
20
20
  return dates.map(function (d) {
21
- var dateObj = typeof d === 'string' ? new Date(d) : d;
21
+ var dateObj = new Date(d);
22
22
  // Check if the date is valid then format it to dd/MM/yyyy format
23
23
  if (isValid(dateObj)) {
24
24
  return format(dateObj, 'dd/MM/yyyy');
@@ -1,10 +1,10 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { cn } from '../../../lib/utils';
3
3
  import { ActionDropdownType } from '../../../types/table/index';
4
- import Button from '../../atoms/Button/Button';
4
+ import Icon from '../../atoms/Icon/Icon';
5
5
  import { ActionDropdown } from '../ActionDropdown/ActionDropdown';
6
6
  export function DetailsAction(props) {
7
- var _a = props.data, data = _a === void 0 ? [] : _a, onAction = props.onAction, _b = props.buttonVariant, buttonVariant = _b === void 0 ? 'outline-secondary' : _b, _c = props.buttonClassName, buttonClassName = _c === void 0 ? '' : _c, _d = props.buttonLabel, buttonLabel = _d === void 0 ? 'More options' : _d, dropdownMaxWidth = props.dropdownMaxWidth;
7
+ var data = props.data, onAction = props.onAction, _a = props.buttonVariant, buttonVariant = _a === void 0 ? 'outline-secondary' : _a, _b = props.buttonClassName, buttonClassName = _b === void 0 ? '' : _b, _c = props.buttonLabel, buttonLabel = _c === void 0 ? 'More options' : _c, dropdownMaxWidth = props.dropdownMaxWidth;
8
8
  return (_jsx(ActionDropdown, { maxWidth: dropdownMaxWidth, data: data
9
9
  ? data
10
10
  : [
@@ -32,5 +32,5 @@ export function DetailsAction(props) {
32
32
  onAction === null || onAction === void 0 ? void 0 : onAction(ActionDropdownType.DELETE_QUOTE);
33
33
  },
34
34
  },
35
- ], children: _jsx(Button, { variant: buttonVariant, trailingIcon: "chevron-down", size: "sm", className: cn('w-[144px] !justify-between !px-[14px]', buttonClassName), children: buttonLabel }) }));
35
+ ], children: _jsxs("div", { className: cn('button button--outline-secondary button--sm w-[144px] !justify-between !px-[14px] cursor-pointer', buttonClassName), children: [buttonLabel, _jsx("span", { className: "button__icon button__icon--trailing", children: _jsx(Icon, { name: "chevron-down" }) })] }) }));
36
36
  }
@@ -4,10 +4,12 @@ export interface DetailsAgencyProps {
4
4
  /** Name of the agency */
5
5
  name: string;
6
6
  /** Client type of the agency */
7
- clientType: string;
7
+ clientType?: string;
8
8
  /** Show the waiting for confirmation chip */
9
9
  isOnRequest: boolean;
10
10
  /** Children of the agency */
11
11
  children?: React.ReactNode;
12
+ /** The logo of the agency */
13
+ logo?: string;
12
14
  }
13
15
  export declare function DetailsAgency(props: DetailsAgencyProps): import("react/jsx-runtime").JSX.Element;
@@ -3,6 +3,6 @@ import Chip from '../../../atoms/Chip/Chip';
3
3
  import { Text } from '../../../atoms/Typography/Typography';
4
4
  import './DetailsAgency.css';
5
5
  export function DetailsAgency(props) {
6
- var name = props.name, clientType = props.clientType, isOnRequest = props.isOnRequest, children = props.children;
7
- return (_jsxs("div", { className: "flex flex-col gap-y-6 items-end", children: [_jsx("img", { src: "/images/mautourco-logo.png", alt: "Mautourco Logo", width: 220 }), _jsxs("div", { className: "details-agency", children: [_jsx(Text, { variant: "bold", color: "accent", children: "Documents details:" }), _jsxs("div", { className: "details-agency__content", children: [_jsxs("div", { className: "details-agency__content-item", children: [_jsx(Text, { variant: "bold", size: "sm", leading: "4", className: "details-agency__content-item-name", children: "Agency" }), _jsx(Text, { size: "sm", leading: "4", children: name })] }), ' ', _jsxs("div", { className: "details-agency__content-item", children: [_jsx(Text, { variant: "bold", size: "sm", leading: "4", className: "details-agency__content-item-name", children: "Client type" }), _jsx(Text, { size: "sm", leading: "4", children: clientType })] })] })] }), isOnRequest && _jsx(Chip, { color: "yellow", children: "Waiting for confirmation" }), children] }));
6
+ var name = props.name, clientType = props.clientType, isOnRequest = props.isOnRequest, children = props.children, _a = props.logo, logo = _a === void 0 ? '/images/mautourco-logo.png' : _a;
7
+ return (_jsxs("div", { className: "flex flex-col gap-y-6 items-end", children: [_jsx("img", { src: logo, alt: "Mautourco Logo", width: 220 }), _jsxs("div", { className: "details-agency", children: [_jsx(Text, { variant: "bold", color: "accent", children: "Documents details:" }), _jsxs("div", { className: "details-agency__content", children: [_jsxs("div", { className: "details-agency__content-item", children: [_jsx(Text, { variant: "bold", size: "sm", leading: "4", className: "details-agency__content-item-name", children: "Agency" }), _jsx(Text, { size: "sm", leading: "4", children: name })] }), ' ', clientType && (_jsxs("div", { className: "details-agency__content-item", children: [_jsx(Text, { variant: "bold", size: "sm", leading: "4", className: "details-agency__content-item-name", children: "Client type" }), _jsx(Text, { size: "sm", leading: "4", children: clientType })] }))] })] }), isOnRequest && _jsx(Chip, { color: "yellow", children: "Waiting for confirmation" }), children] }));
8
8
  }
@@ -27,4 +27,10 @@
27
27
  background-size: cover;
28
28
  }
29
29
  }
30
+ }
31
+
32
+ .details-client__item > :not([hidden]) ~ :not([hidden]) {
33
+ --tw-space-y-reverse: 0;
34
+ margin-top: calc(1rem * calc(1 - var(--tw-space-y-reverse)));
35
+ margin-bottom: calc(1rem * var(--tw-space-y-reverse));
30
36
  }
@@ -5,5 +5,5 @@ import { languagesMap } from '../../ServiceLanguages/constant';
5
5
  import './DetailsClient.css';
6
6
  export function DetailsClientInfo(props) {
7
7
  var language = props.language, clients = props.clients;
8
- return (_jsxs("div", { className: "details-client", children: [_jsx(Text, { variant: "bold", children: "1. Client's information" }), _jsxs("div", { className: "space-y-4", children: [_jsx(Text, { variant: "medium", size: "lg", children: "Language:" }), _jsxs(Chip, { color: "neutral", size: "md", className: "!px-4", children: [_jsx("i", { className: "fi fi-".concat(languagesMap[language.toLowerCase()]) }), _jsx(Text, { variant: "medium", as: "span", children: language })] })] }), _jsx("div", { className: "flex gap-x-8 flex-wrap", children: clients.map(function (client, index) { return (_jsxs("div", { className: "space-y-4", children: [_jsxs(Text, { variant: "medium", size: "lg", children: [client.type, " No ", index + 1, ' ', client.age > 0 ? (_jsxs(Text, { variant: "regular", size: "lg", as: "span", children: ["(", client.age, " yo)"] })) : ('')] }), _jsxs(Chip, { color: "neutral", size: "md", className: "!px-4", children: [client.firstName, " ", client.lastName] })] }, "cl-".concat(index))); }) })] }));
8
+ return (_jsxs("div", { className: "details-client", children: [_jsx(Text, { variant: "bold", children: "1. Client's information" }), _jsxs("div", { className: "details-client__item", children: [_jsx(Text, { variant: "medium", size: "lg", children: "Language:" }), _jsxs(Chip, { color: "neutral", size: "md", className: "!px-4", children: [_jsx("i", { className: "fi fi-".concat(languagesMap[language.toLowerCase()]) }), _jsx(Text, { variant: "medium", as: "span", children: language })] })] }), _jsx("div", { className: "flex gap-x-8 flex-wrap", children: clients.map(function (client, index) { return (_jsxs("div", { className: "details-client__item", children: [_jsxs(Text, { variant: "medium", size: "lg", children: [client.type, " No ", index + 1, ' ', client.age > 0 ? (_jsxs(Text, { variant: "regular", size: "lg", as: "span", children: ["(", client.age, " yo)"] })) : ('')] }), _jsxs(Chip, { color: "neutral", size: "md", className: "!px-4", children: [client.firstName, " ", client.lastName] })] }, "cl-".concat(index))); }) })] }));
9
9
  }
@@ -1,6 +1,6 @@
1
1
  import { HeaderAccomProps } from './HeaderAccom';
2
2
  import { Policy } from './PolicyAccom/PolicyAccom';
3
- export interface CancellationAccomProps extends HeaderAccomProps {
3
+ export interface CancellationAccomProps extends Omit<HeaderAccomProps, 'dates'> {
4
4
  /**
5
5
  * The image of the cancellation accommodation.
6
6
  */
@@ -13,6 +13,7 @@ export interface CancellationAccomProps extends HeaderAccomProps {
13
13
  * The room policies of the cancellation accommodation.
14
14
  */
15
15
  roomPolicies: Array<{
16
+ dates: string[];
16
17
  roomName: string;
17
18
  policies: Policy[];
18
19
  }>;
@@ -1,4 +1,5 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Fragment } from 'react';
2
3
  import CancellationBody from './CancellationBody';
3
4
  import CancellationHeader from './CancellationHeader';
4
5
  import DetailsCancellationPolicy from './TabCancellationPolicy';
@@ -19,6 +20,6 @@ import DetailsCancellationPolicy from './TabCancellationPolicy';
19
20
  * @returns The CancellationAccom component.
20
21
  */
21
22
  export default function CancellationAccom(props) {
22
- var hotelName = props.hotelName, pax = props.pax, dates = props.dates, image = props.image, roomPolicies = props.roomPolicies, isOnRequest = props.isOnRequest;
23
- return (_jsx(DetailsCancellationPolicy.Layout, { title: "Accommodation", icon: "accom", isOnRequest: isOnRequest, image: image, header: _jsx(CancellationHeader, { children: _jsx(CancellationHeader.Accom, { hotelName: hotelName, pax: pax, dates: dates }) }), children: _jsx(CancellationBody, { children: roomPolicies.map(function (roomPolicy, index) { return (_jsx(CancellationBody.Accom, { roomName: roomPolicy.roomName, policies: roomPolicy.policies }, index)); }) }) }));
23
+ var hotelName = props.hotelName, pax = props.pax, image = props.image, roomPolicies = props.roomPolicies, isOnRequest = props.isOnRequest;
24
+ return (_jsx(DetailsCancellationPolicy.Layout, { title: "Accommodation", icon: "accom", isOnRequest: isOnRequest, image: image, children: _jsx(CancellationBody, { children: roomPolicies.map(function (roomPolicy, index) { return (_jsxs(Fragment, { children: [_jsx("div", { className: "details-cancellation-policy__layout-content-header", children: _jsx(CancellationHeader, { children: _jsx(CancellationHeader.Accom, { hotelName: hotelName, pax: pax, dates: roomPolicy.dates }) }) }), _jsx(CancellationBody.Accom, { index: index, roomName: roomPolicy.roomName, policies: roomPolicy.policies }, index)] }, index)); }) }) }));
24
25
  }
@@ -9,6 +9,7 @@
9
9
  }
10
10
 
11
11
  .policy-accom {
12
+ padding-top: 1.5rem;
12
13
  .chip__label {
13
14
  column-gap: 1rem;
14
15
  }
@@ -7,7 +7,7 @@ interface TabCancellationPolicyLayoutProps {
7
7
  isOnRequest?: boolean;
8
8
  children: React.ReactNode;
9
9
  image: string;
10
- header: React.ReactNode;
10
+ header?: React.ReactNode;
11
11
  }
12
12
  export default function TabCancellationPolicyLayout(props: TabCancellationPolicyLayoutProps): import("react/jsx-runtime").JSX.Element;
13
13
  export {};
@@ -4,5 +4,5 @@ import TextWithIcon from '../../../molecules/TextWithIcon/TextWithIcon';
4
4
  import './TabCancellationPolicyLayout.css';
5
5
  export default function TabCancellationPolicyLayout(props) {
6
6
  var title = props.title, icon = props.icon, isOnRequest = props.isOnRequest, children = props.children, image = props.image, header = props.header;
7
- return (_jsxs("div", { className: "details-cancellation-policy__layout", children: [_jsxs(TextWithIcon, { icon: icon, color: isOnRequest ? 'yellow' : 'accent', textVariant: "bold", children: [title, isOnRequest && _jsx(Chip, { color: "yellow", children: "On request" })] }), _jsxs("div", { className: "details-cancellation-policy__layout-flex", children: [_jsx("figure", { children: _jsx("img", { src: image, alt: title, width: 400, height: 400 }) }), _jsxs("div", { className: "details-cancellation-policy__layout-content", children: [_jsx("div", { className: "details-cancellation-policy__layout-content-header", children: header }), _jsx("div", { className: "details-cancellation-policy__layout-content-body", children: children })] })] })] }));
7
+ return (_jsxs("div", { className: "details-cancellation-policy__layout", children: [_jsxs(TextWithIcon, { icon: icon, color: isOnRequest ? 'yellow' : 'accent', textVariant: "bold", children: [title, isOnRequest && _jsx(Chip, { color: "yellow", children: "On request" })] }), _jsxs("div", { className: "details-cancellation-policy__layout-flex", children: [_jsx("figure", { children: _jsx("img", { src: image, alt: title, width: 400, height: 400 }) }), _jsxs("div", { className: "details-cancellation-policy__layout-content", children: [header && (_jsx("div", { className: "details-cancellation-policy__layout-content-header", children: header })), _jsx("div", { className: "details-cancellation-policy__layout-content-body", children: children })] })] })] }));
8
8
  }
@@ -20,7 +20,9 @@
20
20
  width: 100%;
21
21
  border-collapse: collapse;
22
22
  border-spacing: 0;
23
- table-layout: fixed;
23
+ &.table-layout-fixed {
24
+ table-layout: fixed;
25
+ }
24
26
  th,
25
27
  td {
26
28
  padding-inline: var(--spacing-padding-px-4);
@@ -35,6 +35,8 @@ export interface TableProps<T extends TableRowData<T>> {
35
35
  isTotalBorderDash?: boolean;
36
36
  /** Whether the last column is visible */
37
37
  totalSubstractedSpace?: number;
38
+ /** Whether the table layout is fixed */
39
+ isLayoutFixed?: boolean;
38
40
  }
39
41
  /**
40
42
  * A table component for displaying structured data in rows and columns. Supports customizable column definitions and data rows.
@@ -66,7 +66,7 @@ var NestedContent = function (_a) {
66
66
  *
67
67
  */
68
68
  export function Table(props) {
69
- var columns = props.columns, data = props.data, pagination = props.pagination, isGrouped = props.isGrouped, _a = props.totalRows, totalRows = _a === void 0 ? {} : _a, _b = props.isTotalBorderDash, isTotalBorderDash = _b === void 0 ? true : _b, _c = props.totalSubstractedSpace, totalSubstractedSpace = _c === void 0 ? 10 : _c, onClickRow = props.onClickRow;
69
+ var columns = props.columns, data = props.data, pagination = props.pagination, isGrouped = props.isGrouped, _a = props.totalRows, totalRows = _a === void 0 ? {} : _a, _b = props.isTotalBorderDash, isTotalBorderDash = _b === void 0 ? true : _b, _c = props.totalSubstractedSpace, totalSubstractedSpace = _c === void 0 ? 10 : _c, _d = props.isLayoutFixed, isLayoutFixed = _d === void 0 ? true : _d, onClickRow = props.onClickRow;
70
70
  var normalizeLastColumnWidth = function () {
71
71
  var width = columns[columns.length - 1].width;
72
72
  if (typeof width === 'number') {
@@ -75,7 +75,7 @@ export function Table(props) {
75
75
  return width;
76
76
  };
77
77
  var hasTotal = Object.keys(totalRows).length > 0;
78
- return (_jsx(LazyMotion, { features: domAnimation, children: _jsxs("div", { children: [_jsx("div", { className: cn('table-container', { 'table-container--no-total': !hasTotal }), children: _jsxs("table", { className: "table", children: [_jsx("thead", { className: "table__header", children: _jsx("tr", { children: columns.map(function (column, columnIndex) { return (_jsx("th", { className: column.className, style: column.width
78
+ return (_jsx(LazyMotion, { features: domAnimation, children: _jsxs("div", { children: [_jsx("div", { className: cn('table-container', { 'table-container--no-total': !hasTotal }), children: _jsxs("table", { className: cn('table', { 'table-layout-fixed': isLayoutFixed }), children: [_jsx("thead", { className: "table__header", children: _jsx("tr", { children: columns.map(function (column, columnIndex) { return (_jsx("th", { className: column.className, style: column.width
79
79
  ? { minWidth: column.width, width: column.width }
80
80
  : undefined, children: _jsx(Text, { variant: "bold", size: "sm", children: column.header }) }, "hd-".concat(columnIndex))); }) }) }), _jsxs("tbody", { className: "table__body", children: [data.length > 0 &&
81
81
  data.map(function (row, rowIndex) {
@@ -25,7 +25,7 @@ import * as TooltipPrimitive from '@radix-ui/react-tooltip';
25
25
  import { cn } from '../../lib/utils';
26
26
  function TooltipProvider(_a) {
27
27
  var _b = _a.delayDuration, delayDuration = _b === void 0 ? 0 : _b, props = __rest(_a, ["delayDuration"]);
28
- return _jsx(TooltipPrimitive.Provider, __assign({ "data-slot": "tooltip-provider", delayDuration: delayDuration }, props));
28
+ return (_jsx(TooltipPrimitive.Provider, __assign({ "data-slot": "tooltip-provider", delayDuration: delayDuration }, props)));
29
29
  }
30
30
  function Tooltip(_a) {
31
31
  var props = __rest(_a, []);
@@ -37,6 +37,6 @@ function TooltipTrigger(_a) {
37
37
  }
38
38
  function TooltipContent(_a) {
39
39
  var className = _a.className, _b = _a.sideOffset, sideOffset = _b === void 0 ? 0 : _b, children = _a.children, props = __rest(_a, ["className", "sideOffset", "children"]);
40
- return (_jsx(TooltipPrimitive.Portal, { children: _jsxs(TooltipPrimitive.Content, __assign({ "data-slot": "tooltip-content", sideOffset: sideOffset, className: cn('bg-foreground bg-[var(--tooltip-color-background-default)] text-white animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance', className) }, props, { children: [children, _jsx(TooltipPrimitive.Arrow, { className: "bg-[var(--tooltip-color-background-default)] fill-[var(--tooltip-color-background-default)] z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" })] })) }));
40
+ return (_jsx(TooltipPrimitive.Portal, { children: _jsxs(TooltipPrimitive.Content, __assign({ "data-slot": "tooltip-content", sideOffset: sideOffset, className: cn('bg-[var(--tooltip-color-background-default)] text-white animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance', className) }, props, { children: [children, _jsx(TooltipPrimitive.Arrow, { className: "bg-[var(--tooltip-color-background-default)] fill-[var(--tooltip-color-background-default)] z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" })] })) }));
41
41
  }
42
42
  export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mautourco-components",
3
- "version": "0.2.51",
3
+ "version": "0.2.53",
4
4
  "private": false,
5
5
  "description": "Bibliothèque de composants Mautourco pour le redesign",
6
6
  "main": "dist/index.js",
@@ -17,7 +17,7 @@
17
17
  }
18
18
 
19
19
  .action-dropdown-trigger {
20
- @apply w-8 h-8 flex items-center justify-center;
20
+ @apply w-8 h-8 flex items-center justify-center cursor-pointer;
21
21
  border-radius: var(--border-radius-rounded-lg);
22
22
  background-color: var(--color-neutral-100);
23
23
  }
@@ -38,13 +38,15 @@ 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
+
41
43
  return (
42
44
  <Popover open={open} onOpenChange={setOpen}>
43
- <PopoverTrigger asChild>
45
+ <PopoverTrigger>
44
46
  {children ?? (
45
- <button className="action-dropdown-trigger">
47
+ <span className="action-dropdown-trigger">
46
48
  <Icon name="more-vertical" />
47
- </button>
49
+ </span>
48
50
  )}
49
51
  </PopoverTrigger>
50
52
  <PopoverContent
@@ -46,7 +46,7 @@ export function DateDisplay(props: DateDisplayProps) {
46
46
  } = props;
47
47
  const formattedDates = useMemo(() => {
48
48
  return dates.map((d) => {
49
- const dateObj = typeof d === 'string' ? new Date(d) : d;
49
+ const dateObj = new Date(d);
50
50
  // Check if the date is valid then format it to dd/MM/yyyy format
51
51
  if (isValid(dateObj)) {
52
52
  return format(dateObj, 'dd/MM/yyyy');
@@ -1,6 +1,7 @@
1
1
  import { cn } from '@/src/lib/utils';
2
2
  import { ActionDropdownType } from '@/src/types/table';
3
- import Button, { ButtonProps } from '../../atoms/Button/Button';
3
+ import { ButtonProps } from '../../atoms/Button/Button';
4
+ import Icon from '../../atoms/Icon/Icon';
4
5
  import { ActionDropdown, ActionDropdownItem } from '../ActionDropdown/ActionDropdown';
5
6
 
6
7
  export interface DetailsActionProps {
@@ -15,7 +16,7 @@ export interface DetailsActionProps {
15
16
 
16
17
  export function DetailsAction(props: DetailsActionProps) {
17
18
  const {
18
- data = [],
19
+ data,
19
20
  onAction,
20
21
  buttonVariant = 'outline-secondary',
21
22
  buttonClassName = '',
@@ -55,13 +56,16 @@ export function DetailsAction(props: DetailsActionProps) {
55
56
  },
56
57
  ]
57
58
  }>
58
- <Button
59
- variant={buttonVariant}
60
- trailingIcon="chevron-down"
61
- size="sm"
62
- className={cn('w-[144px] !justify-between !px-[14px]', buttonClassName)}>
59
+ <div
60
+ className={cn(
61
+ 'button button--outline-secondary button--sm w-[144px] !justify-between !px-[14px] cursor-pointer',
62
+ buttonClassName
63
+ )}>
63
64
  {buttonLabel}
64
- </Button>
65
+ <span className="button__icon button__icon--trailing">
66
+ <Icon name="chevron-down" />
67
+ </span>
68
+ </div>
65
69
  </ActionDropdown>
66
70
  );
67
71
  }
@@ -7,18 +7,27 @@ export interface DetailsAgencyProps {
7
7
  /** Name of the agency */
8
8
  name: string;
9
9
  /** Client type of the agency */
10
- clientType: string;
10
+ clientType?: string;
11
11
  /** Show the waiting for confirmation chip */
12
12
  isOnRequest: boolean;
13
13
  /** Children of the agency */
14
14
  children?: React.ReactNode;
15
+
16
+ /** The logo of the agency */
17
+ logo?: string;
15
18
  }
16
19
 
17
20
  export function DetailsAgency(props: DetailsAgencyProps) {
18
- const { name, clientType, isOnRequest, children } = props;
21
+ const {
22
+ name,
23
+ clientType,
24
+ isOnRequest,
25
+ children,
26
+ logo = '/images/mautourco-logo.png',
27
+ } = props;
19
28
  return (
20
29
  <div className="flex flex-col gap-y-6 items-end">
21
- <img src="/images/mautourco-logo.png" alt="Mautourco Logo" width={220} />
30
+ <img src={logo} alt="Mautourco Logo" width={220} />
22
31
  <div className="details-agency">
23
32
  <Text variant="bold" color="accent">
24
33
  Documents details:
@@ -36,18 +45,20 @@ export function DetailsAgency(props: DetailsAgencyProps) {
36
45
  {name}
37
46
  </Text>
38
47
  </div>{' '}
39
- <div className="details-agency__content-item">
40
- <Text
41
- variant="bold"
42
- size="sm"
43
- leading="4"
44
- className="details-agency__content-item-name">
45
- Client type
46
- </Text>
47
- <Text size="sm" leading="4">
48
- {clientType}
49
- </Text>
50
- </div>
48
+ {clientType && (
49
+ <div className="details-agency__content-item">
50
+ <Text
51
+ variant="bold"
52
+ size="sm"
53
+ leading="4"
54
+ className="details-agency__content-item-name">
55
+ Client type
56
+ </Text>
57
+ <Text size="sm" leading="4">
58
+ {clientType}
59
+ </Text>
60
+ </div>
61
+ )}
51
62
  </div>
52
63
  </div>
53
64
  {isOnRequest && <Chip color="yellow">Waiting for confirmation</Chip>}
@@ -8,3 +8,7 @@
8
8
  }
9
9
  }
10
10
  }
11
+
12
+ .details-client__item {
13
+ @apply space-y-4;
14
+ }
@@ -20,7 +20,7 @@ export function DetailsClientInfo(props: DetailsClientInfoProps) {
20
20
  return (
21
21
  <div className="details-client">
22
22
  <Text variant="bold">1. Client's information</Text>
23
- <div className="space-y-4">
23
+ <div className="details-client__item">
24
24
  <Text variant="medium" size="lg">
25
25
  Language:
26
26
  </Text>
@@ -33,7 +33,7 @@ export function DetailsClientInfo(props: DetailsClientInfoProps) {
33
33
  </div>
34
34
  <div className="flex gap-x-8 flex-wrap">
35
35
  {clients.map((client, index) => (
36
- <div key={`cl-${index}`} className="space-y-4">
36
+ <div key={`cl-${index}`} className="details-client__item">
37
37
  <Text variant="medium" size="lg">
38
38
  {client.type} No {index + 1}{' '}
39
39
  {client.age > 0 ? (
@@ -1,10 +1,11 @@
1
+ import { Fragment } from 'react';
1
2
  import CancellationBody from './CancellationBody';
2
3
  import CancellationHeader from './CancellationHeader';
3
4
  import { HeaderAccomProps } from './HeaderAccom';
4
5
  import { Policy } from './PolicyAccom/PolicyAccom';
5
6
  import DetailsCancellationPolicy from './TabCancellationPolicy';
6
7
 
7
- export interface CancellationAccomProps extends HeaderAccomProps {
8
+ export interface CancellationAccomProps extends Omit<HeaderAccomProps, 'dates'> {
8
9
  /**
9
10
  * The image of the cancellation accommodation.
10
11
  */
@@ -17,6 +18,7 @@ export interface CancellationAccomProps extends HeaderAccomProps {
17
18
  * The room policies of the cancellation accommodation.
18
19
  */
19
20
  roomPolicies: Array<{
21
+ dates: string[];
20
22
  roomName: string;
21
23
  policies: Policy[];
22
24
  }>;
@@ -39,25 +41,32 @@ export interface CancellationAccomProps extends HeaderAccomProps {
39
41
  * @returns The CancellationAccom component.
40
42
  */
41
43
  export default function CancellationAccom(props: CancellationAccomProps) {
42
- const { hotelName, pax, dates, image, roomPolicies, isOnRequest } = props;
44
+ const { hotelName, pax, image, roomPolicies, isOnRequest } = props;
43
45
  return (
44
46
  <DetailsCancellationPolicy.Layout
45
47
  title="Accommodation"
46
48
  icon="accom"
47
49
  isOnRequest={isOnRequest}
48
- image={image}
49
- header={
50
- <CancellationHeader>
51
- <CancellationHeader.Accom hotelName={hotelName} pax={pax} dates={dates} />
52
- </CancellationHeader>
53
- }>
50
+ image={image}>
54
51
  <CancellationBody>
55
52
  {roomPolicies.map((roomPolicy, index) => (
56
- <CancellationBody.Accom
57
- key={index}
58
- roomName={roomPolicy.roomName}
59
- policies={roomPolicy.policies}
60
- />
53
+ <Fragment key={index}>
54
+ <div className="details-cancellation-policy__layout-content-header">
55
+ <CancellationHeader>
56
+ <CancellationHeader.Accom
57
+ hotelName={hotelName}
58
+ pax={pax}
59
+ dates={roomPolicy.dates}
60
+ />
61
+ </CancellationHeader>
62
+ </div>
63
+ <CancellationBody.Accom
64
+ key={index}
65
+ index={index}
66
+ roomName={roomPolicy.roomName}
67
+ policies={roomPolicy.policies}
68
+ />
69
+ </Fragment>
61
70
  ))}
62
71
  </CancellationBody>
63
72
  </DetailsCancellationPolicy.Layout>
@@ -1,5 +1,5 @@
1
1
  .policy-accom {
2
- @apply space-y-6;
2
+ @apply space-y-6 pt-6;
3
3
  .chip__label {
4
4
  @apply gap-x-4;
5
5
  }
@@ -10,7 +10,7 @@ interface TabCancellationPolicyLayoutProps {
10
10
  isOnRequest?: boolean;
11
11
  children: React.ReactNode;
12
12
  image: string;
13
- header: React.ReactNode;
13
+ header?: React.ReactNode;
14
14
  }
15
15
 
16
16
  export default function TabCancellationPolicyLayout(
@@ -31,9 +31,11 @@ export default function TabCancellationPolicyLayout(
31
31
  <img src={image} alt={title} width={400} height={400} />
32
32
  </figure>
33
33
  <div className="details-cancellation-policy__layout-content">
34
- <div className="details-cancellation-policy__layout-content-header">
35
- {header}
36
- </div>
34
+ {header && (
35
+ <div className="details-cancellation-policy__layout-content-header">
36
+ {header}
37
+ </div>
38
+ )}
37
39
  <div className="details-cancellation-policy__layout-content-body">
38
40
  {children}
39
41
  </div>
@@ -16,7 +16,9 @@
16
16
  width: 100%;
17
17
  border-collapse: collapse;
18
18
  border-spacing: 0;
19
- table-layout: fixed;
19
+ &.table-layout-fixed {
20
+ table-layout: fixed;
21
+ }
20
22
  th,
21
23
  td {
22
24
  padding-inline: var(--spacing-padding-px-4);
@@ -52,6 +52,9 @@ export interface TableProps<T extends TableRowData<T>> {
52
52
 
53
53
  /** Whether the last column is visible */
54
54
  totalSubstractedSpace?: number;
55
+
56
+ /** Whether the table layout is fixed */
57
+ isLayoutFixed?: boolean;
55
58
  }
56
59
 
57
60
  /**
@@ -150,6 +153,7 @@ export function Table<T extends TableRowData<T>>(props: TableProps<T>) {
150
153
  totalRows = {},
151
154
  isTotalBorderDash = true,
152
155
  totalSubstractedSpace = 10,
156
+ isLayoutFixed = true,
153
157
  onClickRow,
154
158
  } = props;
155
159
 
@@ -168,7 +172,7 @@ export function Table<T extends TableRowData<T>>(props: TableProps<T>) {
168
172
  <div>
169
173
  <div
170
174
  className={cn('table-container', { 'table-container--no-total': !hasTotal })}>
171
- <table className="table">
175
+ <table className={cn('table', { 'table-layout-fixed': isLayoutFixed })}>
172
176
  <thead className="table__header">
173
177
  <tr>
174
178
  {columns.map((column, columnIndex) => (
@@ -3,8 +3,17 @@ import * as React from 'react';
3
3
 
4
4
  import { cn } from '@/src/lib/utils';
5
5
 
6
- function TooltipProvider({ delayDuration = 0, ...props }: React.ComponentProps<typeof TooltipPrimitive.Provider>) {
7
- return <TooltipPrimitive.Provider data-slot="tooltip-provider" delayDuration={delayDuration} {...props} />;
6
+ function TooltipProvider({
7
+ delayDuration = 0,
8
+ ...props
9
+ }: React.ComponentProps<typeof TooltipPrimitive.Provider>) {
10
+ return (
11
+ <TooltipPrimitive.Provider
12
+ data-slot="tooltip-provider"
13
+ delayDuration={delayDuration}
14
+ {...props}
15
+ />
16
+ );
8
17
  }
9
18
 
10
19
  function Tooltip({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Root>) {
@@ -15,7 +24,9 @@ function Tooltip({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Root
15
24
  );
16
25
  }
17
26
 
18
- function TooltipTrigger({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Trigger>) {
27
+ function TooltipTrigger({
28
+ ...props
29
+ }: React.ComponentProps<typeof TooltipPrimitive.Trigger>) {
19
30
  return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />;
20
31
  }
21
32
 
@@ -31,7 +42,7 @@ function TooltipContent({
31
42
  data-slot="tooltip-content"
32
43
  sideOffset={sideOffset}
33
44
  className={cn(
34
- 'bg-foreground bg-[var(--tooltip-color-background-default)] text-white animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance',
45
+ 'bg-[var(--tooltip-color-background-default)] text-white animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance',
35
46
  className
36
47
  )}
37
48
  {...props}>